Skip to content

Commit

Permalink
Fix PolygonOverlayFunctions to support MultiPolygons
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Davis <mtnclimb@gmail.com>
  • Loading branch information
dr-jts authored and fangyuzhong2016 committed Sep 12, 2021
1 parent 46e4635 commit 7009252
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.Point;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.geom.Polygonal;
import org.locationtech.jts.geom.PrecisionModel;
import org.locationtech.jts.geom.util.LinearComponentExtracter;
import org.locationtech.jts.index.strtree.STRtree;
Expand Down Expand Up @@ -175,7 +176,7 @@ public void addSourcePolygons(Geometry source) {
if (source == null || source.getDimension() < 2) return;
for (int i = 0; i < source.getNumGeometries(); i++) {
Geometry geom = source.getGeometryN(i);
if (geom instanceof Polygon) {
if (geom instanceof Polygonal) {
sourceIndex.insert(geom.getEnvelopeInternal(), geom);
}
}
Expand All @@ -187,8 +188,8 @@ public List<Polygon> findParents(List<Polygon> resultants) {
Point intPt = res.getInteriorPoint();
Coordinate intCoord = intPt.getCoordinate();

List<Polygon> candidates = sourceIndex.query(intPt.getEnvelopeInternal());
for (Polygon cand : candidates) {
List<Geometry> candidates = sourceIndex.query(intPt.getEnvelopeInternal());
for (Geometry cand : candidates) {

boolean isParent = SimplePointInAreaLocator.isContained(intCoord, cand);
if (isParent) {
Expand Down

0 comments on commit 7009252

Please sign in to comment.