use of com.revolsys.visitor.CreateListVisitor in project com.revolsys.open by revolsys.
the class EdgeLessThanDistance method getEdges.
public static List<Edge<LineSegment>> getEdges(final Graph<LineSegment> graph, final LineSegment lineSegment, final double maxDistance) {
final CreateListVisitor<Edge<LineSegment>> results = new CreateListVisitor<>();
BoundingBox envelope = lineSegment.getBoundingBox();
envelope = envelope.expand(maxDistance);
final IdObjectIndex<Edge<LineSegment>> edgeIndex = graph.getEdgeIndex();
edgeIndex.forEach(envelope, new EdgeLessThanDistance(lineSegment, maxDistance, results));
return results.getList();
}
use of com.revolsys.visitor.CreateListVisitor in project com.revolsys.open by revolsys.
the class NodeOnEdgeVisitor method getEdges.
public static <T> List<Edge<T>> getEdges(final Graph<T> graph, final Node<T> node, final double maxDistance) {
final CreateListVisitor<Edge<T>> results = new CreateListVisitor<>();
final Point point = node;
BoundingBox boundingBox = point.getBoundingBox();
boundingBox = boundingBox.expand(maxDistance);
final IdObjectIndex<Edge<T>> index = graph.getEdgeIndex();
final NodeOnEdgeVisitor<T> visitor = new NodeOnEdgeVisitor<>(node, boundingBox, maxDistance, results);
index.forEach(boundingBox, visitor);
final List<Edge<T>> edges = results.getList();
Collections.sort(edges);
return edges;
}
use of com.revolsys.visitor.CreateListVisitor in project com.revolsys.open by revolsys.
the class EdgeIntersectLineVisitor method getEdges.
public static <T> List<Edge<T>> getEdges(final Graph<T> graph, final LineString line) {
final CreateListVisitor<Edge<T>> results = new CreateListVisitor<>();
final BoundingBox env = line.getBoundingBox();
final IdObjectIndex<Edge<T>> index = graph.getEdgeIndex();
index.forEach(env, new EdgeIntersectLineVisitor<>(line, results));
return results.getList();
}
Aggregations