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


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

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


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

示例1: GeoPoint

bool
getIsectPoint( const GeoPoint& p1, const GeoPoint& p2, const GeoPoint& p3, const GeoPoint& p4, GeoPoint& out )
{
    double denom = (p4.y()-p3.y())*(p2.x()-p1.x()) - (p4.x()-p3.x())*(p2.y()-p1.y());
    if ( denom == 0.0 )
    {
        out = GeoPoint::invalid(); // parallel lines
        return false;
    }

    double ua_num = (p4.x()-p3.x())*(p1.y()-p3.y()) - (p4.y()-p3.y())*(p1.x()-p3.x());
    double ub_num = (p2.x()-p1.x())*(p1.y()-p3.y()) - (p2.y()-p1.y())*(p1.x()-p3.x());

    double ua = ua_num/denom;
    double ub = ub_num/denom;

    if ( ua < 0.0 || ua > 1.0 ) // || ub < 0.0 || ub > 1.0 )
    {
        out = GeoPoint::invalid(); // isect point is on line, but not on line segment
        return false;
    }

    double x = p1.x() + ua*(p2.x()-p1.x());
    double y = p1.y() + ua*(p2.y()-p1.y());
    double z = p1.getDim() > 2? p1.z() + ua*(p2.z()-p1.z()) : 0.0; //right?
    out = GeoPoint( x, y, z, p1.getSRS() );
    return true;
}
开发者ID:aarnchng,项目名称:osggis,代码行数:28,代码来源:CropFilter.cpp

示例2: isValid

bool
GeoPoint::operator == ( const GeoPoint& rhs ) const
{
    return
        isValid() && rhs.isValid() &&
        SpatialReference::equivalent( getSRS(), rhs.getSRS() ) &&
        getDim() == rhs.getDim() &&
        x() == rhs.x() &&
        (getDim() < 2 || y() == rhs.y()) &&
        (getDim() < 3 || z() == rhs.z());
}
开发者ID:aarnchng,项目名称:osggis,代码行数:11,代码来源:GeoPoint.cpp

示例3: 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

示例4: if

bool
findIsectSegmentAndPoint(const GeoPoint& p1,
                         const GeoPoint& p2,
                         const GeoPointList& input,
                         const UINT start_i,
                         int&      out_seg_i,
                         GeoPoint& out_isect_p )
{
    for( UINT i=0; i<input.size()-1; i++ )
    {
        // ignore the segments preceding and following the start index
        if ( (input.size()+start_i-1)%input.size() <= i && i <= (input.size()+start_i+1)%input.size() )
            continue;

        const GeoPoint& p3 = input[i];
        const GeoPoint& p4 = input[i+1];

        double denom = (p4.y()-p3.y())*(p2.x()-p1.x()) - (p4.x()-p3.x())*(p2.y()-p1.y());
        if ( denom != 0.0 )
        {
            double ua_num = (p4.x()-p3.x())*(p1.y()-p3.y()) - (p4.y()-p3.y())*(p1.x()-p3.x());
            double ub_num = (p2.x()-p1.x())*(p1.y()-p3.y()) - (p2.y()-p1.y())*(p1.x()-p3.x());

            double ua = ua_num/denom;
            double ub = ub_num/denom;

            if ( ua <= 1.0 ) {
                //osgGIS::notify( osg::WARN ) 
                //    << " [" 
                //    << i << "] "
                //    << "isect point was found at on source segment (ua=" << ua << ")" 
                //    << std::endl
                //    << "  source segment = (" << p1.toString() << " => " << p2.toString() << "), "
                //    << "  target segment = (" << p3.toString() << " => " << p4.toString() << ")"
                //    << std::endl;
            }

            else if ( ub < 0.0 || ub > 1.0 ) 
            {
                //osgGIS::notify( osg::WARN ) 
                //    << " [" 
                //    << i << "] "
                //    << "isect point was not found on target segment (ub=" << ub << ")" 
                //    << std::endl
                //    << "  source segment = (" << p1.toString() << " => " << p2.toString() << "), "
                //    << "  target segment = (" << p3.toString() << " => " << p4.toString() << ")"
                //    << std::endl;
            }
            else
            {
                double isect_x = p1.x() + ua*(p2.x()-p1.x());
                double isect_y = p1.y() + ua*(p2.y()-p1.y());
                out_seg_i = i;
                out_isect_p = p1.getDim() == 2?
                    GeoPoint( isect_x, isect_y, p4.getSRS() ) :
                    GeoPoint( isect_x, isect_y, p4.z(), p4.getSRS() );
                return true;
            }
        }
    }
    return false;
}
开发者ID:aarnchng,项目名称:osggis,代码行数:62,代码来源:CropFilter.cpp


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