Class ObjectAnnotationPanel

    • Field Detail

      • ZOOM_FACTOR

        public static final double ZOOM_FACTOR
        the zoom factor to use.
        See Also:
        Constant Field Values
      • m_PanelZoom

        protected JPanel m_PanelZoom
        the panel for the zoom controls.
      • m_TextZoom

        protected NumberTextField m_TextZoom
        the text field for the zoom.
      • m_ButtonZoomClear

        protected BaseFlatButton m_ButtonZoomClear
        the button for clearing zoom.
      • m_ButtonZoomIn

        protected BaseFlatButton m_ButtonZoomIn
        the button for zooming in.
      • m_ButtonZoomOut

        protected BaseFlatButton m_ButtonZoomOut
        the button for zooming out.
      • m_ButtonZoomBestFit

        protected BaseFlatButton m_ButtonZoomBestFit
        the button for best fit zoom.
      • m_ButtonZoom

        protected BaseFlatButton m_ButtonZoom
        the button for applying the zoom.
      • m_PanelUndo

        protected JPanel m_PanelUndo
        the panel for the undo/redo controls.
      • m_ButtonUndo

        protected BaseFlatButton m_ButtonUndo
        the button for performing an undo.
      • m_ButtonRedo

        protected BaseFlatButton m_ButtonRedo
        the button for performing a redo.
      • m_PanelBrightness

        protected JPanel m_PanelBrightness
        the panel for the brightness controls.
      • m_TextBrightness

        protected NumberTextField m_TextBrightness
        the brightness to use.
      • m_ButtonBrightness

        protected BaseFlatButton m_ButtonBrightness
        the button for applying the values.
      • m_PanelUsePreviousReport

        protected JPanel m_PanelUsePreviousReport
        the panel for the last button controls.
      • m_ButtonUsePreviousReport

        protected BaseFlatButton m_ButtonUsePreviousReport
        the button for using the last report.
      • m_ButtonShowAnnotations

        protected BaseToggleButton m_ButtonShowAnnotations
        for toggling the visibility of the annotations.
      • m_SplitPaneLeft

        protected BaseSplitPane m_SplitPaneLeft
        the left split panel (label selector | rest).
      • m_SplitPaneRight

        protected BaseSplitPane m_SplitPaneRight
        the right split pane (image | annotations).
      • m_PanelCanvas

        protected CanvasPanel m_PanelCanvas
        the canvas in use.
      • m_ScrollPane

        protected BaseScrollPane m_ScrollPane
        the JScrollPane that embeds the paint panel.
      • m_PanelAnnotationsAndTools

        protected BasePanel m_PanelAnnotationsAndTools
        the annotations + tools panel.
      • m_SplitPaneAnnotationsAndTools

        protected BaseSplitPane m_SplitPaneAnnotationsAndTools
        the split pane for annotations/tools.
      • m_PanelTools

        protected BasePanel m_PanelTools
        the tools panel.
      • m_SplitPaneTools

        protected BaseSplitPane m_SplitPaneTools
        the split pane for the tools.
      • m_PanelToolOptions

        protected BasePanel m_PanelToolOptions
        the panel for displaying the tool options.
      • m_PanelToolButtons

        protected JPanel m_PanelToolButtons
        the panel with the buttons.
      • m_StatusBar

        protected BaseStatusBar m_StatusBar
        the status bar label.
      • m_Overlay

        protected Overlay m_Overlay
        the overlay.
      • m_Undo

        protected Undo m_Undo
        the undo manager.
      • m_CurrentLabel

        protected String m_CurrentLabel
        the current label.
      • m_AnnotationChangeListeners

        protected Set<ChangeListener> m_AnnotationChangeListeners
        the listeners for annotation changes.
      • m_PreviousReport

        protected Report m_PreviousReport
        the report from the previous session.
      • m_Tools

        protected List<Tool> m_Tools
        the tools.
      • m_LastMouseListener

        protected MouseListener m_LastMouseListener
        the last mouse listener in use.
      • m_LastMouseMotionListener

        protected MouseMotionListener m_LastMouseMotionListener
        the last mouse motion listener in use.
      • m_LastKeyListener

        protected KeyListener m_LastKeyListener
        the last key listener in use.
      • m_ActiveTool

        protected Tool m_ActiveTool
        the active tool.
      • m_ShowAnnotations

        protected boolean m_ShowAnnotations
        whether to show the annotations.
    • Constructor Detail

      • ObjectAnnotationPanel

        public ObjectAnnotationPanel()
    • Method Detail

      • initialize

        protected void initialize()
        Initializes the members.
        Overrides:
        initialize in class BasePanel
      • initGUI

        protected void initGUI()
        Initializes the widgets.
        Overrides:
        initGUI in class BasePanel
      • finishInit

        protected void finishInit()
        Finishes the initialization.
        Overrides:
        finishInit in class BasePanel
      • setZoomVisible

        public void setZoomVisible​(boolean value)
        Sets whether the zoom controls are visible or not.
        Parameters:
        value - true if visible
      • isZoomVisible

        public boolean isZoomVisible()
        Returns whether the zoom controls are visible or not.
        Returns:
        true if visible
      • setUndoVisible

        public void setUndoVisible​(boolean value)
        Sets whether the undo controls are visible or not.
        Parameters:
        value - true if visible
      • isUndoVisible

        public boolean isUndoVisible()
        Returns whether the undo controls are visible or not.
        Returns:
        true if visible
      • setBrightnessVisible

        public void setBrightnessVisible​(boolean value)
        Sets whether the brightness controls are visible or not.
        Parameters:
        value - true if visible
      • isBrightnessVisible

        public boolean isBrightnessVisible()
        Returns whether the brightness controls are visible or not.
        Returns:
        true if visible
      • setUsePreviousReportVisible

        public void setUsePreviousReportVisible​(boolean value)
        Sets whether the controls for using the previous report are visible or not.
        Parameters:
        value - true if visible
      • isUsePreviousReportVisible

        public boolean isUsePreviousReportVisible()
        Returns whether the controls for using the previous report are visible or not.
        Returns:
        true if visible
      • setBestFit

        public void setBestFit​(boolean value)
        Sets whether to use best fit or specified scale.
        Parameters:
        value - true if to use best fit
      • getBestFit

        public boolean getBestFit()
        Sets whether to use best fit.
        Returns:
        true if to use best fit
      • setZoom

        public void setZoom​(double value)
        Sets the zoom.
        Parameters:
        value - the zoom to use (1 = 100%)
      • getZoom

        public double getZoom()
        Returns the current zoom.
        Returns:
        the zoom (1 = 100%)
      • getActualZoom

        public double getActualZoom()
        Returns the actual zoom (taking best fit into account if set).
        Returns:
        the zoom in use (1 = 100%)
      • clearZoom

        public void clearZoom()
        Clears the zoom.
      • zoomIn

        public void zoomIn()
        Zooms in.
      • zoomOut

        public void zoomOut()
        Zooms out.
      • bestFitZoom

        public void bestFitZoom()
        Fits the image.
      • clear

        public void clear()
        Clears: label, image, annotations, interaction log, undo.
      • setImage

        public void setImage​(BufferedImage value)
        Sets the image to display.
        Parameters:
        value - the image, null for none
      • getImage

        public BufferedImage getImage()
        Returns the image on display.
        Returns:
        the image, null if none set
      • setReport

        public void setReport​(Report value)
        Sets the report to display.
        Parameters:
        value - the report
      • getReport

        public Report getReport()
        Returns the current report.
        Returns:
        the report
      • setPreviousReport

        public void setPreviousReport​(Report value)
        Sets the previous report.
        Parameters:
        value - the report, null to unset
      • getPreviousReport

        public Report getPreviousReport()
        Returns the previous report.
        Returns:
        the report, null if not set
      • applyPreviousReport

        protected void applyPreviousReport()
        Applies the previous report, if possible.
      • setObjects

        public void setObjects​(LocatedObjects value)
        Sets the located objects to use.
        Parameters:
        value - the report
      • getObjects

        public LocatedObjects getObjects()
        Returns the current located objects.
        Returns:
        the objects
      • setBrightness

        public void setBrightness​(float value)
        Sets the brightness to use.
        Parameters:
        value - the brightness (100 = default)
      • getBrightness

        public float getBrightness()
        Returns the brightness in use.
        Returns:
        the brightness (100 = default)
      • setUndo

        public void setUndo​(Undo value)
        Sets the undo manager to use, can be null if no undo-support wanted.
        Specified by:
        setUndo in interface UndoHandler
        Parameters:
        value - the undo manager to use
      • getUndo

        public Undo getUndo()
        Returns the current undo manager, can be null.
        Specified by:
        getUndo in interface UndoHandler
        Returns:
        the undo manager, if any
      • isUndoSupported

        public boolean isUndoSupported()
        Returns whether an Undo manager is currently available.
        Specified by:
        isUndoSupported in interface UndoHandler
        Returns:
        true if an undo manager is set
      • addUndoPoint

        public void addUndoPoint​(String comment)
        Adds an undo point with the given comment.
        Specified by:
        addUndoPoint in interface UndoHandlerWithQuickAccess
        Parameters:
        comment - the comment for the undo point
      • undoOccurred

        public void undoOccurred​(UndoEvent e)
        An undo event, like add or remove, has occurred.
        Specified by:
        undoOccurred in interface UndoListener
        Parameters:
        e - the trigger event
      • preselectCurrentLabel

        public void preselectCurrentLabel​(String label)
        Pre-selects the label.
        Parameters:
        label - the label to use
      • setCurrentLabel

        public void setCurrentLabel​(String value)
        Sets the current label to use.
        Parameters:
        value - the label, null to unset
      • getCurrentLabel

        public String getCurrentLabel()
        Returns the current label in use.
        Returns:
        the label, null if not set
      • setLabelSelectorPanel

        public void setLabelSelectorPanel​(AbstractLabelSelectorPanel value)
        Sets the label selector panel.
        Parameters:
        value - the panel, null to hide
      • getLabelSelectorPanel

        public AbstractLabelSelectorPanel getLabelSelectorPanel()
        Returns the label selector panel.
        Returns:
        the panel, null if none available
      • setAnnotationsPanel

        public void setAnnotationsPanel​(AbstractAnnotationsDisplayPanel value)
        Sets the annotations panel.
        Parameters:
        value - the panel to use
      • getScrollPane

        public BaseScrollPane getScrollPane()
        Returns the scrollpane.
        Returns:
        the scroll pane
      • getCanvas

        public CanvasPanel getCanvas()
        Returns the canvas.
        Returns:
        the panel for drawing
      • setLeftDividerLocation

        public void setLeftDividerLocation​(int value)
        Sets the location of the left divider.
        Parameters:
        value - the position in pixels
      • setLeftDividerLocation

        public void setLeftDividerLocation​(double value)
        Sets the proportional location for the left divider.
        Parameters:
        value - the location (0-1)
      • getLeftDividerLocation

        public int getLeftDividerLocation()
        Returns the left divider location.
        Returns:
        the position in pixels
      • setRightDividerLocation

        public void setRightDividerLocation​(int value)
        Sets the location of the right divider.
        Parameters:
        value - the position in pixels
      • setRightDividerLocation

        public void setRightDividerLocation​(double value)
        Sets the proportional location for the right divider.
        Parameters:
        value - the location (0-1)
      • getRightDividerLocation

        public int getRightDividerLocation()
        Returns the right divider location.
        Returns:
        the position in pixels
      • setOverlay

        public void setOverlay​(Overlay value)
        Sets the overlay to use.
        Parameters:
        value - the overlay
      • getOverlay

        public Overlay getOverlay()
        Returns the current overlay.
        Returns:
        the overlay
      • setMouseClickProcessor

        public void setMouseClickProcessor​(AbstractMouseClickProcessor value)
        Sets the mouse click processor to use.
        Parameters:
        value - the processor
      • getMouseClickProcessor

        public AbstractMouseClickProcessor getMouseClickProcessor()
        Returns the current mouse click processor.
        Returns:
        the processor
      • annotationsChanged

        public void annotationsChanged​(Object source)
        For notifying everyone that the annotations have changed
        Parameters:
        source - the source triggering the change
      • labelChanged

        public void labelChanged​(Object source)
        For notifying everyone that the label have changed
        Parameters:
        source - the source triggering the change
      • getActiveTool

        public Tool getActiveTool()
        Returns the currently active tool.
        Returns:
        the active tool, null if not available
      • setAnnotator

        public void setAnnotator​(AbstractAnnotator value)
        Sets and installs the annotator.
        Parameters:
        value - the annotator
      • getAnnotator

        public AbstractAnnotator getAnnotator()
        Returns the current annotator.
        Returns:
        the annotator
      • updateStatus

        public void updateStatus()
        Updates the status bar.
      • updateStatus

        public void updateStatus​(Point pos)
        Updates the status bar.
        Parameters:
        pos - the mouse position
      • showStatus

        public void showStatus​(String msg)
        Displays a message.
        Parameters:
        msg - the message to display
      • updateButtons

        public void updateButtons()
        Updates the state of the buttons.
      • update

        public void update()
        Updates the image, buttons, status.
      • update

        public void update​(boolean doLayout)
        Updates the image.
        Parameters:
        doLayout - whether to update the layout
      • mouseToPixelLocation

        public Point mouseToPixelLocation​(Point mousePos)
        Turns the mouse position into pixel location. Limits the pixel position to the size of the image, i.e., no negative pixel locations or ones that exceed the image size are generated.
        Parameters:
        mousePos - the mouse position
        Returns:
        the pixel location
      • pixelToMouseLocation

        public Point pixelToMouseLocation​(Point pixelPos)
        Converts the pixel position (at 100% scale) to a mouse location.
        Parameters:
        pixelPos - the pixel position
        Returns:
        the mouse position
      • setInteractionLoggingFilter

        public void setInteractionLoggingFilter​(InteractionLoggingFilter value)
        Sets the interaction log filter to use.
        Parameters:
        value - the filter
      • getInteractionLoggingFilter

        public InteractionLoggingFilter getInteractionLoggingFilter()
        Returns the interaction log filter in use.
        Returns:
        the filter
      • hasInteractionLog

        public boolean hasInteractionLog()
        Checks whether there have been any interactions recorded.
        Specified by:
        hasInteractionLog in interface InteractionLogManager
        Returns:
        true if interactions are available
      • addAnnotationChangeListener

        public void addAnnotationChangeListener​(ChangeListener l)
        Adds the listener for annotation changes.
        Parameters:
        l - the listener to add
      • removeAnnotationChangeListener

        public void removeAnnotationChangeListener​(ChangeListener l)
        Removes the listener for annotation changes.
        Parameters:
        l - the listener to remove
      • notifyAnnotationChangeListeners

        protected void notifyAnnotationChangeListeners()
        Notifies all annotation change listeners.
      • notifyTools

        protected void notifyTools()
        Notifies all tools to update.
        See Also:
        Tool.update()
      • setShowAnnotations

        public void setShowAnnotations​(boolean value)
        Sets whether the annotations are to be shown.
        Parameters:
        value - true if to show the annotations
      • getShowAnnotations

        public boolean getShowAnnotations()
        Returns whether the annotations are shown.
        Returns:
        true if shown
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface CleanUpHandler
      • main

        public static void main​(String[] args)
                         throws Exception
        For testing only.
        Parameters:
        args - the image to display
        Throws:
        Exception - if something goes wrong