本文整理汇总了C++中layervector::const_iterator::get方法的典型用法代码示例。如果您正苦于以下问题:C++ const_iterator::get方法的具体用法?C++ const_iterator::get怎么用?C++ const_iterator::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类layervector::const_iterator
的用法示例。
在下文中一共展示了const_iterator::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
bool
MapFrame::containsEnabledLayer(UID uid) const
{
for (LayerVector::const_iterator i = _layers.begin(); i != _layers.end(); ++i)
{
if (i->get()->getUID() == uid)
{
return i->get()->getEnabled();
}
}
return false;
}
示例3: refreshComputedValues
bool
MapFrame::sync()
{
bool changed = false;
_elevationLayers.clear();
osg::ref_ptr<const Map> map;
if ( _map.lock(map) )
{
changed = map->sync( *this );
if ( changed )
{
refreshComputedValues();
}
_pool = map->getElevationPool();
}
else
{
_layers.clear();
}
for (LayerVector::const_iterator i = _layers.begin(); i != _layers.end(); ++i)
{
ElevationLayer* e = dynamic_cast<ElevationLayer*>(i->get());
if (e)
_elevationLayers.push_back(e);
}
return changed;
}
示例4:
void
MapFrame::refreshComputedValues()
{
_highestMinLevel = 0;
_elevationLayers.clear();
for (LayerVector::const_iterator i = _layers.begin(); i != _layers.end(); ++i)
{
TerrainLayer* terrainLayer = dynamic_cast<TerrainLayer*>(i->get());
if (terrainLayer)
{
const optional<unsigned>& minLevel = terrainLayer->getTerrainLayerRuntimeOptions().minLevel();
if (minLevel.isSet() && minLevel.value() > _highestMinLevel)
{
_highestMinLevel = minLevel.value();
}
ElevationLayer* elevation = dynamic_cast<ElevationLayer*>(terrainLayer);
if (elevation)
{
_elevationLayers.push_back(elevation);
}
}
}
}
示例5: 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;
}
示例6:
bool
MapFrame::containsLayer(UID uid) const
{
for (LayerVector::const_iterator i = _layers.begin(); i != _layers.end(); ++i)
if (i->get()->getUID() == uid)
return true;
return false;
}
示例7: 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);
}
示例8: if
void
TerrainRenderData::setup(const MapFrame& frame,
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;
// Make a drawable for each rendering pass (i.e. each render-able map layer).
for(LayerVector::const_iterator i = frame.layers().begin();
i != frame.layers().end();
++i)
{
Layer* layer = i->get();
if (layer->getEnabled())
{
if (layer->getRenderType() == Layer::RENDERTYPE_TILE ||
layer->getRenderType() == Layer::RENDERTYPE_PATCH)
{
bool render = true;
// If this is an image layer, check the enabled/visible states.
VisibleLayer* visLayer = dynamic_cast<VisibleLayer*>(layer);
if (visLayer)
{
render = visLayer->getVisible();
}
if (render)
{
ImageLayer* imgLayer = dynamic_cast<ImageLayer*>(layer);
// Make a list of "global" layers. There are layers whose data is not
// represented in the TerrainTileModel, like a splatting layer or a patch
// layer. The data for these is dynamic and not based on data fetched.
if (imgLayer == 0L && layer->getRenderType() == Layer::RENDERTYPE_TILE)
{
tileLayers().push_back(layer);
addLayerDrawable(layer);
}
else if (layer->getRenderType() == Layer::RENDERTYPE_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);
}
}
else
{
addLayerDrawable(layer);
}
}
}
}
}
// Include a "blank" layer for missing data.
LayerDrawable* blank = addLayerDrawable(0L);
blank->getOrCreateStateSet()->setDefine("OE_TERRAIN_RENDER_IMAGERY", osg::StateAttribute::OFF);
}
示例9: 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);
}