本文整理汇总了C++中Geometry::SetbM方法的典型用法代码示例。如果您正苦于以下问题:C++ Geometry::SetbM方法的具体用法?C++ Geometry::SetbM怎么用?C++ Geometry::SetbM使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Geometry
的用法示例。
在下文中一共展示了Geometry::SetbM方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
if ( psShape->nParts == 0 )
{
pGeometry = NULL;
}
//建立一个空的多边形要素
pGeometry =(Geometry*)GeometryFactory::getDefaultInstance()->createPolygon();
if ( psShape->nParts == 1 )
{
CoordVect *pcoords =new CoordVect(psShape->nVertices);
for(int i=0;i<psShape->nVertices;i++)
{
coord.x =psShape->padfX[i];
coord.y = psShape->padfY[i];
coord.z = psShape->padfZ[i];
coord.m =psShape->padfM[i];
(*pcoords)[i] =coord;
}
CoordinateSequence *coords = GeometryFactory::getDefaultInstance()->getCoordinateSequenceFactory()->create(pcoords);
LinearRing *pring = GeometryFactory::getDefaultInstance()->createLinearRing(coords);
((GEOMETRY::geom::Polygon*)pGeometry)->AddGeometry((Geometry*)pring);
}
else
{
int iRing;
int nRingPoints;
int nRingStart;
int i;
CoordVect *pcoords =NULL;
for( iRing = 0; iRing < psShape->nParts; iRing++ )
{
if( psShape->panPartStart == NULL )
{
nRingPoints = psShape->nVertices;
nRingStart = 0;
}
else
{
if( iRing == psShape->nParts - 1 )
nRingPoints =psShape->nVertices - psShape->panPartStart[iRing];
else
nRingPoints = psShape->panPartStart[iRing+1]- psShape->panPartStart[iRing];
nRingStart = psShape->panPartStart[iRing];
}
pcoords =new CoordVect(nRingPoints);
for(i=0;i<nRingPoints;i++)
{
coord.x = *(psShape->padfX+nRingStart+i);
coord.y = *(psShape->padfY+nRingStart+i);
coord.z = *(psShape->padfZ+nRingStart+i);
coord.m = *(psShape->padfM+nRingStart+i);
(*pcoords)[i] =coord;
}
CoordinateSequence *coords = GeometryFactory::getDefaultInstance()->getCoordinateSequenceFactory()->create(pcoords);
LinearRing *pring = GeometryFactory::getDefaultInstance()->createLinearRing(coords);
((GEOMETRY::geom::Polygon*)pGeometry)->AddGeometry((Geometry*)pring);
}
}
}
/* -------------------------------------------------------------------- */
/* Otherwise for now we just ignore the object. Eventually we */
/* should implement multipatch. */
/* -------------------------------------------------------------------- */
else
{
if( psShape->nSHPType != SHPT_NULL )
{
}
/* nothing returned */
}
/* -------------------------------------------------------------------- */
/* Cleanup shape, and set feature id. */
/* -------------------------------------------------------------------- */
SHPDestroyObject( psShape );
if(pGeometry)
{
pGeometry->SetbZ(HasZ());
pGeometry->SetbM(HasM());
}
return pGeometry;
}