Package adams.gui.tools.previewbrowser
Class ObjectAnnotationsReportHandler
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.previewbrowser.AbstractContentHandler
-
- adams.gui.tools.previewbrowser.AbstractObjectContentHandler
-
- adams.gui.tools.previewbrowser.ObjectAnnotationsReportHandler
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ObjectPrefixHandler
,ContentHandler
,ObjectContentHandler
,Serializable
public class ObjectAnnotationsReportHandler extends AbstractObjectContentHandler implements ObjectPrefixHandler
Overlays the annotations onto the image.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-image-width <int> (property: imageWidth) The image width to use; use <= 0 for automatically determining minimal bbox around annotations. default: -1 minimum: -1
-image-height <int> (property: imageHeight) The image height to use; use <= 0 for automatically determining minimal bbox around annotations. default: -1 minimum: -1
-image-background <java.awt.Color> (property: imageBackground) The background color to use for the image. default: #ffffff
-reader <adams.data.io.input.AbstractReportReader> (property: reader) The reader setup to use for reading the object locations from the spreadsheet. default: adams.data.io.input.ObjectLocationsSpreadSheetReader -reader \"adams.data.io.input.CsvSpreadSheetReader -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.DefaultSpreadSheet\" -row-finder adams.data.spreadsheet.rowfinder.AllFinder -col-left x0 -col-top y0 -col-right x1 -col-bottom y1 -col-type label_str
-prefix <java.lang.String> (property: prefix) The report field prefix used for objects. default: Object.
-cleaner <adams.gui.visualization.object.objectannotations.cleaning.AnnotationCleaner> [-cleaner ...] (property: cleaners) The cleaners to apply to the annotations. default:
-shape-plotter <adams.gui.visualization.object.objectannotations.shape.ShapePlotter> [-shape-plotter ...] (property: shapePlotters) The plotters to use for drawing the shapes. default:
-shape-color <adams.gui.visualization.object.objectannotations.colors.AnnotationColors> [-shape-color ...] (property: shapeColors) The colorizers for the corresponding shape plotters. default:
-outline-plotter <adams.gui.visualization.object.objectannotations.outline.OutlinePlotter> [-outline-plotter ...] (property: outlinePlotters) The plotters to use for drawing the outlines. default: adams.gui.visualization.object.objectannotations.outline.RectangleOutline
-outline-color <adams.gui.visualization.object.objectannotations.colors.AnnotationColors> [-outline-color ...] (property: outlineColors) The colorizers for the corresponding outline plotters. default: adams.gui.visualization.object.objectannotations.colors.FixedColor
-label-plotter <adams.gui.visualization.object.objectannotations.label.LabelPlotter> [-label-plotter ...] (property: labelPlotters) The plotters to use for drawing the labels. default:
-label-color <adams.gui.visualization.object.objectannotations.colors.AnnotationColors> [-label-color ...] (property: labelColors) The colorizers for the corresponding label plotters. default:
-show-object-panel <boolean> (property: showObjectPanel) If enabled, the panel for selecting located objects is being displayed. default: false
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AnnotationCleaner[]
m_Cleaners
the cleaners to use.protected Color
m_ImageBackground
the background color to use.protected int
m_ImageHeight
the image height to use.protected int
m_ImageWidth
the image width to use.protected AnnotationColors[]
m_LabelColors
the colorizers for the labels.protected LabelPlotter[]
m_LabelPlotters
the label plotters.protected AnnotationColors[]
m_OutlineColors
the colorizers for the outline.protected OutlinePlotter[]
m_OutlinePlotters
the outline plotters.protected String
m_Prefix
the prefix to use.protected AbstractReportReader
m_Reader
the reader to use.protected AnnotationColors[]
m_ShapeColors
the colorizers for the shape.protected ShapePlotter[]
m_ShapePlotters
the shape plotters.protected boolean
m_ShowObjectPanel
whether to show the located object panel.static int
MISSING_HEIGHT
static int
MISSING_WIDTH
-
Fields inherited from class adams.gui.tools.previewbrowser.AbstractObjectContentHandler
m_ObjectHandlerMapping
-
Fields inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
m_Relation
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.gui.tools.previewbrowser.ContentHandler
MATCH_ALL
-
-
Constructor Summary
Constructors Constructor Description ObjectAnnotationsReportHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canHandle(Class cls)
Checks whether the class is handled by this content handler.String
cleanersTipText()
Returns the tip text for this property.protected BufferedImage
createImage(Report report)
Creates an empty dummy image that will fit all the annotations.PreviewPanel
createPreview(File file)
Creates the actual view.PreviewPanel
createPreview(Object obj)
Creates the actual preview.void
defineOptions()
Adds options to the internal list of options.AnnotationCleaner[]
getCleaners()
Returns the cleaners for the annotations.protected Color
getDefaultImageBackground()
Returns the default background color.protected int
getDefaultImageHeight()
Returns the default image height.protected int
getDefaultImageWidth()
Returns the default image width.protected AbstractReportReader
getDefaultReader()
Returns the default reader.String[]
getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.Color
getImageBackground()
Returns the color to use for the background.int
getImageHeight()
Returns the image height to use rather than auto determined one (-1).int
getImageWidth()
Returns the image width to use rather than auto determined one (-1).AnnotationColors[]
getLabelColors()
Returns the colorizers for the label plotters.LabelPlotter[]
getLabelPlotters()
Returns the plotters for the labels.AnnotationColors[]
getOutlineColors()
Returns the colorizers for the outline plotters.OutlinePlotter[]
getOutlinePlotters()
Returns the plotters for the outlines.String
getPrefix()
Returns the field prefix used in the report.AbstractReportReader
getReader()
Returns the reader setup to use for reading the object locations from the spreadsheet.AnnotationColors[]
getShapeColors()
Returns the colorizers for the shape plotters.ShapePlotter[]
getShapePlotters()
Returns the plotters for the shapes.boolean
getShowObjectPanel()
Returns whether to show the panel with the located objects.String
globalInfo()
Returns a string describing the object.String
imageBackgroundTipText()
Returns the tip text for this property.String
imageHeightTipText()
Returns the tip text for this property.String
imageWidthTipText()
Returns the tip text for this property.String
labelColorsTipText()
Returns the tip text for this property.String
labelPlottersTipText()
Returns the tip text for this property.protected Report
loadAnnotations(File file)
Loads the report associated with the image.String
outlineColorsTipText()
Returns the tip text for this property.String
outlinePlottersTipText()
Returns the tip text for this property.String
prefixTipText()
Returns the tip text for this property.String
readerTipText()
Returns the tip text for this property.PreviewPanel
reusePreview(File file, PreviewPanel previewPanel)
Reuses the last preview, if possible.PreviewPanel
reusePreview(Object obj, PreviewPanel lastPreview)
Reuses the last preview, if possible.void
setCleaners(AnnotationCleaner[] value)
Sets the cleaners for the annotations.void
setImageBackground(Color value)
Sets the color to use for the background.void
setImageHeight(int value)
Sets the image height to use rather than auto determined one (-1).void
setImageWidth(int value)
Sets the image width to use rather than auto determined one (-1).void
setLabelColors(AnnotationColors[] value)
Sets the colorizers for the label plotters.void
setLabelPlotters(LabelPlotter[] value)
Sets the plotters for the labels.void
setOutlineColors(AnnotationColors[] value)
Sets the colorizers for the outline plotters.void
setOutlinePlotters(OutlinePlotter[] value)
Sets the plotters for the outlines.void
setPrefix(String value)
Sets the field prefix used in the report.void
setReader(AbstractReportReader value)
Sets the reader setup to use for reading the object locations from the spreadsheet.void
setShapeColors(AnnotationColors[] value)
Sets the colorizers for the shape plotters.void
setShapePlotters(ShapePlotter[] value)
Sets the plotters for the shapes.void
setShowObjectPanel(boolean value)
Sets whether to show the panel with the located panels.String
shapeColorsTipText()
Returns the tip text for this property.String
shapePlottersTipText()
Returns the tip text for this property.String
showObjectPanelTipText()
Returns the tip text for this property.-
Methods inherited from class adams.gui.tools.previewbrowser.AbstractObjectContentHandler
canHandle, checkObject, getObjectHandlers, getObjectHandlersFor, getObjectHandlersFor, getPreview, hasObjectHandler, hasObjectHandler
-
Methods inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
checkFile, getHandlers, getHandlersForFile, getHandlersForFile, getPreview, getRelation, hasHandler, hasHandler
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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.gui.tools.previewbrowser.ContentHandler
getPreview
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
MISSING_WIDTH
public static final int MISSING_WIDTH
- See Also:
- Constant Field Values
-
MISSING_HEIGHT
public static final int MISSING_HEIGHT
- See Also:
- Constant Field Values
-
m_ImageWidth
protected int m_ImageWidth
the image width to use.
-
m_ImageHeight
protected int m_ImageHeight
the image height to use.
-
m_ImageBackground
protected Color m_ImageBackground
the background color to use.
-
m_Reader
protected AbstractReportReader m_Reader
the reader to use.
-
m_Prefix
protected String m_Prefix
the prefix to use.
-
m_Cleaners
protected AnnotationCleaner[] m_Cleaners
the cleaners to use.
-
m_ShapePlotters
protected ShapePlotter[] m_ShapePlotters
the shape plotters.
-
m_ShapeColors
protected AnnotationColors[] m_ShapeColors
the colorizers for the shape.
-
m_OutlinePlotters
protected OutlinePlotter[] m_OutlinePlotters
the outline plotters.
-
m_OutlineColors
protected AnnotationColors[] m_OutlineColors
the colorizers for the outline.
-
m_LabelPlotters
protected LabelPlotter[] m_LabelPlotters
the label plotters.
-
m_LabelColors
protected AnnotationColors[] m_LabelColors
the colorizers for the labels.
-
m_ShowObjectPanel
protected boolean m_ShowObjectPanel
whether to show the located object panel.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
getDefaultImageWidth
protected int getDefaultImageWidth()
Returns the default image width.- Returns:
- the default
-
setImageWidth
public void setImageWidth(int value)
Sets the image width to use rather than auto determined one (-1).- Parameters:
value
- the image width (<= 0: auto)
-
getImageWidth
public int getImageWidth()
Returns the image width to use rather than auto determined one (-1).- Returns:
- the image width (<= 0: auto)
-
imageWidthTipText
public String imageWidthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultImageHeight
protected int getDefaultImageHeight()
Returns the default image height.- Returns:
- the default
-
setImageHeight
public void setImageHeight(int value)
Sets the image height to use rather than auto determined one (-1).- Parameters:
value
- the image height (<= 0: auto)
-
getImageHeight
public int getImageHeight()
Returns the image height to use rather than auto determined one (-1).- Returns:
- the image height (<= 0: auto)
-
imageHeightTipText
public String imageHeightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultImageBackground
protected Color getDefaultImageBackground()
Returns the default background color.- Returns:
- the default
-
setImageBackground
public void setImageBackground(Color value)
Sets the color to use for the background.- Parameters:
value
- the color
-
getImageBackground
public Color getImageBackground()
Returns the color to use for the background.- Returns:
- the color
-
imageBackgroundTipText
public String imageBackgroundTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultReader
protected AbstractReportReader getDefaultReader()
Returns the default reader.- Returns:
- the reader
-
setReader
public void setReader(AbstractReportReader value)
Sets the reader setup to use for reading the object locations from the spreadsheet.- Parameters:
value
- the reader
-
getReader
public AbstractReportReader getReader()
Returns the reader setup to use for reading the object locations from the spreadsheet.- Returns:
- the reader
-
readerTipText
public String readerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPrefix
public void setPrefix(String value)
Sets the field prefix used in the report.- Specified by:
setPrefix
in interfaceObjectPrefixHandler
- Parameters:
value
- the field prefix
-
getPrefix
public String getPrefix()
Returns the field prefix used in the report.- Specified by:
getPrefix
in interfaceObjectPrefixHandler
- Returns:
- the field prefix
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Specified by:
prefixTipText
in interfaceObjectPrefixHandler
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setCleaners
public void setCleaners(AnnotationCleaner[] value)
Sets the cleaners for the annotations.- Parameters:
value
- the cleaners
-
getCleaners
public AnnotationCleaner[] getCleaners()
Returns the cleaners for the annotations.- Returns:
- the cleaners
-
cleanersTipText
public String cleanersTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShapeColors
public void setShapeColors(AnnotationColors[] value)
Sets the colorizers for the shape plotters.- Parameters:
value
- the colorizers
-
getShapeColors
public AnnotationColors[] getShapeColors()
Returns the colorizers for the shape plotters.- Returns:
- the colorizers
-
shapeColorsTipText
public String shapeColorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShapePlotters
public void setShapePlotters(ShapePlotter[] value)
Sets the plotters for the shapes.- Parameters:
value
- the plotters
-
getShapePlotters
public ShapePlotter[] getShapePlotters()
Returns the plotters for the shapes.- Returns:
- the plotters
-
shapePlottersTipText
public String shapePlottersTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutlineColors
public void setOutlineColors(AnnotationColors[] value)
Sets the colorizers for the outline plotters.- Parameters:
value
- the colorizers
-
getOutlineColors
public AnnotationColors[] getOutlineColors()
Returns the colorizers for the outline plotters.- Returns:
- the colorizers
-
outlineColorsTipText
public String outlineColorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOutlinePlotters
public void setOutlinePlotters(OutlinePlotter[] value)
Sets the plotters for the outlines.- Parameters:
value
- the plotters
-
getOutlinePlotters
public OutlinePlotter[] getOutlinePlotters()
Returns the plotters for the outlines.- Returns:
- the plotters
-
outlinePlottersTipText
public String outlinePlottersTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelColors
public void setLabelColors(AnnotationColors[] value)
Sets the colorizers for the label plotters.- Parameters:
value
- the colorizers
-
getLabelColors
public AnnotationColors[] getLabelColors()
Returns the colorizers for the label plotters.- Returns:
- the colorizers
-
labelColorsTipText
public String labelColorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelPlotters
public void setLabelPlotters(LabelPlotter[] value)
Sets the plotters for the labels.- Parameters:
value
- the plotters
-
getLabelPlotters
public LabelPlotter[] getLabelPlotters()
Returns the plotters for the labels.- Returns:
- the plotters
-
labelPlottersTipText
public String labelPlottersTipText()
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.
-
getExtensions
public String[] getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.- Specified by:
getExtensions
in interfaceContentHandler
- Returns:
- the list of extensions (no dot)
-
loadAnnotations
protected Report loadAnnotations(File file)
Loads the report associated with the image.- Parameters:
file
- the image file- Returns:
- the report, null if failed to load report data or none available
-
createImage
protected BufferedImage createImage(Report report)
Creates an empty dummy image that will fit all the annotations. If a dimension cannot be determined (eg no annotations), then default ones are used.- Parameters:
report
- the report to use- Returns:
- the dummy image
- See Also:
MISSING_WIDTH
,MISSING_HEIGHT
-
createPreview
public PreviewPanel createPreview(File file)
Creates the actual view.- Specified by:
createPreview
in interfaceContentHandler
- Specified by:
createPreview
in classAbstractContentHandler
- Parameters:
file
- the file to create the view for- Returns:
- the view
-
reusePreview
public PreviewPanel reusePreview(File file, PreviewPanel previewPanel)
Reuses the last preview, if possible.- Specified by:
reusePreview
in interfaceContentHandler
- Overrides:
reusePreview
in classAbstractContentHandler
- Parameters:
file
- the file to create the view for- Returns:
- the view
-
canHandle
public boolean canHandle(Class cls)
Checks whether the class is handled by this content handler.- Specified by:
canHandle
in interfaceObjectContentHandler
- Parameters:
cls
- the class to check- Returns:
- true if handled
-
reusePreview
public PreviewPanel reusePreview(Object obj, PreviewPanel lastPreview)
Reuses the last preview, if possible.- Specified by:
reusePreview
in interfaceObjectContentHandler
- Overrides:
reusePreview
in classAbstractObjectContentHandler
- Parameters:
obj
- the object to create the view for- Returns:
- the preview
-
createPreview
public PreviewPanel createPreview(Object obj)
Creates the actual preview.- Specified by:
createPreview
in interfaceObjectContentHandler
- Parameters:
obj
- the object to create the view for- Returns:
- the preview
-
-