use of com.revolsys.geometry.index.IdObjectIndex in project com.revolsys.open by revolsys.
the class Graph method getNodes.
/**
* Find the nodes <= the distance of the specified geometry.
*
* @param geometry The geometry.
* @param maxDistance The maximum distance.
* @return The list of nodes.
*/
public List<Node<T>> getNodes(final Geometry geometry, final double maxDistance) {
BoundingBox boundingBox = geometry.getBoundingBox();
boundingBox = boundingBox.expand(maxDistance);
final IdObjectIndex<Node<T>> nodeIndex = getNodeIndex();
final Predicate<? super Node<T>> filter = (node) -> {
final double distance = geometry.distancePoint(node);
return distance <= maxDistance;
};
return BoundingBox.newArraySorted(nodeIndex::forEach, boundingBox, filter);
}
Aggregations