Class JMapPane

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, MapBoundsListener, MapLayerListListener, MapPane, RenderingExecutorListener

public class JMapPane extends AbstractMapPane
A lightweight map pane which uses a single renderer and backing image. Used by JMapFrame for the GeoTools tutorial applications.
Since:
2.6
Author:
Michael Bedward, Ian Turton
See Also:
  • Field Details

  • Constructor Details

    • JMapPane

      public JMapPane()
      Creates a new map pane.
    • JMapPane

      public JMapPane(MapContent content)
      Creates a new map pane.
      Parameters:
      content - the map content containing the layers to display (may be null)
    • JMapPane

      public JMapPane(MapContent content, RenderingExecutor executor, GTRenderer renderer)
      Creates a new map pane. Any or all arguments may be null
      Parameters:
      content - the map content containing the layers to display
      executor - the rendering executor to manage drawing
      renderer - the renderer to use for drawing layers
  • Method Details

    • setMapContent

      public void setMapContent(MapContent content)
      Sets the MapContent instance containing the layers to display.
      Specified by:
      setMapContent in interface MapPane
      Overrides:
      setMapContent in class AbstractMapPane
      Parameters:
      content - the map content
    • getRenderer

      public GTRenderer getRenderer()
      Gets the renderer, creating a default one if required.
      Returns:
      the renderer
    • setRenderer

      public void setRenderer(GTRenderer renderer)
      Sets the renderer to be used by this map pane.
      Parameters:
      renderer - the renderer to use
    • getBaseImage

      public RenderedImage getBaseImage()
      Retrieve the map pane's current base image.

      The map pane caches the most recent rendering of map layers as an image to avoid time-consuming rendering requests whenever possible. The base image will be re-drawn whenever there is a change to map layer data, style or visibility; and it will be replaced by a new image when the pane is resized.

      This method returns a live reference to the current base image. Use with caution.

      Returns:
      a live reference to the current base image
    • paintComponent

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

      protected void drawLayers(boolean createNewImage)
      Description copied from class: AbstractMapPane
      Draws layers into one or more images which will then be displayed by the map pane.
      Specified by:
      drawLayers in class AbstractMapPane