Skip to content

Commit

Permalink
All TestBuilder PolygonOverlayFunctions to support linear inputs
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Davis <[email protected]>
  • Loading branch information
dr-jts committed Jun 22, 2021
1 parent d46da5a commit ab2a5b4
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,17 @@ private static Geometry computeOverlay(Geometry g1, Geometry g2, Noder noder)
polygonizer.add(nodedDedupedLinework);
List<Polygon> resultants = (List<Polygon>) polygonizer.getPolygons();

// use PIP to find polygons which have a parent
List<Polygon> polys = ParentFinder.findParents(g1, g2, resultants);
/**
* If the input contained polygons,
* use PIP to find polygons which have a parent.
* Otherwise just return all resultants
* (to support providing just lines as input)
*/
boolean hasPolys = g1.getDimension() >= 2;
List<Polygon> polys = resultants;
if (hasPolys) {
polys = ParentFinder.findParents(g1, g2, resultants);
}

// convert to collection for return
Polygon[] polyArray = GeometryFactory.toPolygonArray(polys);
Expand Down

0 comments on commit ab2a5b4

Please sign in to comment.