本文整理汇总了C++中OGRMultiPolygon::addGeometry方法的典型用法代码示例。如果您正苦于以下问题:C++ OGRMultiPolygon::addGeometry方法的具体用法?C++ OGRMultiPolygon::addGeometry怎么用?C++ OGRMultiPolygon::addGeometry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OGRMultiPolygon
的用法示例。
在下文中一共展示了OGRMultiPolygon::addGeometry方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getSpatialReference
OGRGeometry *OGRMultiPolygon::clone() const
{
OGRMultiPolygon *poNewGC;
poNewGC = new OGRMultiPolygon;
poNewGC->assignSpatialReference( getSpatialReference() );
for( int i = 0; i < getNumGeometries(); i++ )
{
poNewGC->addGeometry( getGeometryRef(i) );
}
return poNewGC;
}
示例2: extrude_box
OGRMultiPolygon* Building::extrude_box() const
{
OGRMultiPolygon* block = new OGRMultiPolygon;
//extrude roof
OGRPolygon roof;
{
roof.addRing(_footprint->getExteriorRing());
OGRLinearRing* ring = roof.getExteriorRing();
for(int i=0; i<ring->getNumPoints(); i++)
ring->setPoint(i,ring->getX(i),ring->getY(i),_height);
}
if(int n = _footprint->getNumInteriorRings())
{
for (int j=0; j<n; j++)
{
roof.addRing(_footprint->getInteriorRing(j));
OGRLinearRing* ring = roof.getInteriorRing(j);
for(int i=0; i<ring->getNumPoints(); i++)
ring->setPoint(i,ring->getX(i),ring->getY(i),_height);
}
}
block->addGeometry(&roof);
//extrude exter walls
OGRLinearRing* ringEx = _footprint->getExteriorRing();
for(int i=0; i<ringEx->getNumPoints()-1; i++)
{
OGRPolygon wall;
OGRLinearRing ring;
ring.addPoint(ringEx->getX(i),ringEx->getY(i),0);
ring.addPoint(ringEx->getX(i+1),ringEx->getY(i+1),0);
ring.addPoint(ringEx->getX(i+1),ringEx->getY(i+1),_height);
ring.addPoint(ringEx->getX(i),ringEx->getY(i),_height);
ring.addPoint(ringEx->getX(i),ringEx->getY(i),0);
wall.addRing(&ring);
block->addGeometry(&wall);
}
//extrude inner walls if exist
if(int n = _footprint->getNumInteriorRings())
{
for (int i=0; i<n; i++)
{
OGRLinearRing* ringIn = _footprint->getInteriorRing(i);
for(int j=0; j<ringIn->getNumPoints()-1; j++)
{
OGRPolygon wall;
OGRLinearRing ring;
ring.addPoint(ringIn->getX(j),ringIn->getY(j),0);
ring.addPoint(ringIn->getX(j+1),ringIn->getY(j+1),0);
ring.addPoint(ringIn->getX(j+1),ringIn->getY(j+1),_height);
ring.addPoint(ringIn->getX(j),ringIn->getY(j),_height);
ring.addPoint(ringIn->getX(j),ringIn->getY(j),0);
wall.addRing(&ring);
block->addGeometry(&wall);
}
}
}
return block;
}
示例3: ICreateFeature
//.........这里部分代码省略.........
osSQL += OGRCARTODBEscapeLiteral(poFeature->GetFieldAsString(i));
osSQL += "'";
}
else if( (eType == OFTInteger || eType == OFTInteger64) &&
poFeatureDefn->GetFieldDefn(i)->GetSubType() == OFSTBoolean )
{
osSQL += poFeature->GetFieldAsInteger(i) ? "'t'" : "'f'";
}
else
osSQL += poFeature->GetFieldAsString(i);
}
for(i = 0; i < poFeatureDefn->GetGeomFieldCount(); i++)
{
OGRGeometry* poGeom = poFeature->GetGeomFieldRef(i);
if( poGeom == NULL )
continue;
if( bMustComma )
osSQL += ", ";
else
bMustComma = TRUE;
OGRCartoDBGeomFieldDefn* poGeomFieldDefn =
(OGRCartoDBGeomFieldDefn *)poFeatureDefn->GetGeomFieldDefn(i);
int nSRID = poGeomFieldDefn->nSRID;
if( nSRID == 0 )
nSRID = 4326;
char* pszEWKB;
if( wkbFlatten(poGeom->getGeometryType()) == wkbPolygon &&
wkbFlatten(GetGeomType()) == wkbMultiPolygon )
{
OGRMultiPolygon* poNewGeom = new OGRMultiPolygon();
poNewGeom->addGeometry(poGeom);
pszEWKB = OGRGeometryToHexEWKB(poNewGeom, nSRID, FALSE);
delete poNewGeom;
}
else
pszEWKB = OGRGeometryToHexEWKB(poGeom, nSRID, FALSE);
osSQL += "'";
osSQL += pszEWKB;
osSQL += "'";
CPLFree(pszEWKB);
}
if( !bHasUserFieldMatchingFID )
{
if( osFIDColName.size() && nNextFID >= 0 )
{
if( bMustComma )
osSQL += ", ";
else
bMustComma = TRUE;
if( bHasJustGotNextFID )
{
osSQL += CPLSPrintf(CPL_FRMT_GIB, nNextFID);
}
else
{
osSQL += CPLSPrintf("nextval('%s')",
OGRCARTODBEscapeLiteral(CPLSPrintf("%s_%s_seq", osName.c_str(), osFIDColName.c_str())).c_str());
}
poFeature->SetFID(nNextFID);
nNextFID ++;
}