- java.lang.Object
-
- org.arakhne.afc.math.graph.GraphPath<RoadPath,RoadSegment,RoadConnection>
-
- org.arakhne.afc.gis.road.path.RoadPath
-
- All Implemented Interfaces:
Cloneable
,Iterable<RoadSegment>
,Collection<RoadSegment>
,List<RoadSegment>
,GraphSegmentList<RoadSegment,RoadConnection>
public class RoadPath extends GraphPath<RoadPath,RoadSegment,RoadConnection>
This class describes a path inside a road network. A RoadPath is composed of a sequence of connected RoadSegments. Consequently, if you try to add a RoadSegment not connected to the first or to the last segment in the RoadPath, then is will be rejected.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:55
- Author:
- Stéphane GALLAND
- See Also:
ClusteredRoadPath
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisroad
-
-
Constructor Summary
Constructors Modifier Constructor Description RoadPath()
Constructor.protected
RoadPath(List<RoadSegment> original)
Constructor of road path that is backed to the given list.RoadPath(RoadPath path)
Constructor.RoadPath(RoadSegment segment)
Constructor.RoadPath(RoadSegment segment, RoadConnection starting_point)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static boolean
addPathToPath(RoadPath inside, RoadPath elements)
Add the elements stored inside a road path into a road path.Iterator<CrossRoad>
crossRoads()
Replies an iterator on the junction points in this path.RoadSegment
getConnectableSegmentToFirstPoint(RoadPath path)
Replies if the road segment of path (the first or the last in this order) that could be connected to the first point of the current path.RoadSegment
getConnectableSegmentToLastPoint(RoadPath path)
Replies if the road segment of path (the first or the last in this order) that could be connected to the last point of the current path.RoadConnection
getFirstCrossRoad()
Replies the first cross-road point in the path.CrossRoad
getFirstJunctionPoint()
Replies the first cul-de-sac or cross-road point in the path.Direction1D
getSegmentDirectionAt(int index)
Replies the direction of this path on the road segment at the given index.boolean
isConnectableTo(RoadPath path)
Replies if the given road path is connectable to this road path.boolean
isCulDeSacWay()
Replies if the last segment in this path is a real cul-de-sac.boolean
isFirstPointConnectableTo(RoadPath path)
Replies if the given road path is connectable to the first point of this road path.boolean
isLastPointConnectableTo(RoadPath path)
Replies if the given road path is connectable to the last point of this road path.static RoadPath
of(List<RoadSegment> original)
Create a road path that is backed to the given list.Object[]
toArray()
-
Methods inherited from class org.arakhne.afc.math.graph.GraphPath
add, add, add, addAll, addAll, clear, clone, contains, containsAll, get, getAntepenulvianSegment, getFirstPoint, getFirstSegment, getLastPoint, getLastSegment, getLength, getSecondSegment, getStartingPointFor, indexOf, invert, isEmpty, isFirstSegmentReversable, iterator, lastIndexOf, listIterator, listIterator, pointIterator, points, remove, remove, removeAfter, removeAfter, removeAfterLast, removeAfterLast, removeAll, removeBefore, removeBefore, removeBeforeLast, removeBeforeLast, removeFrom, removeFrom, removeFromLast, removeFromLast, removeUntil, removeUntil, removeUntilLast, removeUntilLast, retainAll, set, setFirstSegmentReversable, size, splitAfter, splitAfter, splitAfterLast, splitAfterLast, splitAt, splitAt, splitAt, splitAtLast, splitAtLast, subList, toArray, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
equals, hashCode, replaceAll, sort, spliterator
-
-
-
-
Constructor Detail
-
RoadPath
protected RoadPath(List<RoadSegment> original)
Constructor of road path that is backed to the given list.- Parameters:
original
- the list to be the backend.- Since:
- 16.0
-
RoadPath
public RoadPath()
Constructor.
-
RoadPath
public RoadPath(RoadSegment segment)
Constructor.- Parameters:
segment
- is the segment from which to start.- Since:
- 4.0
-
RoadPath
public RoadPath(RoadSegment segment, RoadConnection starting_point)
Constructor.- Parameters:
segment
- is the segment from which to start.starting_point
- is the segment's point indicating the direction.
-
RoadPath
public RoadPath(RoadPath path)
Constructor.- Parameters:
path
- is the path to copy.- Since:
- 4.0
-
-
Method Detail
-
addPathToPath
public static boolean addPathToPath(RoadPath inside, RoadPath elements)
Add the elements stored inside a road path into a road path. This function takes care about the two ends to the path to insert into.- Parameters:
inside
- is the path to change.elements
- are the elements to insert.- Returns:
true
if all the elements were added; otherwisefalse
.- Since:
- 4.0
-
of
public static RoadPath of(List<RoadSegment> original)
Create a road path that is backed to the given list.- Parameters:
original
- the backend list.- Returns:
- the road path.
- Since:
- 16.0
-
toArray
@Pure public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<RoadSegment>
- Specified by:
toArray
in interfaceList<RoadSegment>
- Overrides:
toArray
in classGraphPath<RoadPath,RoadSegment,RoadConnection>
-
getSegmentDirectionAt
@Pure public Direction1D getSegmentDirectionAt(int index)
Replies the direction of this path on the road segment at the given index.- Parameters:
index
- is the index of the road segment.- Returns:
- the direction of the segment at the given index for this path.
- Since:
- 4.0
-
isConnectableTo
@Pure public boolean isConnectableTo(RoadPath path)
Replies if the given road path is connectable to this road path.- Parameters:
path
- a path.- Returns:
true
if the given road path is connectable; otherwisefalse
.- Since:
- 4.0
- See Also:
isFirstPointConnectableTo(RoadPath)
,isLastPointConnectableTo(RoadPath)
-
getConnectableSegmentToFirstPoint
@Pure public RoadSegment getConnectableSegmentToFirstPoint(RoadPath path)
Replies if the road segment of path (the first or the last in this order) that could be connected to the first point of the current path.- Parameters:
path
- is the path from which a road segment should be read.- Returns:
- the connectable segment from the path; or
null
if no connection is possible. - Since:
- 4.0
-
getConnectableSegmentToLastPoint
@Pure public RoadSegment getConnectableSegmentToLastPoint(RoadPath path)
Replies if the road segment of path (the first or the last in this order) that could be connected to the last point of the current path.- Parameters:
path
- is the path from which a road segment should be read.- Returns:
- the connectable segment from the path; or
null
if no connection is possible. - Since:
- 4.0
-
isFirstPointConnectableTo
@Pure public boolean isFirstPointConnectableTo(RoadPath path)
Replies if the given road path is connectable to the first point of this road path.- Parameters:
path
- a path- Returns:
true
if the given road path is connectable; otherwisefalse
.- Since:
- 4.0
- See Also:
isConnectableTo(RoadPath)
,isLastPointConnectableTo(RoadPath)
-
isLastPointConnectableTo
@Pure public boolean isLastPointConnectableTo(RoadPath path)
Replies if the given road path is connectable to the last point of this road path.- Parameters:
path
- a path.- Returns:
true
if the given road path is connectable; otherwisefalse
.- Since:
- 4.0
- See Also:
isConnectableTo(RoadPath)
,isFirstPointConnectableTo(RoadPath)
-
isCulDeSacWay
@Pure public boolean isCulDeSacWay()
Replies if the last segment in this path is a real cul-de-sac.This function is based on
RoadConnection.isReallyCulDeSac()
which permits to identify the cul-de-sac ways.- Returns:
true
if the last ponit in this path was marked as cul-de-sac, otherwisefalse
.- See Also:
RoadConnection.isReallyCulDeSac()
-
getFirstCrossRoad
@Pure public RoadConnection getFirstCrossRoad()
Replies the first cross-road point in the path.- Returns:
- the cross-road point or
null
if none.
-
getFirstJunctionPoint
@Pure public CrossRoad getFirstJunctionPoint()
Replies the first cul-de-sac or cross-road point in the path.- Returns:
- the cul-de-sac/cross-road point or
null
if none.
-
-