本文整理汇总了C++中GMLFeature::GetGeometryList方法的典型用法代码示例。如果您正苦于以下问题:C++ GMLFeature::GetGeometryList方法的具体用法?C++ GMLFeature::GetGeometryList怎么用?C++ GMLFeature::GetGeometryList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GMLFeature
的用法示例。
在下文中一共展示了GMLFeature::GetGeometryList方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrescanForTemplate
int GMLReader::PrescanForTemplate ()
{
int iCount = 0;
GMLFeature *poFeature;
//int bSequentialLayers = TRUE;
GFSTemplateList *pCC = new GFSTemplateList();
/* processing GML features */
while( (poFeature = NextFeature()) != NULL )
{
GMLFeatureClass *poClass = poFeature->GetClass();
const CPLXMLNode* const * papsGeomList = poFeature->GetGeometryList();
int b_has_geom = FALSE;
if( papsGeomList != NULL )
{
int i = 0;
const CPLXMLNode *psNode = papsGeomList[i];
while( psNode != NULL )
{
b_has_geom = TRUE;
i++;
psNode = papsGeomList[i];
}
}
pCC->Update( poClass->GetElementName(), b_has_geom );
delete poFeature;
}
gmlUpdateFeatureClasses( pCC, this, &m_bSequentialLayers );
if ( m_bSequentialLayers == TRUE )
ReArrangeTemplateClasses( pCC );
iCount = pCC->GetClassCount();
delete pCC;
CleanupParser();
return iCount > 0;
}
示例2: ResetReading
OGRFeature *OGRNASLayer::GetNextFeature()
{
GMLFeature *poNASFeature = NULL;
OGRGeometry *poGeom = NULL;
if( iNextNASId == 0 )
ResetReading();
/* ==================================================================== */
/* Loop till we find and translate a feature meeting all our */
/* requirements. */
/* ==================================================================== */
while( TRUE )
{
/* -------------------------------------------------------------------- */
/* Cleanup last feature, and get a new raw nas feature. */
/* -------------------------------------------------------------------- */
delete poNASFeature;
delete poGeom;
poNASFeature = NULL;
poGeom = NULL;
poNASFeature = poDS->GetReader()->NextFeature();
if( poNASFeature == NULL )
return NULL;
/* -------------------------------------------------------------------- */
/* Is it of the proper feature class? */
/* -------------------------------------------------------------------- */
// We count reading low level NAS features as a feature read for
// work checking purposes, though at least we didn't necessary
// have to turn it into an OGRFeature.
m_nFeaturesRead++;
if( poNASFeature->GetClass() != poFClass )
continue;
iNextNASId++;
/* -------------------------------------------------------------------- */
/* Does it satisfy the spatial query, if there is one? */
/* -------------------------------------------------------------------- */
const CPLXMLNode* const * papsGeometry = poNASFeature->GetGeometryList();
if (papsGeometry[0] != NULL)
{
poGeom = (OGRGeometry*) OGR_G_CreateFromGMLTree(papsGeometry[0]);
// We assume the createFromNAS() function would have already
// reported the error.
if( poGeom == NULL )
{
delete poNASFeature;
return NULL;
}
if( m_poFilterGeom != NULL && !FilterGeometry( poGeom ) )
continue;
}
/* -------------------------------------------------------------------- */
/* Convert the whole feature into an OGRFeature. */
/* -------------------------------------------------------------------- */
int iField;
OGRFeature *poOGRFeature = new OGRFeature( GetLayerDefn() );
poOGRFeature->SetFID( iNextNASId );
for( iField = 0; iField < poFClass->GetPropertyCount(); iField++ )
{
const GMLProperty *psGMLProperty = poNASFeature->GetProperty( iField );
if( psGMLProperty == NULL || psGMLProperty->nSubProperties == 0 )
continue;
switch( poFClass->GetProperty(iField)->GetType() )
{
case GMLPT_Real:
{
poOGRFeature->SetField( iField, CPLAtof(psGMLProperty->papszSubProperties[0]) );
}
break;
case GMLPT_IntegerList:
{
int nCount = psGMLProperty->nSubProperties;
int *panIntList = (int *) CPLMalloc(sizeof(int) * nCount );
int i;
for( i = 0; i < nCount; i++ )
panIntList[i] = atoi(psGMLProperty->papszSubProperties[i]);
poOGRFeature->SetField( iField, nCount, panIntList );
CPLFree( panIntList );
}
break;
case GMLPT_RealList:
{
//.........这里部分代码省略.........
示例3: PrescanForSchema
int NASReader::PrescanForSchema( int bGetExtents )
{
GMLFeature *poFeature;
if( m_pszFilename == NULL )
return FALSE;
SetClassListLocked( FALSE );
ClearClasses();
if( !SetupParser() )
return FALSE;
std::string osWork;
while( (poFeature = NextFeature()) != NULL )
{
GMLFeatureClass *poClass = poFeature->GetClass();
if( poClass->GetFeatureCount() == -1 )
poClass->SetFeatureCount( 1 );
else
poClass->SetFeatureCount( poClass->GetFeatureCount() + 1 );
#ifdef SUPPORT_GEOMETRY
if( bGetExtents )
{
OGRGeometry *poGeometry = NULL;
const CPLXMLNode* const * papsGeometry = poFeature->GetGeometryList();
if( papsGeometry[0] != NULL )
{
poGeometry = (OGRGeometry*) OGR_G_CreateFromGMLTree(papsGeometry[0]);
}
if( poGeometry != NULL )
{
double dfXMin, dfXMax, dfYMin, dfYMax;
OGREnvelope sEnvelope;
OGRwkbGeometryType eGType = (OGRwkbGeometryType)
poClass->GetGeometryType();
// Merge SRSName into layer.
const char* pszSRSName = GML_ExtractSrsNameFromGeometry(papsGeometry, osWork, FALSE);
// if (pszSRSName != NULL)
// m_bCanUseGlobalSRSName = FALSE;
poClass->MergeSRSName(pszSRSName);
// Merge geometry type into layer.
if( poClass->GetFeatureCount() == 1 && eGType == wkbUnknown )
eGType = wkbNone;
poClass->SetGeometryType(
(int) OGRMergeGeometryTypes(
eGType, poGeometry->getGeometryType() ) );
// merge extents.
poGeometry->getEnvelope( &sEnvelope );
delete poGeometry;
if( poClass->GetExtents(&dfXMin, &dfXMax, &dfYMin, &dfYMax) )
{
dfXMin = MIN(dfXMin,sEnvelope.MinX);
dfXMax = MAX(dfXMax,sEnvelope.MaxX);
dfYMin = MIN(dfYMin,sEnvelope.MinY);
dfYMax = MAX(dfYMax,sEnvelope.MaxY);
}
else
{
dfXMin = sEnvelope.MinX;
dfXMax = sEnvelope.MaxX;
dfYMin = sEnvelope.MinY;
dfYMax = sEnvelope.MaxY;
}
poClass->SetExtents( dfXMin, dfXMax, dfYMin, dfYMax );
}
else
{
if( poClass->GetGeometryType() == (int) wkbUnknown
&& poClass->GetFeatureCount() == 1 )
poClass->SetGeometryType( wkbNone );
}
#endif /* def SUPPORT_GEOMETRY */
}
delete poFeature;
}
CleanupParser();
return GetClassCount() > 0;
}
示例4: if
//.........这里部分代码省略.........
if( iNextGMLId <= nFID )
iNextGMLId = nFID + 1;
}
else
{
bInvalidFIDFound = TRUE;
nFID = iNextGMLId++;
}
}
else if( iNextGMLId != 0 )
{
const char* pszFIDPrefix_notnull = pszFIDPrefix;
if (pszFIDPrefix_notnull == NULL) pszFIDPrefix_notnull = "";
int nLenPrefix = strlen(pszFIDPrefix_notnull);
if( strncmp(pszGML_FID, pszFIDPrefix_notnull, nLenPrefix) == 0 &&
strlen(pszGML_FID+nLenPrefix) <= 9 &&
sscanf(pszGML_FID+nLenPrefix, "%d", &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? */
/* -------------------------------------------------------------------- */
char** papszGeometryList = poGMLFeature->GetGeometryList();
if( papszGeometryList != NULL )
{
const char* pszSRSName = poDS->GetGlobalSRSName();
poGeom = GML_BuildOGRGeometryFromList(papszGeometryList, TRUE,
m_bInvertAxisOrderIfLatLong, pszSRSName);
if (poGeom != NULL && poSRS != NULL)
poGeom->assignSpatialReference(poSRS);
// We assume the createFromGML() function would have already
// reported the error.
if( poGeom == NULL )
{
delete poGMLFeature;
return NULL;
}
if( m_poFilterGeom != NULL && !FilterGeometry( poGeom ) )
continue;
}
/* -------------------------------------------------------------------- */
/* Convert the whole feature into an OGRFeature. */
/* -------------------------------------------------------------------- */
int iField;
int iDstField = 0;
OGRFeature *poOGRFeature = new OGRFeature( GetLayerDefn() );
poOGRFeature->SetFID( nFID );
if (poDS->ExposeGMLId())
{
if (pszGML_FID)
poOGRFeature->SetField( iDstField, pszGML_FID );
示例5: if
//.........这里部分代码省略.........
iNextGMLId = nFID + 1;
}
else
{
bInvalidFIDFound = true;
nFID = iNextGMLId++;
}
}
else if( iNextGMLId != 0 )
{
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.