skrueger.geotools
Class XMapPane

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by schmitzm.swing.JPanel
                      extended by skrueger.geotools.XMapPane
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
SelectableXMapPane

public class XMapPane
extends JPanel

The XMapPane class uses a Geotools GTRenderer to paint up to two MapContexts: a "local" MapContext and a "background" MapContext. The idea is, that rendering a background layer made up of e.g. OSM data, may take much longer than rendering local data.
Every MapContext is rendered on a Thread of it's own. Starting/ cancelling these threads is done by the RenderingExecutor.

While the renderers are rending the map, a
The XMapPane is based on schmitzm JPanel, so JPanel.print(Graphics) will automatically set the background of components to pure white. The XMapPane has a MouseListener that manages zooming.
A logo/icon to float in the lower left corner may be set with setMapImage(BufferedImage)

Author:
stefan
See Also:
- an extension of {@link XMapPane} that supports selecting features., Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  skrueger.geotools.RenderingExecutor bgExecuter
          This RenderingExecutor manages the creation and cancellation of up to one Thread for rendering the bgContext.
protected  MapLayerListener bgMapLayerListener
          Listens to each layer in the local MapContext for changes and triggers repaints.
static int DEFAULT_RESIZING_PAINT_DELAY
          Default delay (milliseconds) before the map will be redrawn when resizing the pane.
static int INITIAL_REPAINT_DELAY
          The initial delay in milliseconds until the finalImage is updated the first time.
protected  LabelCache labelCache
           
protected  MapLayerListener localMapLayerListener
          Listens to each layer in the local MapContext for changes and triggers repaints.
protected  Envelope mapArea
          the area of the map to draw
protected  boolean mapImageInvalid
          A flag indicating that the shown image is invalid and needs to be re-rendered.
protected  HashMap<MapLayer,Boolean> mapLayerSelectable
          Holds a flag for each layer, whether it is regarded or ignored on #SELECT_TOP, #SELECT_ALL and #SELECT_ONE_FROM_TOP actions.
protected  Vector<JMapPaneListener> mapPaneListeners
          List of listeners of this XMapPane
static int NONE
          Flag for no-tool.
protected  Envelope oldMapArea
          We store the old mapArea for a moment to use it for the "quick scaled preview" in case of ZoomOut
protected  AffineTransform oldScreenToWorld
          We store the old transform for a moment to use it for the "quick scaled preview" in case of ZoomIn
protected  boolean paneResized
          A flag indicating, that the image size has changed and the buffered images are not big enough any more
protected  ArrayList<Exception> renderingErrors
          Is set if a renderer has an error
static int REPEATING_REPAINT_DELAY
          While the bgExecuter and localExecuter are rendering, the repaintTimer is regularly updating the finalImage with previews.
protected  AffineTransform screenToWorld
          Transformation zwischen Fenster-Koordinaten und Karten-Koordinaten (lat/lon)
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
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
XMapPane()
           
XMapPane(MapContext localContext_, Map<Object,Object> rendererHints)
          full constructor extending JPanel
 
Method Summary
 void addMapPaneListener(JMapPaneListener l)
          Fuegt der Map einen Listener hinzu.
 ReferencedEnvelope bestAllowedMapArea(ReferencedEnvelope env)
          Korrigiert den Envelope aka mapArea auf die beste erlaubte Flaeche damit die Massstabsbeschaenkungen noch eingehalten werden, FALLS der uebergeben Envelope nicht schon gueltig sein sollte.
 void blink( features)
          Makes the given FeatureCollection bink in the map for a moment
 void configureMouse(MouseInputType type, XMapPaneAction action)
           
 void dispose()
          Should be called when the JMapPane is not needed no more to help the GarbageCollector Removes all JMapPaneListeners that are registered
protected  void drawRectangle(Graphics graphics, Point startPos, Point e)
          Draws a rectangle in XOR mode from the origin at #startPos to the given point.
protected  void drawRectangle(Graphics graphics, Point startPos, Point e, Color color, boolean fill)
          Draws a rectangle in XOR mode from the origin at #startPos to the given point.
protected  boolean drawScaledPreviewImage_Zoom(Graphics2D graphics)
          Diretly paints scaled preview into the SelectableXMapPane.
 MapContext getBgContext()
           
 double getDefaultMaxMapExtendMode()
          If maxExtend is null the following rules are used to create a default maximum.
 Point getImageOrigin()
           
 GTRenderer getLocalRenderer()
           
 ReferencedEnvelope getMapArea()
          Returns a copy of the mapArea
 Color getMapBackgroundColor()
          Returns the background Color of the map pane.
 MapContext getMapContext()
           
static DirectPosition2D getMapCoordinatesFromEvent(MouseEvent e)
          Konvertiert die Maus-Koordinaten (relativ zum JMapPane) in Karten-Koordinaten.
 BufferedImage getMapImage()
          Get the BufferedImage to use as a flaoting icon in the lower right corner.
 Envelope getMaxExtend()
          Returns the evelope of the viewable area.
 Double getMaxZoomScale()
          Retuns the maximum allowed zoom scale.
 Double getMinZoomScale()
          Retuns the minimum allowed zoom scale.
 Map<Object,Object> getRendererHints()
           
 AffineTransform getScreenToWorld()
          Liefert eine affine Transformation, um von den Fenster-Koordinaten in die Karten-Koordinaten (Lat/Lon) umzurechnen.
 XMapPaneTool getTool()
           
 AffineTransform getWorldToScreenTransform()
           
 boolean isMapLayerSelectable(MapLayer layer)
          Returns whether a layer is regarded or ignored on #SELECT_TOP, #SELECT_ALL and #SELECT_ONE_FROM_TOP actions.
 boolean isShowExceptions()
          Shall exceptions be reported in the mappane?
 boolean isWellDefined()
          Return true if a CRS and a mapArea are set and the XMapPane is visible and has bounds set.
 void onRenderingCancelled()
          Called by the RenderingExecutor when rendering was cancelled.
 void onRenderingCompleted(long l)
          Called by the RenderingExecutor when rendering has been completed.
 void onRenderingFailed(Exception renderingError)
          Called by the XMapPane.RenderingTask when rendering failed.
protected  void paintComponent(Graphics g)
           
 void pan(int dX, int dY)
          Usually called from XMapPaneAction_Pan to pan the image.
 void refresh()
          Triggers to repaint (fast) and re-render (slow) the JMapPane.
 void removeMapPaneListener(JMapPaneListener l)
          Entfernt einen Listener von der Map.
 void setAntiAliasing(boolean aa)
          Aktiviert oder deaktiviert das AntiAliasing for diese SelectableXMapPane.
 void setBgContext(MapContext context)
           
 void setBorder(Border b)
           
 void setDefaultMaxMapExtendMode(double defaultMaxMapExtendMode)
          If maxExtend is null the following rules are used to create a default maximum.
 void setJava2dHints(RenderingHints java2dHints)
           
 void setLocalContext(MapContext context)
           
 boolean setMapArea(Envelope newMapArea)
          Set the new map area.
 boolean setMapArea(ReferencedEnvelope newMapArea)
          Set the new map area.
 void setMapBackgroundColor(Color bgColor)
          Set the background color of the map.
 void setMapImage(BufferedImage mapImage)
          Set the BufferedImage to use as a flaoting icon in the lower right corner
 void setMapLayerSelectable(MapLayer layer, Boolean selectable)
          Sets whether a layer is regarded or ignored on #SELECT_TOP, #SELECT_ALL and #SELECT_ONE_FROM_TOP actions.
 void setMaxExtend(Envelope maxExtend)
          Defines an evelope of the viwable area.
 void setMaxZoomScale(Double maxZoomScale)
          Set the maximum allowed zoom scale.
 void setMinZoomScale(Double minZoomScale)
          Set the minimum (nearest) allowed zoom scale.
 void setPainting(boolean b)
          If true, allow the XMapPane to process #repaint() requests.
 void setShowExceptions(boolean showExceptions)
          Shall non-fatal rendering exceptions be reported in the mappane or be dropped quitely.
 void setTool(XMapPaneTool tool)
          Configure the XMapPaneTool that active on the map.
 Point2D tranformGeoToWindow(double x, double y)
          Transformiert einen Geo-Koordinate in eine Fenster-Koordinaten.
 Envelope tranformGeoToWindow(double ox, double oy, double px, double py)
          Transformiert einen Geo-Koordinaten-Bereich in Fenster-Koordinaten.
 Envelope tranformWindowToGeo(int ox, int oy, int px, int py)
          Transformiert einen Fenster-Koordinaten-Bereich in Geo-Koordinaten.
 void updateCursor()
          Will update the cursor.
protected  Image updateFinalImage()
          The renderers are all rendering into their own Images.
 void zoomTo( features)
          Sets the mapArea to best possibly present the given features.
 void zoomTo(Point center, Double zoomFaktor)
          Zooms towards a point.
 void zoomToLayer(MapLayer layer)
          Setzt den Kartenausschnitt auf die Ausdehnung eines bestimmten Layers.
 void zoomToLayerIdxReverse(int index)
          Zooms the SelectableXMapPane to the Envelope of the selected layer.
 
Methods inherited from class schmitzm.swing.JPanel
print, setBackground, setEnabled
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INITIAL_REPAINT_DELAY

public static final int INITIAL_REPAINT_DELAY
The initial delay in milliseconds until the finalImage is updated the first time.

See Also:
Constant Field Values

REPEATING_REPAINT_DELAY

public static final int REPEATING_REPAINT_DELAY
While the bgExecuter and localExecuter are rendering, the repaintTimer is regularly updating the finalImage with previews.

See Also:
Constant Field Values

DEFAULT_RESIZING_PAINT_DELAY

public static final int DEFAULT_RESIZING_PAINT_DELAY
Default delay (milliseconds) before the map will be redrawn when resizing the pane. This is to avoid flickering while drag-resizing.

See Also:
resizeTimer, Constant Field Values

NONE

public static final int NONE
Flag for no-tool.

See Also:
Constant Field Values

bgExecuter

protected skrueger.geotools.RenderingExecutor bgExecuter
This RenderingExecutor manages the creation and cancellation of up to one Thread for rendering the bgContext.


bgMapLayerListener

protected MapLayerListener bgMapLayerListener
Listens to each layer in the local MapContext for changes and triggers repaints.


labelCache

protected LabelCache labelCache

localMapLayerListener

protected MapLayerListener localMapLayerListener
Listens to each layer in the local MapContext for changes and triggers repaints. We don't have to listen layerChanged, because that is already done in localContextListener


mapArea

protected Envelope mapArea
the area of the map to draw


mapImageInvalid

protected boolean mapImageInvalid
A flag indicating that the shown image is invalid and needs to be re-rendered.


mapLayerSelectable

protected final HashMap<MapLayer,Boolean> mapLayerSelectable
Holds a flag for each layer, whether it is regarded or ignored on #SELECT_TOP, #SELECT_ALL and #SELECT_ONE_FROM_TOP actions.


mapPaneListeners

protected Vector<JMapPaneListener> mapPaneListeners
List of listeners of this XMapPane


oldMapArea

protected Envelope oldMapArea
We store the old mapArea for a moment to use it for the "quick scaled preview" in case of ZoomOut


oldScreenToWorld

protected AffineTransform oldScreenToWorld
We store the old transform for a moment to use it for the "quick scaled preview" in case of ZoomIn


paneResized

protected boolean paneResized
A flag indicating, that the image size has changed and the buffered images are not big enough any more


screenToWorld

protected AffineTransform screenToWorld
Transformation zwischen Fenster-Koordinaten und Karten-Koordinaten (lat/lon)


renderingErrors

protected ArrayList<Exception> renderingErrors
Is set if a renderer has an error

Constructor Detail

XMapPane

public XMapPane()

XMapPane

public XMapPane(MapContext localContext_,
                Map<Object,Object> rendererHints)
full constructor extending JPanel

Parameters:
rendererHints - may be null. Otherwise a Map of RenderingHints to override the default from GTUtil.getDefaultGTRendererHints(GTRenderer)
localContext - The main MapContext to use. If null, an empty DefaultMapContext will be created.
Method Detail

getTool

public XMapPaneTool getTool()

getMapCoordinatesFromEvent

public static DirectPosition2D getMapCoordinatesFromEvent(MouseEvent e)
Konvertiert die Maus-Koordinaten (relativ zum JMapPane) in Karten-Koordinaten.

Parameters:
e - Maus-Ereignis

addMapPaneListener

public void addMapPaneListener(JMapPaneListener l)
Fuegt der Map einen Listener hinzu.

Parameters:
l - neuer Listener

bestAllowedMapArea

public ReferencedEnvelope bestAllowedMapArea(ReferencedEnvelope env)
Korrigiert den Envelope aka mapArea auf die beste erlaubte Flaeche damit die Massstabsbeschaenkungen noch eingehalten werden, FALLS der uebergeben Envelope nicht schon gueltig sein sollte.
Since 21. April 09: Before thecalculation starts, the aspect ratio is corrected. This change implies, that setMapArea() will most of the time not allow setting to a wrong aspectRatio.


dispose

public void dispose()
Should be called when the JMapPane is not needed no more to help the GarbageCollector Removes all JMapPaneListeners that are registered


drawRectangle

protected void drawRectangle(Graphics graphics,
                             Point startPos,
                             Point e)
Draws a rectangle in XOR mode from the origin at #startPos to the given point. All in screen coordinates.


drawRectangle

protected void drawRectangle(Graphics graphics,
                             Point startPos,
                             Point e,
                             Color color,
                             boolean fill)
Draws a rectangle in XOR mode from the origin at #startPos to the given point. All in screen coordinates.


drawScaledPreviewImage_Zoom

protected boolean drawScaledPreviewImage_Zoom(Graphics2D graphics)
Diretly paints scaled preview into the SelectableXMapPane. Used to give the user something to look at while we are rendering. Method should be called after setMapArea(Envelope) has been set to the new mapArea and transform has been reset.

Parameters:
g - Graphics2D to paint the preview into

getBgContext

public MapContext getBgContext()

getMapContext

public MapContext getMapContext()

getMapArea

public ReferencedEnvelope getMapArea()
Returns a copy of the mapArea

Returns:

getMapBackgroundColor

public Color getMapBackgroundColor()
Returns the background Color of the map pane. If not set, the methods looks for a parent component and will use its background color. If no parent component is available, WHITE is returned.


getMapImage

public BufferedImage getMapImage()
Get the BufferedImage to use as a flaoting icon in the lower right corner.

Returns:
null if the feature is deactivated.

getMaxExtend

public Envelope getMaxExtend()
Returns the evelope of the viewable area. The JMapPane will never show anything outside of this extend. If this has been set to null via setMaxExtend(Envelope), it tries to return quickly the context's bounds. It it takes to long to determine the context bounds, null is returned.

Parameters:
maxExtend - null to not have this restriction.

getMaxZoomScale

public Double getMaxZoomScale()
Retuns the maximum allowed zoom scale. This is the smaller number value of the two. Defaults to Double.MIN_VALUE


getMinZoomScale

public Double getMinZoomScale()
Retuns the minimum allowed zoom scale. This is the bigger number value of the two. Defaults to Double.MAX_VALUE


getRendererHints

public Map<Object,Object> getRendererHints()

getScreenToWorld

public AffineTransform getScreenToWorld()
Liefert eine affine Transformation, um von den Fenster-Koordinaten in die Karten-Koordinaten (Lat/Lon) umzurechnen.

Returns:
eine Kopie der aktuellen Transformation; null wenn noch keine Karte angezeigt wird

getWorldToScreenTransform

public AffineTransform getWorldToScreenTransform()

isMapLayerSelectable

public boolean isMapLayerSelectable(MapLayer layer)
Returns whether a layer is regarded or ignored on #SELECT_TOP, #SELECT_ALL and #SELECT_ONE_FROM_TOP actions. Returns true if the selectability has not been defined.

Parameters:
layer - a layer

isWellDefined

public boolean isWellDefined()
Return true if a CRS and a mapArea are set and the XMapPane is visible and has bounds set.


pan

public void pan(int dX,
                int dY)
Usually called from XMapPaneAction_Pan to pan the image.

Parameters:
startPos - in screen coordinates
lastPos - in screen coordinates

onRenderingCancelled

public void onRenderingCancelled()
Called by the RenderingExecutor when rendering was cancelled.


onRenderingCompleted

public void onRenderingCompleted(long l)
Called by the RenderingExecutor when rendering has been completed.

Parameters:
l - long ms the rendering took

onRenderingFailed

public void onRenderingFailed(Exception renderingError)
Called by the XMapPane.RenderingTask when rendering failed. Publishes a MapPaneEvent of type MapPaneEvent.Type.RENDERING_STOPPED to listeners.

Parameters:
renderingError - The error that occured during rendering
See Also:
MapPaneListener#onRenderingStopped(org.geotools.swing.event.MapPaneEvent)

paintComponent

protected void paintComponent(Graphics g)
Overrides:
paintComponent in class JComponent

removeMapPaneListener

public void removeMapPaneListener(JMapPaneListener l)
Entfernt einen Listener von der Map.

Parameters:
l - zu entfernender Listener

setBgContext

public void setBgContext(MapContext context)

setJava2dHints

public void setJava2dHints(RenderingHints java2dHints)

setLocalContext

public void setLocalContext(MapContext context)

setBorder

public void setBorder(Border b)
Overrides:
setBorder in class JComponent

refresh

public void refresh()
Triggers to repaint (fast) and re-render (slow) the JMapPane.


setMapArea

public boolean setMapArea(Envelope newMapArea)
Set the new map area.

Parameters:
newMapArea -
Returns:
true if the mapArea has been changed and a repaint has been triggered.

setMapArea

public boolean setMapArea(ReferencedEnvelope newMapArea)
Set the new map area.

Parameters:
newMapArea -
Returns:
true if the mapArea has been changed and a repaint has been triggered.

setMapBackgroundColor

public void setMapBackgroundColor(Color bgColor)
Set the background color of the map.

Parameters:
if - null, white is used.

setMapImage

public void setMapImage(BufferedImage mapImage)
Set the BufferedImage to use as a flaoting icon in the lower right corner

Parameters:
mapImageIcon - null is allowed and deactivates this icon.

setMapLayerSelectable

public void setMapLayerSelectable(MapLayer layer,
                                  Boolean selectable)
Sets whether a layer is regarded or ignored on #SELECT_TOP, #SELECT_ALL and #SELECT_ONE_FROM_TOP actions.

Parameters:
layer - a layer
selectable - if false the layer is ignored during the upper mentioned actions. If null, the default (true) will be used.

setMaxExtend

public void setMaxExtend(Envelope maxExtend)
Defines an evelope of the viwable area. The JMapPane will never show anything outside of this extend.

Parameters:
maxExtend - null to not have this restriction.

setMaxZoomScale

public void setMaxZoomScale(Double maxZoomScale)
Set the maximum allowed zoom scale. This is the smaller number value of the two. If null is passed, Double.MINVALUE are used which mean there is no restriction.


setMinZoomScale

public void setMinZoomScale(Double minZoomScale)
Set the minimum (nearest) allowed zoom scale. This is the bigger number value of the two. If null is passed, Double.MAXVALUE are used which mean there is no restriction.


setPainting

public void setPainting(boolean b)
If true, allow the XMapPane to process #repaint() requests. Otherwise the map will not paint anything and not start any rendering Threads.


configureMouse

public void configureMouse(MouseInputType type,
                           XMapPaneAction action)

setTool

public void setTool(XMapPaneTool tool)
Configure the XMapPaneTool that active on the map. Passing null will set the NO_ACTION tool.


tranformGeoToWindow

public Envelope tranformGeoToWindow(double ox,
                                    double oy,
                                    double px,
                                    double py)
Transformiert einen Geo-Koordinaten-Bereich in Fenster-Koordinaten.

Parameters:
ox - X-Koordinate der VON-Position
oy - Y-Koordinate der VON-Position
px - X-Koordinate der BIS-Position
py - Y-Koordinate der BIS-Position

tranformGeoToWindow

public Point2D tranformGeoToWindow(double x,
                                   double y)
Transformiert einen Geo-Koordinate in eine Fenster-Koordinaten.

Parameters:
x - X-Koordinate der VON-Position
y - Y-Koordinate der VON-Position

tranformWindowToGeo

public Envelope tranformWindowToGeo(int ox,
                                    int oy,
                                    int px,
                                    int py)
Transformiert einen Fenster-Koordinaten-Bereich in Geo-Koordinaten.

Parameters:
ox - X-Koordinate der VON-Position
oy - Y-Koordinate der VON-Position
px - X-Koordinate der BIS-Position
py - Y-Koordinate der BIS-Position

updateCursor

public void updateCursor()
Will update the cursor. If all rendering is finished also stops the repaintTimer


updateFinalImage

protected Image updateFinalImage()
The renderers are all rendering into their own Images. This method combines all images to one finalImage. The repaintTimer is calling this method regularely to update the finalImage even if the renderers are still working.


zoomTo

public void zoomTo( features)
Sets the mapArea to best possibly present the given features. If only one single point is given, the window is moved over the point.

Parameters:
features - if null or size==0, the function doesn nothing.

zoomTo

public void zoomTo(Point center,
                   Double zoomFaktor)
Zooms towards a point.

Parameters:
center - position in window coordinates
zoomFaktor - > 1 for zoom out, < 1 for zoom in. Default is .5

setShowExceptions

public void setShowExceptions(boolean showExceptions)
Shall non-fatal rendering exceptions be reported in the mappane or be dropped quitely.


isShowExceptions

public boolean isShowExceptions()
Shall exceptions be reported in the mappane?


getLocalRenderer

public GTRenderer getLocalRenderer()

zoomToLayer

public void zoomToLayer(MapLayer layer)
Setzt den Kartenausschnitt auf die Ausdehnung eines bestimmten Layers. Macht nichts, wenn null uebergeben wird.

Parameters:
layer - ein Layer

zoomToLayerIdxReverse

public void zoomToLayerIdxReverse(int index)
Zooms the SelectableXMapPane to the Envelope of the selected layer. The layer is selected by the idx, counting from front to back, like humans would expect in a JList
A refresh of the map is not done automatically

Parameters:
index - Reverse index of the MapLayer in the MapContext

setAntiAliasing

public void setAntiAliasing(boolean aa)
Aktiviert oder deaktiviert das AntiAliasing for diese SelectableXMapPane. AntiALiasing ist besonders fuer Textbeschriftung sehr schoen, verbraucht aber auch mehr Performance.


getImageOrigin

public Point getImageOrigin()

setDefaultMaxMapExtendMode

public void setDefaultMaxMapExtendMode(double defaultMaxMapExtendMode)
If maxExtend is null the following rules are used to create a default maximum.


getDefaultMaxMapExtendMode

public double getDefaultMaxMapExtendMode()
If maxExtend is null the following rules are used to create a default maximum.


blink

public void blink( features)
Makes the given FeatureCollection bink in the map for a moment