MCPcopy Index your code
hub / github.com/MapServer/MapServer / msIntersectPolygons

Function msIntersectPolygons

mapsearch.c:280–305  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

278}
279
280int msIntersectPolygons(shapeObj *p1, shapeObj *p2) {
281 int i;
282
283 /* STEP 1: polygon 1 completely contains 2 (only need to check one point from each part) */
284 for(i=0; i<p2->numlines; i++) {
285 if(msIntersectPointPolygon(&(p2->line[i].point[0]), p1) == MS_TRUE) /* this considers holes and multiple parts */
286 return(MS_TRUE);
287 }
288
289 /* STEP 2: polygon 2 completely contains 1 (only need to check one point from each part) */
290 for(i=0; i<p1->numlines; i++) {
291 if(msIntersectPointPolygon(&(p1->line[i].point[0]), p2) == MS_TRUE) /* this considers holes and multiple parts */
292 return(MS_TRUE);
293 }
294
295 /* STEP 3: look for intersecting line segments */
296 if (msIntersectPolylines(p1, p2) == MS_TRUE)
297 return(MS_TRUE);
298
299 /*
300 ** At this point we know there are are no intersections between edges. There may be other tests necessary
301 ** but I haven't run into any cases that require them.
302 */
303
304 return(MS_FALSE);
305}
306
307
308/*

Callers 5

msQueryByRectFunction · 0.85
msQueryByFeaturesFunction · 0.85
msQueryByShapeFunction · 0.85
msGEOSIntersectsFunction · 0.85
shapeObj_intersectsFunction · 0.85

Calls 2

msIntersectPointPolygonFunction · 0.85
msIntersectPolylinesFunction · 0.85

Tested by

no test coverage detected