本文整理汇总了C++中OGRGeometry::swapXY方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRGeometry::swapXY方法的具体用法?C++ OGRGeometry::swapXY怎么用?C++ OGRGeometry::swapXY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRGeometry
的用法示例。
在下文中一共展示了OGRGeometry::swapXY方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GML_BuildOGRGeometryFromList
//.........这里部分代码省略.........
{
OGRGeometry* poGeom = NULL;
int i;
OGRGeometryCollection* poCollection = NULL;
for(i=0;papsGeometry[i] != NULL;i++)
{
OGRGeometry* poSubGeom = GML2OGRGeometry_XMLNode( papsGeometry[i],
bGetSecondaryGeometryOption );
if (poSubGeom)
{
if (poGeom == NULL)
poGeom = poSubGeom;
else
{
if (poCollection == NULL)
{
if (bTryToMakeMultipolygons &&
wkbFlatten(poGeom->getGeometryType()) == wkbPolygon &&
wkbFlatten(poSubGeom->getGeometryType()) == wkbPolygon)
{
OGRGeometryCollection* poGeomColl = new OGRMultiPolygon();
poGeomColl->addGeometryDirectly(poGeom);
poGeomColl->addGeometryDirectly(poSubGeom);
poGeom = poGeomColl;
}
else if (bTryToMakeMultipolygons &&
wkbFlatten(poGeom->getGeometryType()) == wkbMultiPolygon &&
wkbFlatten(poSubGeom->getGeometryType()) == wkbPolygon)
{
OGRGeometryCollection* poGeomColl = (OGRGeometryCollection* )poGeom;
poGeomColl->addGeometryDirectly(poSubGeom);
}
else if (bTryToMakeMultipolygons &&
wkbFlatten(poGeom->getGeometryType()) == wkbMultiPolygon &&
wkbFlatten(poSubGeom->getGeometryType()) == wkbMultiPolygon)
{
OGRGeometryCollection* poGeomColl = (OGRGeometryCollection* )poGeom;
OGRGeometryCollection* poGeomColl2 = (OGRGeometryCollection* )poSubGeom;
int nCount = poGeomColl2->getNumGeometries();
int i;
for(i=0;i<nCount;i++)
{
poGeomColl->addGeometry(poGeomColl2->getGeometryRef(i));
}
delete poSubGeom;
}
else if (bTryToMakeMultipolygons &&
wkbFlatten(poGeom->getGeometryType()) == wkbMultiPolygon)
{
delete poGeom;
delete poSubGeom;
return GML_BuildOGRGeometryFromList(papsGeometry, FALSE,
bInvertAxisOrderIfLatLong,
pszDefaultSRSName,
bConsiderEPSGAsURN,
bGetSecondaryGeometryOption,
hCacheSRS);
}
else
{
poCollection = new OGRGeometryCollection();
poCollection->addGeometryDirectly(poGeom);
poGeom = poCollection;
}
}
if (poCollection != NULL)
{
poCollection->addGeometryDirectly(poSubGeom);
}
}
}
}
if ( poGeom != NULL && bInvertAxisOrderIfLatLong )
{
std::string osWork;
const char* pszSRSName = GML_ExtractSrsNameFromGeometry(papsGeometry, osWork,
bConsiderEPSGAsURN);
const char* pszNameLookup = pszSRSName ? pszSRSName : pszDefaultSRSName;
if (pszNameLookup != NULL)
{
SRSCache* poSRSCache = (SRSCache*)hCacheSRS;
int bSwap;
if (strcmp(poSRSCache->osLastSRSName.c_str(), pszNameLookup) == 0)
{
bSwap = poSRSCache->bAxisInvertLastSRSName;
}
else
{
bSwap = GML_IsSRSLatLongOrder(pszNameLookup);
poSRSCache->osLastSRSName = pszNameLookup;
poSRSCache->bAxisInvertLastSRSName= bSwap;
}
if (bSwap)
poGeom->swapXY();
}
}
return poGeom;
}
示例2: GML_BuildOGRGeometryFromList
OGRGeometry* GML_BuildOGRGeometryFromList(const CPLXMLNode* const * papsGeometry,
int bTryToMakeMultipolygons,
int bInvertAxisOrderIfLatLong,
const char* pszDefaultSRSName,
int bConsiderEPSGAsURN,
int bGetSecondaryGeometryOption,
void* hCacheSRS,
int bFaceHoleNegative)
{
OGRGeometry* poGeom = NULL;
int i;
OGRGeometryCollection* poCollection = NULL;
for(i=0;papsGeometry[i] != NULL;i++)
{
OGRGeometry* poSubGeom = GML2OGRGeometry_XMLNode( papsGeometry[i],
bGetSecondaryGeometryOption,
0, 0, FALSE, TRUE,
bFaceHoleNegative );
if (poSubGeom)
{
if (poGeom == NULL)
poGeom = poSubGeom;
else
{
if (poCollection == NULL)
{
if (bTryToMakeMultipolygons &&
wkbFlatten(poGeom->getGeometryType()) == wkbPolygon &&
wkbFlatten(poSubGeom->getGeometryType()) == wkbPolygon)
{
OGRGeometryCollection* poGeomColl = new OGRMultiPolygon();
poGeomColl->addGeometryDirectly(poGeom);
poGeomColl->addGeometryDirectly(poSubGeom);
poGeom = poGeomColl;
}
else if (bTryToMakeMultipolygons &&
wkbFlatten(poGeom->getGeometryType()) == wkbMultiPolygon &&
wkbFlatten(poSubGeom->getGeometryType()) == wkbPolygon)
{
OGRGeometryCollection* poGeomColl = (OGRGeometryCollection* )poGeom;
poGeomColl->addGeometryDirectly(poSubGeom);
}
else if (bTryToMakeMultipolygons &&
wkbFlatten(poGeom->getGeometryType()) == wkbMultiPolygon &&
wkbFlatten(poSubGeom->getGeometryType()) == wkbMultiPolygon)
{
OGRGeometryCollection* poGeomColl = (OGRGeometryCollection* )poGeom;
OGRGeometryCollection* poGeomColl2 = (OGRGeometryCollection* )poSubGeom;
int nCount = poGeomColl2->getNumGeometries();
int i;
for(i=0;i<nCount;i++)
{
poGeomColl->addGeometry(poGeomColl2->getGeometryRef(i));
}
delete poSubGeom;
}
else if (bTryToMakeMultipolygons &&
wkbFlatten(poGeom->getGeometryType()) == wkbMultiPolygon)
{
delete poGeom;
delete poSubGeom;
return GML_BuildOGRGeometryFromList(papsGeometry, FALSE,
bInvertAxisOrderIfLatLong,
pszDefaultSRSName,
bConsiderEPSGAsURN,
bGetSecondaryGeometryOption,
hCacheSRS);
}
else
{
poCollection = new OGRGeometryCollection();
poCollection->addGeometryDirectly(poGeom);
poGeom = poCollection;
}
}
if (poCollection != NULL)
{
poCollection->addGeometryDirectly(poSubGeom);
}
}
}
}
if( poGeom == NULL )
return NULL;
std::string osWork;
const char* pszSRSName = GML_ExtractSrsNameFromGeometry(papsGeometry, osWork,
bConsiderEPSGAsURN);
const char* pszNameLookup = pszSRSName;
if( pszNameLookup == NULL )
pszNameLookup = pszDefaultSRSName;
if (pszNameLookup != NULL)
{
SRSCache* poSRSCache = (SRSCache*)hCacheSRS;
SRSDesc& oSRSDesc = poSRSCache->Get(pszNameLookup);
poGeom->assignSpatialReference(oSRSDesc.poSRS);
if (oSRSDesc.bAxisInvert && bInvertAxisOrderIfLatLong)
poGeom->swapXY();
//.........这里部分代码省略.........