Search in sources :

Example 46 with BoundingBox

use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.

the class EdgeLessThanDistanceToNodeVisitor method edgesWithinDistance.

public static <T> List<Edge<T>> edgesWithinDistance(final Graph<T> graph, final Node<T> node, final double maxDistance) {
    final CreateListVisitor<Edge<T>> results = new CreateListVisitor<>();
    final Point point = node;
    BoundingBox env = point.getBoundingBox();
    env = env.expand(maxDistance);
    graph.getEdgeIndex().forEach(env, new EdgeLessThanDistanceToNodeVisitor<>(node, maxDistance, results));
    return results.getList();
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) CreateListVisitor(com.revolsys.visitor.CreateListVisitor) Point(com.revolsys.geometry.model.Point) Edge(com.revolsys.geometry.graph.Edge)

Example 47 with BoundingBox

use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.

the class NearParallelEdgeVisitor method getEnvelope.

@Override
public BoundingBox getEnvelope() {
    BoundingBox envelope = this.line.getBoundingBox();
    envelope = envelope.expand(this.maxDistance);
    return envelope;
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 48 with BoundingBox

use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.

the class NodeLessThanDistanceOfGeometryVisitor method getNodes.

public static <T> List<Node<T>> getNodes(final Graph<T> graph, final Geometry geometry, final double maxDistance) {
    if (geometry == null) {
        return Collections.emptyList();
    } else {
        final CreateListVisitor<Node<T>> results = new CreateListVisitor<>();
        BoundingBox env = geometry.getBoundingBox();
        env = env.expand(maxDistance);
        final IdObjectIndex<Node<T>> index = graph.getNodeIndex();
        final NodeLessThanDistanceOfGeometryVisitor<T> visitor = new NodeLessThanDistanceOfGeometryVisitor<>(geometry, maxDistance, results);
        index.forEach(env, visitor);
        return results.getList();
    }
}
Also used : Node(com.revolsys.geometry.graph.Node) BoundingBox(com.revolsys.geometry.model.BoundingBox) CreateListVisitor(com.revolsys.visitor.CreateListVisitor)

Example 49 with BoundingBox

use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.

the class OnLineNodeVisitor method getNodes.

public static <T> List<Node<T>> getNodes(final Graph<T> graph, final LineString line, final double maxDistance) {
    if (line == null) {
        return Collections.emptyList();
    } else {
        final CreateListVisitor<Node<T>> results = new CreateListVisitor<>();
        BoundingBox env = line.getBoundingBox();
        env = env.expand(maxDistance);
        final IdObjectIndex<Node<T>> index = graph.getNodeIndex();
        final OnLineNodeVisitor<T> visitor = new OnLineNodeVisitor<>(line, results);
        index.forEach(env, visitor);
        return results.getList();
    }
}
Also used : Node(com.revolsys.geometry.graph.Node) BoundingBox(com.revolsys.geometry.model.BoundingBox) CreateListVisitor(com.revolsys.visitor.CreateListVisitor)

Example 50 with BoundingBox

use of com.revolsys.geometry.model.BoundingBox in project com.revolsys.open by revolsys.

the class LineSegmentIndex method queryIntersections.

public List<Geometry> queryIntersections(final LineSegment querySeg) {
    final BoundingBox env = querySeg.getBoundingBox();
    final LineSegmentIntersectionVisitor visitor = new LineSegmentIntersectionVisitor(querySeg);
    forEach(env, visitor);
    final List<Geometry> intersections = new ArrayList<>(visitor.getIntersections());
    return intersections;
}
Also used : LineSegmentIntersectionVisitor(com.revolsys.geometry.index.visitor.LineSegmentIntersectionVisitor) Geometry(com.revolsys.geometry.model.Geometry) BoundingBox(com.revolsys.geometry.model.BoundingBox) ArrayList(java.util.ArrayList)

Aggregations

BoundingBox (com.revolsys.geometry.model.BoundingBox)307 Point (com.revolsys.geometry.model.Point)83 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)76 ArrayList (java.util.ArrayList)45 Geometry (com.revolsys.geometry.model.Geometry)41 LineString (com.revolsys.geometry.model.LineString)26 List (java.util.List)26 BoundingBoxDoubleXY (com.revolsys.geometry.model.impl.BoundingBoxDoubleXY)19 Polygon (com.revolsys.geometry.model.Polygon)14 PointDoubleXY (com.revolsys.geometry.model.impl.PointDoubleXY)14 Project (com.revolsys.swing.map.layer.Project)14 CreateListVisitor (com.revolsys.visitor.CreateListVisitor)12 CoordinateSystem (com.revolsys.geometry.cs.CoordinateSystem)11 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)11 Edge (com.revolsys.geometry.graph.Edge)10 HashMap (java.util.HashMap)10 Record (com.revolsys.record.Record)9 Graphics2D (java.awt.Graphics2D)9 MapEx (com.revolsys.collection.map.MapEx)8 LinearRing (com.revolsys.geometry.model.LinearRing)8