- java.lang.Object
-
- org.arakhne.afc.gis.primitive.AbstractGISElement<C,T>
-
- org.arakhne.afc.gis.primitive.AbstractBoundedGISElement<GISContainer<?>,StandardRoadNetwork>
-
- org.arakhne.afc.gis.road.StandardRoadNetwork
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Iterable<RoadSegment>
,EventListener
,AttributeChangeListener
,AttributeCollection
,AttributeProvider
,BoundedGISElement
,GISCloneable<StandardRoadNetwork>
,GISElement
,GISPrimitive
,RoadNetwork
,RoadSegmentContainer
,BoundedElement2afp<Rectangle2d>
,Graph<RoadSegment,RoadConnection>
,JsonableObject
public class StandardRoadNetwork extends AbstractBoundedGISElement<GISContainer<?>,StandardRoadNetwork> implements RoadNetwork
This class describes a road network.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:55
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisroad
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
StandardRoadNetwork.EventHandler
Default evant handler for the road network.
-
Field Summary
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISElement
ATTR_NAME, NAME_COMPARATOR
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
COMPARATOR
-
-
Constructor Summary
Constructors Constructor Description StandardRoadNetwork(UUID id, Rectangle2afp<?,?,?,?,?,?> originalBounds)
Constructor.StandardRoadNetwork(UUID id, Rectangle2afp<?,?,?,?,?,?> originalBounds, AttributeCollection attributeProvider)
Constructor.StandardRoadNetwork(Rectangle2afp<?,?,?,?,?,?> originalBounds)
Constructor.StandardRoadNetwork(Rectangle2afp<?,?,?,?,?,?> originalBounds, AttributeCollection attributeProvider)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRoadNetworkListener(RoadNetworkListener listener)
Add a listener.boolean
addRoadPolyline(RoadPolyline segment)
Add a road segment inside the road network.void
addRoadSegment(RoadSegment segment)
Add a road segment inside the road network.Iterator<Rectangle2afp<?,?,?,?,?,?>>
boundsIterator()
Replies the bounding rectangles of the internal data-structure elements.protected Rectangle2d
calcBounds()
Compute the bounds of this element.boolean
clear()
Clear this road network by removing all the road segments.StandardRoadNetwork
clone()
Clone this object to obtain a valid copy.RoadConnection
connectSegmentEndPoint(RoadConnection connection, RoadSegment segment, Point2D<?,?> position)
Connection the end point of the given road segment to the given road connection or to a new connection.RoadConnection
connectSegmentStartPoint(RoadConnection connection, RoadSegment segment, Point2D<?,?> position)
Connection the start point of the given road segment to the given road connection or to a new connection.boolean
contains(Object obj)
Replies is this graph contains the given segment.boolean
contains(RoadSegment segment)
Replies if the given road segment is inside this road network.protected GISPolylineSet<RoadPolyline>
createInternalDataStructure(Rectangle2afp<?,?,?,?,?,?> originalBounds)
Create the internal data structure.GraphIterator<RoadSegment,RoadConnection>
depthIterator(RoadSegment startingSegment, double depth, double position_from_starting_point, RoadConnection startingPoint, boolean allowManyReplies, boolean assumeOrientedSegments, DynamicDepthUpdater<RoadSegment,RoadConnection> dynamicDepthUpdater)
Replies an iterator that permits to move along the segment's graph starting from the specified segment and from the specified starting point.protected void
fireSegmentAdded(RoadSegment segment)
Fire the addition event.protected void
fireSegmentChanged(RoadSegment segment)
Fire the change event.protected void
fireSegmentRemoved(RoadSegment segment)
Fire the addition event.Collection<RoadConnection>
getConnections(Rectangle2afp<?,?,?,?,?,?> bounds)
Return the the road connections inside the given bounds.Collection<RoadConnection>
getConnections(Rectangle2d bounds)
Return the the road connections inside the given bounds.GeoLocation
getGeoLocation()
Replies the geo-location.GISPolylineSet<RoadPolyline>
getInternalSet()
Replies the internal data-structure as set.Tree<RoadPolyline,?>
getInternalTree()
Replies the internal data-structure as tree.LegalTrafficSide
getLegalTrafficSide()
Replies the legal traffic side.RoadConnection
getNearestConnection(Point2D<?,?> pos)
Return the nearest point from a position.Point1d
getNearestPosition(Point2D<?,?> pos)
Return the nearest point 1.5D from a 2D position.Point1d
getNearestPositionOnRoadBorder(Point2D<?,?> pos)
Return the nearest point 1.5D on the road borders from a 2D position.RoadSegment
getNearestSegment(Point2D<?,?> pos)
Return the nearest segment from a position.org.eclipse.xtext.xbase.lib.Pair<? extends RoadSegment,Double>
getNearestSegmentData(Point2D<?,?> pos)
Return the nearest segment from a position; and its distance to the point.int
getPointCount()
Replies the count of points in this graph.RoadSegment
getRoadSegment(GeoId geoId)
Replies the road segment with the given identifier.RoadSegment
getRoadSegment(GeoLocation location)
Replies the road segment with the given location.Collection<? extends RoadSegment>
getRoadSegments()
Replies a collection of segments inside this road network.int
getSegmentCount()
Replies the count of segments in this graph.Shape2d<?>
getShape()
Replies the shape of this this element.boolean
isEmpty()
Replies if this graph is empty or not.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<RoadSegment>
iterator()
GraphIterator<RoadSegment,RoadConnection>
iterator(RoadSegment starting_segment, RoadConnection starting_point, boolean allowManyReplies, boolean assumeOrientedSegments)
Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point.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.RoadConnection
mergeRoadConnections(Collection<? extends RoadConnection> connections)
Merge the given connections to obtain only one connection.RoadConnection
mergeRoadConnections(RoadConnection... connections)
Merge the given connections to obtain only one connection.void
removeRoadNetworkListener(RoadNetworkListener listener)
Remove a listener.boolean
removeRoadSegment(RoadSegment segment)
Remove a segment from this network.void
setUUID(UUID id)
Set the unique identifier for element.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.void
toJson(JsonBuffer buffer)
Replies the Json representation of this node.-
Methods inherited from class org.arakhne.afc.gis.primitive.AbstractBoundedGISElement
getBoundingBox, resetBoundingBox, setBoundingBox
-
Methods inherited from class org.arakhne.afc.gis.primitive.AbstractGISElement
addAttributeChangeListener, addAttributes, addAttributes, attributes, copyAttributes, flush, freeMemory, getAllAttributeNames, getAllAttributes, getAllAttributesByType, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeAsBool, getAttributeAsDate, getAttributeAsDouble, getAttributeAsEnumeration, getAttributeAsEnumeration, getAttributeAsFloat, getAttributeAsInetAddress, getAttributeAsInt, getAttributeAsJavaClass, getAttributeAsLong, getAttributeAsString, getAttributeAsURI, getAttributeAsURL, getAttributeAsUUID, getAttributeCollection, getAttributeCount, getAttributeObject, getAttributeProvider, getContainer, getGeoId, getName, getTopContainer, getUUID, hasAttribute, hashKey, isEventFirable, onAttributeChangeEvent, removeAllAttributes, removeAttribute, removeAttributeChangeListener, renameAttribute, renameAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setAttributeType, setContainer, setEventFirable, setName, toMap, toMap, toString
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeCollection
addAttributeChangeListener, addAttributes, addAttributes, flush, isEventFirable, removeAllAttributes, removeAttribute, removeAttributeChangeListener, renameAttribute, renameAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttributes, setAttributes, setAttributeType, setEventFirable
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeProvider
attributes, freeMemory, getAllAttributeNames, getAllAttributes, getAllAttributesByType, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeAsBool, getAttributeAsDate, getAttributeAsDouble, getAttributeAsEnumeration, getAttributeAsEnumeration, getAttributeAsFloat, getAttributeAsInetAddress, getAttributeAsInt, getAttributeAsJavaClass, getAttributeAsLong, getAttributeAsString, getAttributeAsURI, getAttributeAsURL, getAttributeAsUUID, getAttributeCount, getAttributeObject, hasAttribute, toMap, toMap
-
Methods inherited from interface org.arakhne.afc.math.geometry.d2.afp.BoundedElement2afp
getBoundingBox
-
Methods inherited from interface org.arakhne.afc.gis.primitive.BoundedGISElement
resetBoundingBox
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISElement
copyAttributes, getName, hashKey, setName
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
getGeoId, getUUID
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Methods inherited from interface org.arakhne.afc.gis.road.primitive.RoadSegmentContainer
depthIterator
-
-
-
-
Constructor Detail
-
StandardRoadNetwork
public StandardRoadNetwork(Rectangle2afp<?,?,?,?,?,?> originalBounds, AttributeCollection attributeProvider)
Constructor.- Parameters:
originalBounds
- are the bounds of the road network.attributeProvider
- is the attribute collection associated to this network.
-
StandardRoadNetwork
public StandardRoadNetwork(Rectangle2afp<?,?,?,?,?,?> originalBounds)
Constructor.- Parameters:
originalBounds
- are the bounds of the road network.
-
StandardRoadNetwork
public StandardRoadNetwork(UUID id, Rectangle2afp<?,?,?,?,?,?> originalBounds, AttributeCollection attributeProvider)
Constructor.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.originalBounds
- are the bounds of the road network.attributeProvider
- is the attribute collection associated to this network.- Since:
- 4.0
-
StandardRoadNetwork
public StandardRoadNetwork(UUID id, Rectangle2afp<?,?,?,?,?,?> originalBounds)
Constructor.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.originalBounds
- are the bounds of the road network.- Since:
- 4.0
-
-
Method Detail
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObject
Replies the Json representation of this node.- Specified by:
toJson
in interfaceJsonableObject
- Overrides:
toJson
in classAbstractBoundedGISElement<GISContainer<?>,StandardRoadNetwork>
- Parameters:
buffer
- the Json buffer.
-
createInternalDataStructure
protected GISPolylineSet<RoadPolyline> createInternalDataStructure(Rectangle2afp<?,?,?,?,?,?> originalBounds)
Create the internal data structure.- Parameters:
originalBounds
- are the bounds of the road network.- Returns:
- the internal data structure.
-
clone
@Pure public StandardRoadNetwork clone()
Clone this object to obtain a valid copy.- Specified by:
clone
in interfaceAttributeCollection
- Specified by:
clone
in interfaceAttributeProvider
- Specified by:
clone
in interfaceGISCloneable<StandardRoadNetwork>
- Specified by:
clone
in interfaceGISElement
- Overrides:
clone
in classAbstractBoundedGISElement<GISContainer<?>,StandardRoadNetwork>
- Returns:
- a copy
-
getInternalSet
@Pure public GISPolylineSet<RoadPolyline> getInternalSet()
Replies the internal data-structure as set.- Returns:
- the internal data-structure as set.
-
getInternalTree
@Pure public Tree<RoadPolyline,?> getInternalTree()
Replies the internal data-structure as tree.- Returns:
- the internal data-structure as tree.
-
setUUID
public final void setUUID(UUID id)
Set the unique identifier for element.A Unique IDentifier (UID) must be unique for all the object instances.
- Overrides:
setUUID
in classAbstractGISElement<GISContainer<?>,StandardRoadNetwork>
- Parameters:
id
- is the new identifier- Since:
- 4.0
-
getLegalTrafficSide
@Pure public LegalTrafficSide getLegalTrafficSide()
Replies the legal traffic side.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.
- Returns:
- the legal traffic side
-
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 interfaceRoadNetwork
- 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 interfaceRoadNetwork
- Specified by:
isRightSidedTrafficDirection
in interfaceRoadSegmentContainer
- Returns:
true
if the right-side rule is used on this network, otherwisefalse
.
-
getSegmentCount
@Pure public int getSegmentCount()
Description copied from interface:Graph
Replies the count of segments in this graph.- Specified by:
getSegmentCount
in interfaceGraph<RoadSegment,RoadConnection>
- Returns:
- the count of segments in this graph.
-
getPointCount
@Pure public int getPointCount()
Description copied from interface:Graph
Replies the count of points in this graph.- Specified by:
getPointCount
in interfaceGraph<RoadSegment,RoadConnection>
- Returns:
- the count of points in this graph.
-
contains
@Pure public boolean contains(Object obj)
Description copied from interface:Graph
Replies is this graph contains the given segment. The test is based onObject.equals(Object)
.- Specified by:
contains
in interfaceGraph<RoadSegment,RoadConnection>
- Parameters:
obj
- the object to search for.- Returns:
true
if the graph contains the segment, otherwisefalse
.
-
contains
@Pure public final boolean contains(RoadSegment segment)
Description copied from interface:RoadSegmentContainer
Replies if the given road segment is inside this road network.- Specified by:
contains
in interfaceRoadNetwork
- Specified by:
contains
in interfaceRoadSegmentContainer
- Parameters:
segment
- a segment.- Returns:
true
if the segment is inside the road network, otherwisefalse
-
isEmpty
@Pure public boolean isEmpty()
Description copied from interface:Graph
Replies if this graph is empty or not.- Specified by:
isEmpty
in interfaceGraph<RoadSegment,RoadConnection>
- Returns:
true
if the graph is empty, otherwisefalse
.
-
calcBounds
@Pure protected Rectangle2d calcBounds()
Compute the bounds of this element. This function does not update the internal attribute replied byAbstractBoundedGISElement.getBoundingBox()
- Specified by:
calcBounds
in classAbstractBoundedGISElement<GISContainer<?>,StandardRoadNetwork>
- Returns:
- the bounds
-
getShape
public Shape2d<?> getShape()
Description copied from interface:BoundedGISElement
Replies the shape of this this element.The bounding box replied by
BoundedElement2afp.getBoundingBox()
encloses the replied shape.- Specified by:
getShape
in interfaceBoundedGISElement
- Returns:
- the shape or
null
if not applicable.
-
getGeoLocation
@Pure public GeoLocation getGeoLocation()
Description copied from interface:GISPrimitive
Replies the geo-location.A GeoLocation is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have equal GeoLocations.
The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):
GISElement obj1 = new MapPolyline(100,10,200,30,300,4); GISElement obj2 = new MapPolyline(100,10,200,30,300,4); assert( obj1.getGeoId().equals(obj2.getGeoId()) ); assert( obj2.getGeoId().equals(obj1.getGeoId()) ); assert( ! obj1.getUid().equals(obj2.getUid()) ); assert( ! obj2.getUid().equals(obj1.getUid()) );
- Specified by:
getGeoLocation
in interfaceGISPrimitive
- Returns:
- a location
- See Also:
GISPrimitive.getGeoId()
,GISPrimitive.getGeoLocation()
-
getRoadSegments
@Pure public Collection<? extends RoadSegment> getRoadSegments()
Description copied from interface:RoadNetwork
Replies a collection of segments inside this road network.- Specified by:
getRoadSegments
in interfaceRoadNetwork
- Returns:
- a collection of segments inside this road network.
-
getRoadSegment
@Pure public final 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 interfaceRoadNetwork
- Specified by:
getRoadSegment
in interfaceRoadSegmentContainer
- Parameters:
geoId
- an identifier.- Returns:
- the road segment or
null
if not found.
-
getRoadSegment
@Pure public final RoadSegment getRoadSegment(GeoLocation location)
Description copied from interface:RoadSegmentContainer
Replies the road segment with the given location.- Specified by:
getRoadSegment
in interfaceRoadNetwork
- Specified by:
getRoadSegment
in interfaceRoadSegmentContainer
- Parameters:
location
- a location- Returns:
- the road segment or
null
if not found.
-
getConnections
@Pure public Collection<RoadConnection> getConnections(Rectangle2afp<?,?,?,?,?,?> bounds)
Description copied from interface:RoadNetwork
Return the the road connections inside the given bounds.- Specified by:
getConnections
in interfaceRoadNetwork
- Parameters:
bounds
- are the bounds to explore.- Returns:
- the road connections in the given bounds.
-
getConnections
@Pure public Collection<RoadConnection> getConnections(Rectangle2d bounds)
Description copied from interface:RoadNetwork
Return the the road connections inside the given bounds.- Specified by:
getConnections
in interfaceRoadNetwork
- Parameters:
bounds
- are the bounds to explore.- Returns:
- the road connections in the given bounds.
-
getNearestConnection
@Pure public RoadConnection getNearestConnection(Point2D<?,?> pos)
Description copied from interface:RoadNetwork
Return the nearest point from a position.- Specified by:
getNearestConnection
in interfaceRoadNetwork
- Parameters:
pos
- is the testing position.- Returns:
- the nearest road network point to the given point.
-
getNearestSegment
@Pure public RoadSegment getNearestSegment(Point2D<?,?> pos)
Description copied from interface:RoadNetwork
Return the nearest segment from a position.- Specified by:
getNearestSegment
in interfaceRoadNetwork
- Parameters:
pos
- is the testing position.- Returns:
- the nearest road network segment to the given point.
-
getNearestSegmentData
@Pure public org.eclipse.xtext.xbase.lib.Pair<? extends RoadSegment,Double> getNearestSegmentData(Point2D<?,?> pos)
Description copied from interface:RoadNetwork
Return the nearest segment from a position; and its distance to the point.- Specified by:
getNearestSegmentData
in interfaceRoadNetwork
- Parameters:
pos
- is the testing position.- Returns:
- the nearest road network segment and its distance
to the given point;
or
null
if none.
-
getNearestPosition
@Pure public Point1d getNearestPosition(Point2D<?,?> pos)
Description copied from interface:RoadNetwork
Return the nearest point 1.5D from a 2D position.- Specified by:
getNearestPosition
in interfaceRoadNetwork
- Parameters:
pos
- is the testing position.- Returns:
- the nearest 1.5D position on the road network.
-
getNearestPositionOnRoadBorder
@Pure public Point1d getNearestPositionOnRoadBorder(Point2D<?,?> pos)
Description copied from interface:RoadNetwork
Return the nearest point 1.5D on the road borders from a 2D position.- Specified by:
getNearestPositionOnRoadBorder
in interfaceRoadNetwork
- Parameters:
pos
- is the testing position.- Returns:
- the nearest 1.5D position on the road network.
-
addRoadSegment
public final void addRoadSegment(RoadSegment segment) throws RoadNetworkException
Description copied from interface:RoadNetwork
Add a road segment inside the road network.- Specified by:
addRoadSegment
in interfaceRoadNetwork
- Parameters:
segment
- is the road segment to insert- Throws:
RoadNetworkException
-
addRoadPolyline
public final boolean addRoadPolyline(RoadPolyline segment) throws RoadNetworkException
Add a road segment inside the road network.- Parameters:
segment
- is the road segment to insert- Returns:
true
if segment successfully added, otherwisefalse
- Throws:
RoadNetworkException
- in case of error.
-
removeRoadSegment
public boolean removeRoadSegment(RoadSegment segment)
Description copied from interface:RoadNetwork
Remove a segment from this network.- Specified by:
removeRoadSegment
in interfaceRoadNetwork
- Parameters:
segment
- is the segment to remove- Returns:
true
if the segment was successfully removed, otherwhisefalse
-
clear
public boolean clear()
Description copied from interface:RoadNetwork
Clear this road network by removing all the road segments.- Specified by:
clear
in interfaceRoadNetwork
- Returns:
true
if the road network changed due to this call; otherwisefalse
.
-
mergeRoadConnections
public final RoadConnection mergeRoadConnections(RoadConnection... connections)
Description copied from interface:RoadNetwork
Merge the given connections to obtain only one connection.- Specified by:
mergeRoadConnections
in interfaceRoadNetwork
- Parameters:
connections
- are the connections to merge.- Returns:
- the result of the merging action.
-
mergeRoadConnections
public RoadConnection mergeRoadConnections(Collection<? extends RoadConnection> connections)
Description copied from interface:RoadNetwork
Merge the given connections to obtain only one connection.- Specified by:
mergeRoadConnections
in interfaceRoadNetwork
- Parameters:
connections
- are the connections to merge.- Returns:
- the result of the merging action.
-
connectSegmentStartPoint
public RoadConnection connectSegmentStartPoint(RoadConnection connection, RoadSegment segment, Point2D<?,?> position)
Description copied from interface:RoadNetwork
Connection the start point of the given road segment to the given road connection or to a new connection.- Specified by:
connectSegmentStartPoint
in interfaceRoadNetwork
- Parameters:
connection
- is the connection to connect to, ornull
if a new connection should be created.segment
- is the road to connected to.position
- is the position where the first point of the segment should be located, ornull
if this position may be unchanged.- Returns:
- the connection to which the segment was attached.
-
connectSegmentEndPoint
public RoadConnection connectSegmentEndPoint(RoadConnection connection, RoadSegment segment, Point2D<?,?> position)
Description copied from interface:RoadNetwork
Connection the end point of the given road segment to the given road connection or to a new connection.- Specified by:
connectSegmentEndPoint
in interfaceRoadNetwork
- Parameters:
connection
- is the connection to connect to, ornull
if a new connection should be created.segment
- is the road to connected to.position
- is the position where the end point of the segment should be located, ornull
if this position may be unchanged.- Returns:
- the connection to which the segment was attached.
-
addRoadNetworkListener
public void addRoadNetworkListener(RoadNetworkListener listener)
Description copied from interface:RoadNetwork
Add a listener.- Specified by:
addRoadNetworkListener
in interfaceRoadNetwork
- Parameters:
listener
- the listener.
-
removeRoadNetworkListener
public void removeRoadNetworkListener(RoadNetworkListener listener)
Description copied from interface:RoadNetwork
Remove a listener.- Specified by:
removeRoadNetworkListener
in interfaceRoadNetwork
- Parameters:
listener
- the listener.
-
fireSegmentAdded
protected void fireSegmentAdded(RoadSegment segment)
Fire the addition event.- Parameters:
segment
- is the added segment
-
fireSegmentChanged
protected void fireSegmentChanged(RoadSegment segment)
Fire the change event.- Parameters:
segment
- is the changed segment
-
fireSegmentRemoved
protected void fireSegmentRemoved(RoadSegment segment)
Fire the addition event.- Parameters:
segment
- is the removed segment
-
depthIterator
@Pure public GraphIterator<RoadSegment,RoadConnection> depthIterator(RoadSegment startingSegment, double depth, double position_from_starting_point, RoadConnection startingPoint, boolean allowManyReplies, boolean assumeOrientedSegments, DynamicDepthUpdater<RoadSegment,RoadConnection> dynamicDepthUpdater)
Description copied from interface:Graph
Replies an iterator that permits to move along the segment's graph starting from the specified segment and from the specified starting point. If the specified starting point is not one of the ends of the segment, this function assumes to start from the point replied byGraphSegment.getBeginPoint()
.This function does not allow the cycles during the iterations.
- Specified by:
depthIterator
in interfaceGraph<RoadSegment,RoadConnection>
- Specified by:
depthIterator
in interfaceRoadSegmentContainer
- Parameters:
startingSegment
- is the first segment to iterate.depth
- is the maximal depth to reach.position_from_starting_point
- is the starting position from thestartingPoint
.startingPoint
- is the starting point of the iterations.allowManyReplies
- may betrue
to allow to reply many times the same segment, otherwhisefalse
.assumeOrientedSegments
- may betrue
to assume that the same segment has two different instances for graph iteration: the first instance is associated the first point of the segment and the second instance is associated to the last point of the segment. If this parameter isfalse
to assume that the end points of a segment are not distinguished.dynamicDepthUpdater
- if notnull
, it is a lambda that is used for dynamically updating the maximal depth.- Returns:
- the iterator.
- See Also:
Graph.depthIterator(GraphSegment, double, double, GraphPoint, boolean, boolean)
-
iterator
@Pure public GraphIterator<RoadSegment,RoadConnection> iterator(RoadSegment starting_segment, RoadConnection starting_point, boolean allowManyReplies, boolean assumeOrientedSegments)
Description copied from interface:Graph
Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point.- Specified by:
iterator
in interfaceGraph<RoadSegment,RoadConnection>
- Specified by:
iterator
in interfaceRoadSegmentContainer
- Parameters:
starting_segment
- is the first segment to iterate.starting_point
- is the starting point of the iterations.allowManyReplies
- may betrue
to allow to reply many times the same segment, otherwhisefalse
.assumeOrientedSegments
- may betrue
to assume that the same segment has two different instances for graph iteration: the first instance is associated the first point of the segment and the second instance is associated to the last point of the segment. If this parameter isfalse
to assume that the end points of a segment are not distinguished.- Returns:
- the iterator.
-
iterator
@Pure public Iterator<RoadSegment> iterator()
- Specified by:
iterator
in interfaceIterable<RoadSegment>
-
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 interfaceRoadNetwork
- 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 interfaceRoadNetwork
- 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 interfaceRoadNetwork
- 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 interfaceRoadNetwork
- 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.
-
boundsIterator
@Pure public Iterator<Rectangle2afp<?,?,?,?,?,?>> boundsIterator()
Description copied from interface:RoadNetwork
Replies the bounding rectangles of the internal data-structure elements.- Specified by:
boundsIterator
in interfaceRoadNetwork
- Returns:
- the bounding boxes in the data-structure.
-
-