[gdal-dev] OGR can't create PCIDSK polygon file
liminlu0314
liminlu0314 at 163.com
Wed Jan 7 04:55:12 PST 2015
OGR cannot create the PCIDSK polygon vector data, Found in the GDAL library
code is not achieved, I realize part of the code, surface vector data can
create PCIDSK type.
The modified code is as follows[ogrpcidsklayer.cpp file OGRErr
OGRPCIDSKLayer::SetFeature( OGRFeature *poFeature )]:
else if( wkbFlatten(poGeometry->getGeometryType()) == wkbPolygon )
{
OGRPolygon *poPoly = (OGRPolygon *) poGeometry;
int nRingSize = poPoly->getNumInteriorRings();
std::vector<PCIDSK::int32> anRingStart;
anRingStart.resize(nRingSize+1);
OGRLinearRing *poRing = NULL;
poRing = poPoly->getExteriorRing();
anRingStart[0] = poRing->getNumPoints();
aoVertices.resize(poRing->getNumPoints());
for(int i = 0; i < aoVertices.size(); i++ )
{
aoVertices[i].x = poRing->getX(i);
aoVertices[i].y = poRing->getY(i);
aoVertices[i].z = poRing->getZ(i);
}
for (int iRing=0; iRing < nRingSize; iRing++)
{
int nCurrentStart = aoVertices.size();
poRing = poPoly->getInteriorRing(iRing);
anRingStart[iRing+1] = nCurrentStart + poRing->getNumPoints();
aoVertices.resize(nCurrentStart + poRing->getNumPoints());
for(int i = nCurrentStart; i < aoVertices.size(); i++ )
{
aoVertices[i].x = poRing->getX(i-nCurrentStart);
aoVertices[i].y = poRing->getY(i-nCurrentStart);
aoVertices[i].z = poRing->getZ(i-nCurrentStart);
}
}
if(iRingStartField == -1)
{
iRingStartField = poVecSeg->GetFieldCount();
//poVecSeg->AddField( "RingStart", PCIDSK::FieldTypeCountedInt, "", ""
);
OGRFieldDefn oField( "RingStart", OFTIntegerList );
//oField.SetWidth(100);
CreateField( &oField );
}
std::vector<PCIDSK::ShapeField> aoShapeFields;
poVecSeg->GetFields(id, aoShapeFields);
aoShapeFields[iRingStartField].SetValue(anRingStart);
poVecSeg->SetFields( id, aoShapeFields );
}
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/OGR-can-t-create-PCIDSK-polygon-file-tp5180339.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.
More information about the gdal-dev
mailing list