Class PlanarCanvas

Object
Canvas
PlanarCanvas
All Implemented Interfaces:
Localized

public abstract class PlanarCanvas extends Canvas
A canvas for two-dimensional display device using a Cartesian coordinate system. Data are reduced to a two-dimensional slice before to be displayed.

Multi-threading

Planar­Canvas is not thread-safe. Synchronization, if desired, must be done by the caller. Another common strategy is to interact with Planar­Canvas from a single thread, for example the Swing or JavaFX event queue.
Since:
1.1

Defined in the sis-portrayal module

  • Field Details

  • Constructor Details

    • PlanarCanvas

      protected PlanarCanvas(Locale locale)
      Creates a new two-dimensional canvas.
      Parameters:
      locale - the locale to use for labels and some messages, or null for default.
  • Method Details

    • getDisplayBounds

      public Envelope2D getDisplayBounds()
      Returns the size and location of the display device. The unit of measurement is Units​.PIXEL and coordinate values are usually (but not necessarily) integers.

      This value may be null on newly created Canvas, before data are added and canvas is configured. It should not be null anymore once a Canvas is ready for displaying. The returned envelope is a copy; display changes happening after this method invocation will not be reflected in the returned envelope.

      Overrides:
      get­Display­Bounds in class Canvas
      Returns:
      size and location of the display device in pixel coordinates.
      See Also:
    • transformObjectiveCoordinates

      public void transformObjectiveCoordinates(AffineTransform before)
      Updates the objective to display transform as if the given transform was applied before the current transform. For example if the given before transform is a translation, then the translation vector is in units of the objective CRS (typically metres on the map).
      Parameters:
      before - coordinate conversion to apply before the current objective to display transform.
    • transformDisplayCoordinates

      public void transformDisplayCoordinates(AffineTransform after)
      Updates the objective to display transform as if the given transform was applied after the current transform. For example if the given after transform is a translation, then the translation vector is in pixel units.
      Parameters:
      after - coordinate conversion to apply after the current objective to display transform.
    • addPropertyChangeListener

      public final void addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Registers a listener for the property of the given name. The listener will be notified every time that the property of the given name got a new value. If the same listener is registered twice for the same property, then it will be notified twice (this method does not perform duplication checks).
      Parameters:
      property­Name - name of the property to listen (should be one of the *_PROPERTY constants).
      listener - property listener to register.
    • removePropertyChangeListener

      public final void removePropertyChangeListener(String propertyName, PropertyChangeListener listener)
      Unregisters a property listener. The given property­Name should be the name used during listener registration. If the specified listener is not registered for the named property, then nothing happen. If the listener has been registered twice, then only one registration is removed (one registration will remain).
      Parameters:
      property­Name - name of the listened property.
      listener - property listener to unregister.
    • firePropertyChange

      protected void firePropertyChange(String propertyName, Object oldValue, Object newValue)
      Notifies all registered listeners that a property of the given name changed its value. The change event source will be this. It is caller responsibility to verify that the old and new values are different (this method does not check for equality).
      Parameters:
      property­Name - name of the property that changed its value.
      old­Value - the old property value (may be null).
      new­Value - the new property value (may be null).
      See Also:
    • firePropertyChange

      protected void firePropertyChange(PropertyChangeEvent event)
      Notifies all registered listeners that a property changed its value. It is caller responsibility to verify that the event source and property name are valid.
      Parameters:
      event - the event to forward. Can not be null.
      See Also: