Class ObjectLocationsFromReport

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, SizeOfHandler, Serializable

    public class ObjectLocationsFromReport
    extends AbstractDrawObjectsFromReport
    Displays the locations of objects in the image, using data from the attached report.
    Suffixes:
    .x
    .y
    .width
    .height
    Optionally, if type information is available per object, the locations can be displayed in distinct colors per type. The type itself can be displayed as well.
    If polygon data should be available (.poly_x and .poly_y), then this takes precedence over the rectangle coordinates.

    -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: false
     
    -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
     
    -type-regexp <adams.core.base.BaseRegExp> (property: typeRegExp)
        The regular expression that the types must match in order to get drawn (
        eg only plotting a subset).
        default: .*
        more: https://docs.oracle.com/javase/tutorial/essential/regex/
        https://docs.oracle.com/javase/8/docs/api/java/util/regex/Pattern.html
     
    -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
     
    -predefined-labels <adams.core.base.BaseString> [-predefined-labels ...] (property: predefinedLabels)
        The predefined labels to use for setting up the colors; avoids constants
        changing in color pallet.
        default:
     
    -stroke-thickness <float> (property: strokeThickness)
        The thickness of the stroke.
        default: 1.0
        minimum: 0.01
     
    -filled <boolean> (property: filled)
        If enabled, the shape is drawn filled.
        default: false
     
    -polygon-bounds <boolean> (property: polygonBounds)
        If enabled, the polygon bounds are drawn as well.
        default: false
     
    -bounding-box-fallback-ratio <double> (property: boundingBoxFallbackRatio)
        The threshold for the ratio between the areas (shape / bbox), below which
        the bounding box is used over the polygon (ie bad masks/shapes).
        default: 0.0
        minimum: 0.0
        maximum: 1.0
     
    -vary-shape-color <boolean> (property: varyShapeColor)
        If enabled, the shape colors get varied.
        default: false
     
    -shape-color-provider <adams.gui.visualization.core.ColorProvider> (property: shapeColorProvider)
        The color provider to use when varying the shape colors.
        default: adams.gui.visualization.core.TranslucentColorProvider -provider adams.gui.visualization.core.DefaultColorProvider
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_StrokeThickness

        protected float m_StrokeThickness
        the thickness of the stroke.
      • m_Filled

        protected boolean m_Filled
        whether to draw the shape filled.
      • m_OutlineAlpha

        protected int m_OutlineAlpha
        the alpha value to use for the outlines.
      • m_OutlineColors

        protected transient Map<Color,​Color> m_OutlineColors
        the colors for the polygon bounds.
      • m_PolygonBounds

        protected boolean m_PolygonBounds
        whether to draw the bounds of the polygon as well.
    • Constructor Detail

      • ObjectLocationsFromReport

        public ObjectLocationsFromReport()
    • Method Detail

      • setStrokeThickness

        public void setStrokeThickness​(float value)
        Sets the stroke thickness to use.
        Parameters:
        value - the thickness
      • getStrokeThickness

        public float getStrokeThickness()
        Returns the current stroke thickness.
        Returns:
        the thickness
      • strokeThicknessTipText

        public String strokeThicknessTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setFilled

        public void setFilled​(boolean value)
        Sets whether to draw the shape filled.
        Parameters:
        value - true if to fill
      • getFilled

        public boolean getFilled()
        Returns whether to draw the shape filled.
        Returns:
        true if to fill
      • filledTipText

        public String filledTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setOutlineAlpha

        public void setOutlineAlpha​(int value)
        Sets the alpha value to use when drawing the outlines.
        Parameters:
        value - the alpha value (0: transparent, 255: opaque)
      • getOutlineAlpha

        public int getOutlineAlpha()
        Returns the alpha value to use when drawing the outlines.
        Returns:
        the alpha value (0: transparent, 255: opaque)
      • outlineAlphaTipText

        public String outlineAlphaTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setPolygonBounds

        public void setPolygonBounds​(boolean value)
        Sets whether to draw the polygon bounds.
        Parameters:
        value - true if to draw bounds
      • getPolygonBounds

        public boolean getPolygonBounds()
        Returns whether to draw the polygon bounds.
        Returns:
        true if to draw bounds
      • polygonBoundsTipText

        public String polygonBoundsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setBoundingBoxFallbackRatio

        public void setBoundingBoxFallbackRatio​(double value)
        Sets the ratio between shape area over bbox area. If below the bbox is used instead of the polygon.
        Parameters:
        value - the ratio
      • getBoundingBoxFallbackRatio

        public double getBoundingBoxFallbackRatio()
        Returns the ratio between shape area over bbox area. If below the bbox is used instead of the polygon.
        Returns:
        the ratio
      • boundingBoxFallbackRatioTipText

        public String boundingBoxFallbackRatioTipText()
        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.
      • getStrokeWidth

        protected float getStrokeWidth​(Graphics g,
                                       float defValue)
        Returns the thickness of the stroke.
        Parameters:
        g - graphics context to get the thickness from
        defValue - the default value to return in case of failure
        Returns:
        the stroke, default value if failed to extract
      • applyStroke

        protected void applyStroke​(Graphics g,
                                   float stroke)
        Applies the stroke thickness.
        Parameters:
        stroke - the thickness to apply