MCPcopy Create free account
hub / github.com/MapServer/MapServer / msGEOSShape2Geometry

Function msGEOSShape2Geometry

mapgeos.c:247–282  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245}
246
247GEOSGeom msGEOSShape2Geometry(shapeObj *shape)
248{
249 if(!shape)
250 return NULL; /* a NULL shape generates a NULL geometry */
251
252 switch(shape->type) {
253 case MS_SHAPE_POINT:
254 if(shape->numlines == 0 || shape->line[0].numpoints == 0) /* not enough info for a point */
255 return NULL;
256
257 if(shape->line[0].numpoints == 1) /* simple point */
258 return msGEOSShape2Geometry_point(&(shape->line[0].point[0]));
259 else /* multi-point */
260 return msGEOSShape2Geometry_multipoint(&(shape->line[0]));
261 break;
262 case MS_SHAPE_LINE:
263 if(shape->numlines == 0 || shape->line[0].numpoints < 2) /* not enough info for a line */
264 return NULL;
265
266 if(shape->numlines == 1) /* simple line */
267 return msGEOSShape2Geometry_line(&(shape->line[0]));
268 else /* multi-line */
269 return msGEOSShape2Geometry_multiline(shape);
270 break;
271 case MS_SHAPE_POLYGON:
272 if(shape->numlines == 0 || shape->line[0].numpoints < 4) /* not enough info for a polygon (first=last) */
273 return NULL;
274
275 return msGEOSShape2Geometry_polygon(shape); /* simple and multipolygon cases are addressed */
276 break;
277 default:
278 break;
279 }
280
281 return NULL; /* should not get here */
282}
283
284static shapeObj *msGEOSGeometry2Shape_point(GEOSGeom g)
285{

Callers 15

msGEOSShapeToWKTFunction · 0.85
msGEOSBufferFunction · 0.85
msGEOSSimplifyFunction · 0.85
msGEOSConvexHullFunction · 0.85
msGEOSBoundaryFunction · 0.85
msGEOSGetCentroidFunction · 0.85
msGEOSUnionFunction · 0.85
msGEOSIntersectionFunction · 0.85
msGEOSDifferenceFunction · 0.85
msGEOSSymDifferenceFunction · 0.85
msGEOSContainsFunction · 0.85

Tested by

no test coverage detected