Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class FastPolygonOperations implements Serializable {
private final double envWidth;
private final double envHeight;

private final GeometryFactory gf = new GeometryFactory();

/**
* Constructor using a given geometry {@code geom} and geometry type {@code P}.
*
Expand All @@ -50,8 +52,6 @@ public <P extends Geometry & Polygonal> FastPolygonOperations(P geom) {
envWidth = env.getMaxX() - env.getMinX();
envHeight = env.getMaxY() - env.getMinY();

GeometryFactory gf = new GeometryFactory();

Geometry[] result = new Geometry[numBands * numBands];
traverseQuads(bandIterations, 0, 0, env, geom, gf, result);

Expand Down Expand Up @@ -184,10 +184,15 @@ public Geometry intersection(Geometry other) {
}

assert intersector != null;
Geometry result;
if (other instanceof GeometryCollection) {
return other.intersection(intersector);
result = other.intersection(intersector);
} else {
return intersector.intersection(other);
result = intersector.intersection(other);
}
if (result.getDimension() != other.getDimension()) {
return gf.createEmpty(other.getDimension());
}
return result;
}
}