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


C++ GeoPoint::set方法代码示例

本文整理汇总了C++中GeoPoint::set方法的典型用法代码示例。如果您正苦于以下问题:C++ GeoPoint::set方法的具体用法?C++ GeoPoint::set怎么用?C++ GeoPoint::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GeoPoint的用法示例。


在下文中一共展示了GeoPoint::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: visitPoint

        bool visitPoint( GeoPoint& p )
        {
            bool ok = true;

            // pull it out of the source reference frame:
            p.set( p * src_rf );

            // reproject it:
            if ( handle )
                ok = OCTTransform( handle, 1, &p.x(), &p.y(), &p.z() ) != 0;

            // push it into the new reference frame:
            p.set( p * to_srs->getReferenceFrame() );

            p = p.getDim() == 2? GeoPoint( p.x(), p.y(), to_srs ) : GeoPoint( p.x(), p.y(), p.z(), to_srs );

            return ok;
        }
开发者ID:aarnchng,项目名称:osggis,代码行数:18,代码来源:OGR_SpatialReference.cpp

示例2:

bool
MapInfo::worldPointToMapPoint( const osg::Vec3d& input, GeoPoint& output ) const
{
    osg::Vec3d temp;
    bool ok = _profile->getSRS()->transformFromWorld(input, temp);
    if ( ok )
        output.set(_profile->getSRS(), temp, ALTMODE_ABSOLUTE);
    return ok;
}
开发者ID:chuckshaw,项目名称:osgearth,代码行数:9,代码来源:Map.cpp

示例3: GeoPoint

bool
OGR_SpatialReference::transformInPlace( GeoPoint& input ) const
{
    if ( !handle || !input.isValid() ) {
        osgGIS::notify( osg::WARN ) << "Spatial reference or input point is invalid" << std::endl;
        return false;
    }

	OGR_SpatialReference* input_sr = (OGR_SpatialReference*)input.getSRS();
    if ( !input_sr ) {
        osgGIS::notify( osg::WARN ) << "SpatialReference: input point has no SRS" << std::endl;
        return false;
    }

    // first check whether the input point is geocentric - and if so, pre-convert it to geographic:
    if ( input_sr->isGeocentric() )
    {
        input.set( input * input_sr->getInverseReferenceFrame() );
        osg::Vec3d temp = input_sr->getEllipsoid().geocentricToLatLong( input );
        input = GeoPoint( temp, input_sr->getGeographicSRS() ); 
        input_sr = static_cast<OGR_SpatialReference*>( input.getSRS() );
    }

    osg::Vec3d input_vec = input;
    bool crs_equiv = false;
    bool mat_equiv = false;
    testEquivalence( input_sr, /*out*/crs_equiv, /*out*/mat_equiv );

    // pull it out of its source frame:
    if ( !mat_equiv )
    {
        input.set( input * input_sr->inv_ref_frame );
    }    

    bool result = false;

    if ( !crs_equiv )
    {
        OGR_SCOPE_LOCK();

        //TODO: some kind of per-thread cache

        void* xform_handle = OCTNewCoordinateTransformation( input_sr->handle, this->handle );
        if ( !xform_handle ) {
            osgGIS::notify( osg::WARN ) << "Spatial Reference: SRS xform not possible" << std::endl
                << "    From => " << input_sr->getWKT() << std::endl
                << "    To   => " << this->getWKT() << std::endl;
            return false;
        }

        //TODO: figure out why xforming GEOCS x=-180 to another GEOCS doesn't work
        if ( OCTTransform( xform_handle, 1, &input.x(), &input.y(), &input.z() ) )
        {
            result = true;
        }
        else
        {
            osgGIS::notify( osg::WARN ) << "Spatial Reference: Failed to xform a point from "
                << input_sr->getName() << " to " << this->getName()
                << std::endl;
        }

        OCTDestroyCoordinateTransformation( xform_handle );
    }
    else
    {
        result = true;
    }

    // put it into the new ref frame:
    if ( !mat_equiv )
    {
        input.set( input * ref_frame );
    }

    if ( result == true )
    {
        applyTo( input );
    }

    return result;
}
开发者ID:aarnchng,项目名称:osggis,代码行数:82,代码来源:OGR_SpatialReference.cpp


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