Class OSMLink
- java.lang.Object
-
- org.opentrafficsim.road.network.factory.osm.OSMLink
-
- All Implemented Interfaces:
java.io.Serializable
,Identifiable
public class OSMLink extends java.lang.Object implements java.io.Serializable, Identifiable
OpenStreetMap Link.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.$LastChangedDate: 2015-07-26 01:01:13 +0200 (Sun, 26 Jul 2015) $, @version $Revision: 1155 $, by $Author: averbraeck $, initial version 31 dec. 2014
- Author:
- Moritz Bergmann
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description OSMLink(OSMNode startNode, OSMNode endNode, java.util.List<OSMTag> tags, double length, byte lanes, byte flanes)
Construct a new OSMLink with specified number of lanes and forward lanes.OSMLink(OSMNode fromNode, OSMNode toNode, java.util.List<OSMTag> tags, double length, WarningListener warningListener)
Construct a new OSMLink.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSpline(OSMNode shapeNode)
Append a Node to the list of OSMNodes of this OSMLink that define the shape of this OSMLink.void
addTag(OSMTag tag)
Add an OSMTag to this Link.boolean
containsAllTags(java.util.List<OSMTag> tagsToCheck)
Report if this OSMLink has all tags in a supplied set.OSMNode
getEnd()
byte
getForwardLanes()
Retrieve the total number of forward lanes on this OSMLink; forward lanes are lanes that may only be traveled from startNode towards endNode.java.lang.String
getId()
byte
getLanes()
Retrieve the total number of lanes on this OSMLink.double
getLength()
Retrieve the length of this OSMLink.java.util.List<OSMNode>
getSplineList()
Retrieve the list of OSMNodes that define the shape of this OSMLink.OSMNode
getStart()
java.util.List<OSMTag>
getTags()
Retrieve the tags of this OSMLink.boolean
hasTag(java.lang.String key)
Returns true if the link has an OSMTag with the specified key.boolean
isOneway()
Indicate if this OSMLink is one way.void
setOneway(boolean isOneWay)
Set the one way status of this OSMLink.java.lang.String
toString()
-
-
-
Constructor Detail
-
OSMLink
public OSMLink(OSMNode fromNode, OSMNode toNode, java.util.List<OSMTag> tags, double length, WarningListener warningListener)
Construct a new OSMLink.- Parameters:
fromNode
- OSMNode; the OSMNode where this OSMLinks beginstoNode
- OSMNode; the OSMNode where this OSMLink endstags
- List<OSMTag>; the OSMTags (inherited from the OSMWay that causes this OSMLink to be constructed)length
- double; the length of the new OSMLinkwarningListener
- WarningListener; the warning listener that will receive warning events
-
OSMLink
public OSMLink(OSMNode startNode, OSMNode endNode, java.util.List<OSMTag> tags, double length, byte lanes, byte flanes)
Construct a new OSMLink with specified number of lanes and forward lanes.- Parameters:
startNode
- OSMNode; the start OSMNode of the new OSMLinkendNode
- OSMNode; the end OSMNode of the new OSMLinktags
- List<OSMTag>; List of Tags inherited from waylength
- double; length of linklanes
- byte; the total number of lanesflanes
- byte; the number of forward lanes
-
-
Method Detail
-
getId
public final java.lang.String getId()
- Specified by:
getId
in interfaceIdentifiable
-
getStart
public final OSMNode getStart()
- Returns:
- start.
-
getEnd
public final OSMNode getEnd()
- Returns:
- end.
-
getTags
public final java.util.List<OSMTag> getTags()
Retrieve the tags of this OSMLink.- Returns:
- List<OSMTab>; the returned object is a copy; modifications of the returned object do not affect this OSMLink
-
isOneway
public final boolean isOneway()
Indicate if this OSMLink is one way.- Returns:
- boolean; true if this OSMLink is one way; false if this OSMLink is not one way
-
setOneway
public final void setOneway(boolean isOneWay)
Set the one way status of this OSMLink.- Parameters:
isOneWay
- boolean; the new value for the one way status of this OSMLink
-
getLanes
public final byte getLanes()
Retrieve the total number of lanes on this OSMLink.- Returns:
- byte; the total number of lanes on this OSMLink
-
getForwardLanes
public final byte getForwardLanes()
Retrieve the total number of forward lanes on this OSMLink; forward lanes are lanes that may only be traveled from startNode towards endNode.- Returns:
- byte; the number of forward lanes on this OSMLink
-
addTag
public final void addTag(OSMTag tag)
Add an OSMTag to this Link.- Parameters:
tag
- OSMTag; the OSMTag that must be added
-
getLength
public final double getLength()
Retrieve the length of this OSMLink.- Returns:
- double; the length of this OSMLink in meters
-
getSplineList
public final java.util.List<OSMNode> getSplineList()
Retrieve the list of OSMNodes that define the shape of this OSMLink.- Returns:
- List<OSMNode>; the list of OSMNodes that define the shape of this OSMLink
-
addSpline
public final void addSpline(OSMNode shapeNode)
Append a Node to the list of OSMNodes of this OSMLink that define the shape of this OSMLink.- Parameters:
shapeNode
- OSMNode; the OSMNode to add to the list of OSMNodes that define the shape of this OSMLink
-
hasTag
public final boolean hasTag(java.lang.String key)
Returns true if the link has an OSMTag with the specified key.- Parameters:
key
- String; the key of the sought OSMTag- Returns:
- boolean; true if this OSMLink has (one or more) OSMTag(s) with the specified key
-
toString
public final java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
containsAllTags
public final boolean containsAllTags(java.util.List<OSMTag> tagsToCheck)
Report if this OSMLink has all tags in a supplied set.- Parameters:
tagsToCheck
- List<OSMTag>; the supplied set of tags- Returns:
- boolean; true if this Link has all the supplied tags; false otherwise
-
-