Class LayerCanvas

All Implemented Interfaces:
AdjustableView, ViewportAware, ImageObserver, MenuContainer, Serializable, Accessible

public class LayerCanvas extends JPanel implements AdjustableView
A Swing component capable of drawing a collection of Layers.
See Also:
  • Constructor Details

    • LayerCanvas

      public LayerCanvas()
    • LayerCanvas

      public LayerCanvas(Layer layer)
    • LayerCanvas

      public LayerCanvas(Layer layer, Viewport viewport)
    • LayerCanvas

      public LayerCanvas(LayerCanvasModel model)
  • Method Details

    • getModel

      public LayerCanvasModel getModel()
    • setModel

      public void setModel(LayerCanvasModel newModel)
    • getLayer

      public Layer getLayer()
    • getLayerFilter

      public LayerFilter getLayerFilter()
    • setLayerFilter

      public void setLayerFilter(LayerFilter layerFilter)
    • dispose

      public void dispose()
    • addOverlay

      public void addOverlay(LayerCanvas.Overlay overlay)
      Adds an overlay to the canvas.
      Parameters:
      overlay - An overlay
    • removeOverlay

      public void removeOverlay(LayerCanvas.Overlay overlay)
      Removes an overlay from the canvas.
      Parameters:
      overlay - An overlay
    • isNavControlShown

      public boolean isNavControlShown()
      None API. Don't use this method!
      Returns:
      true, if this canvas uses a NavControl.
    • isAntialiasing

      public boolean isAntialiasing()
      Checks if anti-aliased vector graphics are enabled.
      Returns:
      true, if enabled.
    • setAntialiasing

      public void setAntialiasing(boolean antialiasing)
      Enables / disables anti-aliased vector graphics.
      Parameters:
      antialiasing - true, if enabled.
    • setNavControlShown

      public void setNavControlShown(boolean navControlShown)
      None API. Don't use this method!
      Parameters:
      navControlShown - true, if this canvas uses a NavControl.
    • isInitiallyZoomingAll

      public boolean isInitiallyZoomingAll()
    • setInitiallyZoomingAll

      public void setInitiallyZoomingAll(boolean initiallyZoomingAll)
    • zoomAll

      public void zoomAll()
    • getViewport

      public Viewport getViewport()
      Specified by:
      getViewport in interface ViewportAware
      Returns:
      The viewport.
    • getMaxVisibleModelBounds

      public Rectangle2D getMaxVisibleModelBounds()
      Specified by:
      getMaxVisibleModelBounds in interface AdjustableView
      Returns:
      The maximum visible model bounds in model coordinates.
    • getMinZoomFactor

      public double getMinZoomFactor()
      Specified by:
      getMinZoomFactor in interface AdjustableView
      Returns:
      The minimum zoom factor.
      See Also:
    • getMaxZoomFactor

      public double getMaxZoomFactor()
      Specified by:
      getMaxZoomFactor in interface AdjustableView
      Returns:
      The maximum zoom factor.
      See Also:
    • getDefaultZoomFactor

      public double getDefaultZoomFactor()
      Specified by:
      getDefaultZoomFactor in interface AdjustableView
      Returns:
      The default zoom factor.
      See Also:
    • computeMaxVisibleModelBounds

      public static Rectangle2D computeMaxVisibleModelBounds(Rectangle2D modelBounds, double orientation)
    • setBounds

      public void setBounds(int x, int y, int width, int height)
      Overrides:
      setBounds in class Component
    • doLayout

      public void doLayout()
      Overrides:
      doLayout in class Container
    • paintComponent

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