-
- 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 voidaddUserData(String id, Object data)Add an user data associated to this segment.voidclearUserData()Clear all the data from all the groups.voidclearUserData(String id)Clear all the data from a group.RoadPolylineclone()Clone this object to obtain a valid copy.booleancontainsUserData(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.doubledistance(Point2D<?,?> point)Replies the distance between this MapElement and point.booleanequals(Object element)Replies if the specified objects is the same as this one.Point2dgetAntepenulvianPoint()Replies the coordinates of the antepenulvian (before last) point.RoadConnectiongetBeginPoint()Replies the starting point of this segment.(package private) <CT extends RoadConnection>
CTgetBeginPoint(Class<CT> connectionClass)Replies the first point of this segment.doublegetDistanceFromStart(double ratio)Replies the distance from the starting point.doublegetDistanceToEnd(double ratio)Replies the distance to the ending point.RoadConnectiongetEndPoint()Replies the ending point of this segment.(package private) <CT extends RoadConnection>
CTgetEndPoint(Class<CT> connectionClass)Replies the last connection point of this segment.Point2dgetFirstPoint()Replies the 2D cooordinate of the first point of the segment.Point2dgetGeoLocationForDistance(double desired_distance)Replies the geo-location of the point described by the specified distance.Point2dgetGeoLocationForDistance(double desired_distance, double shifting)Replies the geo-location of the point described by the specified distance.voidgetGeoLocationForDistance(double desired_distance, double shifting, Point2D<?,?> geoLocation)Replies the geo-location of the point described by the specified distance.voidgetGeoLocationForDistance(double desired_distance, double shifting, Point2D<?,?> geoLocation, Vector2D<?,?> tangent)Replies the geo-location of the point described by the specified distance.Point2dgetGeoLocationForDistance(double desired_distance, double shifting, Vector2D<?,?> tangent)Replies the geo-location of the point described by the specified distance.voidgetGeoLocationForDistance(double desired_distance, Point2D<?,?> geoLocation)Replies the geo-location of the point described by the specified distance.Point2dgetGeoLocationForLocationRatio(double ratio)Replies the geo-location of the point described by the location ratio.Point2dgetGeoLocationForLocationRatio(double ratio, double shifting)Replies the geo-location of the point described by the location ratio.voidgetGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> geoLocation)Replies the geo-location of the point described by the location ratio.voidgetGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> output, Vector2D<?,?> tangent)Replies the geo-location of the point described by the location ratio.Point2dgetGeoLocationForLocationRatio(double ratio, double shifting, Vector2D<?,?> tangent)Replies the geo-location of the point described by the location ratio.voidgetGeoLocationForLocationRatio(double ratio, Point2D<?,?> geoLocation)Replies the geo-location of the point described by the location ratio.doublegetLaneCenter(int laneIndex)Replies the center line of the lane at the given index.intgetLaneCount()Replies the count of lanes on this road segment.Direction1DgetLaneDirection(int laneIndex)Replies the direction of the lane at the given index.doublegetLaneSize(int laneIndex)Replies the size of the lane at the given index.Point2dgetLastPoint()Replies the 2D cooordinates of the last point of the segment.StringgetName()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.RoadConnectiongetOtherSidePoint(RoadConnection ref_point)Replies the point at the other side of the segment.PointFusionValidatorgetPointFusionValidator()Replies the validator that is able to detect points at the same location.doublegetRoadBorderDistance()Replies the distance to the road border according to the driving side on the road.StandardRoadNetworkgetRoadNetwork()Replies the road network that contains this segment.StringgetRoadNumber()Replies the number of the road segment.RoadTypegetRoadType()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.RoadConnectiongetSharedConnectionWith(RoadSegment otherSegment)Replies the shared connection between this segment and the specified one.Vector2dgetTangentAt(double positionOnSegment)Replies the 2D tangent at the position on the segment.TrafficDirectiongetTrafficDirection()Replies the traffic direction on this road segment.<T> TgetUserData(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.doublegetWidth()Returns the poly-element width in the geo-located referencial.RoadSegmentgetWrappedRoadSegment()Replies the wrapped road segment if this object is a wrapper to another road segment.booleanhasUserData(String id)Replies if at least one user data is associated to the given identifier.RoadPolylineinvert()Invert the order of points coordinates of this element and reorder the groupIndex too.RoadPolylineinvertPointsIn(int groupIndex)invert the points coordinates of this element on the groupIndex in argument.booleanisConnectedTo(RoadSegment otherSegment)Replies if this segment is connected to the specified segment.booleanisFirstPointConnectedTo(Segment1D<?,?> segment)Replies if this segment is connected to the specified segment by its first point.booleanisLastPointConnectedTo(Segment1D<?,?> segment)Replies if this segment is connected to the specified segment by its last point.booleanisTraversableFrom(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.voidprojectsOnPlane(double positionOnSegment, double shiftDistance, Point2D<?,?> position, Vector2D<?,?> tangent)Replies the 2D position and the 2D tangent at the position on the segment.voidprojectsOnPlane(double positionOnSegment, Point2D<?,?> position, Vector2D<?,?> tangent)Replies the 2D position and the 2D tangent at the position on the segment.booleanremoveUserData(String id, Object data)Remove an user data associated to this segment.(package private) voidsetEndPoint(StandardRoadConnection desiredConnection)Move the end point of a road segment.voidsetName(String name)Set the name of the element.(package private) voidsetRoadNetwork(StandardRoadNetwork network)Set the road network that contains this segment.voidsetRoadNumber(String number)Set the number of the road segment.voidsetRoadType(RoadType type)Set the type of the road segment.(package private) voidsetStartPoint(StandardRoadConnection desiredConnection)Move the start point of a road segment.voidsetTrafficDirection(TrafficDirection direction)Set the traffic direction on this road segment.voidsetUserData(String id, Object data)Set an user data associated to this segment.voidsetWidth(double width)Set the road width in the geo-located referencial.voidtoJson(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, ornullif 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, ornullif 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:JsonableObjectReplies the Json representation of this node.- Specified by:
toJsonin interfaceJsonableObject- Overrides:
toJsonin classMapPolyline- Parameters:
buffer- the Json buffer.
-
clone
@Pure public RoadPolyline clone()
Clone this object to obtain a valid copy.- Specified by:
clonein interfaceAttributeCollection- Specified by:
clonein interfaceAttributeProvider- Specified by:
clonein interfaceGISCloneable<MapElement>- Specified by:
clonein interfaceGISElement- Specified by:
clonein interfaceRoadSegment- Overrides:
clonein classMapComposedElement- Returns:
- a copy
-
equals
@Pure public boolean equals(Object element)
Description copied from class:MapElementReplies if the specified objects is the same as this one.- Overrides:
equalsin classMapElement
-
getPointFusionValidator
@Pure public PointFusionValidator getPointFusionValidator()
Description copied from class:MapComposedElementReplies 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:
getPointFusionValidatorin classMapComposedElement- Returns:
- the validator, never
null
-
getRoadNetwork
@Pure public StandardRoadNetwork getRoadNetwork()
Description copied from interface:RoadSegmentReplies the road network that contains this segment.- Specified by:
getRoadNetworkin 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:GraphSegmentReplies the point at the other side of the segment.- Specified by:
getOtherSidePointin interfaceGraphSegment<RoadSegment,RoadConnection>- Specified by:
getOtherSidePointin 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:GraphSegmentReplies the starting point of this segment.- Specified by:
getBeginPointin interfaceGraphSegment<RoadSegment,RoadConnection>- Specified by:
getBeginPointin 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:GraphSegmentReplies the ending point of this segment.- Specified by:
getEndPointin interfaceGraphSegment<RoadSegment,RoadConnection>- Specified by:
getEndPointin 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:RoadSegmentReplies the coordinates of the antepenulvian (before last) point.- Specified by:
getAntepenulvianPointin interfaceRoadSegment- Returns:
- the coordinates of the antepenulvian (before last) point.
-
getFirstPoint
@Pure public Point2d getFirstPoint()
Description copied from interface:Segment1DReplies the 2D cooordinate of the first point of the segment.- Specified by:
getFirstPointin interfaceRoadSegment- Specified by:
getFirstPointin interfaceSegment1D<Point2d,Vector2d>- Returns:
- the 2D coordinate or
nullif 2D mapping is impossible.
-
getLastPoint
@Pure public Point2d getLastPoint()
Description copied from interface:Segment1DReplies the 2D cooordinates of the last point of the segment.- Specified by:
getLastPointin interfaceRoadSegment- Specified by:
getLastPointin interfaceSegment1D<Point2d,Vector2d>- Returns:
- the 2D coordinates or
nullif 2D mapping is impossible.
-
invert
public RoadPolyline invert()
Description copied from class:MapComposedElementInvert 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:
invertin classMapComposedElement- Returns:
- the inverted element
-
invertPointsIn
public RoadPolyline invertPointsIn(int groupIndex)
Description copied from class:MapComposedElementinvert 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:
invertPointsInin classMapComposedElement- Parameters:
groupIndex- int element on which invert points- Returns:
- this
-
isConnectedTo
@Pure public boolean isConnectedTo(RoadSegment otherSegment)
Description copied from interface:RoadSegmentReplies if this segment is connected to the specified segment.- Specified by:
isConnectedToin interfaceRoadSegment- Parameters:
otherSegment- a segment.- Returns:
trueif this segment is connected to the given one, otherwisefalse
-
isTraversableFrom
@Pure public boolean isTraversableFrom(RoadConnection point)
Description copied from interface:RoadSegmentReplies 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:
isTraversableFromin interfaceRoadSegment- Parameters:
point- a point.- Returns:
trueif this segment is traversable starting from the given point; otherwisefalse.
-
getTrafficDirection
@Pure public TrafficDirection getTrafficDirection()
Description copied from interface:RoadSegmentReplies the traffic direction on this road segment.- Specified by:
getTrafficDirectionin interfaceRoadSegment- Returns:
- the traffic direction
-
setTrafficDirection
public void setTrafficDirection(TrafficDirection direction)
Description copied from interface:RoadSegmentSet the traffic direction on this road segment.- Specified by:
setTrafficDirectionin 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:RoadSegmentReplies the type of the road segment.- Specified by:
getRoadTypein interfaceRoadSegment- Returns:
- the type of the road segment.
-
setRoadType
public void setRoadType(RoadType type)
Description copied from interface:RoadSegmentSet the type of the road segment.- Specified by:
setRoadTypein interfaceRoadSegment- Parameters:
type- is the type of the road segment.
-
getRoadNumber
@Pure public String getRoadNumber()
Description copied from interface:RoadSegmentReplies the number of the road segment.- Specified by:
getRoadNumberin interfaceRoadSegment- Returns:
- the number of the road segment.
-
setRoadNumber
public void setRoadNumber(String number)
Description copied from interface:RoadSegmentSet the number of the road segment.- Specified by:
setRoadNumberin interfaceRoadSegment- Parameters:
number- is the number of the road segment.
-
getName
@Pure public String getName()
Description copied from interface:GISElementReplies the name of the element.- Specified by:
getNamein interfaceGISEditable- Specified by:
getNamein interfaceGISElement- Specified by:
getNamein interfaceRoadSegment- Overrides:
getNamein classAbstractGISElement<GISElementContainer<?>,MapElement>- Returns:
- the name
-
setName
public void setName(String name)
Description copied from interface:GISElementSet the name of the element.- Specified by:
setNamein interfaceGISEditable- Specified by:
setNamein interfaceGISElement- Specified by:
setNamein interfaceRoadSegment- Overrides:
setNamein classAbstractGISElement<GISElementContainer<?>,MapElement>- Parameters:
name- the new name.
-
getSharedConnectionWith
@Pure public RoadConnection getSharedConnectionWith(RoadSegment otherSegment)
Description copied from interface:RoadSegmentReplies the shared connection between this segment and the specified one.- Specified by:
getSharedConnectionWithin 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:RoadSegmentReplies the distance from the starting point.- Specified by:
getDistanceFromStartin interfaceRoadSegment- Parameters:
ratio- is the position on the segment.0for the starting point and1for the ending point.- Returns:
- the distance
-
getDistanceToEnd
@Pure public double getDistanceToEnd(double ratio)
Description copied from interface:RoadSegmentReplies the distance to the ending point.- Specified by:
getDistanceToEndin interfaceRoadSegment- Parameters:
ratio- is the position on the segment.0for the starting point and1for the ending point.- Returns:
- the distance
-
getTangentAt
@Pure public Vector2d getTangentAt(double positionOnSegment)
Description copied from interface:Segment1DReplies the 2D tangent at the position on the segment.- Specified by:
getTangentAtin 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:Segment1DReplies the 2D position and the 2D tangent at the position on the segment.- Specified by:
projectsOnPlanein 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:Segment1DReplies the 2D position and the 2D tangent at the position on the segment.- Specified by:
projectsOnPlanein 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:RoadSegmentReplies the geo-location of the point described by the location ratio. The location ratio is0for the starting point and1for the ending point.- Specified by:
getGeoLocationForLocationRatioin interfaceRoadSegment- Parameters:
ratio- is the location ratio.- Returns:
- the location.
-
getGeoLocationForLocationRatio
@Pure public final Point2d getGeoLocationForLocationRatio(double ratio, double shifting)
Description copied from interface:RoadSegmentReplies the geo-location of the point described by the location ratio. The location ratio is0for the starting point and1for the ending point.The shifting value depends on the given 2D coordinate system.
- Specified by:
getGeoLocationForLocationRatioin 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:RoadSegmentReplies the geo-location of the point described by the location ratio. The location ratio is0for the starting point and1for the ending point.- Specified by:
getGeoLocationForLocationRatioin 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:RoadSegmentReplies the geo-location of the point described by the location ratio. The location ratio is0for the starting point and1for the ending point.The shifting value depends on the given 2D coordinate system.
- Specified by:
getGeoLocationForLocationRatioin 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:RoadSegmentReplies the geo-location of the point described by the location ratio. The location ratio is0for the starting point and1for the ending point.- Specified by:
getGeoLocationForLocationRatioin 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. Ifnullthe 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:RoadSegmentReplies the geo-location of the point described by the location ratio. The location ratio is0for the starting point and1for the ending point.- Specified by:
getGeoLocationForLocationRatioin 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. Ifnullthe tangent will not be computed.
-
getGeoLocationForDistance
@Pure public final Point2d getGeoLocationForDistance(double desired_distance)
Description copied from interface:RoadSegmentReplies the geo-location of the point described by the specified distance. The desired distance is0for the starting point andRoadSegment.getLength()for the ending point.- Specified by:
getGeoLocationForDistancein 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:RoadSegmentReplies the geo-location of the point described by the specified distance. The desired distance is0for the starting point andRoadSegment.getLength()for the ending point.- Specified by:
getGeoLocationForDistancein 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:RoadSegmentReplies the geo-location of the point described by the specified distance. The desired distance is0for the starting point andRoadSegment.getLength()for the ending point.- Specified by:
getGeoLocationForDistancein 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. Ifnullthe tangent will not be computed.- Returns:
- the geo-location.
-
getGeoLocationForDistance
@Pure public final void getGeoLocationForDistance(double desired_distance, Point2D<?,?> geoLocation)Description copied from interface:RoadSegmentReplies the geo-location of the point described by the specified distance. The desired distance is0for the starting point andRoadSegment.getLength()for the ending point.- Specified by:
getGeoLocationForDistancein 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:RoadSegmentReplies the geo-location of the point described by the specified distance. The desired distance is0for the starting point andRoadSegment.getLength()for the ending point.- Specified by:
getGeoLocationForDistancein 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:RoadSegmentReplies the geo-location of the point described by the specified distance. The desired distance is0for the starting point andRoadSegment.getLength()for the ending point.- Specified by:
getGeoLocationForDistancein 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. Ifnullthe 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:RoadSegmentReplies a list of chained road segments without any cross-road which contains this road segment.- Specified by:
getSegmentChainin interfaceRoadSegment- Returns:
- a list of road segments.
-
getSegmentChain
@Pure public List<RoadSegment> getSegmentChain(boolean forward_search, boolean backward_search)
Description copied from interface:RoadSegmentReplies a list of chained road segments without any cross-road which contains this road segment.- Specified by:
getSegmentChainin interfaceRoadSegment- Parameters:
forward_search- must betrueto search the chain's segments in the forward direction for this road segment.backward_search- must betrueto 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:RoadSegmentReplies 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:
depthIteratorin 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 betrueto allow to reply many times the same segment, otherwisefalse.assumeOrientedSegments- may betrueto 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 isfalseto 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:RoadSegmentReplies 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:
iteratorin interfaceRoadSegment- Parameters:
starting_point- is the point from which the iteration must start.allowManyReplies- istrueto allow cycles during iterations, otherwisefalseassumeOrientedSegments- indicates if the iterator is taking into account the orientation of the road segments. Iftrueit assumes that a segment could be reached by both its end points. Iffalseit 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:RoadSegmentReplies 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:
iteratorin interfaceRoadSegment- Returns:
- an iterator
-
isFirstPointConnectedTo
@Pure public boolean isFirstPointConnectedTo(Segment1D<?,?> segment)
Description copied from interface:Segment1DReplies if this segment is connected to the specified segment by its first point.- Specified by:
isFirstPointConnectedToin interfaceSegment1D<Point2d,Vector2d>- Parameters:
segment- is the segment to match.- Returns:
trueif this segment is connected to the given one, otherwisefalse.
-
isLastPointConnectedTo
@Pure public boolean isLastPointConnectedTo(Segment1D<?,?> segment)
Description copied from interface:Segment1DReplies if this segment is connected to the specified segment by its last point.- Specified by:
isLastPointConnectedToin interfaceSegment1D<Point2d,Vector2d>- Parameters:
segment- is the segment to match.- Returns:
trueif this segment is connected to the given one, otherwisefalse.
-
addUserData
public void addUserData(String id, Object data)
Description copied from interface:RoadSegmentAdd an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
addUserDatain 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:RoadSegmentSet an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
setUserDatain 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:RoadSegmentRemove an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
removeUserDatain interfaceRoadSegment- Parameters:
id- is the identifier of the groupdata- is the data to remove from the group- Returns:
trueif the data was removed, otherwisefalse.
-
clearUserData
public void clearUserData(String id)
Description copied from interface:RoadSegmentClear all the data from a group.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
clearUserDatain interfaceRoadSegment- Parameters:
id- is the identifier of the group
-
clearUserData
public void clearUserData()
Description copied from interface:RoadSegmentClear all the data from all the groups.The user data ar not stored as attributes because they are assumed as transient.
- Specified by:
clearUserDatain interfaceRoadSegment
-
getUserData
@Pure public <T> T getUserData(String id)
Description copied from interface:RoadSegmentReplies an user data associated to this segment.The user data are not stored as attributes because they are assumed as transient.
- Specified by:
getUserDatain 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:RoadSegmentReplies the user data associated to this segment.The user data are not stored as attributes because they are assumed as transient.
- Specified by:
getUserDataCollectionin 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:RoadSegmentReplies 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:
hasUserDatain interfaceRoadSegment- Parameters:
id- is the identifier of the group- Returns:
trueif one user data exists, otherwisefalse
-
containsUserData
@Pure public boolean containsUserData(String id, Object data)
Description copied from interface:RoadSegmentReplies 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:
containsUserDatain interfaceRoadSegment- Parameters:
id- is the identifier of the groupdata- is the data to insert in the group- Returns:
trueif the user data exists, otherwisefalse
-
getLaneCount
@Pure public int getLaneCount()
Description copied from interface:RoadSegmentReplies the count of lanes on this road segment.- Specified by:
getLaneCountin interfaceRoadSegment- Returns:
- the count of lanes on this road segment.
-
getWidth
@Pure public double getWidth()
Description copied from class:MapPolylineReturns 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:
getWidthin interfaceRoadSegment- Overrides:
getWidthin classMapPolyline- Returns:
- the width of the poly-element in meters.
-
setWidth
public void setWidth(double width)
Description copied from interface:RoadSegmentSet the road width in the geo-located referencial. The width is the distance between the border lines of the road.- Specified by:
setWidthin interfaceRoadSegment- Parameters:
width- is the width of the road in meters.
-
distance
@Pure public final double distance(Point2D<?,?> point)
Description copied from interface:RoadSegmentReplies the distance between this MapElement and point.- Specified by:
distancein 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:RoadSegmentReplies 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:
getLaneSizein 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:RoadSegmentReplies 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:
getLaneCenterin 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:RoadSegmentReplies the distance to the road border according to the driving side on the road.This function is similar to calls to
{@link #getWidth()} / 2but 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:
getRoadBorderDistancein interfaceRoadSegment- Returns:
- shift distance from the segment's center to the road border.
-
getLaneDirection
@Pure public Direction1D getLaneDirection(int laneIndex)
Description copied from interface:RoadSegmentReplies 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:
getLaneDirectionin interfaceRoadSegment- Parameters:
laneIndex- the lane index.- Returns:
- the count of lanes on this road segment.
-
getWrappedRoadSegment
@Pure public RoadSegment getWrappedRoadSegment()
Description copied from interface:RoadSegmentReplies 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:
getWrappedRoadSegmentin interfaceRoadSegment- Returns:
- the wrapped road segment or this road segment itself.
-
toSegment1D
@Pure protected final Segment1D<?,?> toSegment1D()
Description copied from class:MapPolylineReplies the Segment1D representation of this object.- Overrides:
toSegment1Din classMapPolyline- Returns:
- the Segment1D, never
null.
-
-