org.geotools.swing
Interface MapPane

All Known Implementing Classes:
AbstractMapPane, JLayeredMapPane, JMapPane

public interface MapPane

Defines the core map pane methods.

Since:
8.0
Author:
Michael Bedward

Method Summary
 void addMapPaneListener(MapPaneListener listener)
          Adds a listener to receive MapPaneEvents.
 void addMouseListener(MapMouseListener listener)
          Registers an object that wishes to receive MapMouseEvents such as a StatusBar.
 CursorTool getCursorTool()
          Gets the current cursor tool.
 ReferencedEnvelope getDisplayArea()
          Gets the current display area in world coordinates.
 MapContent getMapContent()
          Gets the MapConent instance containing the layers being displayed by this map pane.
 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.
 AffineTransform getScreenToWorldTransform()
          Gets the screen to world coordinate transform.
 AffineTransform getWorldToScreenTransform()
          Gets the world to screen coordinate transform.
 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).
 void removeMapPaneListener(MapPaneListener listener)
          Removes the specified listener.
 void removeMouseListener(MapMouseListener listener)
          Removes the specified listener.
 void reset()
          Reset the map area to include the full extent of all layers and redraw the display
 void setCursorTool(CursorTool tool)
          Sets the current cursor tool.
 void setDisplayArea(Envelope envelope)
          Sets the area to display in world units.
 void setMapContent(MapContent content)
          Sets the MapContent instance containing the layers to display.
 void setMouseEventDispatcher(MapMouseEventDispatcher dispatcher)
          Replaces the current mouse event dispatcher.
 

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(Envelope envelope)
Sets the area to display in world units.

Parameters:
the - new display area
Throws:
IllegalArgumentException - if envelope is {@code 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 StatusBar.

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.


Copyright © 1996-2014 Geotools. All Rights Reserved.