本文整理汇总了C++中OGRPoint::getZ方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRPoint::getZ方法的具体用法?C++ OGRPoint::getZ怎么用?C++ OGRPoint::getZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRPoint
的用法示例。
在下文中一共展示了OGRPoint::getZ方法的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);
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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;
}
示例7: WriteINSERT
OGRErr OGRDXFWriterLayer::WriteINSERT( OGRFeature *poFeature )
{
WriteValue( 0, "INSERT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbBlockReference" );
WriteValue( 2, poFeature->GetFieldAsString("BlockName") );
/* -------------------------------------------------------------------- */
/* Write location. */
/* -------------------------------------------------------------------- */
OGRPoint *poPoint = (OGRPoint *) poFeature->GetGeometryRef();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
/* -------------------------------------------------------------------- */
/* Write scaling. */
/* -------------------------------------------------------------------- */
int nScaleCount;
const double *padfScale =
poFeature->GetFieldAsDoubleList( "BlockScale", &nScaleCount );
if( nScaleCount == 3 )
{
WriteValue( 41, padfScale[0] );
WriteValue( 42, padfScale[1] );
WriteValue( 43, padfScale[2] );
}
/* -------------------------------------------------------------------- */
/* Write rotation. */
/* -------------------------------------------------------------------- */
double dfAngle = poFeature->GetFieldAsDouble( "BlockAngle" );
if( dfAngle != 0.0 )
{
WriteValue( 50, dfAngle ); // degrees
}
return OGRERR_NONE;
}
示例8: reverseWindingOrder
void OGRLinearRing::reverseWindingOrder()
{
int pos = 0;
OGRPoint tempPoint;
for( int i = 0; i < nPointCount / 2; i++ )
{
getPoint( i, &tempPoint );
pos = nPointCount - i - 1;
setPoint( i, getX(pos), getY(pos), getZ(pos) );
setPoint( pos, tempPoint.getX(), tempPoint.getY(), tempPoint.getZ() );
}
}
示例9: linearRingToDrawable
osg::Geometry* linearRingToDrawable(OGRLinearRing* ring) const
{
osg::Geometry* contourGeom = new osg::Geometry();
osg::Vec3Array* vertices = new osg::Vec3Array();
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()));
}
contourGeom->setVertexArray(vertices);
contourGeom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::LINE_LOOP, 0, vertices->size()));
return contourGeom;
}
示例10: 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;
}
示例11: extrude
osg::ref_ptr<osg::Group> MapExtruder::osg_assemble()
{
osg::ref_ptr<osg::Group> osg = new osg::Group;
osg::ref_ptr<osg::Node> surface = osgDB::readNodeFile(_map2dFile);
ExtrudeVisitor extrude(_height);
surface->accept(extrude);
osg->addChild(surface);
int n = _sides ->getNumGeometries();
osg::ref_ptr<osg::Geode> geode = new osg::Geode;
for(int i=0;i<n;i++)
{
osg::ref_ptr<osg::Geometry> geom = new osg::Geometry;
osg::ref_ptr<osg::Vec3Array> verts = new osg::Vec3Array;
std::vector<OGRPoint> points;
OGRLinearRing *ring = ((OGRPolygon*)_sides->getGeometryRef(i))->getExteriorRing();
int m = ring->getNumPoints();
for(int j=0;j<m;j++)
{
OGRPoint pt;
ring->getPoint(j,&pt);
verts->push_back(osg::Vec3(pt.getX(),pt.getY(),pt.getZ()));
}
geom->setVertexArray(verts);
osg::Vec4Array* colors = new osg::Vec4Array;
colors->push_back(YELLOW);
geom->setColorArray(colors);
geom->setColorBinding(osg::Geometry::BIND_OVERALL);
geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::POLYGON,0,m));
geode->addDrawable(geom);
}
osg->addChild(geode);
return osg;
}
示例12: WritePOINT
OGRErr OGRDXFWriterLayer::WritePOINT( OGRFeature *poFeature )
{
WriteValue( 0, "POINT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbPoint" );
// Write style pen color
OGRStyleTool *poTool = nullptr;
OGRStyleMgr oSM;
if( poFeature->GetStyleString() != nullptr )
{
oSM.InitFromFeature( poFeature );
if( oSM.GetPartCount() > 0 )
poTool = oSM.GetPart(0);
}
if( poTool && poTool->GetType() == OGRSTCPen )
{
OGRStylePen *poPen = (OGRStylePen *) poTool;
GBool bDefault;
if( poPen->Color(bDefault) != nullptr && !bDefault )
WriteValue( 62, ColorStringToDXFColor( poPen->Color(bDefault) ) );
}
delete poTool;
OGRPoint *poPoint = poFeature->GetGeometryRef()->toPoint();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
return OGRERR_NONE;
}
示例13: Equals
OGRBoolean OGRPoint::Equals( OGRGeometry * poOther ) const
{
OGRPoint *poOPoint = (OGRPoint *) poOther;
if( poOPoint== this )
return TRUE;
if( poOther->getGeometryType() != getGeometryType() )
return FALSE;
// we should eventually test the SRS.
if( poOPoint->getX() != getX()
|| poOPoint->getY() != getY()
|| poOPoint->getZ() != getZ() )
return FALSE;
else
return TRUE;
}
示例14: WritePOINT
OGRErr OGRDXFWriterLayer::WritePOINT( OGRFeature *poFeature )
{
WriteValue( 0, "POINT" );
WriteCore( poFeature );
WriteValue( 100, "AcDbEntity" );
WriteValue( 100, "AcDbPoint" );
OGRPoint *poPoint = (OGRPoint *) poFeature->GetGeometryRef();
WriteValue( 10, poPoint->getX() );
if( !WriteValue( 20, poPoint->getY() ) )
return OGRERR_FAILURE;
if( poPoint->getGeometryType() == wkbPoint25D )
{
if( !WriteValue( 30, poPoint->getZ() ) )
return OGRERR_FAILURE;
}
return OGRERR_NONE;
}
示例15: 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() );
}
}
}