Package adams.gui.tools.previewbrowser
Class YoloAnnotationsHandler
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.previewbrowser.AbstractContentHandler
-
- adams.gui.tools.previewbrowser.YoloAnnotationsHandler
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ContentHandler
,Serializable
public class YoloAnnotationsHandler extends AbstractContentHandler
Displays the following image types with an overlay for the objects stored in the .txt file with the same name (using object prefix 'Object.'): tif,jpg,tiff,bmp,gif,png,jpeg,wbmp
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-prefix <java.lang.String> (property: prefix) The prefix of fields in the report to identify as object location, eg 'Object. '. default: Object.
-color <java.awt.Color> (property: color) The color to use for the objects. default: #ff0000
-use-colors-per-type <boolean> (property: useColorsPerType) If enabled, individual colors per type are used. default: true
-type-color-provider <adams.gui.visualization.core.ColorProvider> (property: typeColorProvider) The color provider to use for the various types. default: adams.gui.visualization.core.DefaultColorProvider
-type-suffix <java.lang.String> (property: typeSuffix) The suffix of fields in the report to identify the type. default: .type
-label-format <java.lang.String> (property: labelFormat) The label format string to use for the rectangles; '#' for index, '@' for type and '$' for short type (type suffix must be defined for '@' and '$' ), '{BLAH}' gets replaced with the value associated with the meta-data key 'BLAH'; for instance: '# @' or '# {BLAH}'; in case of numeric values, use '|.X' to limit the number of decimals, eg '{BLAH|.2}' for a maximum of decimals after the decimal point. default: $
-label-font <java.awt.Font> (property: labelFont) The font to use for the labels. default: Display-PLAIN-14
-label-anchor <TOP_LEFT|TOP_CENTER|TOP_RIGHT|MIDDLE_LEFT|MIDDLE_CENTER|MIDDLE_RIGHT|BOTTOM_LEFT|BOTTOM_CENTER|BOTTOM_RIGHT> (property: labelAnchor) The anchor for the label. default: TOP_RIGHT
-label-offset-x <int> (property: labelOffsetX) The X offset for the label; values of 0 or greater are interpreted as absolute pixels, -1 uses left as anchor, -2 the center and -3 the right. default: 0
-label-offset-y <int> (property: labelOffsetY) The Y offset for the label values of 0 or greater are interpreted as absolute pixels, -1 uses top as anchor, -2 the middle and -3 the bottom. default: 0
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Color
m_Color
the color for the objects.protected ObjectFinder
m_Finder
the object finder to use.protected ImageAnchor
m_LabelAnchor
the label anchor.protected Font
m_LabelFont
the label font.protected String
m_LabelFormat
the label for the rectangles.protected int
m_LabelOffsetX
the x offset for the label.protected int
m_LabelOffsetY
the y offset for the label.protected String
m_Prefix
the prefix for the objects in the report.protected ColorProvider
m_TypeColorProvider
the color provider to use.protected String
m_TypeSuffix
the suffix for the type.protected boolean
m_UseColorsPerType
whether to use colors per type.-
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 YoloAnnotationsHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
colorTipText()
Returns the tip text for this property.PreviewPanel
createPreview(File file)
Creates the actual view.void
defineOptions()
Adds options to the internal list of options.Color
getColor()
Returns the color to use for the objects.protected ImageAnchor
getDefaultLabelAnchor()
Returns the default label anchor.protected String
getDefaultLabelFormat()
Returns the default label format.protected int
getDefaultLabelOffsetX()
Returns the default label offset for X.protected int
getDefaultLabelOffsetY()
Returns the default label offset for Y.protected boolean
getDefaultUseColorsPerType()
Returns the default for using colors per type.String[]
getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.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.String
getPrefix()
Returns the prefix to use for the objects in the report.ColorProvider
getTypeColorProvider()
Returns the color provider to use for the types.String
getTypeSuffix()
Returns the suffix to use for the types.boolean
getUseColorsPerType()
Returns whether to use colors per type.String
globalInfo()
Returns a string describing the object.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.String
prefixTipText()
Returns the tip text for this property.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
setPrefix(String value)
Sets the prefix to use for the objects in the report.void
setTypeColorProvider(ColorProvider value)
Sets the color provider to use for the types.void
setTypeSuffix(String value)
Sets the suffix to use for the types.void
setUseColorsPerType(boolean value)
Sets whether to use colors per type.String
typeColorProviderTipText()
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.-
Methods inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
checkFile, getHandlers, getHandlersForFile, getHandlersForFile, getPreview, getRelation, hasHandler, hasHandler, reusePreview
-
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.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
-
m_Prefix
protected String m_Prefix
the prefix for the objects in the report.
-
m_Color
protected Color m_Color
the color for the objects.
-
m_UseColorsPerType
protected boolean m_UseColorsPerType
whether to use colors per type.
-
m_TypeColorProvider
protected ColorProvider m_TypeColorProvider
the color provider to use.
-
m_TypeSuffix
protected String m_TypeSuffix
the suffix for the type.
-
m_LabelFormat
protected String m_LabelFormat
the label for the rectangles.
-
m_LabelFont
protected Font m_LabelFont
the label font.
-
m_LabelAnchor
protected ImageAnchor m_LabelAnchor
the label anchor.
-
m_LabelOffsetX
protected int m_LabelOffsetX
the x offset for the label.
-
m_LabelOffsetY
protected int m_LabelOffsetY
the y offset for the label.
-
m_Finder
protected ObjectFinder m_Finder
the object finder to use.
-
-
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
-
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.
-
getDefaultUseColorsPerType
protected boolean getDefaultUseColorsPerType()
Returns the default for using colors per type.- Returns:
- the default
-
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.
-
getDefaultLabelFormat
protected String getDefaultLabelFormat()
Returns the default label format.- Returns:
- the default
-
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 default
-
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.
-
getExtensions
public String[] getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.- Returns:
- the list of extensions (no dot)
-
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
-
-