- 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) class
SubRoadNetwork.AbstractWrapConnection
Internal connection.(package private) class
SubRoadNetwork.TerminalConnection
Internal connection.(package private) class
SubRoadNetwork.WrapConnection
Internal connection.(package private) class
SubRoadNetwork.WrapGraphPointConnection
Internal graph point connection.(package private) class
SubRoadNetwork.WrapSegment
Internal segment wrapper.(package private) class
SubRoadNetwork.WrapSegmentIterable
Internal iterator.(package private) class
SubRoadNetwork.WrapSegmentIterator
Internal 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 boolean
contains(RoadSegment segment)
Replies if the given road segment is inside this road network.protected RoadSegmentContainer
getParentRoadNetwork()
Replies the parent road network.RoadSegment
getRoadSegment(GeoId geoId)
Replies the road segment with the given identifier.RoadSegment
getRoadSegment(GeoLocation location)
Replies the road segment with the given location.UUID
getUUID()
Replies the identifier of the network.boolean
isLeftSidedTrafficDirection()
Replies if this road network uses a left-side circulation direction rule.boolean
isRightSidedTrafficDirection()
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> O
unwrap(O obj)
Unwrap a connection.protected GraphPoint.GraphPointConnection<RoadConnection,RoadSegment>
wrapGraphPointConnection(GraphPoint.GraphPointConnection<RoadConnection,RoadSegment> connection)
Wrap the given graph point connection.protected RoadConnection
wrapPoint(RoadConnection point)
Wrap the given connection.protected RoadConnection
wrapPoint(RoadConnection point, RoadSegment segment, boolean isTerminal)
Create a wrapping point for the given graph point.protected RoadSegment
wrapSegment(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:SubGraph
Create a wrapping segment for the given graph segment.- Overrides:
wrapSegment
in classSubGraph<RoadSegment,RoadConnection,RoadPath>
- Parameters:
segment
- the segment to wrap.- Returns:
- a wrapping segment or the
segment
itself.
-
wrapPoint
@Pure protected RoadConnection wrapPoint(RoadConnection point, RoadSegment segment, boolean isTerminal)
Description copied from class:SubGraph
Create a wrapping point for the given graph point.- Overrides:
wrapPoint
in 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
point
itself.
-
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:RoadSegmentContainer
Replies if the given road segment is inside this road network.- Specified by:
contains
in interfaceRoadSegmentContainer
- Parameters:
segment
- a segment.- Returns:
true
if the segment is inside the road network, otherwisefalse
-
getRoadSegment
@Pure public RoadSegment getRoadSegment(GeoId geoId)
Description copied from interface:RoadSegmentContainer
Replies 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:
getRoadSegment
in interfaceRoadSegmentContainer
- Parameters:
geoId
- an identifier.- Returns:
- the road segment or
null
if not found.
-
getRoadSegment
@Pure public RoadSegment getRoadSegment(GeoLocation location)
Description copied from interface:RoadSegmentContainer
Replies the road segment with the given location.- Specified by:
getRoadSegment
in interfaceRoadSegmentContainer
- Parameters:
location
- a location- Returns:
- the road segment or
null
if not found.
-
iterator
@Pure public Iterator<? extends RoadSegment> iterator(Rectangle2afp<?,?,?,?,?,?> bounds)
Description copied from interface:RoadSegmentContainer
Iterates on the segments that intersect the specified bounds.- Specified by:
iterator
in 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:RoadSegmentContainer
Iterates on the segments that intersect the specified bounds.- Specified by:
iterator
in 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:RoadSegmentContainer
Iterates on the segments that intersect the specified bounds.- Specified by:
toIterable
in 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:RoadSegmentContainer
Iterates on the segments that intersect the specified bounds.- Specified by:
toIterable
in 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:RoadSegmentContainer
Replies 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:
isLeftSidedTrafficDirection
in interfaceRoadSegmentContainer
- Returns:
true
if the left-side rule is used on this network, otherwisefalse
.
-
isRightSidedTrafficDirection
@Pure public boolean isRightSidedTrafficDirection()
Description copied from interface:RoadSegmentContainer
Replies 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:
isRightSidedTrafficDirection
in interfaceRoadSegmentContainer
- Returns:
true
if the right-side rule is used on this network, otherwisefalse
.
-
-