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

Function msGEOSContains

mapgeos.c:911–936  ·  view source on GitHub ↗

** Does shape1 contain shape2, returns MS_TRUE/MS_FALSE or -1 for an error. */

Source from the content-addressed store, hash-verified

909** Does shape1 contain shape2, returns MS_TRUE/MS_FALSE or -1 for an error.
910*/
911int msGEOSContains(shapeObj *shape1, shapeObj *shape2)
912{
913#ifdef USE_GEOS
914 GEOSGeom g1, g2;
915 int result;
916
917 if(!shape1 || !shape2)
918 return -1;
919
920 if(!shape1->geometry) /* if no geometry for shape1 then build one */
921 shape1->geometry = (GEOSGeom) msGEOSShape2Geometry(shape1);
922 g1 = shape1->geometry;
923 if(!g1) return -1;
924
925 if(!shape2->geometry) /* if no geometry for shape2 then build one */
926 shape2->geometry = (GEOSGeom) msGEOSShape2Geometry(shape2);
927 g2 = shape2->geometry;
928 if(!g2) return -1;
929
930 result = GEOSContains(g1, g2);
931 return ((result==2) ? -1 : result);
932#else
933 msSetError(MS_GEOSERR, "GEOS support is not available.", "msGEOSContains()");
934 return -1;
935#endif
936}
937
938/*
939** Does shape1 overlap shape2, returns MS_TRUE/MS_FALSE or -1 for an error.

Callers 2

yyparseFunction · 0.85
shapeObj_contains_geosFunction · 0.85

Calls 2

msGEOSShape2GeometryFunction · 0.85
msSetErrorFunction · 0.85

Tested by

no test coverage detected