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);
}
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;
}
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);
}
}
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);
}
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);
}
}
}
Aggregations