- java.lang.Object
-
- org.arakhne.afc.math.graph.SubGraph<RoadSegment,RoadConnection,RoadPath>
-
- org.arakhne.afc.gis.road.SubRoadNetwork
-
- All Implemented Interfaces:
Iterable<RoadSegment>,RoadSegmentContainer,Graph<RoadSegment,RoadConnection>
public class SubRoadNetwork extends SubGraph<RoadSegment,RoadConnection,RoadPath> implements RoadSegmentContainer
This class describes a road network sub graph.This function wrap the segments and the connection points to avoid to go thru the rest of the graph.
- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:55
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisroad
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) classSubRoadNetwork.AbstractWrapConnectionInternal connection.(package private) classSubRoadNetwork.TerminalConnectionInternal connection.(package private) classSubRoadNetwork.WrapConnectionInternal connection.(package private) classSubRoadNetwork.WrapGraphPointConnectionInternal graph point connection.(package private) classSubRoadNetwork.WrapSegmentInternal segment wrapper.(package private) classSubRoadNetwork.WrapSegmentIterableInternal iterator.(package private) classSubRoadNetwork.WrapSegmentIteratorInternal iterator.
-
Field Summary
-
Fields inherited from class org.arakhne.afc.math.graph.SubGraph
iterationNotOrientedElementComparator, iterationOrientedElementComparator
-
-
Constructor Summary
Constructors Constructor Description SubRoadNetwork()Constructor.SubRoadNetwork(UUID id)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(RoadSegment segment)Replies if the given road segment is inside this road network.protected RoadSegmentContainergetParentRoadNetwork()Replies the parent road network.RoadSegmentgetRoadSegment(GeoId geoId)Replies the road segment with the given identifier.RoadSegmentgetRoadSegment(GeoLocation location)Replies the road segment with the given location.UUIDgetUUID()Replies the identifier of the network.booleanisLeftSidedTrafficDirection()Replies if this road network uses a left-side circulation direction rule.booleanisRightSidedTrafficDirection()Replies if this road network uses a right-side circulation direction rule.Iterator<? extends RoadSegment>iterator(Rectangle2afp<?,?,?,?,?,?> bounds)Iterates on the segments that intersect the specified bounds.Iterator<? extends RoadSegment>iterator(Rectangle2afp<?,?,?,?,?,?> bounds, int budget)Iterates on the segments that intersect the specified bounds.Iterable<? extends RoadSegment>toIterable(Rectangle2afp<?,?,?,?,?,?> bounds)Iterates on the segments that intersect the specified bounds.Iterable<? extends RoadSegment>toIterable(Rectangle2afp<?,?,?,?,?,?> bounds, int budget)Iterates on the segments that intersect the specified bounds.protected <O> Ounwrap(O obj)Unwrap a connection.protected GraphPoint.GraphPointConnection<RoadConnection,RoadSegment>wrapGraphPointConnection(GraphPoint.GraphPointConnection<RoadConnection,RoadSegment> connection)Wrap the given graph point connection.protected RoadConnectionwrapPoint(RoadConnection point)Wrap the given connection.protected RoadConnectionwrapPoint(RoadConnection point, RoadSegment segment, boolean isTerminal)Create a wrapping point for the given graph point.protected RoadSegmentwrapSegment(RoadSegment segment)Create a wrapping segment for the given graph segment.-
Methods inherited from class org.arakhne.afc.math.graph.SubGraph
build, build, contains, depthIterator, getGraphSegments, getParentGraph, getPointCount, getSegmentCount, isEmpty, isTerminalPoint, iterator, iterator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.math.graph.Graph
contains, getPointCount, getSegmentCount, isEmpty
-
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Methods inherited from interface org.arakhne.afc.gis.road.primitive.RoadSegmentContainer
depthIterator, depthIterator, iterator
-
-
-
-
Constructor Detail
-
SubRoadNetwork
public SubRoadNetwork()
Constructor.
-
SubRoadNetwork
public SubRoadNetwork(UUID id)
Constructor.- Parameters:
id- the identifier of the network.- Since:
- 4.0
-
-
Method Detail
-
getUUID
@Pure public UUID getUUID()
Replies the identifier of the network.- Returns:
- the identifier.
-
getParentRoadNetwork
@Pure protected final RoadSegmentContainer getParentRoadNetwork()
Replies the parent road network.- Returns:
- the parent road network.
-
wrapSegment
@Pure protected RoadSegment wrapSegment(RoadSegment segment)
Description copied from class:SubGraphCreate a wrapping segment for the given graph segment.- Overrides:
wrapSegmentin classSubGraph<RoadSegment,RoadConnection,RoadPath>- Parameters:
segment- the segment to wrap.- Returns:
- a wrapping segment or the
segmentitself.
-
wrapPoint
@Pure protected RoadConnection wrapPoint(RoadConnection point, RoadSegment segment, boolean isTerminal)
Description copied from class:SubGraphCreate a wrapping point for the given graph point.- Overrides:
wrapPointin classSubGraph<RoadSegment,RoadConnection,RoadPath>- Parameters:
point- the point to wrap.segment- is the segment connected to the point.isTerminal- indicates if this point should be a terminal point.- Returns:
- a wrapping point or the
pointitself.
-
wrapPoint
@Pure protected RoadConnection wrapPoint(RoadConnection point)
Wrap the given connection.- Parameters:
point- the connection to wrap.- Returns:
- the wrapper.
- Since:
- 16.0
-
wrapGraphPointConnection
@Pure protected GraphPoint.GraphPointConnection<RoadConnection,RoadSegment> wrapGraphPointConnection(GraphPoint.GraphPointConnection<RoadConnection,RoadSegment> connection)
Wrap the given graph point connection.- Parameters:
connection- the graph point connection to wrap.- Returns:
- the wrapper.
- Since:
- 16.0
-
unwrap
@Pure protected final <O> O unwrap(O obj)
Unwrap a connection.- Type Parameters:
O- the type of the object to unwrap.- Parameters:
obj- the object to unwrap.- Returns:
- the unwrapped segment
-
contains
@Pure public boolean contains(RoadSegment segment)
Description copied from interface:RoadSegmentContainerReplies if the given road segment is inside this road network.- Specified by:
containsin interfaceRoadSegmentContainer- Parameters:
segment- a segment.- Returns:
trueif the segment is inside the road network, otherwisefalse
-
getRoadSegment
@Pure public RoadSegment getRoadSegment(GeoId geoId)
Description copied from interface:RoadSegmentContainerReplies the road segment with the given identifier.This function is time consuming because the location of the road segment could not be retrieved from the geoId.
- Specified by:
getRoadSegmentin interfaceRoadSegmentContainer- Parameters:
geoId- an identifier.- Returns:
- the road segment or
nullif not found.
-
getRoadSegment
@Pure public RoadSegment getRoadSegment(GeoLocation location)
Description copied from interface:RoadSegmentContainerReplies the road segment with the given location.- Specified by:
getRoadSegmentin interfaceRoadSegmentContainer- Parameters:
location- a location- Returns:
- the road segment or
nullif not found.
-
iterator
@Pure public Iterator<? extends RoadSegment> iterator(Rectangle2afp<?,?,?,?,?,?> bounds)
Description copied from interface:RoadSegmentContainerIterates on the segments that intersect the specified bounds.- Specified by:
iteratorin interfaceRoadSegmentContainer- Parameters:
bounds- is the rectangle inside which the replied elements must be located- Returns:
- an iterator.
-
iterator
@Pure public Iterator<? extends RoadSegment> iterator(Rectangle2afp<?,?,?,?,?,?> bounds, int budget)
Description copied from interface:RoadSegmentContainerIterates on the segments that intersect the specified bounds.- Specified by:
iteratorin interfaceRoadSegmentContainer- Parameters:
bounds- is the rectangle inside which the replied elements must be locatedbudget- is the maximal count of elements which will be replied by the iterator.- Returns:
- an iterator.
-
toIterable
@Pure public Iterable<? extends RoadSegment> toIterable(Rectangle2afp<?,?,?,?,?,?> bounds)
Description copied from interface:RoadSegmentContainerIterates on the segments that intersect the specified bounds.- Specified by:
toIterablein interfaceRoadSegmentContainer- Parameters:
bounds- is the rectangle inside which the replied elements must be located- Returns:
- an iterator.
-
toIterable
@Pure public Iterable<? extends RoadSegment> toIterable(Rectangle2afp<?,?,?,?,?,?> bounds, int budget)
Description copied from interface:RoadSegmentContainerIterates on the segments that intersect the specified bounds.- Specified by:
toIterablein interfaceRoadSegmentContainer- Parameters:
bounds- is the rectangle inside which the replied elements must be locatedbudget- is the maximal count of elements which will be replied by the iterator.- Returns:
- an iterator.
-
isLeftSidedTrafficDirection
@Pure public boolean isLeftSidedTrafficDirection()
Description copied from interface:RoadSegmentContainerReplies if this road network uses a left-side circulation direction rule.When left-side circulation direction rule is used, it is supposed that all vehicles are going on the left side of the roads. For example, this rule is used in UK.
- Specified by:
isLeftSidedTrafficDirectionin interfaceRoadSegmentContainer- Returns:
trueif the left-side rule is used on this network, otherwisefalse.
-
isRightSidedTrafficDirection
@Pure public boolean isRightSidedTrafficDirection()
Description copied from interface:RoadSegmentContainerReplies if this road network uses a right-side circulation direction rule.When right-side circulation direction rule is used, it is supposed that all vehicles are going on the right side of the roads. For example, this rule is used in France.
- Specified by:
isRightSidedTrafficDirectionin interfaceRoadSegmentContainer- Returns:
trueif the right-side rule is used on this network, otherwisefalse.
-
-