Class MapViewDrawing

  • All Implemented Interfaces:
    java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, Drawing, org.mapsforge.map.view.MapView

    public class MapViewDrawing
    extends org.mapsforge.map.awt.view.MapView
    implements Drawing
    See Also:
    Serialized Form
    • Nested Class Summary

      • Nested classes/interfaces inherited from class java.awt.Container

        java.awt.Container.AccessibleAWTContainer
      • Nested classes/interfaces inherited from class java.awt.Component

        java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.awt.Color DEFAULT_PATH_COLOR  
      • Fields inherited from class java.awt.Component

        accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
      • Fields inherited from interface java.awt.image.ImageObserver

        ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
    • Constructor Summary

      Constructors 
      Constructor Description
      MapViewDrawing()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addDrawingClickListener​(DrawingClickListener listener)
      Add a listener to click to this drawing.
      void clear()
      Clear the drawing (overlays and underlying graph/map).
      void clearOverlays()
      Remove overlays from the drawing (do not remove the underlying graph/map).
      protected org.mapsforge.core.model.LatLong convertPoint​(Point point)  
      protected MarkerAutoScaling createMarker​(Point point, java.awt.Color outer, java.awt.Color inner, Drawing.AlphaMode mode)  
      PointSetOverlay createPointSetOverlay()
      Create a new PointSetOverlay that can be used to add overlay points to this drawing.
      PointSetOverlay createPointSetOverlay​(int width, java.awt.Color color)
      Create a new PointSetOverlay with the given initial width and color that can be used to add overlay points to this drawing.
      void drawGraph​(java.io.File file)  
      void drawGraph​(Graph graph)
      Draw the given graph using a default palette specific to the implementation.
      void drawGraph​(Graph graph, GraphPalette palette)
      Draw the given graph using the given palette.
      MarkerOverlay drawMarker​(Point point, java.awt.Color outer, java.awt.Color inner, Drawing.AlphaMode mode)
      Draw a marker at the given position using the given colors and according to the given mode.
      PathOverlay drawPath​(Path path)
      Draw a path with both origin and destination markers using a default color specific to the implementation
      PathOverlay drawPath​(Path path, boolean markers)
      Draw a path using a default color specific to the implementation
      PathOverlay drawPath​(Path path, java.awt.Color color)
      Draw a path with both origin and destination markers using the given color.
      PathOverlay drawPath​(Path path, java.awt.Color color, boolean markers)
      Draw a path using the given color.
      void paint​(java.awt.Graphics graphics)  
      void removeDrawingClickListener​(DrawingClickListener listener)
      Remove the given listener from the drawing.
      • Methods inherited from class org.mapsforge.map.awt.view.MapView

        addInputListener, addLayer, addListeners, destroy, destroyAll, getBoundingBox, getDimension, getFpsCounter, getFrameBuffer, getLayerManager, getMapScaleBar, getMapViewProjection, getModel, onMoveEvent, onZoomEvent, removeInputListener, setCenter, setMapScaleBar, setZoomLevel, setZoomLevelMax, setZoomLevelMin
      • Methods inherited from class java.awt.Container

        add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, isValidateRoot, layout, list, list, locate, minimumSize, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
      • Methods inherited from class java.awt.Component

        action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, revalidate, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setMixingCutoutShape, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface org.mapsforge.map.view.MapView

        getHeight, getWidth, repaint
    • Field Detail

      • DEFAULT_PATH_COLOR

        public static final java.awt.Color DEFAULT_PATH_COLOR
    • Constructor Detail

      • MapViewDrawing

        public MapViewDrawing()
    • Method Detail

      • paint

        public void paint​(java.awt.Graphics graphics)
        Overrides:
        paint in class org.mapsforge.map.awt.view.MapView
      • clear

        public void clear()
        Description copied from interface: Drawing
        Clear the drawing (overlays and underlying graph/map).
        Specified by:
        clear in interface Drawing
      • clearOverlays

        public void clearOverlays()
        Description copied from interface: Drawing
        Remove overlays from the drawing (do not remove the underlying graph/map).
        Specified by:
        clearOverlays in interface Drawing
      • convertPoint

        protected org.mapsforge.core.model.LatLong convertPoint​(Point point)
      • addDrawingClickListener

        public void addDrawingClickListener​(DrawingClickListener listener)
        Description copied from interface: Drawing
        Add a listener to click to this drawing.
        Specified by:
        addDrawingClickListener in interface Drawing
        Parameters:
        listener - DrawingClickListener to add to this Drawing.
      • removeDrawingClickListener

        public void removeDrawingClickListener​(DrawingClickListener listener)
        Description copied from interface: Drawing
        Remove the given listener from the drawing.
        Specified by:
        removeDrawingClickListener in interface Drawing
        Parameters:
        listener - DrawingClickListener to remove from this Drawing.
      • drawMarker

        public MarkerOverlay drawMarker​(Point point,
                                        java.awt.Color outer,
                                        java.awt.Color inner,
                                        Drawing.AlphaMode mode)
        Description copied from interface: Drawing
        Draw a marker at the given position using the given colors and according to the given mode.
        Specified by:
        drawMarker in interface Drawing
        Parameters:
        point - Position of the marker to draw.
        outer - Color for the outer part of the marker to draw.
        inner - Color for the inner part of the marker to draw.
        mode - Mode for filling the inner par of the marker.
        Returns:
        A MarkerOverlay instance representing the newly drawn marker.
      • createPointSetOverlay

        public PointSetOverlay createPointSetOverlay()
        Description copied from interface: Drawing
        Create a new PointSetOverlay that can be used to add overlay points to this drawing. PointSetOverlay are heavy memory resources, do not use one for each point!
        Specified by:
        createPointSetOverlay in interface Drawing
        Returns:
        A new PointSetOverlay for this drawing.
      • createPointSetOverlay

        public PointSetOverlay createPointSetOverlay​(int width,
                                                     java.awt.Color color)
        Description copied from interface: Drawing
        Create a new PointSetOverlay with the given initial width and color that can be used to add overlay points to this drawing. PointSetOverlay are heavy memory resources, do not use one for each point!
        Specified by:
        createPointSetOverlay in interface Drawing
        Parameters:
        width - Initial width of points in the overlay.
        color - Initial width of points in the overlay.
        Returns:
        A new PointSetOverlay for this drawing.
      • drawGraph

        public void drawGraph​(java.io.File file)
      • drawGraph

        public void drawGraph​(Graph graph)
        Description copied from interface: Drawing
        Draw the given graph using a default palette specific to the implementation.
        Specified by:
        drawGraph in interface Drawing
        Parameters:
        graph - Graph to draw.
      • drawPath

        public PathOverlay drawPath​(Path path,
                                    java.awt.Color color,
                                    boolean markers)
        Description copied from interface: Drawing
        Draw a path using the given color.
        Specified by:
        drawPath in interface Drawing
        Parameters:
        path - Path to draw.
        color - Color of the path to draw.
        markers - true to show origin and destination markers.
        Returns:
        A PathOverlay instance representing the newly drawn path.
      • drawPath

        public PathOverlay drawPath​(Path path,
                                    java.awt.Color color)
        Description copied from interface: Drawing
        Draw a path with both origin and destination markers using the given color.
        Specified by:
        drawPath in interface Drawing
        Parameters:
        path - Path to draw.
        color - Color of the path to draw.
        Returns:
        A PathOverlay instance representing the newly drawn path.
        See Also:
        Drawing.drawPath(Path, Color, boolean)
      • drawPath

        public PathOverlay drawPath​(Path path)
        Description copied from interface: Drawing
        Draw a path with both origin and destination markers using a default color specific to the implementation
        Specified by:
        drawPath in interface Drawing
        Parameters:
        path - Path to draw.
        Returns:
        A PathOverlay instance representing the newly drawn path.
        See Also:
        Drawing.drawPath(Path, Color, boolean)
      • drawPath

        public PathOverlay drawPath​(Path path,
                                    boolean markers)
        Description copied from interface: Drawing
        Draw a path using a default color specific to the implementation
        Specified by:
        drawPath in interface Drawing
        Parameters:
        path - Path to draw.
        markers - true to show origin and destination markers.
        Returns:
        A PathOverlay instance representing the newly drawn path.
        See Also:
        Drawing.drawPath(Path, Color, boolean)