public class MapViewPath extends MapPath2D
It is possible to clip the part of the path that is outside the view. This is useful when drawing dashed lines. Those lines use up a lot of
performance if the zoom level is high and the part outside the view is long. See computeClippedLine(Stroke)
.
Modifier and Type | Class and Description |
---|---|
private class |
MapViewPath.ClampingPathVisitor |
static interface |
MapViewPath.PathSegmentConsumer
This class is used to visit the segments of this path.
|
Modifier and Type | Field and Description |
---|---|
private MapViewState |
state |
Constructor and Description |
---|
MapViewPath(MapView mv)
Create a new path
|
MapViewPath(MapViewState state)
Create a new path
|
Modifier and Type | Method and Description |
---|---|
MapViewPath |
append(java.lang.Iterable<Node> nodes,
boolean connect)
Append a list of nodes
|
MapViewPath |
appendClosed(java.lang.Iterable<Node> nodes,
boolean connect)
Append a list of nodes as closed way.
|
private void |
appendWay(java.lang.Iterable<Node> nodes,
boolean connect,
boolean close) |
java.awt.Shape |
computeClippedLine(java.awt.Stroke stroke)
Compute a line that is similar to the current path expect for that parts outside the screen are skipped using moveTo commands.
|
MapViewPath |
lineTo(EastNorth eastNorth)
Draw a line to the position.
|
MapViewPath |
lineTo(MapViewState.MapViewPoint p)
Draw a line to the view position of given point
|
MapViewPath |
lineTo(Node n)
Draw a line to the node.
|
MapViewPath |
moveTo(EastNorth eastNorth)
Move the cursor to the given position.
|
MapViewPath |
moveTo(MapViewState.MapViewPoint p)
Move the path to the view position of given point
|
MapViewPath |
moveTo(Node n)
Move the cursor to the given node.
|
MapViewPath |
shapeAround(EastNorth eastNorth,
SymbolShape symbol,
double size)
Add the given shape centered around the current position.
|
MapViewPath |
shapeAround(MapViewState.MapViewPoint p,
SymbolShape symbol,
double size)
Add the given shape centered around the given point
|
MapViewPath |
shapeAround(Node p1,
SymbolShape symbol,
double size)
Add the given shape centered around the current node.
|
boolean |
visitClippedLine(double strokeOffset,
double strokeLength,
MapViewPath.PathSegmentConsumer consumer)
Visits all straight segments of this path.
|
boolean |
visitClippedLine(java.awt.Stroke stroke,
MapViewPath.PathSegmentConsumer consumer)
Visits all straight segments of this path.
|
append, clone, curveTo, getBounds2D, getPathIterator, lineTo, moveTo, quadTo, transform
append, closePath, contains, contains, contains, contains, contains, contains, contains, contains, createTransformedShape, getBounds, getCurrentPoint, getPathIterator, getWindingRule, intersects, intersects, intersects, intersects, reset, setWindingRule
private final MapViewState state
public MapViewPath(MapView mv)
mv
- The map view to use for coordinate conversion.public MapViewPath(MapViewState state)
state
- The state to use for coordinate conversion.public MapViewPath moveTo(Node n)
n
- The nodepublic MapViewPath moveTo(EastNorth eastNorth)
eastNorth
- The positionpublic MapViewPath moveTo(MapViewState.MapViewPoint p)
MapPath2D
public MapViewPath lineTo(Node n)
line clamping to view is done automatically.
n
- The nodepublic MapViewPath lineTo(EastNorth eastNorth)
line clamping to view is done automatically.
eastNorth
- The positionpublic MapViewPath lineTo(MapViewState.MapViewPoint p)
MapPath2D
public MapViewPath shapeAround(Node p1, SymbolShape symbol, double size)
p1
- The point to draw aroundsymbol
- The symbol typesize
- The size of the symbol in pixelpublic MapViewPath shapeAround(EastNorth eastNorth, SymbolShape symbol, double size)
eastNorth
- The point to draw aroundsymbol
- The symbol typesize
- The size of the symbol in pixelpublic MapViewPath shapeAround(MapViewState.MapViewPoint p, SymbolShape symbol, double size)
MapPath2D
shapeAround
in class MapPath2D
p
- The point to draw aroundsymbol
- The symbol typesize
- The size of the symbol in pixelpublic MapViewPath append(java.lang.Iterable<Node> nodes, boolean connect)
nodes
- The nodes to appendconnect
- true
if we should use a lineTo as first command.public MapViewPath appendClosed(java.lang.Iterable<Node> nodes, boolean connect)
nodes
- The nodes to appendconnect
- true
if we should use a lineTo as first command.public java.awt.Shape computeClippedLine(java.awt.Stroke stroke)
stroke
- The stroke to compute the line for.public boolean visitClippedLine(java.awt.Stroke stroke, MapViewPath.PathSegmentConsumer consumer)
stroke
- The stroke to take the dash information from.consumer
- The consumer to call for each segmentpublic boolean visitClippedLine(double strokeOffset, double strokeLength, MapViewPath.PathSegmentConsumer consumer)
strokeOffset
- The initial offset of the patternstrokeLength
- The dash pattern length. 0 to use no pattern.consumer
- The consumer to call for each segment