* ogrGeomPoints() **********************************************************************/
| 126 | * ogrGeomPoints() |
| 127 | **********************************************************************/ |
| 128 | static int ogrGeomPoints(OGRGeometryH hGeom, shapeObj *outshp) |
| 129 | { |
| 130 | int i; |
| 131 | int numpoints; |
| 132 | |
| 133 | if (hGeom == NULL) |
| 134 | return 0; |
| 135 | |
| 136 | OGRwkbGeometryType eGType = wkbFlatten( OGR_G_GetGeometryType( hGeom ) ); |
| 137 | |
| 138 | /* -------------------------------------------------------------------- */ |
| 139 | /* Container types result in recursive invocation on each */ |
| 140 | /* subobject to add a set of points to the current list. */ |
| 141 | /* -------------------------------------------------------------------- */ |
| 142 | switch( eGType ) |
| 143 | { |
| 144 | case wkbGeometryCollection: |
| 145 | case wkbMultiLineString: |
| 146 | case wkbMultiPolygon: |
| 147 | case wkbPolygon: |
| 148 | { |
| 149 | /* Treat it as GeometryCollection */ |
| 150 | for (int iGeom=0; iGeom < OGR_G_GetGeometryCount( hGeom ); iGeom++ ) |
| 151 | { |
| 152 | if( ogrGeomPoints( OGR_G_GetGeometryRef( hGeom, iGeom ), |
| 153 | outshp ) == -1 ) |
| 154 | return -1; |
| 155 | } |
| 156 | |
| 157 | return 0; |
| 158 | } |
| 159 | break; |
| 160 | |
| 161 | case wkbPoint: |
| 162 | case wkbMultiPoint: |
| 163 | case wkbLineString: |
| 164 | case wkbLinearRing: |
| 165 | /* We will handle these directly */ |
| 166 | break; |
| 167 | |
| 168 | default: |
| 169 | /* There shouldn't be any more cases should there? */ |
| 170 | msSetError(MS_OGRERR, |
| 171 | "OGRGeometry type `%s' not supported yet.", |
| 172 | "ogrGeomPoints()", |
| 173 | OGR_G_GetGeometryName( hGeom ) ); |
| 174 | return(-1); |
| 175 | } |
| 176 | |
| 177 | |
| 178 | /* ------------------------------------------------------------------ |
| 179 | * Count total number of points |
| 180 | * ------------------------------------------------------------------ */ |
| 181 | if ( eGType == wkbPoint ) |
| 182 | { |
| 183 | numpoints = 1; |
| 184 | } |
| 185 | else if ( eGType == wkbLineString |
no test coverage detected