当前位置: 首页>>代码示例>>C++>>正文


C++ FilterContext::toLocal方法代码示例

本文整理汇总了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();
}
开发者ID:nedbrek,项目名称:osgearth,代码行数:26,代码来源:JSWrappers.cpp

示例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;
}
开发者ID:sourcepole,项目名称:osgearth,代码行数:52,代码来源:ClampFilter.cpp

示例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;
}
开发者ID:korash,项目名称:osgearth,代码行数:64,代码来源:ScatterFilter.cpp


注:本文中的FilterContext::toLocal方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。