hasSelfIntersections property
bool
get
hasSelfIntersections
Returns whether or not the MultiPolygon overlaps itself.
Example:
MultiPolygon([
[
LinearRing([Coordinate(1, 2), Coordinate(3, 4), Coordinate(5, 6), Coordinate(1, 2)])
],
[
LinearRing([Coordinate(7, 8), Coordinate(9, 10), Coordinate(11, 12), Coordinate(7, 8)])
]
]).hasSelfIntersections; // false
Implementation
bool get hasSelfIntersections {
for (int i = 0; i < coordinates.length; i++) {
for (int j = i + 1; j < coordinates.length; j++) {
if (Polygon(coordinates[i]).intersects(Polygon(coordinates[j]))) {
return true;
}
}
}
return false;
}