Class ObjectLocationsOverlayFromReport

  • All Implemented Interfaces:
    CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, ShallowCopySupporter<AbstractImageOverlay>, SizeOfHandler, PopupMenuCustomizer<ImagePanel.PaintPanel>, ImageOverlay, TypeColorProvider, Serializable

    public class ObjectLocationsOverlayFromReport
    extends AbstractObjectOverlayFromReport
    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
     
    -enabled <boolean> (property: enabled)
        If enabled, this overlay is painted over the image.
        default: true
     
    -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:
     
    -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
     
    -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
     
    -stroke-thickness <float> (property: strokeThickness)
        The thickness of the stroke.
        default: 1.0
        minimum: 0.01
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • 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 polygon bounds.
      • 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.
      • m_StrokeThickness

        protected float m_StrokeThickness
        the thickness of the stroke.
    • Constructor Detail

      • ObjectLocationsOverlayFromReport

        public ObjectLocationsOverlayFromReport()
    • Method Detail

      • 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.
      • 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.
      • 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.
      • 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.
      • 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.
      • 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