8 | | else if( wkbFlatten(poGeometry->getGeometryType()) == wkbPolygon ) |
9 | | { |
10 | | OGRPolygon *poPoly = (OGRPolygon *) poGeometry; |
11 | | int nRingSize = poPoly->getNumInteriorRings(); |
12 | | |
13 | | std::vector<PCIDSK::int32> anRingStart; |
14 | | anRingStart.resize(nRingSize+1); |
15 | | |
16 | | OGRLinearRing *poRing = NULL; |
17 | | poRing = poPoly->getExteriorRing(); |
18 | | anRingStart[0] = poRing->getNumPoints(); |
19 | | |
20 | | aoVertices.resize(poRing->getNumPoints()); |
21 | | for(int i = 0; i < aoVertices.size(); i++ ) |
22 | | { |
23 | | aoVertices[i].x = poRing->getX(i); |
24 | | aoVertices[i].y = poRing->getY(i); |
25 | | aoVertices[i].z = poRing->getZ(i); |
26 | | } |
| 8 | else if( wkbFlatten(poGeometry->getGeometryType()) == wkbPolygon ) |
| 9 | { |
| 10 | OGRPolygon *poPoly = (OGRPolygon *) poGeometry; |
| 11 | OGRLinearRing *poRing = NULL; |
| 12 | poRing = poPoly->getExteriorRing(); |
| 13 | |
| 14 | aoVertices.resize(poRing->getNumPoints()); |
| 15 | for(int i = 0; i < aoVertices.size(); i++ ) |
| 16 | { |
| 17 | aoVertices[i].x = poRing->getX(i); |
| 18 | aoVertices[i].y = poRing->getY(i); |
| 19 | aoVertices[i].z = poRing->getZ(i); |
| 20 | } |
28 | | for (int iRing=0; iRing < nRingSize; iRing++) |
29 | | { |
30 | | int nCurrentStart = aoVertices.size(); |
31 | | poRing = poPoly->getInteriorRing(iRing); |
32 | | anRingStart[iRing+1] = nCurrentStart + poRing->getNumPoints(); |
33 | | aoVertices.resize(nCurrentStart + poRing->getNumPoints()); |
| 22 | int nRingSize = poPoly->getNumInteriorRings(); |
| 23 | if(nRingSize > 0 ) |
| 24 | { |
| 25 | std::vector<PCIDSK::int32> anRingStart; |
| 26 | anRingStart.resize(nRingSize+1); |
| 27 | anRingStart[0] = poRing->getNumPoints(); |
35 | | for(int i = nCurrentStart; i < aoVertices.size(); i++ ) |
36 | | { |
37 | | aoVertices[i].x = poRing->getX(i-nCurrentStart); |
38 | | aoVertices[i].y = poRing->getY(i-nCurrentStart); |
39 | | aoVertices[i].z = poRing->getZ(i-nCurrentStart); |
40 | | } |
41 | | } |
42 | | |
43 | | if(iRingStartField == -1) |
44 | | { |
45 | | iRingStartField = poVecSeg->GetFieldCount(); |
46 | | OGRFieldDefn oField( "RingStart", OFTIntegerList ); |
47 | | CreateField( &oField ); |
48 | | } |
| 29 | for (int iRing=0; iRing < nRingSize; iRing++) |
| 30 | { |
| 31 | int nCurrentStart = aoVertices.size(); |
| 32 | poRing = poPoly->getInteriorRing(iRing); |
| 33 | anRingStart[iRing+1] = nCurrentStart + poRing->getNumPoints(); |
| 34 | aoVertices.resize(nCurrentStart + poRing->getNumPoints()); |
50 | | std::vector<PCIDSK::ShapeField> aoShapeFields; |
51 | | poVecSeg->GetFields(id, aoShapeFields); |
| 36 | for(int i = nCurrentStart; i < aoVertices.size(); i++ ) |
| 37 | { |
| 38 | aoVertices[i].x = poRing->getX(i-nCurrentStart); |
| 39 | aoVertices[i].y = poRing->getY(i-nCurrentStart); |
| 40 | aoVertices[i].z = poRing->getZ(i-nCurrentStart); |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | if(iRingStartField == -1) |
| 45 | { |
| 46 | iRingStartField = poVecSeg->GetFieldCount(); |
| 47 | OGRFieldDefn oField( "RingStart", OFTIntegerList ); |
| 48 | CreateField( &oField ); |
| 49 | } |