Class AbstractMapRenderer
java.lang.Object
org.openstreetmap.josm.data.osm.visitor.paint.AbstractMapRenderer
- All Implemented Interfaces:
Rendering
- Direct Known Subclasses:
StyledMapRenderer,WireframeMapRenderer
Abstract common superclass for Rendering implementations.
- Since:
- 4087
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ColorColor Preference for backgroundprotected booleanPerforms slow operations by default.protected final Graphics2Dthe graphics context to which the visitor renders OSM objectsprotected ColorColor Preference for highlighted objectsprotected ColorColor Preference for inactive objectsprotected booleanif true, the paint visitor shall render OSM objects such that they look inactive.protected final MapViewStateTheMapViewStateto use to convert between coordinates.protected final NavigatableComponentthe map viewport - provides projection and hit detection functionalityprotected ColorColor Preference for nodesprotected ColorColor Preference for members of selected relationsprotected intPreference: minimum space (displayed way length) to display segment numbersprotected ColorColor Preference for selected objectsprotected intPreference: size of virtual nodes (0 displays display)protected intPreference: minimum space (displayed way length) to display virtual nodes -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMapRenderer(Graphics2D g, NavigatableComponent nc, boolean isInactiveMode) Creates an abstract paint visitor -
Method Summary
Modifier and TypeMethodDescriptionabstract voidDraw the node as small square with the given color.protected voiddrawOrderNumber(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, int orderNumber, Color clr) Draw an number of the order of the two consecutive nodes within the parents wayvoiddrawVirtualNodes(OsmData<?, ?, ?, ?> data, BBox bbox) Draws virtual nodes.final voidenableSlowOperations(boolean enable) Sets whether slow operations such as text rendering must be performed (true by default).voidReads the color definitions from preferences.protected voidgetSettings(boolean virtual) Reads all the settings from preferences.static booleanisLargeSegment(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, int space) Checks if a way segment is large enough for additional information display.protected booleanChecks if segment is visible in display.protected booleanisSegmentVisible(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, MapViewState.MapViewRectangle view) Checks if segment is visible in display.voidvisitVirtual(Path2D path, IWay<?> w) Creates path for drawing virtual nodes for one way.
-
Field Details
-
g
the graphics context to which the visitor renders OSM objects -
nc
the map viewport - provides projection and hit detection functionality -
mapState
TheMapViewStateto use to convert between coordinates. -
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. -
backgroundColor
Color Preference for background -
inactiveColor
Color Preference for inactive objects -
selectedColor
Color Preference for selected objects -
relationSelectedColor
Color Preference for members of selected relations -
nodeColor
Color Preference for nodes -
highlightColor
Color Preference for highlighted objects -
virtualNodeSize
Preference: size of virtual nodes (0 displays display) -
virtualNodeSpace
Preference: minimum space (displayed way length) to display virtual nodes -
segmentNumberSpace
Preference: minimum space (displayed way length) to display segment numbers -
doSlowOperations
Performs slow operations by default. Can be disabled when fast partial rendering is required
-
-
Constructor Details
-
Method Details
-
drawNode
Draw the node as small square with the given color.- Parameters:
n- The node to draw.color- The color of the node.size- size in pixelsfill- determines if the square must be filled
-
drawOrderNumber
protected void drawOrderNumber(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, int orderNumber, Color clr) Draw an number of the order of the two consecutive nodes within the parents way- Parameters:
p1- First point of the way segment.p2- Second point of the way segment.orderNumber- The number of the segment in the way.clr- The color to use for drawing the text.- Since:
- 10827
-
drawVirtualNodes
Draws virtual nodes.- Parameters:
data- The data set being rendered.bbox- The bounding box being displayed.- Since:
- 13810 (signature)
-
getColors
Reads the color definitions from preferences. This function ispublic, so that color names in preferences can be displayed even without calling the wireframe display before. -
getSettings
Reads all the settings from preferences. Calls thegetColors()function.- Parameters:
virtual-trueif virtual nodes are used
-
isLargeSegment
public static boolean isLargeSegment(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, int space) Checks if a way segment is large enough for additional information display.- Parameters:
p1- First point of the way segment.p2- Second point of the way segment.space- The free space to check against.- Returns:
trueif segment is larger than required space- Since:
- 10827
-
isSegmentVisible
Checks if segment is visible in display.- Parameters:
p1- First point of the way segment.p2- Second point of the way segment.- Returns:
trueif segment may be visible.- Since:
- 10827
- See Also:
-
isSegmentVisible
protected boolean isSegmentVisible(MapViewState.MapViewPoint p1, MapViewState.MapViewPoint p2, MapViewState.MapViewRectangle view) Checks if segment is visible in display.- Parameters:
p1- First point of the way segment.p2- Second point of the way segment.view- The current view to check- Returns:
trueif segment may be visible.- Since:
- 18501
-
visitVirtual
Creates path for drawing virtual nodes for one way.- Parameters:
path- The path to append drawing to.w- The ways to draw node for.- Since:
- 10827, 13810 (signature)
-
enableSlowOperations
Sets whether slow operations such as text rendering must be performed (true by default).- Parameters:
enable- whether slow operations such as text rendering must be performed- Since:
- 13987
-