Package org.openstreetmap.josm.data.osm
Class WaySegment
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.IWaySegment<Node,Way>
-
- org.openstreetmap.josm.data.osm.WaySegment
-
- All Implemented Interfaces:
java.lang.Comparable<IWaySegment<Node,Way>>
public final class WaySegment extends IWaySegment<Node,Way>
A segment consisting of two consecutive nodes out of a way.
-
-
Field Summary
-
Fields inherited from class org.openstreetmap.josm.data.osm.IWaySegment
NOT_A_SEGMENT
-
-
Constructor Summary
Constructors Constructor Description WaySegment(Way way, int i)
Constructs a newIWaySegment
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static WaySegment
forNodePair(Way way, Node first, Node second)
Determines and returns the way segment for the given way and node pair.java.lang.String
toString()
Way
toWay()
Returns this way segment as complete way.-
Methods inherited from class org.openstreetmap.josm.data.osm.IWaySegment
compareTo, equals, forNodePair, getFirstNode, getLowerIndex, getSecondNode, getUpperIndex, getWay, hashCode, intersects, isSimilar, isUsable
-
-
-
-
Constructor Detail
-
WaySegment
public WaySegment(Way way, int i)
Constructs a newIWaySegment
.- Parameters:
way
- The wayi
- The node lower index- Throws:
java.lang.IllegalArgumentException
- in case of invalid index
-
-
Method Detail
-
forNodePair
public static WaySegment forNodePair(Way way, Node first, Node second)
Determines and returns the way segment for the given way and node pair. You should preferIWaySegment.forNodePair(IWay, INode, INode)
whenever possible.- Parameters:
way
- wayfirst
- first nodesecond
- second node- Returns:
- way segment
- Throws:
java.lang.IllegalArgumentException
- if the node pair is not single a segment of the way
-
toWay
public Way toWay()
Returns this way segment as complete way.- Overrides:
toWay
in classIWaySegment<Node,Way>
- Returns:
- the way segment as
Way
-
toString
public java.lang.String toString()
- Overrides:
toString
in classIWaySegment<Node,Way>
-
-