Class AbstractOverlay
- All Implemented Interfaces:
Overlay
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal voidaddOverlayListener(OverlayListener listener) Add a listener.protected final voidCall this method to notify the system that the overlay has changed.protected final voidCall this method to notify the system that the overlay title has changed.Return the user-customizable settings for this overlay.Return the configuration UI component for this overlay.final booleanReturn whether this overlay is shown.voidpaintOverlay(Graphics2D graphicsContext, Rectangle screenRect, DisplaySettings displaySettings, List<Image> images, Image primaryImage, Rectangle2D.Float imageViewPort) Paint the overlay to the given graphics context.final voidremoveOverlayListener(OverlayListener listener) Remove a listener.voidsetConfiguration(PropertyMap config) Configure the overlay with the given parameters.final voidsetVisible(boolean visible) Show or hide this overlay.
-
Constructor Details
-
AbstractOverlay
public AbstractOverlay()
-
-
Method Details
-
paintOverlay
public void paintOverlay(Graphics2D graphicsContext, Rectangle screenRect, DisplaySettings displaySettings, List<Image> images, Image primaryImage, Rectangle2D.Float imageViewPort) Paint the overlay to the given graphics context.This default implementation draws nothing. Override to draw the overlay graphics.
- Specified by:
paintOverlayin interfaceOverlay- Parameters:
graphicsContext- the graphics context to paint withscreenRect- the screen region displaying part or all of the image, in the graphics context's coordinatesdisplaySettings- the current display settings of the display windowimages- the images on which the overlay is to be drawn (multiple images if in composite color mode)primaryImage- the currently selected image (if in composite color mode) or the single displayed image (otherwise)imageViewPort- the visible region of the image, in image coordinates
-
getConfigurationComponent
Return the configuration UI component for this overlay.The component should work well when laid out with a fixed width and height, determined based on its minimum and maximum sizes. The width of the component may be changed in response to layout changes, but the component must not actively resize itself. It is recommended that the preferred width be no more than 480 pixels.
This method should return the same object every time it is called, throughout the lifetime of this Overlay instance. If the overlay does not require any user configuration,
nullmay be returned.Important: The Overlay must not create any UI objects unless this method is called, and still support all other methods. This is to support headless use of overlays.
This default implementation returns null. Override to provide a user interface.
- Specified by:
getConfigurationComponentin interfaceOverlay- Returns:
- the configuration UI component, or null
-
getConfiguration
Return the user-customizable settings for this overlay.The configuration should contain all parameters needed to reproduce the same overlay on another display window.
This default implementation returns an empty property map. Override to implement custom settings.
- Specified by:
getConfigurationin interfaceOverlay- Returns:
- a property map containing current parameters of the overlay
-
setConfiguration
Configure the overlay with the given parameters.This default implementation does nothing. Override to implement custom settings.
- Specified by:
setConfigurationin interfaceOverlay- Parameters:
config- a property map previously returned bygetConfigurationof an overlay of the same class.
-
isVisible
public final boolean isVisible()Return whether this overlay is shown.Note:
AbstractOverlayimplements this method.This implementation takes care of visibility management.
-
setVisible
public final void setVisible(boolean visible) Show or hide this overlay.Note:
AbstractOverlayimplements this method.This implementation takes care of visibility management.
- Specified by:
setVisiblein interfaceOverlay- Parameters:
visible- whether to show the overlay
-
addOverlayListener
Add a listener.Note:
AbstractOverlayimplements this method.This implementation takes care of managing listeners.
- Specified by:
addOverlayListenerin interfaceOverlay- Parameters:
listener- the listener to add- See Also:
-
removeOverlayListener
Remove a listener.Note:
AbstractOverlayimplements this method.This implementation takes care of managing listeners.
- Specified by:
removeOverlayListenerin interfaceOverlay- Parameters:
listener- the listener to remove- See Also:
-
fireOverlayTitleChanged
protected final void fireOverlayTitleChanged()Call this method to notify the system that the overlay title has changed.If the overlay has a fixed title, this method need not ever be called.
- See Also:
-
fireOverlayConfigurationChanged
protected final void fireOverlayConfigurationChanged()Call this method to notify the system that the overlay has changed.This only needs to be called when the overlay needs a repaint due to its configuration changing. The case when the displayed image has changed is automatically handled by the system.
- See Also:
-