本文整理汇总了C++中GMLFeature::GetGeometryRef方法的典型用法代码示例。如果您正苦于以下问题:C++ GMLFeature::GetGeometryRef方法的具体用法?C++ GMLFeature::GetGeometryRef怎么用?C++ GMLFeature::GetGeometryRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMLFeature
的用法示例。
在下文中一共展示了GMLFeature::GetGeometryRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
{
const char* pszFIDPrefix_notnull = pszFIDPrefix;
if (pszFIDPrefix_notnull == NULL) pszFIDPrefix_notnull = "";
int nLenPrefix = static_cast<int>(strlen(pszFIDPrefix_notnull));
if( strncmp(pszGML_FID, pszFIDPrefix_notnull, nLenPrefix) == 0 &&
strlen(pszGML_FID+nLenPrefix) < 20 &&
sscanf(pszGML_FID+nLenPrefix, CPL_FRMT_GIB, &nFID) == 1 )
{ /* fid with the prefix. Using its numerical part */
if( iNextGMLId < nFID )
iNextGMLId = nFID + 1;
}
else
{ /* fid without the aforementioned prefix or a valid numerical part */
bInvalidFIDFound = true;
nFID = iNextGMLId++;
}
}
/* -------------------------------------------------------------------- */
/* Does it satisfy the spatial query, if there is one? */
/* -------------------------------------------------------------------- */
OGRGeometry** papoGeometries = NULL;
const CPLXMLNode* const * papsGeometry = poGMLFeature->GetGeometryList();
if( poFeatureDefn->GetGeomFieldCount() > 1 )
{
papoGeometries = (OGRGeometry**)
CPLCalloc( poFeatureDefn->GetGeomFieldCount(), sizeof(OGRGeometry*) );
const char* pszSRSName = poDS->GetGlobalSRSName();
for( int i=0; i < poFeatureDefn->GetGeomFieldCount(); i++ )
{
const CPLXMLNode* psGeom = poGMLFeature->GetGeometryRef(i);
if( psGeom != NULL )
{
const CPLXMLNode* myGeometryList[2];
myGeometryList[0] = psGeom;
myGeometryList[1] = NULL;
poGeom = GML_BuildOGRGeometryFromList(myGeometryList, true,
poDS->GetInvertAxisOrderIfLatLong(),
pszSRSName,
poDS->GetConsiderEPSGAsURN(),
poDS->GetSecondaryGeometryOption(),
hCacheSRS,
bFaceHoleNegative );
/* Do geometry type changes if needed to match layer geometry type */
if (poGeom != NULL)
{
papoGeometries[i] = OGRGeometryFactory::forceTo(poGeom,
poFeatureDefn->GetGeomFieldDefn(i)->GetType());
poGeom = NULL;
}
else
// We assume the createFromGML() function would have already
// reported the error.
{
for( i=0; i < poFeatureDefn->GetGeomFieldCount(); i++)
{
delete papoGeometries[i];
}
CPLFree(papoGeometries);
delete poGMLFeature;
return NULL;
}