use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.
the class ProjectedCoordinateSystem method getAreaBoundingBox.
@Override
public BoundingBox getAreaBoundingBox() {
if (this.areaBoundingBox == null) {
final GeometryFactory geographicGeometryFactory = this.geographicCoordinateSystem.getGeometryFactory();
BoundingBox boundingBox;
if (this.area == null) {
boundingBox = geographicGeometryFactory.newBoundingBox(-180, -90, 180, 90);
} else {
final BoundingBox latLonBounds = this.area.getLatLonBounds();
boundingBox = latLonBounds.convert(geographicGeometryFactory);
}
final GeometryFactory geometryFactory = getGeometryFactory();
this.areaBoundingBox = boundingBox.convert(geometryFactory);
}
return this.areaBoundingBox;
}
use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.
the class MCPointInRing method isInside.
@Override
public boolean isInside(final Point pt) {
this.crossings = 0;
// test all segments intersected by ray from pt in positive x direction
final double y = pt.getY();
final BoundingBox rayEnv = new BoundingBoxDoubleXY(-Double.MAX_VALUE, y, Double.MAX_VALUE, y);
this.interval.min = y;
this.interval.max = y;
final List segs = this.tree.query(this.interval);
// System.out.println("query size = " + segs.size());
final MCSelecter mcSelecter = new MCSelecter(pt);
for (final Iterator i = segs.iterator(); i.hasNext(); ) {
final MonotoneChain mc = (MonotoneChain) i.next();
testMonotoneChain(rayEnv, mcSelecter, mc);
}
/*
* p is inside if number of crossings is odd.
*/
if (this.crossings % 2 == 1) {
return true;
}
return false;
}
use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.
the class BoundingBoxIntersectsEdgeVisitor method getEdges.
public static <T> List<Edge<T>> getEdges(final Graph<T> graph, final Edge<T> edge, final double maxDistance) {
final CreateListVisitor<Edge<T>> results = new CreateListVisitor<>();
final LineString line = edge.getLineString();
BoundingBox boundingBox = line.getBoundingBox();
boundingBox = boundingBox.expand(maxDistance);
final BoundingBoxIntersectsEdgeVisitor<T> visitor = new BoundingBoxIntersectsEdgeVisitor<>(boundingBox, results);
final IdObjectIndex<Edge<T>> index = graph.getEdgeIndex();
index.forEach(boundingBox, visitor);
final List<Edge<T>> list = results.getList();
list.remove(edge);
return list;
}
use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.
the class EdgeIntersectsLinearlyEdgeVisitor method accept.
@Override
public void accept(final Edge<T> edge2) {
if (edge2 != this.edge) {
final LineString line1 = this.edge.getLineString();
final LineString line2 = edge2.getLineString();
final BoundingBox envelope1 = line1.getBoundingBox();
final BoundingBox envelope2 = line2.getBoundingBox();
if (envelope1.intersects(envelope2)) {
final IntersectionMatrix relate = line1.relate(line2);
if (relate.get(0, 0) == Dimension.L) {
this.matchVisitor.accept(edge2);
}
}
}
}
use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.
the class EdgeIntersectsLinearlyEdgeVisitor method getEdges.
public static <T> List<Edge<T>> getEdges(final Graph<T> graph, final Edge<T> edge) {
final CreateListVisitor<Edge<T>> results = new CreateListVisitor<>();
final LineString line = edge.getLineString();
final BoundingBox env = line.getBoundingBox();
final IdObjectIndex<Edge<T>> index = graph.getEdgeIndex();
index.forEach(env, new EdgeIntersectsLinearlyEdgeVisitor<>(edge, results));
final List<Edge<T>> edges = results.getList();
Collections.sort(edges);
return edges;
}
Aggregations