Module org.arakhne.afc.gis.giscore
Package org.arakhne.afc.gis.grid
Class MapPolylineGridSet<P extends MapPolyline>
- java.lang.Object
-
- org.arakhne.afc.gis.grid.AbstractGISGridSet<P>
-
- org.arakhne.afc.gis.grid.MapElementGridSet<P>
-
- org.arakhne.afc.gis.grid.MapPolylineGridSet<P>
-
- Type Parameters:
P
- is the type of the user data inside the node.
- All Implemented Interfaces:
Iterable<P>
,Collection<P>
,Set<P>
,GISElementSet<P>
,GISPolylineSet<P>
,GISSet<P>
public class MapPolylineGridSet<P extends MapPolyline> extends MapElementGridSet<P> implements GISPolylineSet<P>
This class describes a grid that contains map polylines 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
-
-
Field Summary
-
Fields inherited from class org.arakhne.afc.gis.grid.AbstractGISGridSet
grid
-
-
Constructor Summary
Constructors Constructor Description MapPolylineGridSet(int nRows, int nColumns, double boundsX, double boundsY, double boundsWidth, double boundsHeight)
Constructor.MapPolylineGridSet(int nRows, int nColumns, Rectangle2d bounds)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(P polyline, double precision, OutputParameter<P> firstNeighbour, OutputParameter<P> secondNeighbour)
Add the selected polyline inside the tree and replies the two nearest polylines that are already inside the tree.P
getNearestEnd(double x, double y)
Replies the object that has the nearest end to the specified point.P
getNearestEnd(Point2D<?,?> position)
Replies the object that has the nearest end to the specified point.-
Methods inherited from class org.arakhne.afc.gis.grid.MapElementGridSet
add, getNearest, getNearest, getNearestData, getNearestData
-
Methods inherited from class org.arakhne.afc.gis.grid.AbstractGISGridSet
addAll, boundsIterator, clear, computeSize, contains, containsAll, extractClassFrom, get, get, get, getBounds, getColumnCount, getElementType, getRowCount, indexOf, isEmpty, isTypeRecomputedAfterRemoval, iterator, iterator, iterator, remove, removeAll, retainAll, setTypeRecomputedAfterRemoval, size, slowContains, toArray, toArray, toIterable, toIterable, updateComponentType, updateComponentType
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface org.arakhne.afc.gis.GISElementSet
getNearest, getNearest, getNearestData, getNearestData
-
Methods inherited from interface org.arakhne.afc.gis.GISSet
boundsIterator, computeSize, get, get, get, getElementType, indexOf, isTypeRecomputedAfterRemoval, iterator, iterator, setTypeRecomputedAfterRemoval, slowContains, toIterable, toIterable
-
-
-
-
Constructor Detail
-
MapPolylineGridSet
public MapPolylineGridSet(int nRows, int nColumns, double boundsX, double boundsY, double boundsWidth, double boundsHeight)
Constructor.- Parameters:
nRows
- numbers of rows in the gridnColumns
- numbers of columns in the gridboundsX
- is the bounds of the scene.boundsY
- is the bounds of the scene.boundsWidth
- is the bounds of the scene.boundsHeight
- is the bounds of the scene.
-
MapPolylineGridSet
public MapPolylineGridSet(int nRows, int nColumns, Rectangle2d bounds)
Constructor.- Parameters:
nRows
- numbers of rows in the gridnColumns
- numbers of columns in the gridbounds
- are the bounds of the scene stored inside this tree.
-
-
Method Detail
-
add
public boolean add(P polyline, double precision, OutputParameter<P> firstNeighbour, OutputParameter<P> secondNeighbour)
Description copied from interface:GISPolylineSet
Add the selected polyline inside the tree and replies the two nearest polylines that are already inside the tree.- Specified by:
add
in interfaceGISPolylineSet<P extends MapPolyline>
- Parameters:
polyline
- is the polyline to addprecision
- is the precision (in meters) used to detect the neighbours.firstNeighbour
- is one of the two nearest polylines that could be connected to the new segment.secondNeighbour
- is one of the two nearest polylines that could be connected to the new segment.- Returns:
true
if successfully added,false
otherwise
-
getNearestEnd
@Pure public final P getNearestEnd(double x, double y)
Description copied from interface:GISPolylineSet
Replies the object that has the nearest end to the specified point.- Specified by:
getNearestEnd
in interfaceGISPolylineSet<P extends MapPolyline>
- 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.
-
getNearestEnd
@Pure public P getNearestEnd(Point2D<?,?> position)
Description copied from interface:GISPolylineSet
Replies the object that has the nearest end to the specified point.- Specified by:
getNearestEnd
in interfaceGISPolylineSet<P extends MapPolyline>
- Parameters:
position
- is the position from which the nearest primitive must be replied.- Returns:
- the nearest element or
null
if none. - See Also:
GISPolylineSet.getNearestEnd(double, double)
-
-