Class OffsetIterator
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.visitor.paint.OffsetIterator
-
- All Implemented Interfaces:
Iterator<MapViewState.MapViewPoint>
public class OffsetIterator extends Object implements Iterator<MapViewState.MapViewPoint>
Iterates over a list of Way Nodes and returns screen coordinates that represent a line that is shifted by a certain offset perpendicular to the way direction. There is no intention, to handle consecutive duplicate Nodes in a perfect way, but it should not throw an exception.- Since:
- 11696 made public
-
-
Field Summary
Fields Modifier and Type Field Description private int
idx
private MapViewState
mapState
private List<MapViewState.MapViewPoint>
nodes
private double
offset
private MapViewState.MapViewPoint
prev
private double
xPrev0
private double
yPrev0
-
Constructor Summary
Constructors Constructor Description OffsetIterator(List<MapViewState.MapViewPoint> nodes, double offset)
Creates a new offset iteratorOffsetIterator(MapViewState mapState, List<? extends INode> nodes, double offset)
Creates a new offset iterator
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private MapViewState.MapViewPoint
getForIndex(int i)
boolean
hasNext()
MapViewState.MapViewPoint
next()
void
remove()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Iterator
forEachRemaining
-
-
-
-
Field Detail
-
mapState
private final MapViewState mapState
-
nodes
private final List<MapViewState.MapViewPoint> nodes
-
offset
private final double offset
-
idx
private int idx
-
prev
private MapViewState.MapViewPoint prev
-
xPrev0
private double xPrev0
-
yPrev0
private double yPrev0
-
-
Constructor Detail
-
OffsetIterator
public OffsetIterator(List<MapViewState.MapViewPoint> nodes, double offset)
Creates a new offset iterator- Parameters:
nodes
- The nodes of the original lineoffset
- The offset of the line.
-
OffsetIterator
public OffsetIterator(MapViewState mapState, List<? extends INode> nodes, double offset)
Creates a new offset iterator- Parameters:
mapState
- The map view state this iterator is for.nodes
- The nodes of the original lineoffset
- The offset of the line.
-
-
Method Detail
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfaceIterator<MapViewState.MapViewPoint>
-
next
public MapViewState.MapViewPoint next()
- Specified by:
next
in interfaceIterator<MapViewState.MapViewPoint>
-
getForIndex
private MapViewState.MapViewPoint getForIndex(int i)
-
remove
public void remove()
- Specified by:
remove
in interfaceIterator<MapViewState.MapViewPoint>
-
-