Package adams.gui.visualization.image
Class AbstractObjectOverlayFromReport
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.visualization.image.AbstractImageOverlay
-
- adams.gui.visualization.image.AbstractObjectOverlayFromReport
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<AbstractImageOverlay>
,SizeOfHandler
,PopupMenuCustomizer<ImagePanel.PaintPanel>
,ImageOverlay
,TypeColorProvider
,Serializable
- Direct Known Subclasses:
ObjectCentersOverlayFromReport
,ObjectLocationsOverlayFromReport
public abstract class AbstractObjectOverlayFromReport extends AbstractImageOverlay implements PopupMenuCustomizer<ImagePanel.PaintPanel>, TypeColorProvider
Ancestor for overlays that use object locations from a report.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AbstractObjectOverlayFromReport.LocatedObjectsPanel
The panel for displaying the located objects.static class
AbstractObjectOverlayFromReport.SelectedObjectFilter
Filter for located objects that only accepts the currently selected ones.
-
Field Summary
Fields Modifier and Type Field Description protected Set<ChangeListener>
m_LocationsUpdatedListeners
the listeners for locations updates.protected ReportObjectOverlay
m_Overlays
the overlay handler.protected ImagePanel.PaintPanel
m_Owner
the owning panel.protected AbstractObjectOverlayFromReport.LocatedObjectsPanel
m_PanelObjects
the panel with the located objects.protected boolean
m_ShowObjectPanel
whether to show the located object panel.static String
PREFIX_DEFAULT
the default prefix.-
Fields inherited from class adams.gui.visualization.image.AbstractImageOverlay
m_Enabled
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractObjectOverlayFromReport()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addLocationsUpdatedListeners(ChangeListener l)
Adds the listener for location updates.void
cleanUp()
Cleans up data structures, frees up memory.String
colorTipText()
Returns the tip text for this property.void
customizePopupMenu(ImagePanel.PaintPanel source, JPopupMenu menu)
For customizing the popup menu.void
defineOptions()
Adds options to the internal list of options.protected void
doImageChanged(ImagePanel.PaintPanel panel)
Notifies the overlay that the image has changed.protected abstract void
doPaintObjects(ImagePanel.PaintPanel panel, Graphics g, List<Polygon> locations)
Performs the actual painting of the objects.protected void
doPaintOverlay(ImagePanel.PaintPanel panel, Graphics g)
Performs the actual painting of the overlay.Color
getColor()
Returns the color to use for the objects.protected ImageAnchor
getDefaultLabelAnchor()
Returns the default label anchor.protected int
getDefaultLabelOffsetX()
Returns the default label offset for X.protected int
getDefaultLabelOffsetY()
Returns the default label offset for Y.ImageAnchor
getLabelAnchor()
Returns the anchor for the label.Font
getLabelFont()
Returns the label font.String
getLabelFormat()
Returns the label format.int
getLabelOffsetX()
Returns the X offset for the label.int
getLabelOffsetY()
Returns the Y offset for the label.protected AbstractObjectOverlayFromReport.LocatedObjectsPanel
getLocatedObjectsPanel()
Returns the objects panel, instantiates it if necessary.protected ReportObjectOverlay
getOverlays()
Returns the underlying report object overlay object.ImagePanel.PaintPanel
getOwner()
Returns the owning panel.BaseString[]
getPredefinedLabels()
Returns the predefined labels.String
getPrefix()
Returns the prefix to use for the objects in the report.ColorProvider
getShapeColorProvider()
Returns the color provider to use when varying the shape colors.boolean
getShowObjectPanel()
Returns whether to show the panel with the located objects.Color
getTypeColor(String type)
Returns the color for the object type.ColorProvider
getTypeColorProvider()
Returns the color provider to use for the types.BaseRegExp
getTypeRegExp()
Returns the regular expression that the types must match in order to get drawn.String
getTypeSuffix()
Returns the suffix to use for the types.boolean
getUseColorsPerType()
Returns whether to use colors per type.boolean
getVaryShapeColor()
Returns whether to vary the colors of the shapes.boolean
hasTypeColor(String type)
Checks whether a color has been stored for the given object type.protected void
initialize()
Initializes the members.String
labelAnchorTipText()
Returns the tip text for this property.String
labelFontTipText()
Returns the tip text for this property.String
labelFormatTipText()
Returns the tip text for this property.String
labelOffsetXTipText()
Returns the tip text for this property.String
labelOffsetYTipText()
Returns the tip text for this property.protected void
notifyLocationsUpdatedListeners()
Notifies all the listeners that the notifications have been updated.void
overlayAdded(ImagePanel.PaintPanel panel)
Gets called when the image overlay got added to a paintable panel.void
overlayRemoved(ImagePanel.PaintPanel panel)
Gets called when the image overlay got removed from a paintable panel.String
predefinedLabelsTipText()
Returns the tip text for this property.String
prefixTipText()
Returns the tip text for this property.void
removeLocationsUpdatedListeners(ChangeListener l)
Removes the listener for location updates.void
setColor(Color value)
Sets the color to use for the objects.void
setLabelAnchor(ImageAnchor value)
Sets the anchor for the label.void
setLabelFont(Font value)
Sets the label font.void
setLabelFormat(String value)
Sets the label format.void
setLabelOffsetX(int value)
Sets the X offset for the label.void
setLabelOffsetY(int value)
Sets the Y offset for the label.void
setPredefinedLabels(BaseString[] value)
Sets the predefined labels.void
setPrefix(String value)
Sets the prefix to use for the objects in the report.void
setShapeColorProvider(ColorProvider value)
Sets the color provider to use when varying the shape colors.void
setShowObjectPanel(boolean value)
Sets whether to show the panel with the located panels.void
setTypeColorProvider(ColorProvider value)
Sets the color provider to use for the types.void
setTypeRegExp(BaseRegExp value)
Sets the regular expression that the types must match in order to get drawn.void
setTypeSuffix(String value)
Sets the suffix to use for the types.void
setUseColorsPerType(boolean value)
Sets whether to use colors per type.void
setVaryShapeColor(boolean value)
Sets whether to vary the colors of the shapes.String
shapeColorProviderTipText()
Returns the tip text for this property.String
showObjectPanelTipText()
Returns the tip text for this property.String
typeColorProviderTipText()
Returns the tip text for this property.String
typeRegExpTipText()
Returns the tip text for this property.String
typeSuffixTipText()
Returns the tip text for this property.String
useColorsPerTypeTipText()
Returns the tip text for this property.String
varyShapeColorTipText()
Returns the tip text for this property.-
Methods inherited from class adams.gui.visualization.image.AbstractImageOverlay
enabledTipText, imageChanged, isEnabled, paintOverlay, setEnabled, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.gui.visualization.image.ImageOverlay
imageChanged, paintOverlay
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
PREFIX_DEFAULT
public static final String PREFIX_DEFAULT
the default prefix.- See Also:
- Constant Field Values
-
m_Overlays
protected ReportObjectOverlay m_Overlays
the overlay handler.
-
m_LocationsUpdatedListeners
protected Set<ChangeListener> m_LocationsUpdatedListeners
the listeners for locations updates.
-
m_ShowObjectPanel
protected boolean m_ShowObjectPanel
whether to show the located object panel.
-
m_PanelObjects
protected AbstractObjectOverlayFromReport.LocatedObjectsPanel m_PanelObjects
the panel with the located objects.
-
m_Owner
protected transient ImagePanel.PaintPanel m_Owner
the owning panel.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractImageOverlay
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractOptionHandler
-
getOwner
public ImagePanel.PaintPanel getOwner()
Returns the owning panel.- Returns:
- the owner, null if none set
-
getOverlays
protected ReportObjectOverlay getOverlays()
Returns the underlying report object overlay object.- Returns:
- the overlay
-
setPrefix
public void setPrefix(String value)
Sets the prefix to use for the objects in the report.- Parameters:
value
- the prefix
-
getPrefix
public String getPrefix()
Returns the prefix to use for the objects in the report.- Returns:
- the prefix
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColor
public void setColor(Color value)
Sets the color to use for the objects.- Parameters:
value
- the color
-
getColor
public Color getColor()
Returns the color to use for the objects.- Returns:
- the color
-
colorTipText
public String colorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseColorsPerType
public void setUseColorsPerType(boolean value)
Sets whether to use colors per type.- Parameters:
value
- true if to use colors per type
-
getUseColorsPerType
public boolean getUseColorsPerType()
Returns whether to use colors per type.- Returns:
- true if to use colors per type
-
useColorsPerTypeTipText
public String useColorsPerTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTypeColorProvider
public void setTypeColorProvider(ColorProvider value)
Sets the color provider to use for the types.- Parameters:
value
- the provider
-
getTypeColorProvider
public ColorProvider getTypeColorProvider()
Returns the color provider to use for the types.- Returns:
- the provider
-
typeColorProviderTipText
public String typeColorProviderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTypeSuffix
public void setTypeSuffix(String value)
Sets the suffix to use for the types.- Parameters:
value
- the suffix
-
getTypeSuffix
public String getTypeSuffix()
Returns the suffix to use for the types.- Returns:
- the suffix
-
typeSuffixTipText
public String typeSuffixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTypeRegExp
public void setTypeRegExp(BaseRegExp value)
Sets the regular expression that the types must match in order to get drawn.- Parameters:
value
- the expression
-
getTypeRegExp
public BaseRegExp getTypeRegExp()
Returns the regular expression that the types must match in order to get drawn.- Returns:
- the expression
-
typeRegExpTipText
public String typeRegExpTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelFormat
public void setLabelFormat(String value)
Sets the label format.- Parameters:
value
- the label format
-
getLabelFormat
public String getLabelFormat()
Returns the label format.- Returns:
- the label format
-
labelFormatTipText
public String labelFormatTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelFont
public void setLabelFont(Font value)
Sets the label font.- Parameters:
value
- the label font
-
getLabelFont
public Font getLabelFont()
Returns the label font.- Returns:
- the label font
-
labelFontTipText
public String labelFontTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultLabelAnchor
protected ImageAnchor getDefaultLabelAnchor()
Returns the default label anchor.- Returns:
- the anchor
-
setLabelAnchor
public void setLabelAnchor(ImageAnchor value)
Sets the anchor for the label.- Parameters:
value
- the anchor
-
getLabelAnchor
public ImageAnchor getLabelAnchor()
Returns the anchor for the label.- Returns:
- the anchor
-
labelAnchorTipText
public String labelAnchorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultLabelOffsetX
protected int getDefaultLabelOffsetX()
Returns the default label offset for X.- Returns:
- the default
-
setLabelOffsetX
public void setLabelOffsetX(int value)
Sets the X offset for the label.- Parameters:
value
- the X offset
-
getLabelOffsetX
public int getLabelOffsetX()
Returns the X offset for the label.- Returns:
- the X offset
-
labelOffsetXTipText
public String labelOffsetXTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultLabelOffsetY
protected int getDefaultLabelOffsetY()
Returns the default label offset for Y.- Returns:
- the default
-
setLabelOffsetY
public void setLabelOffsetY(int value)
Sets the Y offset for the label.- Parameters:
value
- the Y offset
-
getLabelOffsetY
public int getLabelOffsetY()
Returns the Y offset for the label.- Returns:
- the Y offset
-
labelOffsetYTipText
public String labelOffsetYTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPredefinedLabels
public void setPredefinedLabels(BaseString[] value)
Sets the predefined labels.- Parameters:
value
- the labels
-
getPredefinedLabels
public BaseString[] getPredefinedLabels()
Returns the predefined labels.- Returns:
- the labels
-
predefinedLabelsTipText
public String predefinedLabelsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setVaryShapeColor
public void setVaryShapeColor(boolean value)
Sets whether to vary the colors of the shapes.- Parameters:
value
- true if to vary
-
getVaryShapeColor
public boolean getVaryShapeColor()
Returns whether to vary the colors of the shapes.- Returns:
- true if to vary
-
varyShapeColorTipText
public String varyShapeColorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShapeColorProvider
public void setShapeColorProvider(ColorProvider value)
Sets the color provider to use when varying the shape colors.- Parameters:
value
- the provider
-
getShapeColorProvider
public ColorProvider getShapeColorProvider()
Returns the color provider to use when varying the shape colors.- Returns:
- the provider
-
shapeColorProviderTipText
public String shapeColorProviderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowObjectPanel
public void setShowObjectPanel(boolean value)
Sets whether to show the panel with the located panels.- Parameters:
value
- true if to show
-
getShowObjectPanel
public boolean getShowObjectPanel()
Returns whether to show the panel with the located objects.- Returns:
- true if to show
-
showObjectPanelTipText
public String showObjectPanelTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
hasTypeColor
public boolean hasTypeColor(String type)
Checks whether a color has been stored for the given object type.- Specified by:
hasTypeColor
in interfaceTypeColorProvider
- Parameters:
type
- the type to check- Returns:
- true if custom color available
-
getTypeColor
public Color getTypeColor(String type)
Returns the color for the object type.- Specified by:
getTypeColor
in interfaceTypeColorProvider
- Parameters:
type
- the type to get the color for- Returns:
- the color, null if none available
-
addLocationsUpdatedListeners
public void addLocationsUpdatedListeners(ChangeListener l)
Adds the listener for location updates.- Specified by:
addLocationsUpdatedListeners
in interfaceTypeColorProvider
- Parameters:
l
- the listener to add
-
removeLocationsUpdatedListeners
public void removeLocationsUpdatedListeners(ChangeListener l)
Removes the listener for location updates.- Specified by:
removeLocationsUpdatedListeners
in interfaceTypeColorProvider
- Parameters:
l
- the listener to remove
-
notifyLocationsUpdatedListeners
protected void notifyLocationsUpdatedListeners()
Notifies all the listeners that the notifications have been updated.
-
getLocatedObjectsPanel
protected AbstractObjectOverlayFromReport.LocatedObjectsPanel getLocatedObjectsPanel()
Returns the objects panel, instantiates it if necessary.- Returns:
- the panel
-
overlayAdded
public void overlayAdded(ImagePanel.PaintPanel panel)
Gets called when the image overlay got added to a paintable panel.- Specified by:
overlayAdded
in interfaceImageOverlay
- Overrides:
overlayAdded
in classAbstractImageOverlay
- Parameters:
panel
- the panel it got added to
-
overlayRemoved
public void overlayRemoved(ImagePanel.PaintPanel panel)
Gets called when the image overlay got removed from a paintable panel.- Specified by:
overlayRemoved
in interfaceImageOverlay
- Overrides:
overlayRemoved
in classAbstractImageOverlay
- Parameters:
panel
- the panel it got removed from
-
doImageChanged
protected void doImageChanged(ImagePanel.PaintPanel panel)
Notifies the overlay that the image has changed.- Specified by:
doImageChanged
in classAbstractImageOverlay
- Parameters:
panel
- the panel this overlay belongs to
-
doPaintObjects
protected abstract void doPaintObjects(ImagePanel.PaintPanel panel, Graphics g, List<Polygon> locations)
Performs the actual painting of the objects.- Parameters:
panel
- the panel this overlay is forg
- the graphics contextlocations
- the locations to paint
-
doPaintOverlay
protected void doPaintOverlay(ImagePanel.PaintPanel panel, Graphics g)
Performs the actual painting of the overlay.- Specified by:
doPaintOverlay
in classAbstractImageOverlay
- Parameters:
panel
- the panel this overlay is forg
- the graphics context
-
customizePopupMenu
public void customizePopupMenu(ImagePanel.PaintPanel source, JPopupMenu menu)
For customizing the popup menu.- Specified by:
customizePopupMenu
in interfacePopupMenuCustomizer<ImagePanel.PaintPanel>
- Parameters:
source
- the source, e.g., eventmenu
- the menu to customize
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
- Overrides:
cleanUp
in classAbstractImageOverlay
-
-