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

Function msIsOuterRing

mapprimitive.c:221–248  ·  view source on GitHub ↗

checks to see if ring r is an outer ring of shape */

Source from the content-addressed store, hash-verified

219
220/* checks to see if ring r is an outer ring of shape */
221int msIsOuterRing(shapeObj *shape, int r)
222{
223 int i, status=MS_TRUE;
224 int result1, result2;
225
226 if(shape->numlines == 1) return(MS_TRUE);
227
228 for(i=0; i<shape->numlines; i++) {
229 if(i == r) continue;
230
231 /*
232 ** We have to test 2, or perhaps 3 points on the shape against the ring because
233 ** it is possible that at most one point could touch the ring and the function
234 ** msPointInPolygon() is indeterminite in that case. (bug #2434)
235 */
236 result1 = msPointInPolygon(&(shape->line[r].point[0]), &(shape->line[i]));
237 result2 = msPointInPolygon(&(shape->line[r].point[1]), &(shape->line[i]));
238 if(result1 == result2) { /* same result twice, neither point was on the edge */
239 if(result1 == MS_TRUE) status = !status;
240 } else { /* one of the first 2 points were on the edge of the ring, the next one isn't */
241 if(msPointInPolygon(&(shape->line[r].point[2]), &(shape->line[i])) == MS_TRUE)
242 status = !status;
243 }
244
245 }
246
247 return(status);
248}
249
250/*
251** Returns a list of outer rings for shape (the list has one entry for each ring,

Callers 2

msGetOuterListFunction · 0.85
msGetPolygonAreaFunction · 0.85

Calls 1

msPointInPolygonFunction · 0.85

Tested by

no test coverage detected