Class RoadAStar.VirtualSegment
- java.lang.Object
-
- org.arakhne.afc.gis.road.path.astar.RoadAStar.VirtualSegment
-
- All Implemented Interfaces:
Serializable
,Cloneable
,AttributeCollection
,AttributeProvider
,FlagContainer
,GISFlagContainer
,GISPrimitive
,RoadSegment
,Segment1D<Point2d,Vector2d>
,GraphSegment<RoadSegment,RoadConnection>
,JsonableObject
- Enclosing class:
- RoadAStar
static class RoadAStar.VirtualSegment extends Object implements RoadSegment
Is a road segment that connects a virtual point to a real road connection.- 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
-
-
Constructor Summary
Constructors Constructor Description VirtualSegment(RoadSegment virtualizedSegment, RoadAStar.VirtualPoint startPoint, RoadConnection endPoint)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttributeChangeListener(AttributeChangeListener listener)
Add a listener on the attribute value changes.void
addAttributes(Map<String,Object> content)
Put the values given as parameter in this attribute provider.void
addAttributes(AttributeProvider content)
Put the values given as parameter in this attribute provider.void
addUserData(String id, Object data)
Add an user data associated to this segment.Iterable<Attribute>
attributes()
Replies all the attributes.void
clearUserData()
Clear all the data from all the groups.void
clearUserData(String id)
Clear all the data from a group.RoadAStar.VirtualSegment
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.GraphIterator<RoadSegment,RoadConnection>
depthIterator(double depth, double positionFromStartingPoint, RoadConnection startingPoint, 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.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.void
flush()
Force this provider to synchronized the memory state of the attributes with a remote storage area.void
freeMemory()
Clean the internal memory-storage structures if they exist.Collection<String>
getAllAttributeNames()
Replies all the attribute names.Collection<Attribute>
getAllAttributes()
Replies all the attributes.Map<AttributeType,Collection<Attribute>>
getAllAttributesByType()
Replies all the attributes sorted by type.Point2d
getAntepenulvianPoint()
Replies the coordinates of the antepenulvian (before last) point.AttributeValue
getAttribute(String name)
Replies the value for the given attribute.boolean
getAttribute(String name, boolean defaultValue)
Replies the value for the given attribute.double
getAttribute(String name, double defaultValue)
Replies the value for the given attribute.float
getAttribute(String name, float defaultValue)
Replies the value for the given attribute.int
getAttribute(String name, int defaultValue)
Replies the value for the given attribute.long
getAttribute(String name, long defaultValue)
Replies the value for the given attribute.Class<?>
getAttribute(String name, Class<?> defaultValue)
Replies the value for the given attribute.String
getAttribute(String name, String defaultValue)
Replies the value for the given attribute.InetAddress
getAttribute(String name, InetAddress defaultValue)
Replies the value for the given attribute.InetAddress
getAttribute(String name, InetSocketAddress defaultValue)
Replies the value for the given attribute.URI
getAttribute(String name, URI defaultValue)
Replies the value for the given attribute.URL
getAttribute(String name, URL defaultValue)
Replies the value for the given attribute.Date
getAttribute(String name, Date defaultValue)
Replies the value for the given attribute.UUID
getAttribute(String name, UUID defaultValue)
Replies the value for the given attribute.AttributeValue
getAttribute(String name, AttributeValue defaultValue)
Replies the value for the given attribute.<T extends Enum<T>>
TgetAttribute(String name, T defaultValue)
Replies the value for the given attribute.boolean
getAttributeAsBool(String name)
Replies the value for the given attribute.Date
getAttributeAsDate(String name)
Replies the value for the given attribute.double
getAttributeAsDouble(String name)
Replies the value for the given attribute.Enum<?>
getAttributeAsEnumeration(String name)
Replies the value for the given attribute.<T extends Enum<T>>
TgetAttributeAsEnumeration(String name, Class<T> type)
Replies the value for the given attribute.float
getAttributeAsFloat(String name)
Replies the value for the given attribute.InetAddress
getAttributeAsInetAddress(String name)
Replies the value for the given attribute.int
getAttributeAsInt(String name)
Replies the value for the given attribute.Class<?>
getAttributeAsJavaClass(String name)
Replies the value for the given attribute.long
getAttributeAsLong(String name)
Replies the value for the given attribute.String
getAttributeAsString(String name)
Replies the value for the given attribute.URI
getAttributeAsURI(String name)
Replies the value for the given attribute.URL
getAttributeAsURL(String name)
Replies the value for the given attribute.UUID
getAttributeAsUUID(String name)
Replies the value for the given attribute.int
getAttributeCount()
Replies the count of attributes.Attribute
getAttributeObject(String name)
Replies the attribute with the given name.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.int
getFlags()
Replies the flags associated to this element.GeoId
getGeoId()
Replies an unique identifier for primitive.GeoLocation
getGeoLocation()
Replies the geo-location.Point2d
getGeoLocationForDistance(double desiredDistance)
Replies the geo-location of the point described by the specified distance.Point2d
getGeoLocationForDistance(double desiredDistance, double shifting)
Replies the geo-location of the point described by the specified distance.void
getGeoLocationForDistance(double desiredDistance, double shifting, Point2D<?,?> geoLocation)
Replies the geo-location of the point described by the specified distance.void
getGeoLocationForDistance(double desiredDistance, double shifting, Point2D<?,?> geoLocation, Vector2D<?,?> tangent)
Replies the geo-location of the point described by the specified distance.Point2d
getGeoLocationForDistance(double desiredDistance, double shifting, Vector2D<?,?> tangent)
Replies the geo-location of the point described by the specified distance.void
getGeoLocationForDistance(double desiredDistance, 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.Point1d
getNearestPosition(Point2D<?,?> pos, double lateralDistance)
Return the nearest point 1.5D from a 2D position.RoadConnection
getOtherSidePoint(RoadConnection refPoint)
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 forwardSearch, boolean backwardSearch)
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.UUID
getUUID()
Replies the Unique identifier.RoadSegment
getVirtualizedSegment()
Replies the virtualized segment.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
hasAttribute(String name)
Replies if the given attribute exists.boolean
hasFlag(int flagIndex)
Replies if the specified flag is set for this element.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
isEventFirable()
Replies if the events are fired by this container.boolean
isFirstPointConnectedTo(Segment1D<?,?> otherSegment)
Replies if this segment is connected to the specified segment by its first point.boolean
isLastPointConnectedTo(Segment1D<?,?> otherSegment)
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 startingPoint, 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.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
removeAllAttributes()
Remove all the attributes.boolean
removeAttribute(String name)
Remove the given attribute.void
removeAttributeChangeListener(AttributeChangeListener listener)
Remove a listener on the attribute value changes.boolean
removeUserData(String id, Object data)
Remove an user data associated to this segment.boolean
renameAttribute(String oldname, String newname)
Rename the attribute.boolean
renameAttribute(String oldname, String newname, boolean overwrite)
Rename the attribute .Attribute
setAttribute(String name, boolean value)
Set the value for the given attribute.Attribute
setAttribute(String name, double value)
Set the value for the given attribute.Attribute
setAttribute(String name, float value)
Set the value for the given attribute.Attribute
setAttribute(String name, int value)
Set the value for the given attribute.Attribute
setAttribute(String name, long value)
Set the value for the given attribute.Attribute
setAttribute(String name, Class<?> value)
Set the value for the given attribute.Attribute
setAttribute(String name, Enum<?> value)
Set the value for the given attribute.Attribute
setAttribute(String name, String value)
Set the value for the given attribute.Attribute
setAttribute(String name, InetAddress value)
Set the value for the given attribute.Attribute
setAttribute(String name, InetSocketAddress value)
Set the value for the given attribute.Attribute
setAttribute(String name, URI value)
Set the value for the given attribute.Attribute
setAttribute(String name, URL value)
Set the value for the given attribute.Attribute
setAttribute(String name, Date value)
Set the value for the given attribute.Attribute
setAttribute(String name, UUID value)
Set the value for the given attribute.Attribute
setAttribute(String name, AttributeValue value)
Set the value for the given attribute.Attribute
setAttribute(Attribute value)
Set the value for the given attribute.void
setAttributes(Map<String,Object> content)
Set the content of this collection from the given map.void
setAttributes(AttributeProvider content)
Set the content of this collection from the given map.Attribute
setAttributeType(String name, AttributeType type)
Set the type of the attribute with the given name.void
setEventFirable(boolean isFirable)
Set if the events are fired by this container.void
setFlag(int flag)
Set the flag.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.void
switchFlag(int flagIndex)
Switch the value of the specified flag on this element.void
toJson(JsonBuffer buffer)
Replies the Json representation of this node.void
toMap(Map<String,Object> mapToFill)
Fill the given map with the values stored in this attribute provider.void
toPath2D(Path2d path, double startPosition, double endPosition)
Fill the given path with the values representing this road segment.String
toString()
void
unsetFlag(int flagIndex)
Unset the flag.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.attrs.collection.AttributeProvider
toMap
-
Methods inherited from interface org.arakhne.afc.gis.road.primitive.RoadSegment
depthIterator, getNearestPosition, getNearestPositionOnBorder, toPath2D, toPath2D, toPath2D
-
-
-
-
Constructor Detail
-
VirtualSegment
VirtualSegment(RoadSegment virtualizedSegment, RoadAStar.VirtualPoint startPoint, RoadConnection endPoint)
Constructor.- Parameters:
virtualizedSegment
- the segment to virtualize.startPoint
- the start point.endPoint
- the end point.
-
-
Method Detail
-
getVirtualizedSegment
public RoadSegment getVirtualizedSegment()
Replies the virtualized segment.- Returns:
- the virtualized segment.
-
clone
public RoadAStar.VirtualSegment 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
- Specified by:
clone
in interfaceRoadSegment
- Overrides:
clone
in classObject
- Returns:
- the deep copy.
-
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
-
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
-
contains
public boolean contains(Point2D<?,?> point, double delta)
Description copied from interface:RoadSegment
Replies if the specified point (x,y) was inside the figure of this MapElement.- Specified by:
contains
in interfaceRoadSegment
- 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
public boolean contains(Point2D<?,?> point)
Description copied from interface:RoadSegment
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
.- Specified by:
contains
in interfaceRoadSegment
- 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
-
containsUserData
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
-
depthIterator
public GraphIterator<RoadSegment,RoadConnection> depthIterator(double depth, double positionFromStartingPoint, RoadConnection startingPoint, 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).positionFromStartingPoint
- is the starting position from the starting_point (in meters).startingPoint
- 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)
-
distance
public 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.
-
distance
public double distance(Point2D<?,?> point, double width)
Description copied from interface:RoadSegment
Replies the distance between this figure and the specified point.- Specified by:
distance
in interfaceRoadSegment
- Parameters:
point
- is the coordinate of the point.width
- is the width of the polyline.- Returns:
- the computed distance
-
distanceToEnd
public double distanceToEnd(Point2D<?,?> point)
Description copied from interface:RoadSegment
Replies the distance between the nearest end of this MapElement and the point.- Specified by:
distanceToEnd
in interfaceRoadSegment
- Parameters:
point
- a point.- Returns:
- the distance. Should be negative depending of the MapElement type.
-
distanceToEnd
public double distanceToEnd(Point2D<?,?> point, double width)
Description copied from interface:RoadSegment
Replies the distance between the nearest end of this MapElement and the point.- Specified by:
distanceToEnd
in interfaceRoadSegment
- Parameters:
point
- is the coordinate of the point.width
- is the width of the polyline.- Returns:
- the computed distance
-
getAntepenulvianPoint
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.
-
getBoundingBox
public Rectangle2d getBoundingBox()
Description copied from interface:RoadSegment
Replies the bounding box of this element.- Specified by:
getBoundingBox
in interfaceRoadSegment
- Returns:
- the bounding box or
null
if not applicable.
-
getDistanceFromStart
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
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
-
getEndPoint
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.
-
getFirstPoint
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.
-
getGeoLocation
public GeoLocation getGeoLocation()
Description copied from interface:GISPrimitive
Replies the geo-location.A GeoLocation is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have equal GeoLocations.
The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):
GISElement obj1 = new MapPolyline(100,10,200,30,300,4); GISElement obj2 = new MapPolyline(100,10,200,30,300,4); assert( obj1.getGeoId().equals(obj2.getGeoId()) ); assert( obj2.getGeoId().equals(obj1.getGeoId()) ); assert( ! obj1.getUid().equals(obj2.getUid()) ); assert( ! obj2.getUid().equals(obj1.getUid()) );
- Specified by:
getGeoLocation
in interfaceGISPrimitive
- Specified by:
getGeoLocation
in interfaceRoadSegment
- Returns:
- a location
- See Also:
GISPrimitive.getGeoId()
,GISPrimitive.getGeoLocation()
-
getGeoLocationForDistance
public Point2d getGeoLocationForDistance(double desiredDistance)
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:
desiredDistance
- is the distance for which the geo location must be computed.- Returns:
- the geo-location.
-
getGeoLocationForDistance
public Point2d getGeoLocationForDistance(double desiredDistance, 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:
desiredDistance
- is the distance for which the geo location must be computed.shifting
- is the shifting distance.- Returns:
- the geo-location.
-
getGeoLocationForDistance
public Point2d getGeoLocationForDistance(double desiredDistance, 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:
desiredDistance
- 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
public void getGeoLocationForDistance(double desiredDistance, 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:
desiredDistance
- is the distance for which the geo location must be computed.geoLocation
- is the point to set with geo-localized coordinates.
-
getGeoLocationForDistance
public void getGeoLocationForDistance(double desiredDistance, 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:
desiredDistance
- 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
public void getGeoLocationForDistance(double desiredDistance, 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:
desiredDistance
- 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.
-
getGeoLocationForLocationRatio
public 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
public 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
public 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
public 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
public 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
public void getGeoLocationForLocationRatio(double ratio, double shifting, Point2D<?,?> geoLocation, 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.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.
-
getLaneCenter
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.
-
getLaneCount
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.
-
getLaneDirection
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.
-
getLaneSize
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
-
getLastPoint
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.
-
getLength
public double getLength()
Description copied from interface:RoadSegment
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 interfaceRoadSegment
- Specified by:
getLength
in interfaceSegment1D<Point2d,Vector2d>
- Returns:
- the length of the road in meters.
-
getNearestPosition
public Point1d getNearestPosition(Point2D<?,?> pos, double lateralDistance)
Description copied from interface:RoadSegment
Return the nearest point 1.5D from a 2D position.- Specified by:
getNearestPosition
in interfaceRoadSegment
- 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.
- See Also:
RoadSegment.getNearestPosition(Point2D)
-
getOtherSidePoint
public RoadConnection getOtherSidePoint(RoadConnection refPoint)
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:
refPoint
- the reference point.- Returns:
- the point at the other side of the segment.
-
getPointAt
public Point2d getPointAt(int index)
Description copied from interface:RoadSegment
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.
- Specified by:
getPointAt
in interfaceRoadSegment
- Parameters:
index
- is the index of the desired point- Returns:
- the point at the given index
-
getPointCount
public int getPointCount()
Description copied from interface:RoadSegment
Replies the count of points in all the parts.- Specified by:
getPointCount
in interfaceRoadSegment
- Returns:
- the count of points
-
getRoadNetwork
public RoadNetwork 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.
-
getSegmentChain
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
public List<RoadSegment> getSegmentChain(boolean forwardSearch, boolean backwardSearch)
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:
forwardSearch
- must betrue
to search the chain's segments in the forward direction for this road segment.backwardSearch
- must betrue
to search the chain's segments in the backward direction for this road segment.- Returns:
- a list of road segments.
-
getSharedConnectionWith
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
-
getBeginPoint
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.
-
getTrafficDirection
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
-
getRoadType
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.
-
getUserData
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
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
.
-
getWidth
public double getWidth()
Description copied from interface:RoadSegment
Returns the road width in the geo-located referencial. The width is the distance between the border lines of the road.- Specified by:
getWidth
in interfaceRoadSegment
- Returns:
- the width of the road in meters.
-
getRoadBorderDistance
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.
-
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.
-
getName
public String getName()
Description copied from interface:RoadSegment
Returns the name of the road.- Specified by:
getName
in interfaceRoadSegment
- Returns:
- the name of the road.
-
setName
public void setName(String name)
Description copied from interface:RoadSegment
Set the name of the road.- Specified by:
setName
in interfaceRoadSegment
- Parameters:
name
- is the name of the road.
-
getWrappedRoadSegment
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.
-
hasUserData
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
-
intersects
public boolean intersects(Shape2D<?,?,?,?,?,? extends Rectangle2afp<?,?,?,?,?,?>> bounds)
Description copied from interface:RoadSegment
Replies if this element has an intersection with the specified rectangle.If this MapElement has no associated figure, this method always returns
false
.- Specified by:
intersects
in interfaceRoadSegment
- Parameters:
bounds
- the bounds.s- Returns:
true
if this MapElement has an associated figure and the specified rectangle intersecting the figure, otherwisefalse
-
isConnectedTo
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
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
.
-
iterator
public GraphIterator<RoadSegment,RoadConnection> iterator(RoadConnection startingPoint, 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:
startingPoint
- 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
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
-
pointIterator
public Iterator<Point2d> pointIterator()
Description copied from interface:RoadSegment
Replies the iterator on the points.- Specified by:
pointIterator
in interfaceRoadSegment
- Returns:
- the iterator on the points.
-
points
public Iterable<Point2d> points()
Description copied from interface:RoadSegment
Replies the iterator on the points.- Specified by:
points
in interfaceRoadSegment
- Returns:
- the iterator on the points.
-
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
.
-
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.
-
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
-
addAttributeChangeListener
public void addAttributeChangeListener(AttributeChangeListener listener)
Description copied from interface:AttributeCollection
Add a listener on the attribute value changes.- Specified by:
addAttributeChangeListener
in interfaceAttributeCollection
- Parameters:
listener
- the listener.
-
flush
public void flush()
Description copied from interface:AttributeCollection
Force this provider to synchronized the memory state of the attributes with a remote storage area.- Specified by:
flush
in interfaceAttributeCollection
-
removeAllAttributes
public boolean removeAllAttributes()
Description copied from interface:AttributeCollection
Remove all the attributes.- Specified by:
removeAllAttributes
in interfaceAttributeCollection
- Returns:
false
if something wrong appends
-
removeAttribute
public boolean removeAttribute(String name)
Description copied from interface:AttributeCollection
Remove the given attribute.- Specified by:
removeAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to remove.- Returns:
true
on success, otherwhisefalse
-
removeAttributeChangeListener
public void removeAttributeChangeListener(AttributeChangeListener listener)
Description copied from interface:AttributeCollection
Remove a listener on the attribute value changes.- Specified by:
removeAttributeChangeListener
in interfaceAttributeCollection
- Parameters:
listener
- the listener.
-
renameAttribute
public boolean renameAttribute(String oldname, String newname)
Description copied from interface:AttributeCollection
Rename the attribute.If a attribute named
newname
already exists, this function will replyfalse
.This function is equivalent to
renameAttribute(oldname, newname, false)
.- Specified by:
renameAttribute
in interfaceAttributeCollection
- Parameters:
oldname
- is the name of the attribute to rename.newname
- is the new name of the attribute.- Returns:
false
if something wrong appends
-
renameAttribute
public boolean renameAttribute(String oldname, String newname, boolean overwrite)
Description copied from interface:AttributeCollection
Rename the attribute .- Specified by:
renameAttribute
in interfaceAttributeCollection
- Parameters:
oldname
- is the name of the attribute to rename.newname
- is the new name of the attribute.overwrite
- must betrue
if the value of an existing attribute named bynewname
must be overwritten by the value of the attribute namedoldname
.- Returns:
false
if something wrong appends
-
setAttribute
public Attribute setAttribute(Attribute value) throws AttributeException
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
value
- is the value to store.- Returns:
- the changed attribute or
null
- Throws:
AttributeException
- on error.
-
setAttribute
public Attribute setAttribute(String name, InetAddress value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, InetSocketAddress value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Enum<?> value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Class<?> value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, AttributeValue value) throws AttributeException
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
- Throws:
AttributeException
- on error.
-
setAttribute
public Attribute setAttribute(String name, boolean value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, int value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, long value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, float value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, double value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, String value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, UUID value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, URL value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, URI value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Date value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
attributes
public Iterable<Attribute> attributes()
Description copied from interface:AttributeProvider
Replies all the attributes.- Specified by:
attributes
in interfaceAttributeProvider
- Returns:
- an iterable object that contains the attributes.
-
freeMemory
public void freeMemory()
Description copied from interface:AttributeProvider
Clean the internal memory-storage structures if they exist.This function permits to limit the memory usage without removing the attribute value from a hard storage area (database, files...). The attribute which are freed by this method could be reloaded in memory with a call to a getting method.
- Specified by:
freeMemory
in interfaceAttributeProvider
-
getAllAttributeNames
public Collection<String> getAllAttributeNames()
Description copied from interface:AttributeProvider
Replies all the attribute names. This function never load the attribute values even if they are not inside the storage layer.- Specified by:
getAllAttributeNames
in interfaceAttributeProvider
- Returns:
- the list of all attribute names.
-
getAllAttributes
public Collection<Attribute> getAllAttributes()
Description copied from interface:AttributeProvider
Replies all the attributes.- Specified by:
getAllAttributes
in interfaceAttributeProvider
- Returns:
- the list of all attributes
-
getAllAttributesByType
public Map<AttributeType,Collection<Attribute>> getAllAttributesByType()
Description copied from interface:AttributeProvider
Replies all the attributes sorted by type.The keys of the returned hashtable are the types and the values are array of attributes (
Vector
).- Specified by:
getAllAttributesByType
in interfaceAttributeProvider
- Returns:
- the attributes grouped by type.
-
getAttribute
public AttributeValue getAttribute(String name)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value or
null
-
getAttribute
public URI getAttribute(String name, URI defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public Date getAttribute(String name, Date defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public boolean getAttribute(String name, boolean defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public Class<?> getAttribute(String name, Class<?> defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public InetAddress getAttribute(String name, InetAddress defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public InetAddress getAttribute(String name, InetSocketAddress defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public <T extends Enum<T>> T getAttribute(String name, T defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Type Parameters:
T
- is the type of the enumeration.- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public double getAttribute(String name, double defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public float getAttribute(String name, float defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public int getAttribute(String name, int defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public long getAttribute(String name, long defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public String getAttribute(String name, String defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public UUID getAttribute(String name, UUID defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public URL getAttribute(String name, URL defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
public AttributeValue getAttribute(String name, AttributeValue defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value or
null
-
getAttributeAsBool
public boolean getAttributeAsBool(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsBool
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsDouble
public double getAttributeAsDouble(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsDouble
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsFloat
public float getAttributeAsFloat(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsFloat
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsInt
public int getAttributeAsInt(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsInt
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsLong
public long getAttributeAsLong(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsLong
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsString
public String getAttributeAsString(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsString
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsUUID
public UUID getAttributeAsUUID(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsUUID
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsURL
public URL getAttributeAsURL(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsURL
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsURI
public URI getAttributeAsURI(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsURI
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsDate
public Date getAttributeAsDate(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsDate
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeCount
public int getAttributeCount()
Description copied from interface:AttributeProvider
Replies the count of attributes.- Specified by:
getAttributeCount
in interfaceAttributeProvider
- Returns:
- the count of attributes.
-
getAttributeObject
public Attribute getAttributeObject(String name)
Description copied from interface:AttributeProvider
Replies the attribute with the given name.- Specified by:
getAttributeObject
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the attribute or
null
-
hasAttribute
public boolean hasAttribute(String name)
Description copied from interface:AttributeProvider
Replies if the given attribute exists.- Specified by:
hasAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
true
is an attribute with the given name exists, otherwisefalse
-
getGeoId
public GeoId getGeoId()
Description copied from interface:GISPrimitive
Replies an unique identifier for primitive.A Geo-Id 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 the same Geo-Id.
- Specified by:
getGeoId
in interfaceGISPrimitive
- Returns:
- an identifier
- See Also:
GISPrimitive.getGeoLocation()
-
getUUID
public UUID getUUID()
Description copied from interface:GISPrimitive
Replies the Unique identifier.- Specified by:
getUUID
in interfaceGISPrimitive
- Specified by:
getUUID
in interfaceRoadSegment
- Returns:
- the Unique identifier, never
null
.
-
getFlags
public int getFlags()
Description copied from interface:FlagContainer
Replies the flags associated to this element.The flag could be predefined (eg.
FlagContainer.FLAG_SELECTED
, or user defined.- Specified by:
getFlags
in interfaceFlagContainer
- Returns:
- the flags
- See Also:
FlagContainer.FLAG_SELECTED
,FlagContainer.hasFlag(int)
,FlagContainer.setFlag(int)
,FlagContainer.unsetFlag(int)
-
hasFlag
public boolean hasFlag(int flagIndex)
Description copied from interface:FlagContainer
Replies if the specified flag is set for this element.The flag could be predefined (eg.
FlagContainer.FLAG_SELECTED
, or user defined.- Specified by:
hasFlag
in interfaceFlagContainer
- Parameters:
flagIndex
- is the index of the flag- Returns:
true
if the flag was set, otherwisefalse
- See Also:
FlagContainer.FLAG_SELECTED
,FlagContainer.getFlags()
,FlagContainer.setFlag(int)
,FlagContainer.unsetFlag(int)
-
setFlag
public void setFlag(int flag)
Description copied from interface:FlagContainer
Set the flag.The flag could be predefined (eg.
FlagContainer.FLAG_SELECTED
, or user defined.- Specified by:
setFlag
in interfaceFlagContainer
- Parameters:
flag
- is the index of the flag- See Also:
FlagContainer.FLAG_SELECTED
,FlagContainer.getFlags()
,FlagContainer.hasFlag(int)
,FlagContainer.unsetFlag(int)
-
switchFlag
public void switchFlag(int flagIndex)
Description copied from interface:FlagContainer
Switch the value of the specified flag on this element.The flag could be predefined (eg.
FlagContainer.FLAG_SELECTED
, or user defined.- Specified by:
switchFlag
in interfaceFlagContainer
- Parameters:
flagIndex
- is the index of the flag- See Also:
FlagContainer.FLAG_SELECTED
,FlagContainer.getFlags()
,FlagContainer.setFlag(int)
,FlagContainer.unsetFlag(int)
-
unsetFlag
public void unsetFlag(int flagIndex)
Description copied from interface:FlagContainer
Unset the flag.The flag could be predefined (eg.
FlagContainer.FLAG_SELECTED
, or user defined.- Specified by:
unsetFlag
in interfaceFlagContainer
- Parameters:
flagIndex
- is the index of the flag- See Also:
FlagContainer.FLAG_SELECTED
,FlagContainer.getFlags()
,FlagContainer.hasFlag(int)
,FlagContainer.setFlag(int)
-
getTangentAt
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.
-
isFirstPointConnectedTo
public boolean isFirstPointConnectedTo(Segment1D<?,?> otherSegment)
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:
otherSegment
- is the segment to match.- Returns:
true
if this segment is connected to the given one, otherwisefalse
.
-
isLastPointConnectedTo
public boolean isLastPointConnectedTo(Segment1D<?,?> otherSegment)
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:
otherSegment
- is the segment to match.- Returns:
true
if this segment is connected to the given one, otherwisefalse
.
-
setAttributeType
public Attribute setAttributeType(String name, AttributeType type) throws AttributeException
Description copied from interface:AttributeCollection
Set the type of the attribute with the given name.- Specified by:
setAttributeType
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attributetype
- is the desired type.- Returns:
- the changed attribute or
null
- Throws:
AttributeException
- on error.
-
getRoadNumber
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.
-
getAttributeAsEnumeration
public Enum<?> getAttributeAsEnumeration(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsEnumeration
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsEnumeration
public <T extends Enum<T>> T getAttributeAsEnumeration(String name, Class<T> type) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsEnumeration
in interfaceAttributeProvider
- Type Parameters:
T
- is the type of the enumeration to retreive.- Parameters:
name
- the name.type
- is the type of the enumeration to retreive.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsJavaClass
public Class<?> getAttributeAsJavaClass(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsJavaClass
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsInetAddress
public InetAddress getAttributeAsInetAddress(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsInetAddress
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
isEventFirable
public boolean isEventFirable()
Description copied from interface:AttributeCollection
Replies if the events are fired by this container.- Specified by:
isEventFirable
in interfaceAttributeCollection
- Returns:
true
if the events are fired; otherwisefalse
if events are not fired.
-
setEventFirable
public void setEventFirable(boolean isFirable)
Description copied from interface:AttributeCollection
Set if the events are fired by this container.- Specified by:
setEventFirable
in interfaceAttributeCollection
- Parameters:
isFirable
- istrue
if the events are fired; otherwisefalse
if events are not fired.
-
setAttributes
public void setAttributes(Map<String,Object> content)
Description copied from interface:AttributeCollection
Set the content of this collection from the given map. Any previous content of this attribute collection will be lost. This function is equivalent to:this.removeAllAttributes(); this.addAttributes(content);
- Specified by:
setAttributes
in interfaceAttributeCollection
- Parameters:
content
- is the content.- See Also:
AttributeCollection.addAttributes(Map)
-
setAttributes
public void setAttributes(AttributeProvider content) throws AttributeException
Description copied from interface:AttributeCollection
Set the content of this collection from the given map. Any previous content of this attribute collection will be lost. This function is equivalent to:this.removeAllAttributes(); this.addAttributes(content);
- Specified by:
setAttributes
in interfaceAttributeCollection
- Parameters:
content
- is the content.- Throws:
AttributeException
- if one attribute from the content cannot be inserted.- See Also:
AttributeCollection.addAttributes(AttributeProvider)
-
addAttributes
public void addAttributes(Map<String,Object> content)
Description copied from interface:AttributeCollection
Put the values given as parameter in this attribute provider. Any previous content of this attribute collection will remain if the keys are not inside the given content. If the values from the given content will be used to overwrite any existing value.- Specified by:
addAttributes
in interfaceAttributeCollection
- Parameters:
content
- is the content to add inside.- See Also:
AttributeCollection.setAttributes(Map)
-
addAttributes
public void addAttributes(AttributeProvider content) throws AttributeException
Description copied from interface:AttributeCollection
Put the values given as parameter in this attribute provider. Any previous content of this attribute collection will remain if the keys are not inside the given content. If the values from the given content will be used to overwrite any existing value.- Specified by:
addAttributes
in interfaceAttributeCollection
- Parameters:
content
- is the content to add inside.- Throws:
AttributeException
- if one attribute from the content cannot be inserted.- See Also:
AttributeCollection.addAttributes(AttributeProvider)
-
toMap
public void toMap(Map<String,Object> mapToFill)
Description copied from interface:AttributeProvider
Fill the given map with the values stored in this attribute provider.- Specified by:
toMap
in interfaceAttributeProvider
- Parameters:
mapToFill
- is the map to fill, nevernull
.
-
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.
-
toPath2D
public void toPath2D(Path2d path, double startPosition, double endPosition)
Description copied from interface:RoadSegment
Fill the given path with the values representing this road segment.- Specified by:
toPath2D
in interfaceRoadSegment
- 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.
-
toJson
public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObject
Replies the Json representation of this node.- Specified by:
toJson
in interfaceJsonableObject
- Parameters:
buffer
- the Json buffer.
-
-