本文整理汇总了C++中featurelist::iterator::get方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::get方法的具体用法?C++ iterator::get怎么用?C++ iterator::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类featurelist::iterator
的用法示例。
在下文中一共展示了iterator::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
Feature*
FeatureListSource::getFeature( FeatureID fid )
{
for (FeatureList::iterator itr = _features.begin(); itr != _features.end(); ++itr)
{
if (itr->get()->getFID() == fid)
{
return itr->get();
}
}
return NULL;
}
示例2: outcx
FilterContext
TransformFilter::push( FeatureList& input, FilterContext& incx )
{
_bbox = osg::BoundingBoxd();
// first transform all the points into the output SRS, collecting a bounding box as we go:
bool ok = true;
for( FeatureList::iterator i = input.begin(); i != input.end(); i++ )
if ( !push( i->get(), incx ) )
ok = false;
FilterContext outcx( incx );
outcx.isGeocentric() = _makeGeocentric;
if ( _outputSRS.valid() )
{
if ( incx.extent()->isValid() )
outcx.profile() = new FeatureProfile( incx.extent()->transform( _outputSRS.get() ) );
else
outcx.profile() = new FeatureProfile( incx.profile()->getExtent().transform( _outputSRS.get() ) );
}
// set the reference frame to shift data to the centroid. This will
// prevent floating point precision errors in the openGL pipeline for
// properly gridded data.
if ( _bbox.valid() && _localize )
{
// create a suitable reference frame:
osg::Matrixd localizer;
if ( _makeGeocentric )
{
localizer = createGeocentricInvRefFrame( _bbox.center(), _outputSRS.get() );
localizer.invert( localizer );
}
else
{
localizer = osg::Matrixd::translate( -_bbox.center() );
}
// localize the geometry relative to the reference frame.
for( FeatureList::iterator i = input.begin(); i != input.end(); i++ )
{
localizeGeometry( i->get(), localizer );
}
outcx.setReferenceFrame( localizer );
}
return outcx;
}
示例3: scale_iter
FilterContext
ScaleFilter::push( FeatureList& input, FilterContext& cx )
{
for( FeatureList::iterator i = input.begin(); i != input.end(); ++i )
{
Feature* input = i->get();
if ( input && input->getGeometry() )
{
Bounds envelope = input->getGeometry()->getBounds();
// now scale and shift everything
GeometryIterator scale_iter( input->getGeometry() );
while( scale_iter.hasMore() )
{
Geometry* geom = scale_iter.next();
for( osg::Vec3dArray::iterator v = geom->begin(); v != geom->end(); v++ )
{
double xr = (v->x() - envelope.xMin()) / envelope.width();
v->x() += (xr - 0.5) * _scale;
double yr = (v->y() - envelope.yMin()) / envelope.height();
v->y() += (yr - 0.5) * _scale;
}
}
}
}
return cx;
}
示例4: FeatureProfile
const FeatureProfile*
FeatureListSource::createFeatureProfile()
{
const SpatialReference* srs = 0L;
osgEarth::Bounds bounds;
if ( !_features.empty() )
{
// Get the SRS of the first feature
srs = _features.front()->getSRS();
// Compute the extent of the features
for (FeatureList::iterator itr = _features.begin(); itr != _features.end(); ++itr)
{
Feature* feature = itr->get();
if (feature->getGeometry())
{
bounds.expandBy( feature->getGeometry()->getBounds() );
}
}
}
// return the new profile, or a default extent if the profile could not be computed.
if ( srs && bounds.isValid() )
return new FeatureProfile( GeoExtent(srs, bounds) );
else
return new FeatureProfile( _defaultExtent );
}
示例5:
FilterContext
ScriptFilter::push( FeatureList& input, FilterContext& context )
{
if ( !isSupported() )
{
OE_WARN << "ScriptFilter support not enabled" << std::endl;
return context;
}
if (!_engine.valid())
{
OE_WARN << "No scripting engine\n";
return context;
}
bool ok = true;
for( FeatureList::iterator i = input.begin(); i != input.end(); )
{
if ( push( i->get(), context ) )
{
++i;
}
else
{
i = input.erase(i);
}
}
return context;
}
示例6: lock
void
ImageOverlay::init()
{
OpenThreads::ScopedLock< OpenThreads::Mutex > lock(_mutex);
if (_root->getNumChildren() > 0)
{
_root->removeChildren(0, _root->getNumChildren());
}
if ( !_clampCallback.valid() )
{
_clampCallback = new TerrainCallbackAdapter<ImageOverlay>(this);
}
if ( getMapNode() )
{
const SpatialReference* mapSRS = getMapNode()->getMapSRS();
// calculate a bounding polytope in world space (for mesh clamping):
osg::ref_ptr<Feature> f = new Feature( new Polygon(), mapSRS->getGeodeticSRS() );
Geometry* g = f->getGeometry();
g->push_back( osg::Vec3d(_lowerLeft.x(), _lowerLeft.y(), 0) );
g->push_back( osg::Vec3d(_lowerRight.x(), _lowerRight.y(), 0) );
g->push_back( osg::Vec3d(_upperRight.x(), _upperRight.y(), 0) );
g->push_back( osg::Vec3d(_upperLeft.x(), _upperLeft.y(), 0) );
f->getWorldBoundingPolytope( getMapNode()->getMapSRS(), _boundingPolytope );
FeatureList features;
if (!mapSRS->isGeographic())
{
f->splitAcrossDateLine(features);
}
else
{
features.push_back( f );
}
for (FeatureList::iterator itr = features.begin(); itr != features.end(); ++itr)
{
_root->addChild(createNode(itr->get(), features.size() > 1));
}
_dirty = false;
// Set the annotation up for auto-clamping. We always need to auto-clamp a draped image
// so that the mesh roughly conforms with the surface, otherwise the draping routine
// might clip it.
Style style;
style.getOrCreate<AltitudeSymbol>()->clamping() = AltitudeSymbol::CLAMP_RELATIVE_TO_TERRAIN;
applyStyle( style );
setLightingIfNotSet( false );
getMapNode()->getTerrain()->addTerrainCallback( _clampCallback.get() );
clamp( getMapNode()->getTerrain()->getGraph(), getMapNode()->getTerrain() );
}
}
示例7: temp
void
AltitudeFilter::pushAndDontClamp( FeatureList& features, FilterContext& cx )
{
NumericExpression scaleExpr;
if ( _altitude.valid() && _altitude->verticalScale().isSet() )
scaleExpr = *_altitude->verticalScale();
NumericExpression offsetExpr;
if ( _altitude.valid() && _altitude->verticalOffset().isSet() )
offsetExpr = *_altitude->verticalOffset();
for( FeatureList::iterator i = features.begin(); i != features.end(); ++i )
{
Feature* feature = i->get();
// run a symbol script if present.
if ( _altitude.valid() && _altitude->script().isSet() )
{
StringExpression temp( _altitude->script().get() );
feature->eval( temp, &cx );
}
double minHAT = DBL_MAX;
double maxHAT = -DBL_MAX;
double scaleZ = 1.0;
if ( _altitude.valid() && _altitude->verticalScale().isSet() )
scaleZ = feature->eval( scaleExpr, &cx );
double offsetZ = 0.0;
if ( _altitude.valid() && _altitude->verticalOffset().isSet() )
offsetZ = feature->eval( offsetExpr, &cx );
GeometryIterator gi( feature->getGeometry() );
while( gi.hasMore() )
{
Geometry* geom = gi.next();
for( Geometry::iterator g = geom->begin(); g != geom->end(); ++g )
{
g->z() *= scaleZ;
g->z() += offsetZ;
if ( g->z() < minHAT )
minHAT = g->z();
if ( g->z() > maxHAT )
maxHAT = g->z();
}
}
if ( minHAT != DBL_MAX )
{
feature->set( "__min_hat", minHAT );
feature->set( "__max_hat", maxHAT );
}
}
}
示例8: push
virtual FilterContext push( FeatureList& input, FilterContext& context )
{
for (FeatureList::iterator itr = input.begin(); itr != input.end(); itr++)
{
//Change the value of the attribute
if (_key.isSet() && _value.isSet())
{
itr->get()->set(*_key, std::string(*_value));
}
}
return context;
}
示例9: eq
FilterContext
ClampFilter::push( FeatureList& features, const FilterContext& cx )
{
const Session* session = cx.getSession();
if ( !session ) {
OE_WARN << LC << "No session - session is required for elevation clamping" << std::endl;
return cx;
}
// the map against which we'll be doing elevation clamping
MapFrame mapf = session->createMapFrame( Map::ELEVATION_LAYERS );
const SpatialReference* mapSRS = mapf.getProfile()->getSRS();
const SpatialReference* featureSRS = cx.profile()->getSRS();
bool isGeocentric = session->getMapInfo().isGeocentric();
// establish an elevation query interface based on the features' SRS.
ElevationQuery eq( mapf );
for( FeatureList::iterator i = features.begin(); i != features.end(); ++i )
{
Feature* feature = i->get();
GeometryIterator gi( feature->getGeometry() );
while( gi.hasMore() )
{
Geometry* geom = gi.next();
if ( isGeocentric )
{
// convert to map coords:
cx.toWorld( geom );
mapSRS->transformFromECEF( geom );
// populate the elevations:
eq.getElevations( geom, mapSRS );
// convert back to geocentric:
mapSRS->transformToECEF( geom );
cx.toLocal( geom );
}
else
{
// clamps the entire array to the highest available resolution.
eq.getElevations( geom, featureSRS );
}
}
}
return cx;
}
示例10: FeatureListCursor
FeatureCursor*
FeatureListSource::createFeatureCursor( const Symbology::Query& query )
{
//Create a copy of all of the features before returning the cursor.
//The processing filters in osgEarth can modify the features as they are operating and we don't want our original data destroyed.
FeatureList cursorFeatures;
for (FeatureList::iterator itr = _features.begin(); itr != _features.end(); ++itr)
{
Feature* feature = new osgEarth::Features::Feature(*(itr->get()), osg::CopyOp::DEEP_COPY_ALL);
cursorFeatures.push_back( feature );
}
return new FeatureListCursor( cursorFeatures );
}
示例11: dirty
bool
FeatureListSource::deleteFeature(FeatureID fid)
{
for (FeatureList::iterator itr = _features.begin(); itr != _features.end(); ++itr)
{
if (itr->get()->getFID() == fid)
{
_features.erase( itr );
dirty();
return true;
}
}
return false;
}
示例12:
FilterContext
ResampleFilter::push( FeatureList& input, FilterContext& context )
{
if ( !isSupported() )
{
OE_WARN << "ResampleFilter support not enabled" << std::endl;
return context;
}
bool ok = true;
for( FeatureList::iterator i = input.begin(); i != input.end(); ++i )
if ( !push( i->get(), context ) )
ok = false;
return context;
}
示例13:
FilterContext
BufferFilter::push( FeatureList& input, FilterContext& context )
{
if ( !isSupported() )
{
OE_WARN << "BufferFilter support not enabled - please compile osgEarth with GEOS" << std::endl;
return context;
}
//OE_NOTICE << "Buffer: input = " << input.size() << " features" << std::endl;
bool ok = true;
for( FeatureList::iterator i = input.begin(); i != input.end(); ++i )
if ( !push( i->get(), context ) )
ok = false;
return context;
}
示例14: if
FilterContext
ScatterFilter::push(FeatureList& features, FilterContext& context )
{
if ( !isSupported() ) {
OE_WARN << LC << "support for this filter is not enabled" << std::endl;
return context;
}
// seed the random number generator so the randomness is the same each time
_prng = Random( _randomSeed, Random::METHOD_FAST );
for( FeatureList::iterator i = features.begin(); i != features.end(); ++i )
{
Feature* f = i->get();
Geometry* geom = f->getGeometry();
if ( !geom )
continue;
const SpatialReference* geomSRS = context.profile()->getSRS();
osg::ref_ptr< PointSet > points = new PointSet();
if ( geom->getComponentType() == Geometry::TYPE_POLYGON )
{
polyScatter( geom, geomSRS, context, points.get() );
}
else if (
geom->getComponentType() == Geometry::TYPE_LINESTRING ||
geom->getComponentType() == Geometry::TYPE_RING )
{
lineScatter( geom, geomSRS, context, points.get() );
}
else {
points = static_cast< PointSet*>(geom->cloneAs(Geometry::TYPE_POINTSET));
}
// replace the source geometry with the scattered points.
f->setGeometry( points.get() );
}
return context;
}
示例15: PointSet
FilterContext
CentroidFilter::push(FeatureList& features, FilterContext& context )
{
for( FeatureList::iterator i = features.begin(); i != features.end(); ++i )
{
Feature* f = i->get();
Geometry* geom = f->getGeometry();
if ( !geom )
continue;
PointSet* newGeom = new PointSet();
newGeom->push_back( geom->getBounds().center() );
f->setGeometry( newGeom );
}
return context;
}