本文整理汇总了C++中LayerVector::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerVector::begin方法的具体用法?C++ LayerVector::begin怎么用?C++ LayerVector::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerVector
的用法示例。
在下文中一共展示了LayerVector::begin方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
ElevationQuery::reset()
{
// set read callback for IntersectionVisitor
_ivrc = new osgSim::DatabaseCacheReadCallback();
_terrainModelLayers.clear();
_elevationLayers.clear();
osg::ref_ptr<const Map> map;
if (_map.lock(map))
{
map->getLayers(_elevationLayers);
// cache a vector of terrain patch models.
LayerVector layers;
map->getLayers(layers);
for (LayerVector::const_iterator i = layers.begin(); i != layers.end(); ++i)
{
if (i->get()->options().terrainPatch() == true)
{
_terrainModelLayers.push_back(i->get());
}
}
// revisions are now in sync.
_mapRevision = map->getDataModelRevision();
}
// clear any active envelope
_envelope = 0L;
}
示例2: arguments
int
main(int argc, char** argv)
{
osg::ArgumentParser arguments(&argc,argv);
osgViewer::Viewer viewer(arguments);
viewer.setCameraManipulator( new EarthManipulator(arguments) );
osg::Node* node = MapNodeHelper().load(arguments, &viewer);
if ( node )
{
MapNode* mapNode = MapNode::get(node);
if (!mapNode)
return -1;
MyCallback* myCallback = new MyCallback();
// Install a callback on each loaded layer.
LayerVector layers;
mapNode->getMap()->getLayers(layers);
for (LayerVector::iterator layer = layers.begin(); layer != layers.end(); ++layer)
{
layer->get()->getSceneGraphCallbacks()->add( myCallback );
}
viewer.setSceneData( node );
return viewer.run();
}
else
{
return usage(argv[0]);
}
return 0;
}
示例3: mapConf
Config
EarthFileSerializer2::serialize(const MapNode* input, const std::string& referrer) const
{
Config mapConf("map");
mapConf.set("version", "2");
if ( !input || !input->getMap() )
return mapConf;
const Map* map = input->getMap();
MapFrame mapf( map );
// the map and node options:
Config optionsConf = map->getInitialMapOptions().getConfig();
optionsConf.merge( input->getMapNodeOptions().getConfig() );
mapConf.add( "options", optionsConf );
// the layers
LayerVector layers;
mapf.getLayers(layers);
for (LayerVector::const_iterator i = layers.begin(); i != layers.end(); ++i)
{
const Layer* layer = i->get();
Config layerConf = layer->getConfig();
if (!layerConf.empty())
{
mapConf.add(layerConf);
}
}
typedef std::vector< osg::ref_ptr<Extension> > Extensions;
for(Extensions::const_iterator i = input->getExtensions().begin(); i != input->getExtensions().end(); ++i)
{
Extension* e = i->get();
Config conf = e->getConfigOptions().getConfig();
if ( !conf.key().empty() )
{
mapConf.add( conf );
}
}
Config ext = input->externalConfig();
if ( !ext.empty() )
{
ext.key() = "external";
mapConf.add( ext );
}
// Re-write pathnames in the Config so they are relative to the new referrer.
if ( _rewritePaths && !referrer.empty() )
{
RewritePaths rewritePaths( referrer );
rewritePaths.setRewriteAbsolutePaths( _rewriteAbsolutePaths );
rewritePaths.apply( mapConf );
}
return mapConf;
}
示例4: onBeginUpdate
void
MapCallback::invokeOnLayerRemoved(const Map* map)
{
LayerVector layers;
map->getLayers(layers);
unsigned index = 0;
if (layers.size() > 0)
{
onBeginUpdate();
for (LayerVector::iterator i = layers.begin(); i != layers.end(); ++i)
onLayerRemoved(i->get(), index++);
onEndUpdate();
}
}
示例5: createCoverageTexture
void
TerrainTileModelFactory::addColorLayers(TerrainTileModel* model,
const Map* map,
const TerrainEngineRequirements* reqs,
const TileKey& key,
const CreateTileModelFilter& filter,
ProgressCallback* progress)
{
OE_START_TIMER(fetch_image_layers);
int order = 0;
LayerVector layers;
map->getLayers(layers);
for (LayerVector::const_iterator i = layers.begin(); i != layers.end(); ++i)
{
Layer* layer = i->get();
if (layer->getRenderType() != layer->RENDERTYPE_TERRAIN_SURFACE)
continue;
if (!layer->getEnabled())
continue;
if (!filter.accept(layer))
continue;
ImageLayer* imageLayer = dynamic_cast<ImageLayer*>(layer);
if (imageLayer)
{
osg::Texture* tex = 0L;
osg::Matrixf textureMatrix;
if (imageLayer->isKeyInLegalRange(key) && imageLayer->mayHaveDataInExtent(key.getExtent()))
{
if (imageLayer->createTextureSupported())
{
tex = imageLayer->createTexture( key, progress, textureMatrix );
}
else
{
GeoImage geoImage = imageLayer->createImage( key, progress );
if ( geoImage.valid() )
{
if ( imageLayer->isCoverage() )
tex = createCoverageTexture(geoImage.getImage(), imageLayer);
else
tex = createImageTexture(geoImage.getImage(), imageLayer);
}
}
}
// if this is the first LOD, and the engine requires that the first LOD
// be populated, make an empty texture if we didn't get one.
if (tex == 0L &&
_options.firstLOD() == key.getLOD() &&
reqs && reqs->fullDataAtFirstLodRequired())
{
tex = _emptyTexture.get();
}
if (tex)
{
tex->setName(model->getKey().str());
TerrainTileImageLayerModel* layerModel = new TerrainTileImageLayerModel();
layerModel->setImageLayer(imageLayer);
layerModel->setTexture(tex);
layerModel->setMatrix(new osg::RefMatrixf(textureMatrix));
model->colorLayers().push_back(layerModel);
if (imageLayer->isShared())
{
model->sharedLayers().push_back(layerModel);
}
if (imageLayer->isDynamic())
{
model->setRequiresUpdateTraverse(true);
}
}
}
else // non-image kind of TILE layer:
{
TerrainTileColorLayerModel* colorModel = new TerrainTileColorLayerModel();
colorModel->setLayer(layer);
model->colorLayers().push_back(colorModel);
}
}
if (progress)
progress->stats()["fetch_imagery_time"] += OE_STOP_TIMER(fetch_image_layers);
}
示例6: DrawState
void
TerrainRenderData::setup(const Map* map,
const RenderBindings& bindings,
unsigned frameNum,
osgUtil::CullVisitor* cv)
{
_bindings = &bindings;
// Create a new State object to track sampler and uniform settings
_drawState = new DrawState();
_drawState->_frame = frameNum;
_drawState->_bindings = &bindings;
// Is this a depth camera? Because if it is, we don't need any color layers.
const osg::Camera* cam = cv->getCurrentCamera();
bool isDepthCamera = ClampableNode::isDepthCamera(cam);
// Make a drawable for each rendering pass (i.e. each render-able map layer).
LayerVector layers;
map->getLayers(layers);
for (LayerVector::const_iterator i = layers.begin(); i != layers.end(); ++i)
{
Layer* layer = i->get();
if (layer->getEnabled())
{
bool render =
(layer->getRenderType() == Layer::RENDERTYPE_TERRAIN_SURFACE) || // && !isDepthCamera) ||
(layer->getRenderType() == Layer::RENDERTYPE_TERRAIN_PATCH);
if ( render )
{
// If this is an image layer, check the enabled/visible states.
VisibleLayer* visLayer = dynamic_cast<VisibleLayer*>(layer);
if (visLayer)
{
render = visLayer->getVisible();
}
if (render)
{
if (layer->getRenderType() == Layer::RENDERTYPE_TERRAIN_SURFACE)
{
LayerDrawable* ld = addLayerDrawable(layer);
// If the current camera is depth-only, leave this layer in the set
// but mark it as no-draw. We keep it in the set so the culler doesn't
// inadvertently think it's an orphaned layer.
if (isDepthCamera)
{
ld->_draw = false;
}
}
else // if (layer->getRenderType() == Layer::RENDERTYPE_TERRAIN_PATCH)
{
PatchLayer* patchLayer = static_cast<PatchLayer*>(layer); // asumption!
if (patchLayer->getAcceptCallback() != 0L &&
patchLayer->getAcceptCallback()->acceptLayer(*cv, cv->getCurrentCamera()))
{
patchLayers().push_back(dynamic_cast<PatchLayer*>(layer));
addLayerDrawable(layer);
}
}
}
}
}
}
// Include a "blank" layer for missing data.
LayerDrawable* blank = addLayerDrawable(0L);
}