本文整理汇总了C++中OGRLinearRing::set3D方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRLinearRing::set3D方法的具体用法?C++ OGRLinearRing::set3D怎么用?C++ OGRLinearRing::set3D使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRLinearRing
的用法示例。
在下文中一共展示了OGRLinearRing::set3D方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exportToWkt
OGRErr OGRPolygon::exportToWkt( char ** ppszDstText,
OGRwkbVariant eWkbVariant ) const
{
bool bMustWriteComma = false;
/* -------------------------------------------------------------------- */
/* If we have no valid exterior ring, return POLYGON EMPTY. */
/* -------------------------------------------------------------------- */
if( getExteriorRing() == NULL ||
getExteriorRing()->IsEmpty() )
{
if( eWkbVariant == wkbVariantIso )
{
if( (flags & OGR_G_3D) && (flags & OGR_G_MEASURED) )
*ppszDstText = CPLStrdup((CPLString(getGeometryName()) + " ZM EMPTY").c_str());
else if( flags & OGR_G_MEASURED )
*ppszDstText = CPLStrdup((CPLString(getGeometryName()) + " M EMPTY").c_str());
else if( flags & OGR_G_3D )
*ppszDstText = CPLStrdup((CPLString(getGeometryName()) + " Z EMPTY").c_str());
else
*ppszDstText = CPLStrdup((CPLString(getGeometryName()) + " EMPTY").c_str());
}
else
*ppszDstText = CPLStrdup((CPLString(getGeometryName()) + " EMPTY").c_str());
return OGRERR_NONE;
}
/* -------------------------------------------------------------------- */
/* Build a list of strings containing the stuff for each ring. */
/* -------------------------------------------------------------------- */
char **papszRings =
static_cast<char **>(CPLCalloc(sizeof(char *), oCC.nCurveCount));
size_t nCumulativeLength = 0;
size_t nNonEmptyRings = 0;
size_t *pnRingBeginning =
static_cast<size_t *>(CPLCalloc(sizeof(size_t), oCC.nCurveCount));
OGRErr eErr;
for( int iRing = 0; iRing < oCC.nCurveCount; iRing++ )
{
OGRLinearRing* poLR = (OGRLinearRing*) oCC.papoCurves[iRing];
//poLR->setFlags( getFlags() );
poLR->set3D(Is3D());
poLR->setMeasured(IsMeasured());
if( poLR->getNumPoints() == 0 )
{
papszRings[iRing] = NULL;
continue;
}
eErr = poLR->exportToWkt( &(papszRings[iRing]), eWkbVariant );
if( eErr != OGRERR_NONE )
goto error;
if( STARTS_WITH_CI(papszRings[iRing], "LINEARRING ZM (") )
pnRingBeginning[iRing] = 14;
else if( STARTS_WITH_CI(papszRings[iRing], "LINEARRING M (") )
pnRingBeginning[iRing] = 13;
else if( STARTS_WITH_CI(papszRings[iRing], "LINEARRING Z (") )
pnRingBeginning[iRing] = 13;
else if( STARTS_WITH_CI(papszRings[iRing], "LINEARRING (") )
pnRingBeginning[iRing] = 11;
else
{
CPLAssert(false);
}
nCumulativeLength += strlen(papszRings[iRing] + pnRingBeginning[iRing]);
nNonEmptyRings++;
}
/* -------------------------------------------------------------------- */
/* Allocate exactly the right amount of space for the */
/* aggregated string. */
/* -------------------------------------------------------------------- */
*ppszDstText = (char *) VSI_MALLOC_VERBOSE(
nCumulativeLength + nNonEmptyRings + strlen(getGeometryName()) + strlen(" ZM ()") + 1);
if( *ppszDstText == NULL )
{
eErr = OGRERR_NOT_ENOUGH_MEMORY;
goto error;
}
/* -------------------------------------------------------------------- */
/* Build up the string, freeing temporary strings as we go. */
/* -------------------------------------------------------------------- */
if( eWkbVariant == wkbVariantIso )
{
if( (flags & OGR_G_3D) && (flags & OGR_G_MEASURED) )
strcpy( *ppszDstText, (CPLString(getGeometryName()) + " ZM (").c_str() );
else if( flags & OGR_G_MEASURED )
strcpy( *ppszDstText, (CPLString(getGeometryName()) + " M (").c_str() );
else if( flags & OGR_G_3D )
strcpy( *ppszDstText, (CPLString(getGeometryName()) + " Z (").c_str() );
else
strcpy( *ppszDstText, (CPLString(getGeometryName()) + " (").c_str() );
}
//.........这里部分代码省略.........