-
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,AttributeChangeListener
,AttributeCollection
,AttributeProvider
,BoundedGISElement
,FlagContainer
,GISCloneable<MapElement>
,GISContentElement<GISElementContainer<?>>
,GISEditable
,GISElement
,GISFlagContainer
,GISPrimitive
,RoadSegment
,Segment1D<Point2d,Vector2d>
,BoundedElement2afp<Rectangle2d>
,GraphSegment<RoadSegment,RoadConnection>
,JsonableObject
public class RoadPolyline extends MapPolyline implements RoadSegment
This class describes a road segmentA RoadSegment is an elementary polyline which could be connected to other RoadSegments by
RoadConnection
.Caution: the road segment has weak references on its RoadConnections, and the RoadConnections have weak references to the RoadSegments.
Caution: when loaded, this class set the default coordinate systems with
GeoLocationUtil.setGISCoordinateSystemAsDefault()
- 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/interfaces inherited from class org.arakhne.afc.gis.mapelement.MapComposedElement
MapComposedElement.PointGroup
-
Nested classes/interfaces inherited from class org.arakhne.afc.gis.mapelement.MapElement
MapElement.VisualizationType
-
-
Field Summary
-
Fields inherited from class org.arakhne.afc.gis.mapelement.MapElement
ATTR_COLOR, ATTR_USE_CONTAINER_COLOR, ATTR_VISUALIZATION_TYPE
-
Fields inherited from interface org.arakhne.afc.gis.primitive.FlagContainer
FLAG_READONLY, FLAG_SELECTED
-
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 RoadPolyline()
Create a new road segment.RoadPolyline(UUID id)
Create a new road segment.RoadPolyline(UUID id, AttributeCollection attributeProvider)
Create a new road segment.RoadPolyline(AttributeCollection attributeProvider)
Create a new road segment.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addUserData(String id, Object data)
Add an user data associated to this segment.void
clearUserData()
Clear all the data from all the groups.void
clearUserData(String id)
Clear all the data from a group.RoadPolyline
clone()
Clone this object to obtain a valid copy.boolean
containsUserData(String id, Object data)
Replies if the given one user data is associated to the given identifier.GraphIterator<RoadSegment,RoadConnection>
depthIterator(double depth, double position_from_starting_point, RoadConnection starting_point, boolean allowManyReplies, boolean assumeOrientedSegments, DynamicDepthUpdater<RoadSegment,RoadConnection> dynamicDepthUpdate)
Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point.double
distance(Point2D<?,?> point)
Replies the distance between this MapElement and point.boolean
equals(Object element)
Replies if the specified objects is the same as this one.Point2d
getAntepenulvianPoint()
Replies the coordinates of the antepenulvian (before last) point.RoadConnection
getBeginPoint()
Replies the starting point of this segment.(package private) <CT extends RoadConnection>
CTgetBeginPoint(Class<CT> connectionClass)
Replies the first point of this segment.double
getDistanceFromStart(double ratio)
Replies the distance from the starting point.double
getDistanceToEnd(double ratio)
Replies the distance to the ending point.RoadConnection
getEndPoint()
Replies the ending point of this segment.(package private) <CT extends RoadConnection>
CTgetEndPoint(Class<CT> connectionClass)
Replies the last connection point of this segment.Point2d
getFirstPoint()
Replies the 2D cooordinate of the first point of the segment.Point2d
getGeoLocationForDistance(double desired_distance)
Replies the geo-location of the point described by the specified distance.Point2d
getGeoLocationForDistance(double desired_distance, double shifting)
Replies the geo-location of the point described by the specified distance.void
getGeoLocationForDistance(double desired_distance, double shifting, Point2D<?,?> geoLocation)
Replies the geo-location of the point described by the specified distance.void
getGeoLocationForDistance(double desired_distance, double shifting, Point2D<?,?> geoLocation, Vector2D<?,?> tangent)
Replies the geo-location of the point described by the specified distance.Point2d
getGeoLocationForDistance(double desired_distance, double shifting, Vector2D<?,?> tangent)
Replies the geo-location of the point described by the specified distance.void
getGeoLocationForDistance(double desired_distance, Point2D<?,?> geoLocation)
Replies the geo-location of the point described by the specified distance.Point2d
getGeoLocationForLocationRatio(double ratio)
Replies the geo-location of the point described by the location ratio.Point2d
getGeoLocationForLocationRatio(double ratio, double shifting)
Replies the geo-location of the point described by the location ratio.void
getGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> geoLocation)
Replies the geo-location of the point described by the location ratio.void
getGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> output, Vector2D<?,?> tangent)
Replies the geo-location of the point described by the location ratio.Point2d
getGeoLocationForLocationRatio(double ratio, double shifting, Vector2D<?,?> tangent)
Replies the geo-location of the point described by the location ratio.void
getGeoLocationForLocationRatio(double ratio, Point2D<?,?> geoLocation)
Replies the geo-location of the point described by the location ratio.double
getLaneCenter(int laneIndex)
Replies the center line of the lane at the given index.int
getLaneCount()
Replies the count of lanes on this road segment.Direction1D
getLaneDirection(int laneIndex)
Replies the direction of the lane at the given index.double
getLaneSize(int laneIndex)
Replies the size of the lane at the given index.Point2d
getLastPoint()
Replies the 2D cooordinates of the last point of the segment.String
getName()
Replies the name of the element.(package private) <CT extends RoadConnection>
CTgetNearestPoint(Class<CT> connectionClass, double x, double y)
Replies the nearest start/end point to the specified point.(package private) <CT extends RoadConnection>
CTgetNearestPoint(Class<CT> connectionClass, double x, double y, OutputParameter<Double> distance)
Replies the nearest start/end point to the specified point.RoadConnection
getOtherSidePoint(RoadConnection ref_point)
Replies the point at the other side of the segment.PointFusionValidator
getPointFusionValidator()
Replies the validator that is able to detect points at the same location.double
getRoadBorderDistance()
Replies the distance to the road border according to the driving side on the road.StandardRoadNetwork
getRoadNetwork()
Replies the road network that contains this segment.String
getRoadNumber()
Replies the number of the road segment.RoadType
getRoadType()
Replies the type of the road segment.List<RoadSegment>
getSegmentChain()
Replies a list of chained road segments without any cross-road which contains this road segment.List<RoadSegment>
getSegmentChain(boolean forward_search, boolean backward_search)
Replies a list of chained road segments without any cross-road which contains this road segment.RoadConnection
getSharedConnectionWith(RoadSegment otherSegment)
Replies the shared connection between this segment and the specified one.Vector2d
getTangentAt(double positionOnSegment)
Replies the 2D tangent at the position on the segment.TrafficDirection
getTrafficDirection()
Replies the traffic direction on this road segment.<T> T
getUserData(String id)
Replies an user data associated to this segment.<T> Collection<? extends T>
getUserDataCollection(String id)
Replies the user data associated to this segment.double
getWidth()
Returns the poly-element width in the geo-located referencial.RoadSegment
getWrappedRoadSegment()
Replies the wrapped road segment if this object is a wrapper to another road segment.boolean
hasUserData(String id)
Replies if at least one user data is associated to the given identifier.RoadPolyline
invert()
Invert the order of points coordinates of this element and reorder the groupIndex too.RoadPolyline
invertPointsIn(int groupIndex)
invert the points coordinates of this element on the groupIndex in argument.boolean
isConnectedTo(RoadSegment otherSegment)
Replies if this segment is connected to the specified segment.boolean
isFirstPointConnectedTo(Segment1D<?,?> segment)
Replies if this segment is connected to the specified segment by its first point.boolean
isLastPointConnectedTo(Segment1D<?,?> segment)
Replies if this segment is connected to the specified segment by its last point.boolean
isTraversableFrom(RoadConnection point)
Replies if this road segment is traversable from the given point.GraphIterator<RoadSegment,RoadConnection>
iterator()
Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point.GraphIterator<RoadSegment,RoadConnection>
iterator(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.void
projectsOnPlane(double positionOnSegment, double shiftDistance, Point2D<?,?> position, Vector2D<?,?> tangent)
Replies the 2D position and the 2D tangent at the position on the segment.void
projectsOnPlane(double positionOnSegment, Point2D<?,?> position, Vector2D<?,?> tangent)
Replies the 2D position and the 2D tangent at the position on the segment.boolean
removeUserData(String id, Object data)
Remove an user data associated to this segment.(package private) void
setEndPoint(StandardRoadConnection desiredConnection)
Move the end point of a road segment.void
setName(String name)
Set the name of the element.(package private) void
setRoadNetwork(StandardRoadNetwork network)
Set the road network that contains this segment.void
setRoadNumber(String number)
Set the number of the road segment.void
setRoadType(RoadType type)
Set the type of the road segment.(package private) void
setStartPoint(StandardRoadConnection desiredConnection)
Move the start point of a road segment.void
setTrafficDirection(TrafficDirection direction)
Set the traffic direction on this road segment.void
setUserData(String id, Object data)
Set an user data associated to this segment.void
setWidth(double width)
Set the road width in the geo-located referencial.void
toJson(JsonBuffer buffer)
Replies the Json representation of this node.protected Segment1D<?,?>
toSegment1D()
Replies the Segment1D representation of this object.-
Methods inherited from class org.arakhne.afc.gis.mapelement.MapPolyline
calcBounds, computeGeoLocationForDistance, distance, distanceToEnd, distanceToEnd, getDistance, getLength, getNearestEndIndex, getNearestEndIndex, getNearestPosition, getNearestPosition, getShape, getSubSegmentForDistance, intersects, isWidePolyline, resetBoundingBox, setWidePolyline, toPath2D, toPath2D, toPath2D, toPath2D
-
Methods inherited from class org.arakhne.afc.gis.mapelement.MapComposedElement
addGroup, addGroup, addPoint, addPoint, addPoint, addPoint, canonize, clear, contains, containsPoint, containsPoint, equals, getFirstPointIndexInGroup, getGeoLocation, getGroupAt, getGroupCount, getLastPointIndexInGroup, getPointAt, getPointAt, getPointCount, getPointCountInGroup, getPointIndex, getPointIndex, groupIterator, groups, hashCode, insertPointAt, insertPointAt, pointIterator, points, removeGroupAt, removePointAt, setPointAt, setPointAt, setPointAt, setPointAt, setPointAt, setPointAt, setPointAt, setPointAt
-
Methods inherited from class org.arakhne.afc.gis.mapelement.MapElement
addGISEditableChangeListener, boundsContains, boundsIntersects, contains, finalize, fireElementChanged, fireGraphicalAttributeChanged, fireShapeChanged, getColor, getFlags, getRawColor, getVisualizationType, hasFlag, isContainerColorUsed, isReadOnlyObject, onAttributeChanged, removeGISEditableChangeListener, setColor, setContainerColorUse, setFlag, setReadOnlyObject, setUUID, setVisualizationType, switchFlag, unsetFlag
-
Methods inherited from class org.arakhne.afc.gis.primitive.AbstractBoundedGISElement
getBoundingBox, 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, 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, toMap, toMap, toString
-
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.gis.primitive.FlagContainer
getFlags, hasFlag, setFlag, switchFlag, unsetFlag
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISContentElement
getContainer, getTopContainer, setContainer
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISElement
copyAttributes, hashKey
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
getGeoId
-
Methods inherited from interface org.arakhne.afc.gis.road.primitive.RoadSegment
contains, contains, depthIterator, distance, distanceToEnd, distanceToEnd, getBoundingBox, getGeoLocation, getLength, getNearestPosition, getNearestPosition, getNearestPositionOnBorder, getPointAt, getPointCount, getUUID, intersects, pointIterator, points, toPath2D, toPath2D, toPath2D, toPath2D
-
-
-
-
Constructor Detail
-
RoadPolyline
public RoadPolyline()
Create a new road segment.
-
RoadPolyline
public RoadPolyline(AttributeCollection attributeProvider)
Create a new road segment.- Parameters:
attributeProvider
- is the attribute provider associated to this segment.
-
RoadPolyline
public RoadPolyline(UUID id)
Create a new road segment.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.- Since:
- 4.0
-
RoadPolyline
public RoadPolyline(UUID id, AttributeCollection attributeProvider)
Create a new road segment.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeProvider
- is the attribute provider associated to this segment.- 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 classMapPolyline
- Parameters:
buffer
- the Json buffer.
-
clone
@Pure public RoadPolyline clone()
Clone this object to obtain a valid copy.- Specified by:
clone
in interfaceAttributeCollection
- Specified by:
clone
in interfaceAttributeProvider
- Specified by:
clone
in interfaceGISCloneable<MapElement>
- Specified by:
clone
in interfaceGISElement
- Specified by:
clone
in interfaceRoadSegment
- Overrides:
clone
in classMapComposedElement
- Returns:
- a copy
-
equals
@Pure public boolean equals(Object element)
Description copied from class:MapElement
Replies if the specified objects is the same as this one.- Overrides:
equals
in classMapElement
-
getPointFusionValidator
@Pure public PointFusionValidator getPointFusionValidator()
Description copied from class:MapComposedElement
Replies the validator that is able to detect points at the same location.The validator provided by MapComposedElement is based on
Tuple2D.epsilonEquals(org.arakhne.afc.math.geometry.d2.Tuple2D, double)
. Subclasses should override this function to provide specifical implementation of a validator.- Overrides:
getPointFusionValidator
in classMapComposedElement
- Returns:
- the validator, never
null
-
getRoadNetwork
@Pure public StandardRoadNetwork getRoadNetwork()
Description copied from interface:RoadSegment
Replies the road network that contains this segment.- Specified by:
getRoadNetwork
in interfaceRoadSegment
- Returns:
- the road network that contains this segment.
-
setRoadNetwork
void setRoadNetwork(StandardRoadNetwork network)
Set the road network that contains this segment.- Parameters:
network
- the network.
-
getOtherSidePoint
@Pure public RoadConnection getOtherSidePoint(RoadConnection ref_point)
Description copied from interface:GraphSegment
Replies the point at the other side of the segment.- Specified by:
getOtherSidePoint
in interfaceGraphSegment<RoadSegment,RoadConnection>
- Specified by:
getOtherSidePoint
in interfaceRoadSegment
- Parameters:
ref_point
- the reference point.- Returns:
- the point at the other side of the segment.
-
getBeginPoint
@Pure public RoadConnection getBeginPoint()
Description copied from interface:GraphSegment
Replies the starting point of this segment.- Specified by:
getBeginPoint
in interfaceGraphSegment<RoadSegment,RoadConnection>
- Specified by:
getBeginPoint
in interfaceRoadSegment
- Returns:
- the starting point of this segment.
-
getBeginPoint
@Pure <CT extends RoadConnection> CT getBeginPoint(Class<CT> connectionClass)
Replies the first point of this segment.- Type Parameters:
CT
- is the type of the connection to reply- Parameters:
connectionClass
- is the type of the connection to reply- Returns:
- the first point of
null
-
getEndPoint
@Pure public RoadConnection getEndPoint()
Description copied from interface:GraphSegment
Replies the ending point of this segment.- Specified by:
getEndPoint
in interfaceGraphSegment<RoadSegment,RoadConnection>
- Specified by:
getEndPoint
in interfaceRoadSegment
- Returns:
- the ending point of this segment.
-
getEndPoint
@Pure <CT extends RoadConnection> CT getEndPoint(Class<CT> connectionClass)
Replies the last connection point of this segment.- Type Parameters:
CT
- is the type of the connection to reply- Parameters:
connectionClass
- is the type of the connection to reply- Returns:
- the last point of
null
-
getNearestPoint
@Pure <CT extends RoadConnection> CT getNearestPoint(Class<CT> connectionClass, double x, double y)
Replies the nearest start/end point to the specified point.- Type Parameters:
CT
- is the type of the connection to reply- Parameters:
connectionClass
- is the type of the connection to replyx
- x coordinate.y
- y coordinate.- Returns:
- the nearest point
-
getNearestPoint
@Pure <CT extends RoadConnection> CT getNearestPoint(Class<CT> connectionClass, double x, double y, OutputParameter<Double> distance)
Replies the nearest start/end point to the specified point.- Type Parameters:
CT
- is the type of the connection to reply- Parameters:
connectionClass
- is the type of the connection to replyx
- x coordinate.y
- y coordinate.distance
- is the distance between the given point and the start/end point.- Returns:
- the nearest point
-
getAntepenulvianPoint
@Pure public Point2d getAntepenulvianPoint()
Description copied from interface:RoadSegment
Replies the coordinates of the antepenulvian (before last) point.- Specified by:
getAntepenulvianPoint
in interfaceRoadSegment
- Returns:
- the coordinates of the antepenulvian (before last) point.
-
getFirstPoint
@Pure public Point2d getFirstPoint()
Description copied from interface:Segment1D
Replies the 2D cooordinate of the first point of the segment.- Specified by:
getFirstPoint
in interfaceRoadSegment
- Specified by:
getFirstPoint
in interfaceSegment1D<Point2d,Vector2d>
- Returns:
- the 2D coordinate or
null
if 2D mapping is impossible.
-
getLastPoint
@Pure public Point2d getLastPoint()
Description copied from interface:Segment1D
Replies the 2D cooordinates of the last point of the segment.- Specified by:
getLastPoint
in interfaceRoadSegment
- Specified by:
getLastPoint
in interfaceSegment1D<Point2d,Vector2d>
- Returns:
- the 2D coordinates or
null
if 2D mapping is impossible.
-
invert
public RoadPolyline invert()
Description copied from class:MapComposedElement
Invert the order of points coordinates of this element and reorder the groupIndex too.NOTE: invert each parts with
MapComposedElement.invertPointsIn(int)
does'nt produce the same result asMapComposedElement.invert()
This method invert points coordinates AND start index of parts to keep the logical order of points this method is reversible
this.invert() == this.invert().invert()
- Overrides:
invert
in classMapComposedElement
- Returns:
- the inverted element
-
invertPointsIn
public RoadPolyline invertPointsIn(int groupIndex)
Description copied from class:MapComposedElement
invert the points coordinates of this element on the groupIndex in argument.This method is reversible:
this.invertPointsIn(sameIndex) == this.invertPointsIn(sameIndex).invertPointsIn(sameIndex)
NOTE: invert each parts with
MapComposedElement.invertPointsIn(int)
does'nt produce the same result asMapComposedElement.invert()
.This method invert points coordinates only. this.invertPointsIn(0 .. indexCount) != this.invert()
- Overrides:
invertPointsIn
in classMapComposedElement
- Parameters:
groupIndex
- int element on which invert points- Returns:
- this
-
isConnectedTo
@Pure public boolean isConnectedTo(RoadSegment otherSegment)
Description copied from interface:RoadSegment
Replies if this segment is connected to the specified segment.- Specified by:
isConnectedTo
in interfaceRoadSegment
- Parameters:
otherSegment
- a segment.- Returns:
true
if this segment is connected to the given one, otherwisefalse
-
isTraversableFrom
@Pure public boolean isTraversableFrom(RoadConnection point)
Description copied from interface:RoadSegment
Replies if this road segment is traversable from the given point.If the given point is not the start point nor the end point, then this function replies
false
.- Specified by:
isTraversableFrom
in interfaceRoadSegment
- Parameters:
point
- a point.- Returns:
true
if this segment is traversable starting from the given point; otherwisefalse
.
-
getTrafficDirection
@Pure public TrafficDirection getTrafficDirection()
Description copied from interface:RoadSegment
Replies the traffic direction on this road segment.- Specified by:
getTrafficDirection
in interfaceRoadSegment
- Returns:
- the traffic direction
-
setTrafficDirection
public void setTrafficDirection(TrafficDirection direction)
Description copied from interface:RoadSegment
Set the traffic direction on this road segment.- Specified by:
setTrafficDirection
in interfaceRoadSegment
- Parameters:
direction
- is the new traffic direction. Ifnull
, the default traffic direction will be set.
-
getRoadType
@Pure public RoadType getRoadType()
Description copied from interface:RoadSegment
Replies the type of the road segment.- Specified by:
getRoadType
in interfaceRoadSegment
- Returns:
- the type of the road segment.
-
setRoadType
public void setRoadType(RoadType type)
Description copied from interface:RoadSegment
Set the type of the road segment.- Specified by:
setRoadType
in interfaceRoadSegment
- Parameters:
type
- is the type of the road segment.
-
getRoadNumber
@Pure public String getRoadNumber()
Description copied from interface:RoadSegment
Replies the number of the road segment.- Specified by:
getRoadNumber
in interfaceRoadSegment
- Returns:
- the number of the road segment.
-
setRoadNumber
public void setRoadNumber(String number)
Description copied from interface:RoadSegment
Set the number of the road segment.- Specified by:
setRoadNumber
in interfaceRoadSegment
- Parameters:
number
- is the number of the road segment.
-
getName
@Pure public String getName()
Description copied from interface:GISElement
Replies the name of the element.- Specified by:
getName
in interfaceGISEditable
- Specified by:
getName
in interfaceGISElement
- Specified by:
getName
in interfaceRoadSegment
- Overrides:
getName
in classAbstractGISElement<GISElementContainer<?>,MapElement>
- Returns:
- the name
-
setName
public void setName(String name)
Description copied from interface:GISElement
Set the name of the element.- Specified by:
setName
in interfaceGISEditable
- Specified by:
setName
in interfaceGISElement
- Specified by:
setName
in interfaceRoadSegment
- Overrides:
setName
in classAbstractGISElement<GISElementContainer<?>,MapElement>
- Parameters:
name
- the new name.
-
getSharedConnectionWith
@Pure public RoadConnection getSharedConnectionWith(RoadSegment otherSegment)
Description copied from interface:RoadSegment
Replies the shared connection between this segment and the specified one.- Specified by:
getSharedConnectionWith
in interfaceRoadSegment
- Parameters:
otherSegment
- a segment.- Returns:
- a shared connection if the two segments are connected, otherwise
null
-
getDistanceFromStart
@Pure public double getDistanceFromStart(double ratio)
Description copied from interface:RoadSegment
Replies the distance from the starting point.- Specified by:
getDistanceFromStart
in interfaceRoadSegment
- Parameters:
ratio
- is the position on the segment.0
for the starting point and1
for the ending point.- Returns:
- the distance
-
getDistanceToEnd
@Pure public double getDistanceToEnd(double ratio)
Description copied from interface:RoadSegment
Replies the distance to the ending point.- Specified by:
getDistanceToEnd
in interfaceRoadSegment
- Parameters:
ratio
- is the position on the segment.0
for the starting point and1
for the ending point.- Returns:
- the distance
-
getTangentAt
@Pure public Vector2d getTangentAt(double positionOnSegment)
Description copied from interface:Segment1D
Replies the 2D tangent at the position on the segment.- Specified by:
getTangentAt
in interfaceSegment1D<Point2d,Vector2d>
- Parameters:
positionOnSegment
- is the position on the segment (in0..length
).- Returns:
- the 2D tangent at the position on the segment.
-
projectsOnPlane
public void projectsOnPlane(double positionOnSegment, Point2D<?,?> position, Vector2D<?,?> tangent)
Description copied from interface:Segment1D
Replies the 2D position and the 2D tangent at the position on the segment.- Specified by:
projectsOnPlane
in interfaceSegment1D<Point2d,Vector2d>
- Parameters:
positionOnSegment
- is the position on the segment (in0..length
).position
- is the position to fill.tangent
- is the tangent to the segment at the given position.
-
projectsOnPlane
public void projectsOnPlane(double positionOnSegment, double shiftDistance, Point2D<?,?> position, Vector2D<?,?> tangent)
Description copied from interface:Segment1D
Replies the 2D position and the 2D tangent at the position on the segment.- Specified by:
projectsOnPlane
in interfaceSegment1D<Point2d,Vector2d>
- Parameters:
positionOnSegment
- is the position on the segment (in0..length
).shiftDistance
- is the distance that permits to shift the position from the segment.position
- is the position to fill.tangent
- is the tangent to the segment at the given position.
-
getGeoLocationForLocationRatio
@Pure public final Point2d getGeoLocationForLocationRatio(double ratio)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the location ratio. The location ratio is0
for the starting point and1
for the ending point.- Specified by:
getGeoLocationForLocationRatio
in interfaceRoadSegment
- Parameters:
ratio
- is the location ratio.- Returns:
- the location.
-
getGeoLocationForLocationRatio
@Pure public final Point2d getGeoLocationForLocationRatio(double ratio, double shifting)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the location ratio. The location ratio is0
for the starting point and1
for the ending point.The shifting value depends on the given 2D coordinate system.
- Specified by:
getGeoLocationForLocationRatio
in interfaceRoadSegment
- Parameters:
ratio
- is the location ratio.shifting
- is the shifting distance.- Returns:
- the geo-location.
-
getGeoLocationForLocationRatio
@Pure public final void getGeoLocationForLocationRatio(double ratio, Point2D<?,?> geoLocation)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the location ratio. The location ratio is0
for the starting point and1
for the ending point.- Specified by:
getGeoLocationForLocationRatio
in interfaceRoadSegment
- Parameters:
ratio
- is the location ratio.geoLocation
- is the point to set with geo-localized coordinates.
-
getGeoLocationForLocationRatio
@Pure public final void getGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> geoLocation)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the location ratio. The location ratio is0
for the starting point and1
for the ending point.The shifting value depends on the given 2D coordinate system.
- Specified by:
getGeoLocationForLocationRatio
in interfaceRoadSegment
- Parameters:
ratio
- is the location ratio.shifting
- is the shifting distance.geoLocation
- is the point to set with geo-localized coordinates.
-
getGeoLocationForLocationRatio
@Pure public final Point2d getGeoLocationForLocationRatio(double ratio, double shifting, Vector2D<?,?> tangent)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the location ratio. The location ratio is0
for the starting point and1
for the ending point.- Specified by:
getGeoLocationForLocationRatio
in interfaceRoadSegment
- Parameters:
ratio
- is the location ratio.shifting
- is the shifting distance.tangent
- is the vector which will be set by the coordinates of the tangent at the replied point. Ifnull
the tangent will not be computed.- Returns:
- the geo-location.
-
getGeoLocationForLocationRatio
@Pure public final void getGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> output, Vector2D<?,?> tangent)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the location ratio. The location ratio is0
for the starting point and1
for the ending point.- Specified by:
getGeoLocationForLocationRatio
in interfaceRoadSegment
- Parameters:
ratio
- is the location ratio.shifting
- is the shifting distance.output
- is the point to set with geo-localized coordinates.tangent
- is the vector which will be set by the coordinates of the tangent at the replied point. Ifnull
the tangent will not be computed.
-
getGeoLocationForDistance
@Pure public final Point2d getGeoLocationForDistance(double desired_distance)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andRoadSegment.getLength()
for the ending point.- Specified by:
getGeoLocationForDistance
in interfaceRoadSegment
- Parameters:
desired_distance
- is the distance for which the geo location must be computed.- Returns:
- the geo-location.
-
getGeoLocationForDistance
@Pure public final Point2d getGeoLocationForDistance(double desired_distance, double shifting)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andRoadSegment.getLength()
for the ending point.- Specified by:
getGeoLocationForDistance
in interfaceRoadSegment
- Parameters:
desired_distance
- is the distance for which the geo location must be computed.shifting
- is the shifting distance.- Returns:
- the geo-location.
-
getGeoLocationForDistance
@Pure public Point2d getGeoLocationForDistance(double desired_distance, double shifting, Vector2D<?,?> tangent)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andRoadSegment.getLength()
for the ending point.- Specified by:
getGeoLocationForDistance
in interfaceRoadSegment
- Parameters:
desired_distance
- is the distance for which the geo location must be computed.shifting
- is the shifting distance.tangent
- is the vector which will be set by the coordinates of the tangent at the replied point. Ifnull
the tangent will not be computed.- Returns:
- the geo-location.
-
getGeoLocationForDistance
@Pure public final void getGeoLocationForDistance(double desired_distance, Point2D<?,?> geoLocation)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andRoadSegment.getLength()
for the ending point.- Specified by:
getGeoLocationForDistance
in interfaceRoadSegment
- Parameters:
desired_distance
- is the distance for which the geo location must be computed.geoLocation
- is the point to set with geo-localized coordinates.
-
getGeoLocationForDistance
@Pure public final void getGeoLocationForDistance(double desired_distance, double shifting, Point2D<?,?> geoLocation)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andRoadSegment.getLength()
for the ending point.- Specified by:
getGeoLocationForDistance
in interfaceRoadSegment
- Parameters:
desired_distance
- is the distance for which the geo location must be computed.shifting
- is the shifting distance.geoLocation
- is the point to set with geo-localized coordinates.
-
getGeoLocationForDistance
@Pure public void getGeoLocationForDistance(double desired_distance, double shifting, Point2D<?,?> geoLocation, Vector2D<?,?> tangent)
Description copied from interface:RoadSegment
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andRoadSegment.getLength()
for the ending point.- Specified by:
getGeoLocationForDistance
in interfaceRoadSegment
- Parameters:
desired_distance
- is the distance for which the geo location must be computed.shifting
- is the shifting distance.geoLocation
- is the point to set with geo-localized coordinates.tangent
- is the vector which will be set by the coordinates of the tangent at the replied point. Ifnull
the tangent will not be computed.
-
setStartPoint
void setStartPoint(StandardRoadConnection desiredConnection)
Move the start point of a road segment.This function forces the start point of the given segment to correspond to the specified connection point even if the original start point was not near the connection point.
- Parameters:
desiredConnection
- the connection.
-
setEndPoint
void setEndPoint(StandardRoadConnection desiredConnection)
Move the end point of a road segment.This function forces the end point of the given segment to correspond to the specified connection point even if the original end point was not near the connection point.
- Parameters:
desiredConnection
- the connection.
-
getSegmentChain
@Pure public List<RoadSegment> getSegmentChain()
Description copied from interface:RoadSegment
Replies a list of chained road segments without any cross-road which contains this road segment.- Specified by:
getSegmentChain
in interfaceRoadSegment
- Returns:
- a list of road segments.
-
getSegmentChain
@Pure public List<RoadSegment> getSegmentChain(boolean forward_search, boolean backward_search)
Description copied from interface:RoadSegment
Replies a list of chained road segments without any cross-road which contains this road segment.- Specified by:
getSegmentChain
in interfaceRoadSegment
- Parameters:
forward_search
- must betrue
to search the chain's segments in the forward direction for this road segment.backward_search
- must betrue
to search the chain's segments in the backward direction for this road segment.- Returns:
- a list of road segments.
-
depthIterator
@Pure public GraphIterator<RoadSegment,RoadConnection> depthIterator(double depth, double position_from_starting_point, RoadConnection starting_point, boolean allowManyReplies, boolean assumeOrientedSegments, DynamicDepthUpdater<RoadSegment,RoadConnection> dynamicDepthUpdate)
Description copied from interface:RoadSegment
Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point. If the specified starting point is not one of the ends of th segment, this function assumes to start from the point replied byRoadSegment.getBeginPoint()
.- Specified by:
depthIterator
in interfaceRoadSegment
- Parameters:
depth
- is the maximal depth to reach (in meters).position_from_starting_point
- is the starting position from the starting_point (in meters).starting_point
- is the point from which the iteration must start.allowManyReplies
- may betrue
to allow to reply many times the same segment, otherwisefalse
.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.dynamicDepthUpdate
- if notnull
, it is invoked to dynamically update thedepth
.- Returns:
- an iterator
- See Also:
RoadSegment.depthIterator(double, double, RoadConnection, boolean, boolean)
-
iterator
@Pure public GraphIterator<RoadSegment,RoadConnection> iterator(RoadConnection starting_point, boolean allowManyReplies, boolean assumeOrientedSegments)
Description copied from interface:RoadSegment
Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point. If the specified starting point is not one of the ends of th segment, this function assumes to start from the point replied byRoadSegment.getBeginPoint()
.- Specified by:
iterator
in interfaceRoadSegment
- Parameters:
starting_point
- is the point from which the iteration must start.allowManyReplies
- istrue
to allow cycles during iterations, otherwisefalse
assumeOrientedSegments
- indicates if the iterator is taking into account the orientation of the road segments. Iftrue
it assumes that a segment could be reached by both its end points. Iffalse
it assumes that a segment could be reach only one time. This parameter is used only when allowManyReplies was set totrue
.- Returns:
- an iterator
-
iterator
@Pure public GraphIterator<RoadSegment,RoadConnection> iterator()
Description copied from interface:RoadSegment
Replies an iterator that permits to move along the road segment's graph starting from this road segment and from the specified starting point. This function assumes to start from the point replied byRoadSegment.getBeginPoint()
. This function does not allow the cycles during the iterations.- Specified by:
iterator
in interfaceRoadSegment
- Returns:
- an iterator
-
isFirstPointConnectedTo
@Pure public boolean isFirstPointConnectedTo(Segment1D<?,?> segment)
Description copied from interface:Segment1D
Replies if this segment is connected to the specified segment by its first point.- Specified by:
isFirstPointConnectedTo
in interfaceSegment1D<Point2d,Vector2d>
- Parameters:
segment
- is the segment to match.- Returns:
true
if this segment is connected to the given one, otherwisefalse
.
-
isLastPointConnectedTo
@Pure public boolean isLastPointConnectedTo(Segment1D<?,?> segment)
Description copied from interface:Segment1D
Replies if this segment is connected to the specified segment by its last point.- Specified by:
isLastPointConnectedTo
in interfaceSegment1D<Point2d,Vector2d>
- Parameters:
segment
- is the segment to match.- Returns:
true
if this segment is connected to the given one, otherwisefalse
.
-
addUserData
public void addUserData(String id, Object data)
Description copied from interface:RoadSegment
Add an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
addUserData
in interfaceRoadSegment
- Parameters:
id
- is the identifier of the groupdata
- is the data to insert in the group
-
setUserData
public void setUserData(String id, Object data)
Description copied from interface:RoadSegment
Set an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
setUserData
in interfaceRoadSegment
- Parameters:
id
- is the identifier of the groupdata
- is the data to insert in the group
-
removeUserData
public boolean removeUserData(String id, Object data)
Description copied from interface:RoadSegment
Remove an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
removeUserData
in interfaceRoadSegment
- Parameters:
id
- is the identifier of the groupdata
- is the data to remove from the group- Returns:
true
if the data was removed, otherwisefalse
.
-
clearUserData
public void clearUserData(String id)
Description copied from interface:RoadSegment
Clear all the data from a group.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
clearUserData
in interfaceRoadSegment
- Parameters:
id
- is the identifier of the group
-
clearUserData
public void clearUserData()
Description copied from interface:RoadSegment
Clear all the data from all the groups.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
clearUserData
in interfaceRoadSegment
-
getUserData
@Pure public <T> T getUserData(String id)
Description copied from interface:RoadSegment
Replies an user data associated to this segment.The user data are not stored as attributes because they are assumed as transient.
- Specified by:
getUserData
in interfaceRoadSegment
- Type Parameters:
T
- is the type of the data to reply- Parameters:
id
- is the identifier of the group- Returns:
- the first data in the group or
null
.
-
getUserDataCollection
@Pure public <T> Collection<? extends T> getUserDataCollection(String id)
Description copied from interface:RoadSegment
Replies the user data associated to this segment.The user data are not stored as attributes because they are assumed as transient.
- Specified by:
getUserDataCollection
in interfaceRoadSegment
- Type Parameters:
T
- is the type of the data to reply- Parameters:
id
- is the identifier of the group- Returns:
- the list of the user data in the group, never
null
.
-
hasUserData
@Pure public boolean hasUserData(String id)
Description copied from interface:RoadSegment
Replies if at least one user data is associated to the given identifier.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
hasUserData
in interfaceRoadSegment
- Parameters:
id
- is the identifier of the group- Returns:
true
if one user data exists, otherwisefalse
-
containsUserData
@Pure public boolean containsUserData(String id, Object data)
Description copied from interface:RoadSegment
Replies if the given one user data is associated to the given identifier.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
containsUserData
in interfaceRoadSegment
- Parameters:
id
- is the identifier of the groupdata
- is the data to insert in the group- Returns:
true
if the user data exists, otherwisefalse
-
getLaneCount
@Pure public int getLaneCount()
Description copied from interface:RoadSegment
Replies the count of lanes on this road segment.- Specified by:
getLaneCount
in interfaceRoadSegment
- Returns:
- the count of lanes on this road segment.
-
getWidth
@Pure public double getWidth()
Description copied from class:MapPolyline
Returns the poly-element width in the geo-located referencial. The width is the distance between the border lines of the polyline.The implementation provided by the MapPolyline class always replies 1 meter. The function
MapPolyline.getWidth()
must be overrided to provide other way to compute the width the polyelements.- Specified by:
getWidth
in interfaceRoadSegment
- Overrides:
getWidth
in classMapPolyline
- Returns:
- the width of the poly-element in meters.
-
setWidth
public void setWidth(double width)
Description copied from interface:RoadSegment
Set the road width in the geo-located referencial. The width is the distance between the border lines of the road.- Specified by:
setWidth
in interfaceRoadSegment
- Parameters:
width
- is the width of the road in meters.
-
distance
@Pure public final double distance(Point2D<?,?> point)
Description copied from interface:RoadSegment
Replies the distance between this MapElement and point.- Specified by:
distance
in interfaceRoadSegment
- Parameters:
point
- a point- Returns:
- the distance. Could be negative depending of the implementation type.
-
getLaneSize
@Pure public double getLaneSize(int laneIndex)
Description copied from interface:RoadSegment
Replies the size of the lane at the given index.The lane order is influence by the side-rule of the road network, which is replied by
RoadNetwork.isLeftSidedTrafficDirection()
or byRoadNetwork.isRightSidedTrafficDirection()
: if left-sided the left-most lane has index 0, if right-sided the right-most lane has index 0.- Specified by:
getLaneSize
in interfaceRoadSegment
- Parameters:
laneIndex
- the lane index.- Returns:
- the size of the lane in meters
-
getLaneCenter
@Pure public double getLaneCenter(int laneIndex)
Description copied from interface:RoadSegment
Replies the center line of the lane at the given index.The center is given by the jutting distance from the road segment center to the center of the lane.
The lane order is influence by the side-rule of the road network, which is replied by
RoadNetwork.isLeftSidedTrafficDirection()
or byRoadNetwork.isRightSidedTrafficDirection()
: if left-sided the left-most lane has index 0, if right-sided the right-most lane has index 0.- Specified by:
getLaneCenter
in interfaceRoadSegment
- Parameters:
laneIndex
- the lane index.- Returns:
- shift distance from the segment's center to the lane center.
-
getRoadBorderDistance
@Pure public double getRoadBorderDistance()
Description copied from interface:RoadSegment
Replies the distance to the road border according to the driving side on the road.This function is similar to calls to
{@link #getWidth()} / 2
but with a big difference: the previous expression is always positive, the value returned bygetRoadBorderDistance()
has a positive or negative sign depending on theside where cars are running
.- Specified by:
getRoadBorderDistance
in interfaceRoadSegment
- Returns:
- shift distance from the segment's center to the road border.
-
getLaneDirection
@Pure public Direction1D getLaneDirection(int laneIndex)
Description copied from interface:RoadSegment
Replies the direction of the lane at the given index.The lane order is influence by the side-rule of the road network, which is replied by
RoadNetwork.isLeftSidedTrafficDirection()
or byRoadNetwork.isRightSidedTrafficDirection()
: if left-sided the left-most lane has index 0, if right-sided the right-most lane has index 0.- Specified by:
getLaneDirection
in interfaceRoadSegment
- Parameters:
laneIndex
- the lane index.- Returns:
- the count of lanes on this road segment.
-
getWrappedRoadSegment
@Pure public RoadSegment getWrappedRoadSegment()
Description copied from interface:RoadSegment
Replies the wrapped road segment if this object is a wrapper to another road segment. If this object is not a wrapper to another road segment, relies this object iteself.- Specified by:
getWrappedRoadSegment
in interfaceRoadSegment
- Returns:
- the wrapped road segment or this road segment itself.
-
toSegment1D
@Pure protected final Segment1D<?,?> toSegment1D()
Description copied from class:MapPolyline
Replies the Segment1D representation of this object.- Overrides:
toSegment1D
in classMapPolyline
- Returns:
- the Segment1D, never
null
.
-
-