Interface MapPane

    • Method Detail

      • getMapContent

        MapContent getMapContent()
        Gets the MapConent instance containing the layers being displayed by this map pane.
        Returns:
        the map content
      • setMapContent

        void setMapContent​(MapContent content)
        Sets the MapContent instance containing the layers to display.
        Parameters:
        content - the map content
      • getMouseEventDispatcher

        MapMouseEventDispatcher getMouseEventDispatcher()
        Gets the current mouse event dispatcher which is responsible for converting each input Java AWT mouse event into a MapMouseEvent and forwarding it to each MapMouseListener.
        Returns:
        the current mouse event dispatcher (may be null)
      • setMouseEventDispatcher

        void setMouseEventDispatcher​(MapMouseEventDispatcher dispatcher)
        Replaces the current mouse event dispatcher. All current listeners will be removed. It is the responsibility of the client to add them to the new dispatcher if this is desired.
        Parameters:
        dispatcher - the new dispatcher (may be null)
      • getDisplayArea

        ReferencedEnvelope getDisplayArea()
        Gets the current display area in world coordinates. This is a short-cut for mapPane.getMapContent().getViewport().getBounds(). If a MapContent object has not yet been associated with the map pane, an empty ReferencedEnvelope is returned.
        Returns:
        the display area in world coordinates
      • setDisplayArea

        void setDisplayArea​(Bounds envelope)
        Sets the area to display in world units.
        Parameters:
        envelope - the new display area
        Throws:
        IllegalArgumentException - if envelope is null
      • reset

        void reset()
        Reset the map area to include the full extent of all layers and redraw the display
      • getScreenToWorldTransform

        AffineTransform getScreenToWorldTransform()
        Gets the screen to world coordinate transform. This is a short-cut for mapPane.getMapContent().getViewport().getScreenToWorld().
        Returns:
        the screen to world coordinate transform
      • getWorldToScreenTransform

        AffineTransform getWorldToScreenTransform()
        Gets the world to screen coordinate transform. This is a short-cut for mapPane.getMapContent().getViewport().getWorldToScreen().

        The returned AffineTransform can be used to determine the current drawing scale...

        
         double scale = mapPane.getWorldToScreenTransform().getScaleX();
         
        Returns:
        the world to screen coordinate transform
      • addMapPaneListener

        void addMapPaneListener​(MapPaneListener listener)
        Adds a listener to receive MapPaneEvents.
        Parameters:
        listener - the listener to add
        Throws:
        IllegalArgumentException - if listener is null
      • removeMapPaneListener

        void removeMapPaneListener​(MapPaneListener listener)
        Removes the specified listener.
        Parameters:
        listener - the listener to remove
      • addMouseListener

        void addMouseListener​(MapMouseListener listener)
        Registers an object that wishes to receive MapMouseEvents such as a JMapStatusBar.
        Parameters:
        listener - the listener to add
        Throws:
        IllegalArgumentException - if listener is null
        See Also:
        MapMouseListener
      • removeMouseListener

        void removeMouseListener​(MapMouseListener listener)
        Removes the specified listener.
        Parameters:
        listener - the listener to remove
      • getCursorTool

        CursorTool getCursorTool()
        Gets the current cursor tool.
        Returns:
        the current cursor tool (may be null)
      • setCursorTool

        void setCursorTool​(CursorTool tool)
        Sets the current cursor tool.
        Parameters:
        tool - the tool; or null for no cursor tool
      • moveImage

        void moveImage​(int dx,
                       int dy)
        Moves the image(s) displayed by the map pane from the current origin (x,y) (device pixels) to (x+dx, y+dy). If this method is called when the map pane is not visible, or when the pane's visible rectangle is empty, it is ignored.
        Parameters:
        dx - the x offset in pixels
        dy - the y offset in pixels.