本文整理汇总了C++中MapFrame::getProfile方法的典型用法代码示例。如果您正苦于以下问题:C++ MapFrame::getProfile方法的具体用法?C++ MapFrame::getProfile怎么用?C++ MapFrame::getProfile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapFrame
的用法示例。
在下文中一共展示了MapFrame::getProfile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: eq
void
AltitudeFilter::pushAndClamp( FeatureList& features, FilterContext& cx )
{
const Session* session = cx.getSession();
// the map against which we'll be doing elevation clamping
//MapFrame mapf = session->createMapFrame( Map::ELEVATION_LAYERS );
MapFrame mapf = session->createMapFrame(
(Map::ModelParts)(Map::TERRAIN_LAYERS | Map::MODEL_LAYERS) );
const SpatialReference* mapSRS = mapf.getProfile()->getSRS();
osg::ref_ptr<const SpatialReference> featureSRS = cx.profile()->getSRS();
// establish an elevation query interface based on the features' SRS.
ElevationQuery eq( mapf );
// want a result even if it's low res
eq.setFallBackOnNoData( true );
NumericExpression scaleExpr;
if ( _altitude->verticalScale().isSet() )
scaleExpr = *_altitude->verticalScale();
NumericExpression offsetExpr;
if ( _altitude->verticalOffset().isSet() )
offsetExpr = *_altitude->verticalOffset();
// whether to record the min/max height-above-terrain values.
bool collectHATs =
_altitude->clamping() == AltitudeSymbol::CLAMP_RELATIVE_TO_TERRAIN ||
_altitude->clamping() == AltitudeSymbol::CLAMP_ABSOLUTE;
// whether to clamp every vertex (or just the centroid)
bool perVertex =
_altitude->binding() == AltitudeSymbol::BINDING_VERTEX;
// whether the SRS's have a compatible vertical datum.
bool vertEquiv =
featureSRS->isVertEquivalentTo( mapSRS );
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 maxTerrainZ = -DBL_MAX;
double minTerrainZ = DBL_MAX;
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();
// Absolute heights in Z. Only need to collect the HATs; the geometry
// remains unchanged.
if ( _altitude->clamping() == AltitudeSymbol::CLAMP_ABSOLUTE )
{
if ( perVertex )
{
std::vector<double> elevations;
elevations.reserve( geom->size() );
if ( eq.getElevations( geom->asVector(), featureSRS, elevations, _maxRes ) )
{
for( unsigned i=0; i<geom->size(); ++i )
{
osg::Vec3d& p = (*geom)[i];
p.z() *= scaleZ;
p.z() += offsetZ;
double z = p.z();
if ( !vertEquiv )
{
osg::Vec3d tempgeo;
if ( !featureSRS->transform(p, mapSRS->getGeographicSRS(), tempgeo) )
z = tempgeo.z();
}
double hat = z - elevations[i];
//.........这里部分代码省略.........