Interface GISElementSet<P extends MapElement>
-
- Type Parameters:
P
- is the type of the user data inside the node.
- All Superinterfaces:
Collection<P>
,GISSet<P>
,Iterable<P>
,Set<P>
- All Known Subinterfaces:
GISPolylineSet<P>
- All Known Implementing Classes:
MapElementGridSet
,MapElementTreeSet
,MapPolylineGridSet
,MapPolylineTreeSet
public interface GISElementSet<P extends MapElement> extends GISSet<P>
This interface describes a set that contains GIS primitives and that permits to find them according to there geo-location.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- See Also:
GISPrimitive
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description P
getNearest(double x, double y)
Replies the nearest object from the specified point.P
getNearest(Point2D<?,?> position)
Replies the nearest object from the specified point.org.eclipse.xtext.xbase.lib.Pair<P,Double>
getNearestData(double x, double y)
Replies the nearest object from the specified point, and its distance to the point.org.eclipse.xtext.xbase.lib.Pair<P,Double>
getNearestData(Point2D<?,?> position)
Replies the nearest object from the specified point, and its distance to the point.-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.arakhne.afc.gis.GISSet
boundsIterator, computeSize, get, get, get, getElementType, indexOf, isTypeRecomputedAfterRemoval, iterator, iterator, setTypeRecomputedAfterRemoval, slowContains, toIterable, toIterable
-
-
-
-
Method Detail
-
getNearest
P getNearest(Point2D<?,?> position)
Replies the nearest object from the specified point.- Parameters:
position
- is the position from which the nearest primitive must be replied.- Returns:
- the nearest element or
null
if none. - See Also:
getNearestData(Point2D)
-
getNearest
P getNearest(double x, double y)
Replies the nearest object from the specified point.- Parameters:
x
- is the position from which the nearest primitive must be replied.y
- is the position from which the nearest primitive must be replied.- Returns:
- the nearest element or
null
if none. - See Also:
getNearestData(double, double)
-
getNearestData
org.eclipse.xtext.xbase.lib.Pair<P,Double> getNearestData(Point2D<?,?> position)
Replies the nearest object from the specified point, and its distance to the point.- Parameters:
position
- is the position from which the nearest primitive must be replied.- Returns:
- the nearest element and its distance to the given coordinates;
or
null
if none. - See Also:
getNearest(Point2D)
-
getNearestData
org.eclipse.xtext.xbase.lib.Pair<P,Double> getNearestData(double x, double y)
Replies the nearest object from the specified point, and its distance to the point.The nearest neighbor (NN) algorithm, to find the NN to a given target point not in the tree, relies on the ability to discard large portions of the tree by performing a simple test. To perform the NN calculation, the tree is searched in a depth-first fashion, refining the nearest distance. First the root node is examined with an initial assumption that the smallest distance to the next point is infinite. The subdomain (right or left), which is a hyperrectangle, containing the target point is searched. This is done recursively until a final minimum region containing the node is found. The algorithm then (through recursion) examines each parent node, seeing if it is possible for the other domain to contain a point that is closer. This is performed by testing for the possibility of intersection between the hyperrectangle and the hypersphere (formed by target node and current minimum radius). If the rectangle that has not been recursively examined yet does not intersect this sphere, then there is no way that the rectangle can contain a point that is a better nearest neighbour. This is repeated until all domains are either searched or discarded, thus leaving the nearest neighbour as the final result. In addition to this one also has the distance to the nearest neighbour on hand as well. Finding the nearest point is an O(logN) operation.
- Parameters:
x
- is the position from which the nearest primitive must be replied.y
- is the position from which the nearest primitive must be replied.- Returns:
- the nearest element and its distance to the given coordinates;
or
null
if none. - See Also:
getNearest(double, double)
-
-