bool System::getDateOfLastModification(osgTerrain::TerrainTile *source, Date &date) { typedef std::list<osgTerrain::Layer *> Layers; Layers layers; if (source->getElevationLayer()) { layers.push_back(source->getElevationLayer()); } for (unsigned int i = 0; i < source->getNumColorLayers(); ++i) { osgTerrain::Layer *layer = source->getColorLayer(i); if (layer) { layers.push_back(layer); } } typedef std::list<std::string> Filenames; Filenames filenames; for (Layers::iterator itr = layers.begin(); itr != layers.end(); ++itr) { osgTerrain::CompositeLayer *compositeLayer = dynamic_cast<osgTerrain::CompositeLayer *>(*itr); if (compositeLayer) { for (unsigned int i = 0; i < compositeLayer->getNumLayers(); ++i) { filenames.push_back(compositeLayer->getFileName(i)); } } else { filenames.push_back((*itr)->getFileName()); } } bool modified = false; for (Filenames::iterator itr = filenames.begin(); itr != filenames.end(); ++itr) { Date lastModification; if (lastModification.setWithDateOfLastModification(*itr)) { if (lastModification > date) { date = lastModification; modified = true; } } } return modified; }
const_iterator end() const { return m_layers.end(); }
iterator end() { return m_layers.end(); }
bool LayerExists(LayerType layer) { return s_layers.find(layer) != s_layers.end(); }
QStringList SmilExportPlugin::createImages(const QList<KTScene *> &scenes, const QDir &dir, float sx, float sy, const char *format) { QStringList paths; int nPhotogramsRenderized = 0; foreach(KTScene *scene, scenes ) { Layers layers = scene->layers(); bool m_isRendered = false; while ( ! m_isRendered ) { Layers::iterator layerIterator = layers.begin(); bool ok = true; QImage renderized = QImage(m_size.width(), m_size.height(), QImage::Format_RGB32); renderized.fill(qRgb(255, 255, 255)); QPainter painter(&renderized); painter.setRenderHint(QPainter::Antialiasing); while ( layerIterator != layers.end() ) { ok = ok && (nPhotogramsRenderized > (*layerIterator)->frames().count()); if ( *layerIterator && nPhotogramsRenderized < (*layerIterator)->frames().count() && (*layerIterator)->isVisible() ) { KTKeyFrame *frame = (*layerIterator)->frames()[nPhotogramsRenderized]; if ( frame ) { QList<AGraphicComponent *> componentList = frame->components(); if ( componentList.count() > 0 ) { QList<AGraphicComponent *>::iterator it = componentList.begin(); while ( it != componentList.end() ) { (*it)->draw( &painter); ++it; } } } } ++layerIterator; } QString file = ""; QString extension = QString::fromLocal8Bit(format).toLower(); if ( nPhotogramsRenderized < 10 ) { file = QString("000%1").arg(nPhotogramsRenderized); } else if ( nPhotogramsRenderized < 100 ) { file = QString("00%1").arg(nPhotogramsRenderized); } else if( nPhotogramsRenderized < 1000 ) { file = QString("0%1").arg(nPhotogramsRenderized); } else if( nPhotogramsRenderized < 10000 ) { file = QString("%1").arg(nPhotogramsRenderized); } if ( !renderized.isNull() ) { QString dest = dir.path()+"/data/"+m_baseName+file+"."+extension; renderized.save(dest, format); paths << dest; createPar( dest, 1.0f/(float)scene->fps() ); } if (ok ) { m_isRendered = true; } nPhotogramsRenderized++; } }