|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
org.openstreetmap.josm.data.osm.visitor.paint.WireframeMapRenderer
public class WireframeMapRenderer
A map renderer that paints a simple scheme of every primitive it visits to a previous set graphic environment.
Field Summary | |
---|---|
protected java.awt.Color |
backgroundColor
Color Preference for background |
protected java.awt.Color |
connectionColor
Color Preference for multiply connected nodes |
protected int |
connectionNodeSize
Preference: size of multiply connected nodes |
private static double |
cosPHI
Helper variable for #drawSgement |
protected java.awt.Color |
currentColor
Color cache to draw subsequent segments of same color as one Path . |
protected java.awt.geom.GeneralPath |
currentPath
Path store to draw subsequent segments of same color as one Path . |
protected java.awt.Color |
dfltWayColor
Color Preference for ways not matching any other group |
private DataSet |
ds
DataSet passed to the @{link render} function to overcome the argument
limitations of @{link Visitor} interface. |
protected boolean |
fillConnectionNode
Preference: should multiply connected nodes be filled |
protected boolean |
fillSelectedNode
Preference: should selected nodes be filled |
protected boolean |
fillTaggedNode
Preference: should tagged nodes be filled |
protected boolean |
fillUnselectedNode
Preference: should unselected nodes be filled |
protected java.awt.Color |
highlightColor
Color Preference for hightlighted objects |
protected java.awt.Color |
inactiveColor
Color Preference for inactive objects |
protected java.awt.Color |
nodeColor
Color Preference for nodes |
private static double |
PHI
Helper variable for #drawSgement |
private java.awt.Stroke |
relatedWayStroke
Helper variable for {@link #visit(Relation) |
protected java.awt.Color |
relationColor
Color Preference for relations |
protected int |
segmentNumberSpace
Preference: minimum space (displayed way length) to display segment numbers |
protected java.awt.Color |
selectedColor
Color Preference for selected objects |
protected int |
selectedNodeSize
Preference: size of selected nodes |
protected boolean |
showDirectionArrow
Preference: should directional arrows be displayed |
protected boolean |
showHeadArrowOnly
Preference: should only the last arrow of a way be displayed |
protected boolean |
showOnewayArrow
Preference: should arrows for oneways be displayed |
protected boolean |
showOrderNumber
Preference: should the segement numbers of ways be displayed |
private static double |
sinPHI
Helper variable for #drawSgement |
protected java.awt.Color |
taggedColor
Color Preference for tagged nodes |
protected java.awt.Color |
taggedConnectionColor
Color Preference for tagged and multiply connected nodes |
protected int |
taggedNodeSize
Preference: size of tagged nodes |
protected int |
unselectedNodeSize
Preference: size of unselected nodes |
protected java.awt.Color |
untaggedWayColor
Color Preference for untagged ways |
protected int |
virtualNodeSize
Preference: size of virtual nodes (0 displayes display) |
protected int |
virtualNodeSpace
Preference: minimum space (displayed way length) to display virtual nodes |
Fields inherited from class org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer |
---|
g, isInactiveMode, nc |
Constructor Summary | |
---|---|
WireframeMapRenderer(java.awt.Graphics2D g,
NavigatableComponent nc,
boolean isInactiveMode)
Creates an wireframe render |
Method Summary | |
---|---|
protected void |
displaySegments()
Finally display all segments in currect path. |
protected void |
displaySegments(java.awt.Color newColor)
Finally display all segments in currect path. |
void |
drawNode(Node n,
java.awt.Color color,
int size,
boolean fill)
Draw the node as small rectangle with the given color. |
protected void |
drawOrderNumber(java.awt.Point p1,
java.awt.Point p2,
int orderNumber)
Draw an number of the order of the two consecutive nodes within the parents way |
protected void |
drawSegment(java.awt.geom.GeneralPath path,
java.awt.Point p1,
java.awt.Point p2,
boolean showDirection)
Draw a line with the given color. |
protected void |
drawSegment(java.awt.Point p1,
java.awt.Point p2,
java.awt.Color col,
boolean showDirection)
Draw a line with the given color. |
void |
drawVirtualNodes(java.util.Collection<Way> ways,
java.util.Collection<WaySegment> highlightVirtualNodes)
Draws virtual nodes. |
void |
getColors()
Reads the color definitions from preferences. |
protected void |
getSettings(boolean virtual)
Reads all the settings from preferences. |
static boolean |
isLargeSegment(java.awt.geom.Point2D p1,
java.awt.geom.Point2D p2,
int space)
Checks if a way segemnt is large enough for additional information display. |
protected boolean |
isPolygonVisible(java.awt.Polygon polygon)
Checks if a polygon is visible in display. |
protected boolean |
isSegmentVisible(java.awt.Point p1,
java.awt.Point p2)
Checks if segment is visible in display. |
private static int |
max(int a,
int b,
int c,
int d)
Helper function to calculate maximum of 4 values. |
void |
render(DataSet data,
boolean virtual,
Bounds bounds)
Renders the dataset for display. |
void |
visit(Changeset cs)
Visitor for changesets not used in this class |
void |
visit(Node n)
Draw a small rectangle. |
void |
visit(Relation r)
Draw objects used in relations. |
void |
visit(Way w)
Draw a line for all way segments. |
void |
visitVirtual(java.awt.geom.GeneralPath path,
Way w)
Creates path for drawing virtual nodes for one way. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.awt.Color inactiveColor
protected java.awt.Color selectedColor
protected java.awt.Color nodeColor
protected java.awt.Color dfltWayColor
protected java.awt.Color relationColor
protected java.awt.Color untaggedWayColor
protected java.awt.Color backgroundColor
protected java.awt.Color highlightColor
protected java.awt.Color taggedColor
protected java.awt.Color connectionColor
protected java.awt.Color taggedConnectionColor
protected boolean showDirectionArrow
protected boolean showOnewayArrow
protected boolean showHeadArrowOnly
protected boolean showOrderNumber
protected boolean fillSelectedNode
protected boolean fillUnselectedNode
protected boolean fillTaggedNode
protected boolean fillConnectionNode
protected int selectedNodeSize
protected int unselectedNodeSize
protected int connectionNodeSize
protected int taggedNodeSize
protected int virtualNodeSize
protected int virtualNodeSpace
protected int segmentNumberSpace
protected java.awt.Color currentColor
Path
.
protected java.awt.geom.GeneralPath currentPath
Path
.
private DataSet ds
DataSet
passed to the @{link render} function to overcome the argument
limitations of @{link Visitor} interface. Only valid until end of rendering call.
private static final double PHI
#drawSgement
private static final double cosPHI
#drawSgement
private static final double sinPHI
#drawSgement
private java.awt.Stroke relatedWayStroke
Constructor Detail |
---|
public WireframeMapRenderer(java.awt.Graphics2D g, NavigatableComponent nc, boolean isInactiveMode)
g
- the graphics context. Must not be null.nc
- the map viewport. Must not be null.isInactiveMode
- if true, the paint visitor shall render OSM objects such that they
look inactive. Example: rendering of data in an inactive layer using light gray as color only.
java.lang.IllegalArgumentException
- thrown if g
is null
java.lang.IllegalArgumentException
- thrown if nc
is nullMethod Detail |
---|
public void getColors()
public
, so that
color names in preferences can be displayed even without calling the wireframe display before.
protected void getSettings(boolean virtual)
virtual
- true
if virtual nodes are usedpublic void render(DataSet data, boolean virtual, Bounds bounds)
render
in interface Rendering
data
- DataSet
to displayvirtual
- true
if virtual nodes are usedbounds
- display boundariesprivate static final int max(int a, int b, int c, int d)
a
- First valueb
- Second valuec
- Third valued
- Fourth valuepublic void visit(Node n)
visit
in interface Visitor
n
- The node to draw.public static boolean isLargeSegment(java.awt.geom.Point2D p1, java.awt.geom.Point2D p2, int space)
p1
- First point of the way segment.p2
- Second point of the way segment.space
- The free space to check against.
true
if segment is larger than required spacepublic void drawVirtualNodes(java.util.Collection<Way> ways, java.util.Collection<WaySegment> highlightVirtualNodes)
ways
- The ways to draw nodes for.highlightVirtualNodes
- Way segements, where nodesshould be highlighted.public void visitVirtual(java.awt.geom.GeneralPath path, Way w)
path
- The path to append drawing to.w
- The ways to draw node for.public void visit(Way w)
visit
in interface Visitor
w
- The way to draw.public void visit(Relation r)
visit
in interface Visitor
r
- The relation to draw.public void visit(Changeset cs)
visit
in interface Visitor
cs
- The changeset for inspection.protected void drawOrderNumber(java.awt.Point p1, java.awt.Point p2, int orderNumber)
p1
- First point of the way segment.p2
- Second point of the way segment.orderNumber
- The number of the segment in the way.public void drawNode(Node n, java.awt.Color color, int size, boolean fill)
n
- The node to draw.color
- The color of the node.protected void drawSegment(java.awt.geom.GeneralPath path, java.awt.Point p1, java.awt.Point p2, boolean showDirection)
path
- The path to append this segment.p1
- First point of the way segment.p2
- Second point of the way segment.showDirection
- true
if segment direction should be indicatedprotected void drawSegment(java.awt.Point p1, java.awt.Point p2, java.awt.Color col, boolean showDirection)
p1
- First point of the way segment.p2
- Second point of the way segment.col
- The color to use for drawing line.showDirection
- true
if segment direction should be indicated.protected boolean isSegmentVisible(java.awt.Point p1, java.awt.Point p2)
p1
- First point of the way segment.p2
- Second point of the way segment.
true
if segment is visible.protected boolean isPolygonVisible(java.awt.Polygon polygon)
polygon
- The polygon to check.
true
if polygon is visible.protected void displaySegments()
protected void displaySegments(java.awt.Color newColor)
newColor
- This color is set after the path is drawn.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |