Search in sources :

Example 56 with BoundingBox

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

the class AbstractIdObjectQuadTree method remove.

@Override
public boolean remove(final T object) {
    final BoundingBox envelope = getBoundingBox(object);
    final int id = getId(object);
    return this.index.removeItem(envelope, id);
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 57 with BoundingBox

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

the class PointQuadTree method findEntriesWithinDistance.

public List<Entry<Point, T>> findEntriesWithinDistance(final Point from, final Point to, final double maxDistance) {
    final BoundingBox boundingBox = this.geometryFactory.newBoundingBox(from.getX(), from.getY(), to.getX(), to.getY());
    final List<Entry<Point, T>> entries = new ArrayList<>();
    this.root.findEntriesWithin(entries, boundingBox);
    for (final Iterator<Entry<Point, T>> iterator = entries.iterator(); iterator.hasNext(); ) {
        final Entry<Point, T> entry = iterator.next();
        final Point coordinates = entry.getKey();
        final double distance = LineSegmentUtil.distanceLinePoint(from, to, coordinates);
        if (distance >= maxDistance) {
            iterator.remove();
        }
    }
    return entries;
}
Also used : Entry(java.util.Map.Entry) BoundingBox(com.revolsys.geometry.model.BoundingBox) ArrayList(java.util.ArrayList) Point(com.revolsys.geometry.model.Point)

Example 58 with BoundingBox

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

the class PointQuadTree method forEach.

@Override
public void forEach(final BoundingBoxProxy boundingBoxProxy, final Consumer<? super T> action) {
    if (this.root != null) {
        final BoundingBox boundingBox = boundingBoxProxy.getBoundingBox();
        this.root.forEach(action, boundingBox);
    }
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 59 with BoundingBox

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

the class RecordQuadTree method query.

public void query(final Geometry geometry, final Consumer<R> visitor) {
    final BoundingBox boundingBox = geometry.getBoundingBox();
    forEach(boundingBox, visitor);
}
Also used : BoundingBox(com.revolsys.geometry.model.BoundingBox)

Example 60 with BoundingBox

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

the class RecordQuadTree method addRecord.

public void addRecord(final R record) {
    if (record != null) {
        final Geometry geometry = record.getGeometry();
        if (geometry != null && !geometry.isEmpty()) {
            final BoundingBox boundingBox = geometry.getBoundingBox();
            insertItem(boundingBox, record);
        }
    }
}
Also used : Geometry(com.revolsys.geometry.model.Geometry) 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