Search in sources :

Example 51 with BoundingBox

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

the class LineSegmentIndex method isWithinDistance.

public boolean isWithinDistance(final Point point) {
    BoundingBox envelope = point.getBoundingBox();
    envelope = envelope.expand(1);
    final List<LineSegment> lines = getItems(envelope);
    for (final LineSegment line : lines) {
        if (line.distancePoint(point) <= 1) {
            return true;
        }
    }
    return false;
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox) LineSegment(com.revolsys.geometry.model.segment.LineSegment)

Example 52 with BoundingBox

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

the class SpatialIndex method forEach.

default boolean forEach(final BoundingBoxProxy boundingBoxProxy, final Predicate<? super V> filter, final Consumer<? super V> action) {
    final BoundingBox boundingBox = convertBoundingBox(boundingBoxProxy);
    final double minX = boundingBox.getMinX();
    final double minY = boundingBox.getMinY();
    final double maxX = boundingBox.getMaxX();
    final double maxY = boundingBox.getMaxY();
    return forEach(minX, minY, maxX, maxY, filter, action);
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 53 with BoundingBox

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

the class SpatialIndex method forEach.

default boolean forEach(final BoundingBoxProxy boundingBoxProxy, final Consumer<? super V> action) {
    final BoundingBox boundingBox = convertBoundingBox(boundingBoxProxy);
    final double minX = boundingBox.getMinX();
    final double minY = boundingBox.getMinY();
    final double maxX = boundingBox.getMaxX();
    final double maxY = boundingBox.getMaxY();
    return forEach(minX, minY, maxX, maxY, action);
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 54 with BoundingBox

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

the class SpatialIndex method insertItem.

default void insertItem(final BoundingBoxProxy boundingBoxProxy, final V item) {
    final BoundingBox boundingBox = boundingBoxProxy.getBoundingBox();
    insertItem(boundingBox, item);
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 55 with BoundingBox

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

the class AbstractIdObjectPointQuadTree method forEach.

@Override
public void forEach(final BoundingBoxProxy boundingBoxProxy, final Predicate<? super T> filter, final Consumer<? super T> action) {
    final BoundingBox boundingBox = boundingBoxProxy.getBoundingBox();
    this.index.forEach(boundingBox, (id) -> {
        final T object = getObject(id);
        final BoundingBox e = getBoundingBox(object);
        if (e.intersects(boundingBox) && filter.test(object)) {
            action.accept(object);
        }
    });
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox)

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