Class AbstractMapRenderer

    • Field Detail

      • g

        protected final java.awt.Graphics2D g
        the graphics context to which the visitor renders OSM objects
      • nc

        protected final NavigatableComponent nc
        the map viewport - provides projection and hit detection functionality
      • isInactiveMode

        protected boolean 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

        protected java.awt.Color backgroundColor
        Color Preference for background
      • inactiveColor

        protected java.awt.Color inactiveColor
        Color Preference for inactive objects
      • selectedColor

        protected java.awt.Color selectedColor
        Color Preference for selected objects
      • relationSelectedColor

        protected java.awt.Color relationSelectedColor
        Color Preference for members of selected relations
      • nodeColor

        protected java.awt.Color nodeColor
        Color Preference for nodes
      • highlightColor

        protected java.awt.Color highlightColor
        Color Preference for highlighted objects
      • virtualNodeSize

        protected int virtualNodeSize
        Preference: size of virtual nodes (0 displays display)
      • virtualNodeSpace

        protected int virtualNodeSpace
        Preference: minimum space (displayed way length) to display virtual nodes
      • segmentNumberSpace

        protected int segmentNumberSpace
        Preference: minimum space (displayed way length) to display segment numbers
      • doSlowOperations

        protected boolean doSlowOperations
        Performs slow operations by default. Can be disabled when fast partial rendering is required
    • Constructor Detail

      • AbstractMapRenderer

        protected AbstractMapRenderer​(java.awt.Graphics2D g,
                                      NavigatableComponent nc,
                                      boolean isInactiveMode)

        Creates an abstract paint visitor

        Parameters:
        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.
        Throws:
        java.lang.IllegalArgumentException - if g is null
        java.lang.IllegalArgumentException - if nc is null
    • Method Detail

      • drawNode

        public abstract void drawNode​(INode n,
                                      java.awt.Color color,
                                      int size,
                                      boolean fill)
        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 pixels
        fill - determines if the square must be filled
      • drawOrderNumber

        protected void drawOrderNumber​(MapViewState.MapViewPoint p1,
                                       MapViewState.MapViewPoint p2,
                                       int orderNumber,
                                       java.awt.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

        public void drawVirtualNodes​(OsmData<?,​?,​?,​?> data,
                                     BBox bbox)
        Draws virtual nodes.
        Parameters:
        data - The data set being rendered.
        bbox - The bounding box being displayed.
        Since:
        13810 (signature)
      • getColors

        public void getColors()
        Reads the color definitions from preferences. This function is public, so that color names in preferences can be displayed even without calling the wireframe display before.
      • getSettings

        protected void getSettings​(boolean virtual)
        Reads all the settings from preferences. Calls the getColors() function.
        Parameters:
        virtual - true if 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:
        true if segment is larger than required space
        Since:
        10827
      • visitVirtual

        public void visitVirtual​(java.awt.geom.Path2D path,
                                 IWay<?> w)
        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

        public final void enableSlowOperations​(boolean enable)
        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