Class OffsetIterator
- java.lang.Object
-
- org.openstreetmap.josm.data.osm.visitor.paint.OffsetIterator
-
- All Implemented Interfaces:
java.util.Iterator<MapViewState.MapViewPoint>
public class OffsetIterator extends java.lang.Object implements java.util.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 intidxprivate MapViewStatemapStateprivate java.util.List<MapViewState.MapViewPoint>nodesprivate doubleoffsetprivate MapViewState.MapViewPointprevprivate doublexPrev0private doubleyPrev0
-
Constructor Summary
Constructors Constructor Description OffsetIterator(java.util.List<MapViewState.MapViewPoint> nodes, double offset)Creates a new offset iteratorOffsetIterator(MapViewState mapState, java.util.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.MapViewPointgetForIndex(int i)booleanhasNext()MapViewState.MapViewPointnext()voidremove()
-
-
-
Field Detail
-
mapState
private final MapViewState mapState
-
nodes
private final java.util.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(java.util.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, java.util.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:
hasNextin interfacejava.util.Iterator<MapViewState.MapViewPoint>
-
next
public MapViewState.MapViewPoint next()
- Specified by:
nextin interfacejava.util.Iterator<MapViewState.MapViewPoint>
-
getForIndex
private MapViewState.MapViewPoint getForIndex(int i)
-
remove
public void remove()
- Specified by:
removein interfacejava.util.Iterator<MapViewState.MapViewPoint>
-
-