本文整理汇总了C++中FilterContext::toLocal方法的典型用法代码示例。如果您正苦于以下问题:C++ FilterContext::toLocal方法的具体用法?C++ FilterContext::toLocal怎么用?C++ FilterContext::toLocal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilterContext
的用法示例。
在下文中一共展示了FilterContext::toLocal方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: obj
v8::Handle<v8::Value>
JSFilterContext::ToLocalCallback(const v8::Arguments& args)
{
FilterContext* context = V8Util::UnwrapObject<FilterContext>(args.Holder());
if (context && args.Length() == 1 && args[0]->IsObject())
{
v8::Local<v8::Object> obj( v8::Object::Cast(*args[0]) );
/*if (V8Util::CheckObjectType(obj, JSGeometry::GetObjectType())) // Geometry
{
osgEarth::Symbology::Geometry* geometry = V8Util::UnwrapObject<osgEarth::Symbology::Geometry>(obj);
return
}*/
if (V8Util::CheckObjectType(obj, JSVec3d::GetObjectType())) // Vec3d
{
osg::Vec3d* vec = V8Util::UnwrapObject<osg::Vec3d>(obj);
osg::Vec3d* local = new osg::Vec3d(context->toLocal(*vec));
return JSVec3d::WrapVec3d(local, true);
}
}
return v8::Undefined();
}
示例2: 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;
}
示例3: gi
FilterContext
ScatterFilter::push(FeatureList& features, const 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
// todo: control this seeding based on the feature source name, perhaps?
::srand( _randomSeed );
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();
// first, undo the localization frame if there is one.
context.toWorld( geom );
// convert to geodetic if necessary, and compute the approximate area in sq km
if ( context.isGeocentric() )
{
GeometryIterator gi( geom );
while( gi.hasMore() )
geomSRS->getGeographicSRS()->transformFromECEF( gi.next(), true );
geomSRS = geomSRS->getGeographicSRS();
}
PointSet* points = new PointSet();
if ( geom->getComponentType() == Geometry::TYPE_POLYGON )
{
polyScatter( geom, geomSRS, context, points );
}
else if (
geom->getComponentType() == Geometry::TYPE_LINESTRING ||
geom->getComponentType() == Geometry::TYPE_RING )
{
lineScatter( geom, geomSRS, context, points );
}
else {
OE_WARN << LC << "Sorry, don't know how to scatter a PointSet yet" << std::endl;
}
// convert back to geocentric if necessary.
if ( context.isGeocentric() )
context.profile()->getSRS()->getGeographicSRS()->transformToECEF( points, true );
// re-apply the localization frame.
context.toLocal( points );
// replace the source geometry with the scattered points.
f->setGeometry( points );
}
return context;
}