-
- All Superinterfaces:
AttributeCollection
,AttributeProvider
,Cloneable
,FlagContainer
,GISFlagContainer
,GISPrimitive
,GraphSegment<RoadSegment,RoadConnection>
,JsonableObject
,Segment1D<Point2d,Vector2d>
,Serializable
- All Known Implementing Classes:
RoadAStar.VirtualSegment
,RoadPolyline
,SubRoadNetwork.WrapSegment
public interface RoadSegment extends AttributeCollection, GISFlagContainer, GraphSegment<RoadSegment,RoadConnection>, Segment1D<Point2d,Vector2d>
This interface 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.
- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:55
- Author:
- Stéphane GALLAND
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- gisroad
-
-
Field Summary
-
Fields inherited from interface org.arakhne.afc.gis.primitive.FlagContainer
FLAG_READONLY, FLAG_SELECTED
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
COMPARATOR
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default 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.RoadSegment
clone()
Make a deep copy of this object and replies the copy.boolean
contains(Point2D<?,?> point)
Replies if the specified point (x,y) was inside the figure of this MapElement.boolean
contains(Point2D<?,?> point, double delta)
Replies if the specified point (x,y) was inside the figure of this MapElement.boolean
containsUserData(String id, Object data)
Replies if the given one user data is associated to the given identifier.default GraphIterator<RoadSegment,RoadConnection>
depthIterator(double depth, double position_from_starting_point, 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.GraphIterator<RoadSegment,RoadConnection>
depthIterator(double depth, double position_from_starting_point, RoadConnection starting_point, boolean allowManyReplies, boolean assumeOrientedSegments, DynamicDepthUpdater<RoadSegment,RoadConnection> dynamicDepthUpdater)
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.double
distance(Point2D<?,?> point, double width)
Replies the distance between this figure and the specified point.double
distanceToEnd(Point2D<?,?> point)
Replies the distance between the nearest end of this MapElement and the point.double
distanceToEnd(Point2D<?,?> point, double width)
Replies the distance between the nearest end of this MapElement and the point.Point2d
getAntepenulvianPoint()
Replies the coordinates of the antepenulvian (before last) point.RoadConnection
getBeginPoint()
Replies the starting point of this segment.Rectangle2d
getBoundingBox()
Replies the bounding box of this element.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.Point2d
getFirstPoint()
Replies the 2D cooordinate of the first point of the segment.GeoLocation
getGeoLocation()
Replies the geo-location.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<?,?> geoLocation, 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.double
getLength()
Returns the road length in the geo-located referencial.String
getName()
Returns the name of the road.default Point1d
getNearestPosition(Point2D<?,?> pos)
Return the nearest point 1.5D from a 2D position.Point1d
getNearestPosition(Point2D<?,?> pos, double lateralDistance)
Return the nearest point 1.5D from a 2D position.default Point1d
getNearestPositionOnBorder(Point2D<?,?> pos)
Return the nearest point 1.5D on the border of the road segment from a 2D position.RoadConnection
getOtherSidePoint(RoadConnection ref_point)
Replies the point at the other side of the segment.Point2d
getPointAt(int index)
Replies the specified point at the given index.int
getPointCount()
Replies the count of points in all the parts.double
getRoadBorderDistance()
Replies the distance to the road border according to the driving side on the road.RoadNetwork
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.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.UUID
getUUID()
Replies the Unique identifier.double
getWidth()
Returns the road 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.boolean
intersects(Shape2D<?,?,?,?,?,? extends Rectangle2afp<?,?,?,?,?,?>> bounds)
Replies if this element has an intersection with the specified rectangle.boolean
isConnectedTo(RoadSegment otherSegment)
Replies if this segment is connected to the specified segment.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.Iterator<Point2d>
pointIterator()
Replies the iterator on the points.Iterable<Point2d>
points()
Replies the iterator on the points.boolean
removeUserData(String id, Object data)
Remove an user data associated to this segment.void
setName(String name)
Set the name of the road.void
setRoadNumber(String number)
Set the number of the road segment.void
setRoadType(RoadType type)
Set the type of the 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.default Path2d
toPath2D()
Replies the path representing this road segment.default Path2d
toPath2D(double startPosition, double endPosition)
Replies the path representing this road segment.default void
toPath2D(Path2d path)
Fill the given path with the values representing this road segment.void
toPath2D(Path2d path, double startPosition, double endPosition)
Fill the given path with the values representing this road segment.-
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.GISPrimitive
getGeoId
-
Methods inherited from interface org.arakhne.afc.vmutil.json.JsonableObject
toJson
-
Methods inherited from interface org.arakhne.afc.math.geometry.d1.Segment1D
getTangentAt, isFirstPointConnectedTo, isLastPointConnectedTo, projectsOnPlane, projectsOnPlane
-
-
-
-
Method Detail
-
clone
@Pure RoadSegment clone()
Description copied from interface:AttributeCollection
Make a deep copy of this object and replies the copy.- Specified by:
clone
in interfaceAttributeCollection
- Specified by:
clone
in interfaceAttributeProvider
- Returns:
- the deep copy.
-
getUUID
@Pure UUID getUUID()
Description copied from interface:GISPrimitive
Replies the Unique identifier.- Specified by:
getUUID
in interfaceGISPrimitive
- Returns:
- the Unique identifier, never
null
.
-
getRoadNetwork
@Pure RoadNetwork getRoadNetwork()
Replies the road network that contains this segment.- Returns:
- the road network that contains this segment.
-
getOtherSidePoint
@Pure 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>
- Parameters:
ref_point
- the reference point.- Returns:
- the point at the other side of the segment.
-
getBeginPoint
@Pure RoadConnection getBeginPoint()
Description copied from interface:GraphSegment
Replies the starting point of this segment.- Specified by:
getBeginPoint
in interfaceGraphSegment<RoadSegment,RoadConnection>
- Returns:
- the starting point of this segment.
-
getEndPoint
@Pure RoadConnection getEndPoint()
Description copied from interface:GraphSegment
Replies the ending point of this segment.- Specified by:
getEndPoint
in interfaceGraphSegment<RoadSegment,RoadConnection>
- Returns:
- the ending point of this segment.
-
getAntepenulvianPoint
@Pure Point2d getAntepenulvianPoint()
Replies the coordinates of the antepenulvian (before last) point.- Returns:
- the coordinates of the antepenulvian (before last) point.
-
getFirstPoint
@Pure Point2d getFirstPoint()
Description copied from interface:Segment1D
Replies the 2D cooordinate of the first point of the segment.- Specified by:
getFirstPoint
in interfaceSegment1D<Point2d,Vector2d>
- Returns:
- the 2D coordinate or
null
if 2D mapping is impossible.
-
getLastPoint
@Pure Point2d getLastPoint()
Description copied from interface:Segment1D
Replies the 2D cooordinates of the last point of the segment.- Specified by:
getLastPoint
in interfaceSegment1D<Point2d,Vector2d>
- Returns:
- the 2D coordinates or
null
if 2D mapping is impossible.
-
getLength
@Pure double getLength()
Returns the road length in the geo-located referencial. The length is the distance between the first point and the last point of the road.- Specified by:
getLength
in interfaceGraphSegment<RoadSegment,RoadConnection>
- Specified by:
getLength
in interfaceSegment1D<Point2d,Vector2d>
- Returns:
- the length of the road in meters.
-
getRoadBorderDistance
@Pure double getRoadBorderDistance()
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
.- Returns:
- shift distance from the segment's center to the road border.
- Since:
- 14.0
-
getWidth
@Pure double getWidth()
Returns the road width in the geo-located referencial. The width is the distance between the border lines of the road.- Returns:
- the width of the road in meters.
-
setWidth
void setWidth(double width)
Set the road width in the geo-located referencial. The width is the distance between the border lines of the road.- Parameters:
width
- is the width of the road in meters.- Since:
- 4.0
-
getName
@Pure String getName()
Returns the name of the road.- Returns:
- the name of the road.
- Since:
- 4.0
-
setName
void setName(String name)
Set the name of the road.- Parameters:
name
- is the name of the road.- Since:
- 4.0
-
isConnectedTo
@Pure boolean isConnectedTo(RoadSegment otherSegment)
Replies if this segment is connected to the specified segment.- Parameters:
otherSegment
- a segment.- Returns:
true
if this segment is connected to the given one, otherwisefalse
-
getSharedConnectionWith
@Pure RoadConnection getSharedConnectionWith(RoadSegment otherSegment)
Replies the shared connection between this segment and the specified one.- Parameters:
otherSegment
- a segment.- Returns:
- a shared connection if the two segments are connected, otherwise
null
-
getDistanceFromStart
@Pure double getDistanceFromStart(double ratio)
Replies the distance from the starting point.- Parameters:
ratio
- is the position on the segment.0
for the starting point and1
for the ending point.- Returns:
- the distance
-
getDistanceToEnd
@Pure double getDistanceToEnd(double ratio)
Replies the distance to the ending point.- Parameters:
ratio
- is the position on the segment.0
for the starting point and1
for the ending point.- Returns:
- the distance
-
getGeoLocationForLocationRatio
@Pure Point2d getGeoLocationForLocationRatio(double ratio)
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.- Parameters:
ratio
- is the location ratio.- Returns:
- the location.
-
getGeoLocationForLocationRatio
@Pure Point2d getGeoLocationForLocationRatio(double ratio, double shifting)
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.
- Parameters:
ratio
- is the location ratio.shifting
- is the shifting distance.- Returns:
- the geo-location.
-
getGeoLocationForLocationRatio
@Pure Point2d getGeoLocationForLocationRatio(double ratio, double shifting, Vector2D<?,?> tangent)
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.- 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
void getGeoLocationForLocationRatio(double ratio, Point2D<?,?> geoLocation)
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.- Parameters:
ratio
- is the location ratio.geoLocation
- is the point to set with geo-localized coordinates.
-
getGeoLocationForLocationRatio
void getGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> geoLocation)
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.
- Parameters:
ratio
- is the location ratio.shifting
- is the shifting distance.geoLocation
- is the point to set with geo-localized coordinates.
-
getGeoLocationForLocationRatio
void getGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> geoLocation, Vector2D<?,?> tangent)
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.- Parameters:
ratio
- is the location ratio.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.
-
getGeoLocationForDistance
@Pure Point2d getGeoLocationForDistance(double desired_distance)
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andgetLength()
for the ending point.- Parameters:
desired_distance
- is the distance for which the geo location must be computed.- Returns:
- the geo-location.
-
getGeoLocationForDistance
@Pure Point2d getGeoLocationForDistance(double desired_distance, double shifting)
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andgetLength()
for the ending point.- 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 Point2d getGeoLocationForDistance(double desired_distance, double shifting, Vector2D<?,?> tangent)
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andgetLength()
for the ending point.- 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
void getGeoLocationForDistance(double desired_distance, Point2D<?,?> geoLocation)
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andgetLength()
for the ending point.- 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
void getGeoLocationForDistance(double desired_distance, double shifting, Point2D<?,?> geoLocation)
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andgetLength()
for the ending point.- 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
void getGeoLocationForDistance(double desired_distance, double shifting, Point2D<?,?> geoLocation, Vector2D<?,?> tangent)
Replies the geo-location of the point described by the specified distance. The desired distance is0
for the starting point andgetLength()
for the ending point.- 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.
-
getSegmentChain
@Pure List<RoadSegment> getSegmentChain()
Replies a list of chained road segments without any cross-road which contains this road segment.- Returns:
- a list of road segments.
-
getSegmentChain
@Pure 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.- 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.
-
iterator
@Pure 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. If the specified starting point is not one of the ends of th segment, this function assumes to start from the point replied bygetBeginPoint()
.- 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 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. This function assumes to start from the point replied bygetBeginPoint()
. This function does not allow the cycles during the iterations.- Returns:
- an iterator
-
depthIterator
@Pure default GraphIterator<RoadSegment,RoadConnection> depthIterator(double depth, double position_from_starting_point, 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. If the specified starting point is not one of the ends of th segment, this function assumes to start from the point replied bygetBeginPoint()
.- 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.- Returns:
- an iterator
- See Also:
depthIterator(double, double, RoadConnection, boolean, boolean, DynamicDepthUpdater)
-
depthIterator
@Pure GraphIterator<RoadSegment,RoadConnection> depthIterator(double depth, double position_from_starting_point, RoadConnection starting_point, boolean allowManyReplies, boolean assumeOrientedSegments, DynamicDepthUpdater<RoadSegment,RoadConnection> dynamicDepthUpdater)
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 bygetBeginPoint()
.- 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.dynamicDepthUpdater
- if notnull
, it is invoked to dynamically update thedepth
.- Returns:
- an iterator
- Since:
- 16.0
- See Also:
depthIterator(double, double, RoadConnection, boolean, boolean)
-
hasUserData
@Pure boolean hasUserData(String id)
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.
- Parameters:
id
- is the identifier of the group- Returns:
true
if one user data exists, otherwisefalse
-
containsUserData
@Pure boolean containsUserData(String id, Object data)
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.
- Parameters:
id
- is the identifier of the groupdata
- is the data to insert in the group- Returns:
true
if the user data exists, otherwisefalse
-
addUserData
void addUserData(String id, Object data)
Add an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- Parameters:
id
- is the identifier of the groupdata
- is the data to insert in the group
-
setUserData
void setUserData(String id, Object data)
Set an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- Parameters:
id
- is the identifier of the groupdata
- is the data to insert in the group
-
removeUserData
boolean removeUserData(String id, Object data)
Remove an user data associated to this segment.The user data ar not stored as attributes because they are assumed as transient.
- 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
void clearUserData(String id)
Clear all the data from a group.The user data ar not stored as attributes because they are assumed as transient.
- Parameters:
id
- is the identifier of the group
-
clearUserData
void clearUserData()
Clear all the data from all the groups.The user data ar not stored as attributes because they are assumed as transient.
-
getUserData
@Pure <T> T getUserData(String id)
Replies an user data associated to this segment.The user data are not stored as attributes because they are assumed as transient.
- 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 <T> Collection<? extends T> getUserDataCollection(String id)
Replies the user data associated to this segment.The user data are not stored as attributes because they are assumed as transient.
- 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
.
-
distance
@Pure double distance(Point2D<?,?> point)
Replies the distance between this MapElement and point.- Parameters:
point
- a point- Returns:
- the distance. Could be negative depending of the implementation type.
-
distance
@Pure double distance(Point2D<?,?> point, double width)
Replies the distance between this figure and the specified point.- Parameters:
point
- is the coordinate of the point.width
- is the width of the polyline.- Returns:
- the computed distance
-
distanceToEnd
@Pure double distanceToEnd(Point2D<?,?> point)
Replies the distance between the nearest end of this MapElement and the point.- Parameters:
point
- a point.- Returns:
- the distance. Should be negative depending of the MapElement type.
-
distanceToEnd
@Pure double distanceToEnd(Point2D<?,?> point, double width)
Replies the distance between the nearest end of this MapElement and the point.- Parameters:
point
- is the coordinate of the point.width
- is the width of the polyline.- Returns:
- the computed distance
-
contains
@Pure boolean contains(Point2D<?,?> point, double delta)
Replies if the specified point (x,y) was inside the figure of this MapElement.- Parameters:
point
- is a geo-referenced coordinatedelta
- is the geo-referenced distance that corresponds to a approximation distance in the screen coordinate system- Returns:
true
if the specified point has a distance nearest than delta to this element, otherwisefalse
-
contains
@Pure boolean contains(Point2D<?,?> point)
Replies if the specified point (x,y) was inside the figure of this MapElement.If this MapElement has no associated figure, this method always returns
false
.- Parameters:
point
- is a geo-referenced coordinate- Returns:
true
if this MapElement had an associated figure and the specified point was inside this bounds of this figure, otherwisefalse
-
getGeoLocation
@Pure GeoLocation getGeoLocation()
Description copied from interface:GISPrimitive
Replies the geo-location.A GeoLocation is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have equal GeoLocations.
The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):
GISElement obj1 = new MapPolyline(100,10,200,30,300,4); GISElement obj2 = new MapPolyline(100,10,200,30,300,4); assert( obj1.getGeoId().equals(obj2.getGeoId()) ); assert( obj2.getGeoId().equals(obj1.getGeoId()) ); assert( ! obj1.getUid().equals(obj2.getUid()) ); assert( ! obj2.getUid().equals(obj1.getUid()) );
- Specified by:
getGeoLocation
in interfaceGISPrimitive
- Returns:
- a location
- See Also:
GISPrimitive.getGeoId()
,GISPrimitive.getGeoLocation()
-
getPointCount
@Pure int getPointCount()
Replies the count of points in all the parts.- Returns:
- the count of points
-
points
@Pure Iterable<Point2d> points()
Replies the iterator on the points.- Returns:
- the iterator on the points.
-
pointIterator
@Pure Iterator<Point2d> pointIterator()
Replies the iterator on the points.- Returns:
- the iterator on the points.
-
getPointAt
@Pure Point2d getPointAt(int index)
Replies the specified point at the given index.If the index is negative, it will corresponds to an index starting from the end of the list.
- Parameters:
index
- is the index of the desired point- Returns:
- the point at the given index
- Throws:
IndexOutOfBoundsException
- in case of error.
-
intersects
@Pure boolean intersects(Shape2D<?,?,?,?,?,? extends Rectangle2afp<?,?,?,?,?,?>> bounds)
Replies if this element has an intersection with the specified rectangle.If this MapElement has no associated figure, this method always returns
false
.- Parameters:
bounds
- the bounds.s- Returns:
true
if this MapElement has an associated figure and the specified rectangle intersecting the figure, otherwisefalse
-
getBoundingBox
@Pure Rectangle2d getBoundingBox()
Replies the bounding box of this element.- Returns:
- the bounding box or
null
if not applicable.
-
getLaneCount
@Pure int getLaneCount()
Replies the count of lanes on this road segment.- Returns:
- the count of lanes on this road segment.
-
getLaneDirection
@Pure Direction1D getLaneDirection(int laneIndex)
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.- Parameters:
laneIndex
- the lane index.- Returns:
- the count of lanes on this road segment.
-
getLaneSize
@Pure double getLaneSize(int laneIndex)
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.- Parameters:
laneIndex
- the lane index.- Returns:
- the size of the lane in meters
-
getLaneCenter
@Pure double getLaneCenter(int laneIndex)
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.- Parameters:
laneIndex
- the lane index.- Returns:
- shift distance from the segment's center to the lane center.
-
getWrappedRoadSegment
@Pure RoadSegment getWrappedRoadSegment()
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.- Returns:
- the wrapped road segment or this road segment itself.
-
isTraversableFrom
@Pure boolean isTraversableFrom(RoadConnection point)
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
.- Parameters:
point
- a point.- Returns:
true
if this segment is traversable starting from the given point; otherwisefalse
.
-
getTrafficDirection
@Pure TrafficDirection getTrafficDirection()
Replies the traffic direction on this road segment.- Returns:
- the traffic direction
- Since:
- 4.0
-
setTrafficDirection
void setTrafficDirection(TrafficDirection direction)
Set the traffic direction on this road segment.- Parameters:
direction
- is the new traffic direction. Ifnull
, the default traffic direction will be set.- Since:
- 4.0
-
getRoadType
@Pure RoadType getRoadType()
Replies the type of the road segment.- Returns:
- the type of the road segment.
- Since:
- 4.0
-
setRoadType
void setRoadType(RoadType type)
Set the type of the road segment.- Parameters:
type
- is the type of the road segment.- Since:
- 4.0
-
getNearestPosition
@Pure default Point1d getNearestPosition(Point2D<?,?> pos)
Return the nearest point 1.5D from a 2D position.- Parameters:
pos
- is the testing position.- Returns:
- the nearest 1.5D position on the road network.
- See Also:
getNearestPosition(Point2D, double)
,getNearestPositionOnBorder(Point2D)
-
getNearestPosition
@Pure Point1d getNearestPosition(Point2D<?,?> pos, double lateralDistance)
Return the nearest point 1.5D from a 2D position.- Parameters:
pos
- is the testing position.lateralDistance
- the lateral distance to put into the replied point, if any.- Returns:
- the nearest 1.5D position on the road network.
- Since:
- 16.0
- See Also:
getNearestPosition(Point2D)
-
getNearestPositionOnBorder
@Pure default Point1d getNearestPositionOnBorder(Point2D<?,?> pos)
Return the nearest point 1.5D on the border of the road segment from a 2D position.- Parameters:
pos
- is the testing position.- Returns:
- the nearest 1.5D position on the road segment's border.
- Since:
- 16.0
- See Also:
getNearestPosition(Point2D)
-
getRoadNumber
@Pure String getRoadNumber()
Replies the number of the road segment.- Returns:
- the number of the road segment.
- Since:
- 4.0
-
setRoadNumber
void setRoadNumber(String number)
Set the number of the road segment.- Parameters:
number
- is the number of the road segment.- Since:
- 4.0
-
toPath2D
@Pure default Path2d toPath2D()
Replies the path representing this road segment.- Returns:
- the path.
-
toPath2D
default Path2d toPath2D(double startPosition, double endPosition)
Replies the path representing this road segment.- Parameters:
startPosition
- the position along the segment at which the path representation should start. IfDouble.NaN
or negative, the path starts at the beginning of the road segment.endPosition
- the position along the segment at which the path representation should end. IfDouble.NaN
or greater than the segment length, the path ends at the end of the road segment.- Returns:
- the path.
-
toPath2D
default void toPath2D(Path2d path)
Fill the given path with the values representing this road segment.- Parameters:
path
- the path to fill out.
-
toPath2D
void toPath2D(Path2d path, double startPosition, double endPosition)
Fill the given path with the values representing this road segment.- Parameters:
path
- the path to fill out.startPosition
- the position along the segment at which the path representation should start. IfDouble.NaN
or negative, the path starts at the beginning of the road segment.endPosition
- the position along the segment at which the path representation should end. IfDouble.NaN
or greater than the segment length, the path ends at the end of the road segment.
-
-