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


C++ OGRPoint::getX方法代码示例

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


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

示例1: addCurveDirectlyInternal

OGRErr OGRCompoundCurve::addCurveDirectlyInternal( OGRCurve* poCurve,
                                                   double dfToleranceEps,
                                                   int bNeedRealloc )
{
    if( poCurve->getNumPoints() == 1 )
    {
        CPLError(CE_Failure, CPLE_AppDefined,
                 "Invalid curve: not enough points");
        return OGRERR_FAILURE;
    }

    const OGRwkbGeometryType eCurveType =
        wkbFlatten(poCurve->getGeometryType());
    if( EQUAL(poCurve->getGeometryName(), "LINEARRING") )
    {
        CPLError(CE_Failure, CPLE_AppDefined, "Linearring not allowed.");
        return OGRERR_FAILURE;
    }
    else if( eCurveType == wkbCompoundCurve )
    {
        CPLError(CE_Failure, CPLE_AppDefined,
                 "Cannot add a compound curve inside a compound curve");
        return OGRERR_FAILURE;
    }

    if( oCC.nCurveCount > 0 )
    {
        if( oCC.papoCurves[oCC.nCurveCount-1]->IsEmpty() ||
            poCurve->IsEmpty() )
        {
            CPLError(CE_Failure, CPLE_AppDefined, "Non contiguous curves");
            return OGRERR_FAILURE;
        }

        OGRPoint end;
        OGRPoint start;
        oCC.papoCurves[oCC.nCurveCount-1]->EndPoint(&end);
        poCurve->StartPoint(&start);
        if( fabs(end.getX() - start.getX()) > dfToleranceEps ||
            fabs(end.getY() - start.getY()) > dfToleranceEps ||
            fabs(end.getZ() - start.getZ()) > dfToleranceEps )
        {
            poCurve->EndPoint(&start);
            if( fabs(end.getX() - start.getX()) > dfToleranceEps ||
                fabs(end.getY() - start.getY()) > dfToleranceEps ||
                fabs(end.getZ() - start.getZ()) > dfToleranceEps )
            {
                CPLError(CE_Failure, CPLE_AppDefined, "Non contiguous curves");
                return OGRERR_FAILURE;
            }

            CPLDebug("GML", "reversing curve");
            ((OGRSimpleCurve*)poCurve)->reversePoints();
        }
        // Patch so that it matches exactly.
        ((OGRSimpleCurve*)poCurve)->setPoint(0, &end);
    }

    return oCC.addCurveDirectly(this, poCurve, bNeedRealloc);
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:60,代码来源:ogrcompoundcurve.cpp

示例2: Draw

void wxGISSimpleCircleSymbol::Draw(const wxGISGeometry &Geometry, int nLevel)
{
    if (!Geometry.IsOk() || !m_pDisplay)
        return;

    OGRwkbGeometryType eGeomType = wkbFlatten(Geometry.GetType());
    if (eGeomType != wkbMultiPoint)
        return;

    OGREnvelope Env;
    OGRGeometry *pGeom = Geometry;

    OGRMultiPoint* pMPT = (OGRMultiPoint*)pGeom;
    OGRPoint* pCenterPt = (OGRPoint*)pMPT->getGeometryRef(0);
    OGRPoint* pOriginPt = (OGRPoint*)pMPT->getGeometryRef(1);
    double dfRadius = sqrt((pCenterPt->getX() - pOriginPt->getX())*(pCenterPt->getX() - pOriginPt->getX()) + (pCenterPt->getY() - pOriginPt->getY())*(pCenterPt->getY() - pOriginPt->getY()));
    Env.MaxX = pCenterPt->getX() + dfRadius;
    Env.MinX = pCenterPt->getX() - dfRadius;
    Env.MaxY = pCenterPt->getY() + dfRadius;
    Env.MinY = pCenterPt->getY() - dfRadius;

    if (!m_pDisplay->CanDraw(Env))
        return;

    wxCriticalSectionLocker lock(m_pDisplay->GetLock());

    if (!m_pDisplay->CheckDrawAsPoint(Env, m_pLineSymbol->GetWidth()))
    {
        if (!m_pDisplay->DrawCircle(pCenterPt->getX(), pCenterPt->getY(), 0, 0, dfRadius))
        {
            return;
        }

        if (m_Color.Alpha() > 0)
        {
            switch (m_eFillRule)
            {
            case enumGISFillRuleWinding:
                m_pDisplay->SetFillRule(CAIRO_FILL_RULE_WINDING);
                break;
            case enumGISFillRuleOdd:
                m_pDisplay->SetFillRule(CAIRO_FILL_RULE_EVEN_ODD);
                break;
            }
            m_pDisplay->SetColor(m_Color);
            m_pDisplay->FillPreserve();
        }

    }

    m_pLineSymbol->SetStyleToDisplay();

    m_pDisplay->Stroke();
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:54,代码来源:symbol.cpp

示例3: exportToWkt

OGRErr OGRMultiPoint::exportToWkt( char ** ppszDstText ) const

{
    int         nMaxString = getNumGeometries() * 20 + 128;
    int         nRetLen = 0;

    if( getNumGeometries() == 0 )
    {
        *ppszDstText = CPLStrdup("MULTIPOINT(EMPTY)");
        return OGRERR_NONE;
    }

    *ppszDstText = (char *) VSIMalloc( nMaxString );
    if( *ppszDstText == NULL )
        return OGRERR_NOT_ENOUGH_MEMORY;

    sprintf( *ppszDstText, "%s (", getGeometryName() );

    for( int i = 0; i < getNumGeometries(); i++ )
    {
        OGRPoint        *poPoint = (OGRPoint *) getGeometryRef( i );

        if( i > 0 )
            strcat( *ppszDstText + nRetLen, "," );

        nRetLen += strlen(*ppszDstText + nRetLen);

        if( nMaxString < nRetLen + 100 )
        {
            nMaxString = nMaxString * 2;
            *ppszDstText = (char *) CPLRealloc(*ppszDstText,nMaxString);
        }

        if( poPoint->getCoordinateDimension() == 3 )
            OGRMakeWktCoordinate( *ppszDstText + nRetLen,
                                  poPoint->getX(),
                                  poPoint->getY(),
                                  poPoint->getZ() );
        else
            OGRMakeWktCoordinate( *ppszDstText + nRetLen,
                                  poPoint->getX(),
                                  poPoint->getY(),
                                  0.0 );
    }

    strcat( *ppszDstText+nRetLen, ")" );

    return OGRERR_NONE;
}
开发者ID:buya07,项目名称:KomodoExercise,代码行数:49,代码来源:ogrmultipoint.cpp

示例4: get_Area

double OGRCompoundCurve::get_Area() const
{
    if( IsEmpty() || !get_IsClosed() )
        return 0;

    // Optimization for convex rings.
    if( IsConvex() )
    {
        // Compute area of shape without the circular segments.
        OGRPointIterator* poIter = getPointIterator();
        OGRLineString oLS;
        oLS.setNumPoints( getNumPoints() );
        OGRPoint p;
        for( int i = 0; poIter->getNextPoint(&p); i++ )
        {
            oLS.setPoint( i, p.getX(), p.getY() );
        }
        double dfArea = oLS.get_Area();
        delete poIter;

        // Add the area of the spherical segments.
        dfArea += get_AreaOfCurveSegments();

        return dfArea;
    }

    OGRLineString* poLS = CurveToLine();
    double dfArea = poLS->get_Area();
    delete poLS;

    return dfArea;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:32,代码来源:ogrcompoundcurve.cpp

示例5: CreateFeature

OGRErr TigerPoint::CreateFeature( OGRFeature *poFeature,
                                  int pointIndex)

{
    char        szRecord[OGR_TIGER_RECBUF_LEN];
    OGRPoint    *poPoint = poFeature->GetGeometryRef()->toPoint();

    if( !SetWriteModule( m_pszFileCode, psRTInfo->nRecordLength+2, poFeature ) )
        return OGRERR_FAILURE;

    memset( szRecord, ' ', psRTInfo->nRecordLength );

    WriteFields( psRTInfo, poFeature, szRecord );

    if( poPoint != nullptr
        && (poPoint->getGeometryType() == wkbPoint
            || poPoint->getGeometryType() == wkbPoint25D) ) {
        WritePoint( szRecord, pointIndex, poPoint->getX(), poPoint->getY() );
    } else {
        if (bRequireGeom) {
            return OGRERR_FAILURE;
        }
    }

    WriteRecord( szRecord, psRTInfo->nRecordLength, m_pszFileCode );

    return OGRERR_NONE;
}
开发者ID:OSGeo,项目名称:gdal,代码行数:28,代码来源:tigerpoint.cpp

示例6: Equals

OGRBoolean OGRPoint::Equals( OGRGeometry * poOther ) const

{
    if( poOther== this )
        return TRUE;

    if( poOther->getGeometryType() != getGeometryType() )
        return FALSE;

    OGRPoint *poOPoint = dynamic_cast<OGRPoint *>(poOther);
    if( poOPoint == NULL )
    {
        CPLError(CE_Fatal, CPLE_AppDefined,
                 "dynamic_cast failed.  Expected OGRPoint.");
        return FALSE;
    }
    if( flags != poOPoint->flags )
        return FALSE;

    if( IsEmpty() )
        return TRUE;

    // Should eventually test the SRS.
    if( poOPoint->getX() != getX()
        || poOPoint->getY() != getY()
        || poOPoint->getZ() != getZ() )
        return FALSE;

    return TRUE;
}
开发者ID:Mavrx-inc,项目名称:gdal,代码行数:30,代码来源:ogrpoint.cpp

示例7: multiPointToDrawable

    osg::Geometry* multiPointToDrawable(OGRMultiPoint* mpoint) const
    {
        osg::Geometry* geom = new osg::Geometry;

        osg::Geometry* pointGeom = new osg::Geometry();
        osg::Vec3Array* vertices = new osg::Vec3Array();

        vertices->reserve(mpoint->getNumGeometries());
        for (int i = 0; i < mpoint->getNumGeometries(); i++ )
        {
            OGRGeometry* ogrGeom = mpoint->getGeometryRef(i);
            OGRwkbGeometryType ogrGeomType = ogrGeom->getGeometryType();

            if (wkbPoint != ogrGeomType && wkbPoint25D != ogrGeomType)
                continue; // skip

            OGRPoint* points = static_cast<OGRPoint*>(ogrGeom);

            vertices->push_back(osg::Vec3(points->getX(), points->getY(), points->getZ()));
        }

        pointGeom->setVertexArray(vertices);
        pointGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POINTS, 0, vertices->size()));

        if (pointGeom->getVertexArray())
        {
            OSG_INFO << "osgOgrFeature::multiPointToDrawable " << geom->getVertexArray()->getNumElements() << " vertexes"<< std::endl;
        }

        return pointGeom;
    }
开发者ID:Kurdakov,项目名称:emscripten_OSG,代码行数:31,代码来源:ReaderWriterOGR.cpp

示例8: HashAirwayIntersectionFeatureFunc

static unsigned long HashAirwayIntersectionFeatureFunc(const void* _feature)
{
    OGRFeature* feature = (OGRFeature*)_feature;
    OGRPoint* point = (OGRPoint*) feature->GetGeometryRef();
    unsigned long hash = CPLHashSetHashStr((unsigned char*)feature->GetFieldAsString(0));
    const double x = point->getX();
    const double y = point->getY();
    return hash ^ OGRXPlaneAirwayHashDouble(x) ^ OGRXPlaneAirwayHashDouble(y);
}
开发者ID:rashadkm,项目名称:lib_gdal,代码行数:9,代码来源:ogr_xplane_awy_reader.cpp

示例9: CreateFeature

OGRErr GTMWaypointLayer::CreateFeature (OGRFeature *poFeature)
{
    FILE* fp = poDS->getOutputFP();
    if (fp == NULL)
        return CE_Failure;

    OGRGeometry *poGeom = poFeature->GetGeometryRef();
    if ( poGeom == NULL )
    {
        CPLError( CE_Failure, CPLE_AppDefined,
                  "Features without geometry not supported by GTM writer in waypoints layer." );
        return OGRERR_FAILURE;
    }

    if (NULL != poCT)
    {
        poGeom = poGeom->clone();
        poGeom->transform( poCT );
    }


    switch( poGeom->getGeometryType() )
    {
    case wkbPoint:
    case wkbPoint25D:
    {
        OGRPoint* point = (OGRPoint*)poGeom;
        double lat = point->getY();
        double lon = point->getX();
        CheckAndFixCoordinatesValidity(lat, lon);
        poDS->checkBounds((float)lat, (float)lon);
        writeDouble(fp, lat);
        writeDouble(fp, lon);
        float altitude = 0.0;
        if (poGeom->getGeometryType() == wkbPoint25D)
            altitude = (float) point->getZ();

        WriteFeatureAttributes(poFeature, altitude);
        break;
    }

    default:
    {
        CPLError( CE_Failure, CPLE_NotSupported,
                  "Geometry type of `%s' not supported for 'waypoint' element.\n",
                  OGRGeometryTypeToName(poGeom->getGeometryType()) );
        return OGRERR_FAILURE;
    }
    }

    if (NULL != poCT)
        delete poGeom;

    return OGRERR_NONE;

}
开发者ID:RyanHun,项目名称:World-Wind-Java,代码行数:56,代码来源:gtmwaypointlayer.cpp

示例10: polygonToDrawable

    osg::Geometry* polygonToDrawable(OGRPolygon* polygon) const
    {
        osg::Geometry* geom = new osg::Geometry();
        osg::Vec3Array* vertices = new osg::Vec3Array();
        geom->setVertexArray(vertices);
        {
            OGRLinearRing *ring = polygon->getExteriorRing();
            OGRPoint point;
            for(int i = 0; i < ring->getNumPoints(); i++)
            {
                ring->getPoint(i, &point);
                vertices->push_back(osg::Vec3(point.getX(), point.getY(), point.getZ()));
            }
            geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP, 0, vertices->size()));
        }

        if (polygon->getNumInteriorRings())
        {
            for (int i = 0; i < polygon->getNumInteriorRings(); i++)
            {
                OGRLinearRing *ring = polygon->getInteriorRing(i);
                OGRPoint point;
                for (int j = 0; j < ring->getNumPoints(); j++)
                {
                    ring->getPoint(j, &point);
                    vertices->push_back(osg::Vec3(point.getX(), point.getY(), point.getZ()));
                }
                geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP, vertices->size()-ring->getNumPoints() , ring->getNumPoints()));
            }
        }
        osgUtil::Tessellator tsl;
        tsl.setTessellationType(osgUtil::Tessellator::TESS_TYPE_GEOMETRY);
        tsl.setBoundaryOnly(false);
        tsl.retessellatePolygons(*geom);

        osg::Vec3Array* array = triangulizeGeometry(geom);
        geom->setVertexArray(array);
        geom->removePrimitiveSet(0,geom->getNumPrimitiveSets());
        geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::TRIANGLES, 0, array->size()));

        return geom;
    }
开发者ID:Kurdakov,项目名称:emscripten_OSG,代码行数:42,代码来源:ReaderWriterOGR.cpp

示例11: readRing

	void Shape::readRing(OGRLinearRing* ring, ShapePart& shapePart) {
		shapePart.points.resize(ring->getNumPoints());
		for (int j = 0; j < ring->getNumPoints(); ++j) {
			OGRPoint point;
			ring->getPoint(j, &point);

			shapePart.points[j].x = point.getX();
			shapePart.points[j].y = point.getY();
			updateBounds(&point);
		}
	}
开发者ID:gnishida,项目名称:GDALTest,代码行数:11,代码来源:GShapefile.cpp

示例12: readLineString

	void Shape::readLineString(OGRLineString* lineString, ShapeObject& shapeObject) {
		shapeObject.parts.resize(1);
		shapeObject.parts[0].points.resize(lineString->getNumPoints());

		for (int i = 0; i < lineString->getNumPoints(); ++i) {
			OGRPoint point;
			lineString->getPoint(i, &point);
			shapeObject.parts[0].points[i].x = point.getX();
			shapeObject.parts[0].points[i].y = point.getY();
			updateBounds(&point);
		}
	}
开发者ID:gnishida,项目名称:GDALTest,代码行数:12,代码来源:GShapefile.cpp

示例13: convertAndTransform

  inline Usul::Math::Vec3d convertAndTransform ( const OGRPoint& point, OGRCoordinateTransformation* transform, double verticalOffset )
  {
    // Declare the point.
    Usul::Math::Vec3d p ( point.getX(), point.getY(), point.getZ() + verticalOffset );

    // Transform the point.
    if ( 0x0 != transform )
    {
      transform->Transform ( 1, &p[0], &p[1], &p[2] );
    }

    return p;
  }
开发者ID:gideonmay,项目名称:minervagis,代码行数:13,代码来源:OGRConvert.cpp

示例14: reverseWindingOrder

void OGRLinearRing::reverseWindingOrder() 

{ 
    int pos = 0; 
    OGRPoint tempPoint; 

    for( int i = 0; i < nPointCount / 2; i++ ) 
    { 
        getPoint( i, &tempPoint ); 
        pos = nPointCount - i - 1;
        if( getCoordinateDimension() == 2 )
        {
            setPoint( i, getX(pos), getY(pos) );
            setPoint( pos, tempPoint.getX(), tempPoint.getY() );
        }
        else
        {
            setPoint( i, getX(pos), getY(pos), getZ(pos) );
            setPoint( pos, tempPoint.getX(), tempPoint.getY(), tempPoint.getZ() );
        }
    } 
} 
开发者ID:agrismart,项目名称:gdal-1.9.2,代码行数:22,代码来源:ogrlinearring.cpp

示例15: GetBounds

OGREnvelope wxGISShape::GetBounds() const
{
    OGREnvelope oReturnBounds;

    switch (m_eType)
    {
    case enumGISShapeTypeRectangle:
    case enumGISShapeTypePolygon:
    case enumGISShapeTypeLine:
    case enumGISShapeTypeEllipse:
    case enumGISShapeTypeMarker:
        oReturnBounds = m_oGeom.GetEnvelope();
        break;
    case enumGISShapeTypeCircle:
    {
        OGRGeometry *pGeom = m_oGeom;

        OGRMultiPoint* pMPT = (OGRMultiPoint*)pGeom;
        OGRPoint* pCenterPt = (OGRPoint*)pMPT->getGeometryRef(0);
        OGRPoint* pOriginPt = (OGRPoint*)pMPT->getGeometryRef(1);
        double dfRadius = sqrt((pCenterPt->getX() - pOriginPt->getX())*(pCenterPt->getX() - pOriginPt->getX()) + (pCenterPt->getY() - pOriginPt->getY())*(pCenterPt->getY() - pOriginPt->getY()));
        oReturnBounds.MaxX = pCenterPt->getX() + dfRadius;
        oReturnBounds.MinX = pCenterPt->getX() - dfRadius;
        oReturnBounds.MaxY = pCenterPt->getY() + dfRadius;
        oReturnBounds.MinY = pCenterPt->getY() - dfRadius;
        break;
    }
#ifdef wxGIS_USE_SPLINE
    case enumGISShapeTypeCurve://TODO:
    case enumGISShapeTypeFreeHand:
        break;
#endif //wxGIS_USE_SPLINE
    case enumGISShapeTypeFreeHand:
        oReturnBounds = m_oGeom.GetEnvelope();
        break;
    };

    return oReturnBounds;
}
开发者ID:GimpoByte,项目名称:nextgismanager,代码行数:39,代码来源:drawinglayer.cpp


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