Package adams.gui.visualization.object
Class ObjectAnnotationPanel
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JPanel
-
- adams.gui.core.BasePanel
-
- adams.gui.visualization.object.ObjectAnnotationPanel
-
- All Implemented Interfaces:
CleanUpHandler,FlowContextHandler,PopupMenuCustomizer<CanvasPanel>,UndoHandler,UndoHandlerWithQuickAccess,UndoListener,InteractionLogManager,PopupMenuCustomizer,ImageObserver,MenuContainer,Serializable,EventListener,Accessible
public class ObjectAnnotationPanel extends BasePanel implements CleanUpHandler, UndoHandlerWithQuickAccess, UndoListener, InteractionLogManager, PopupMenuCustomizer, FlowContextHandler
Panel for annotating objects in images.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classObjectAnnotationPanel.AnnotationsStateFor undo/redo.-
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
-
Field Summary
Fields Modifier and Type Field Description protected Toolm_ActiveToolthe active tool.protected Set<ChangeListener>m_AnnotationChangeListenersthe listeners for annotation changes.protected AbstractAnnotatorm_Annotatorthe annotator.protected KeyListenerm_BaseKeyListenerthe base key listener.protected BaseFlatButtonm_ButtonBrightnessthe button for applying the values.protected BaseFlatButtonm_ButtonHelpthe button for help.protected BaseFlatButtonm_ButtonMaxMinthe button for maximize/minimize.protected BaseFlatButtonm_ButtonRedothe button for performing a redo.protected BaseToggleButtonm_ButtonShowAnnotationsfor toggling the visibility of the annotations.protected BaseFlatButtonm_ButtonStopFlowthe button for stopping the flow.protected BaseFlatButtonm_ButtonUndothe button for performing an undo.protected BaseFlatButtonm_ButtonUsePreviousReportthe button for using the last report.protected BaseFlatButtonm_ButtonZoomthe button for applying the zoom.protected BaseFlatButtonm_ButtonZoomBestFitthe button for best fit zoom.protected BaseFlatButtonm_ButtonZoomClearthe button for clearing zoom.protected BaseFlatButtonm_ButtonZoomInthe button for zooming in.protected BaseFlatButtonm_ButtonZoomOutthe button for zooming out.protected Stringm_CurrentLabelthe current label.protected Actorm_FlowContextthe flow context.protected List<InteractionEvent>m_InteractionLogthe interaction log.protected KeyListenerm_LastKeyListenerthe last key listener in use.protected MouseListenerm_LastMouseListenerthe last mouse listener in use.protected MouseMotionListenerm_LastMouseMotionListenerthe last mouse motion listener in use.protected AbstractMouseClickProcessorm_MouseClickProcessorthe mouse click processor.protected Overlaym_Overlaythe overlay.protected AbstractAnnotationsDisplayPanelm_PanelAnnotationsthe annotations panel.protected BasePanelm_PanelAnnotationsAndToolsthe annotations + tools panel.protected JPanelm_PanelBrightnessthe panel for the brightness controls.protected CanvasPanelm_PanelCanvasthe canvas in use.protected AbstractLabelSelectorPanelm_PanelLabelSelectorthe label selector panel.protected JPanelm_PanelToolButtonsthe panel with the buttons.protected BasePanelm_PanelToolOptionsthe panel for displaying the tool options.protected BasePanelm_PanelToolsthe tools panel.protected JPanelm_PanelUndothe panel for the undo/redo controls.protected JPanelm_PanelUsePreviousReportthe panel for the last button controls.protected JPanelm_PanelZoomthe panel for the zoom controls.protected Reportm_PreviousReportthe report from the previous session.protected BaseScrollPanem_ScrollPanethe JScrollPane that embeds the paint panel.protected booleanm_ShowAnnotationswhether to show the annotations.protected BaseSplitPanem_SplitPaneAnnotationsAndToolsthe split pane for annotations/tools.protected BaseSplitPanem_SplitPaneLeftthe left split panel (label selector | rest).protected BaseSplitPanem_SplitPaneRightthe right split pane (image | annotations).protected BaseSplitPanem_SplitPaneToolsthe split pane for the tools.protected BaseStatusBarm_StatusBarthe status bar label.protected NumberTextFieldm_TextBrightnessthe brightness to use.protected NumberTextFieldm_TextZoomthe text field for the zoom.protected Set<ChangeListener>m_ToolOptionsUpdatedListenerslisteners for when tool options get updated.protected List<Tool>m_Toolsthe tools.protected Undom_Undothe undo manager.static doubleZOOM_FACTORthe zoom factor to use.-
Fields inherited from class adams.gui.core.BasePanel
m_FileChooser
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
-
Constructor Summary
Constructors Constructor Description ObjectAnnotationPanel()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAnnotationChangeListener(ChangeListener l)Adds the listener for annotation changes.voidaddInteractionLog(InteractionEvent e)Adds the interaction event to the log.voidaddToolOptionsUpdatedListener(ChangeListener l)Adds the listener for when tool options have been updated.voidaddUndoPoint(String comment)Adds an undo point with the given comment.voidannotationsChanged(Object source)For notifying everyone that the annotations have changedprotected voidapplyPreviousReport()Applies the previous report, if possible.protected voidbeforeShow()Hook method just before the panel is made visible.voidbestFitZoom()Fits the image.voidcleanUp()Cleans up data structures, frees up memory.voidclear()Clears: label, image, annotations, interaction log, undo.voidclearInteractionLog()Clears the interaction log.voidclearZoom()Clears the zoom.voidcustomizePopupMenu(CanvasPanel source, JPopupMenu menu)For customizing the popup menu.protected voidfinishInit()Finishes the initialization.ToolgetActiveTool()Returns the currently active tool.doublegetActualZoom()Returns the actual zoom (taking best fit into account if set).AbstractAnnotationsDisplayPanelgetAnnotationsPanel()Returns the annotations panel.AbstractAnnotatorgetAnnotator()Returns the current annotator.booleangetBestFit()Sets whether to use best fit.floatgetBrightness()Returns the brightness in use.CanvasPanelgetCanvas()Returns the canvas.StringgetCurrentLabel()Returns the current label in use.ActorgetFlowContext()Returns the flow context, if any.BufferedImagegetImage()Returns the image on display.List<InteractionEvent>getInteractionLog()Returns the interaction log.InteractionLoggingFiltergetInteractionLoggingFilter()Returns the interaction log filter in use.AbstractLabelSelectorPanelgetLabelSelectorPanel()Returns the label selector panel.intgetLeftDividerLocation()Returns the left divider location.AbstractMouseClickProcessorgetMouseClickProcessor()Returns the current mouse click processor.LocatedObjectsgetObjects()Returns the current located objects.OverlaygetOverlay()Returns the current overlay.ReportgetPreviousReport()Returns the previous report.ReportgetReport()Returns the current report.intgetRightDividerLocation()Returns the right divider location.BaseScrollPanegetScrollPane()Returns the scrollpane.booleangetShowAnnotations()Returns whether the annotations are shown.ObjectAnnotationPanel.AnnotationsStategetState()Returns the current state.Map<String,Object>getToolOptions()Retrieves the current options.UndogetUndo()Returns the current undo manager, can be null.doublegetZoom()Returns the current zoom.booleanhasInteractionLog()Checks whether there have been any interactions recorded.Stringhelp()Returns the help string.protected voidinitGUI()Initializes the widgets.protected voidinitialize()Initializes the members.booleanisBrightnessVisible()Returns whether the brightness controls are visible or not.booleanisHelpVisible()Returns whether the help button is visible.booleanisMaxMinVisible()Returns whether the max/min button is visible.booleanisStopFlowButtonVisible()Returns whether to show the stop flow button.booleanisUndoSupported()Returns whether an Undo manager is currently available.booleanisUndoVisible()Returns whether the undo controls are visible or not.booleanisUsePreviousReportVisible()Returns whether the controls for using the previous report are visible or not.booleanisZoomVisible()Returns whether the zoom controls are visible or not.voidlabelChanged(Object source)For notifying everyone that the label have changedvoidloadToolOptions(PlaceholderFile optionsFile, LoggingSupporter logger)Restores the tool options from the JSON file.static voidmain(String[] args)For testing only.PointmouseToPixelLocation(Point mousePos)Turns the mouse position into pixel location.protected voidnotifyAnnotationChangeListeners()Notifies all annotation change listeners.protected voidnotifyTools()Notifies all tools to update.PointpixelToMouseLocation(Point pixelPos)Converts the pixel position (at 100% scale) to a mouse location.voidpreselectCurrentLabel(String label)Pre-selects the label.voidredo()performs a redo if possible.voidremoveAnnotationChangeListener(ChangeListener l)Removes the listener for annotation changes.voidremoveToolOptionsUpdatedListener(ChangeListener l)Removes the listener for when tool options have been updated.voidsaveToolOptions(PlaceholderFile optionsFile, LoggingSupporter logger)Saves the tool options to the specified JSON file.voidsetAnnotationsPanel(AbstractAnnotationsDisplayPanel value)Sets the annotations panel.voidsetAnnotator(AbstractAnnotator value)Sets and installs the annotator.voidsetBestFit(boolean value)Sets whether to use best fit or specified scale.voidsetBrightness(float value)Sets the brightness to use.voidsetBrightnessVisible(boolean value)Sets whether the brightness controls are visible or not.voidsetCurrentLabel(String value)Sets the current label to use.voidsetFlowContext(Actor value)Sets the flow context.voidsetHelpVisible(boolean value)Sets whether the help button is visible.voidsetImage(BufferedImage value)Sets the image to display.voidsetInteractionLoggingFilter(InteractionLoggingFilter value)Sets the interaction log filter to use.voidsetLabelSelectorPanel(AbstractLabelSelectorPanel value)Sets the label selector panel.voidsetLeftDividerLocation(double value)Sets the proportional location for the left divider.voidsetLeftDividerLocation(int value)Sets the location of the left divider.voidsetMaxMinVisible(boolean value)Sets whether the max/min button is visible.voidsetMouseClickProcessor(AbstractMouseClickProcessor value)Sets the mouse click processor to use.voidsetObjects(LocatedObjects value)Sets the located objects to use.voidsetOverlay(Overlay value)Sets the overlay to use.voidsetPreviousReport(Report value)Sets the previous report.voidsetReport(Report value)Sets the report to display.voidsetRightDividerLocation(double value)Sets the proportional location for the right divider.voidsetRightDividerLocation(int value)Sets the location of the right divider.voidsetShowAnnotations(boolean value)Sets whether the annotations are to be shown.voidsetState(ObjectAnnotationPanel.AnnotationsState state)Restores the state of the layer.voidsetStopFlowButtonVisible(boolean value)Sets whether to show the stop flow button.voidsetToolOptions(Map<String,Object> value)Updates the tools with these options.voidsetUndo(Undo value)Sets the undo manager to use, can be null if no undo-support wanted.voidsetUndoVisible(boolean value)Sets whether the undo controls are visible or not.voidsetUsePreviousReportVisible(boolean value)Sets whether the controls for using the previous report are visible or not.voidsetZoom(double value)Sets the zoom.voidsetZoomVisible(boolean value)Sets whether the zoom controls are visible or not.voidshowHelp()Displays the help in a dialog.voidshowStatus(String msg)Displays a message.voidstopFlow()Stops the flow execution, if a flow context is set and the stop button visible.voidtoggleWindowSize()Toggles the window size between normal and maximized.voidtoolOptionsUpdated()Gets called when the options in a tool got updated.voidundo()performs an undo if possible.voidundoOccurred(UndoEvent e)An undo event, like add or remove, has occurred.voidupdate()Updates the image, buttons, status.voidupdate(boolean doLayout)Updates the image.voidupdateButtons()Updates the state of the buttons.voidupdateStatus()Updates the status bar.voidupdateStatus(Point pos)Updates the status bar.voidzoomIn()Zooms in.voidzoomOut()Zooms out.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, closeParent, getParentChild, getParentDialog, getParentFrame, getParentInternalFrame, getParentTitle, initFileChooser, printErrorMessage, printException, saveComponent, setEnabledCascade, setEnabledCascade, setParentTitle, setVisible
-
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
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_ButtonStopFlow
protected BaseFlatButton m_ButtonStopFlow
the button for stopping the flow.
-
m_ButtonMaxMin
protected BaseFlatButton m_ButtonMaxMin
the button for maximize/minimize.
-
m_ButtonHelp
protected BaseFlatButton m_ButtonHelp
the button for help.
-
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_PanelLabelSelector
protected AbstractLabelSelectorPanel m_PanelLabelSelector
the label selector panel.
-
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_PanelAnnotations
protected AbstractAnnotationsDisplayPanel m_PanelAnnotations
the annotations panel.
-
m_StatusBar
protected BaseStatusBar m_StatusBar
the status bar label.
-
m_Overlay
protected Overlay m_Overlay
the overlay.
-
m_MouseClickProcessor
protected AbstractMouseClickProcessor m_MouseClickProcessor
the mouse click processor.
-
m_Annotator
protected AbstractAnnotator m_Annotator
the annotator.
-
m_Undo
protected Undo m_Undo
the undo manager.
-
m_CurrentLabel
protected String m_CurrentLabel
the current label.
-
m_InteractionLog
protected List<InteractionEvent> m_InteractionLog
the interaction log.
-
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_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_BaseKeyListener
protected KeyListener m_BaseKeyListener
the base key listener.
-
m_ActiveTool
protected Tool m_ActiveTool
the active tool.
-
m_ShowAnnotations
protected boolean m_ShowAnnotations
whether to show the annotations.
-
m_ToolOptionsUpdatedListeners
protected Set<ChangeListener> m_ToolOptionsUpdatedListeners
listeners for when tool options get updated.
-
m_FlowContext
protected Actor m_FlowContext
the flow context.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInitin classBasePanel
-
beforeShow
protected void beforeShow()
Hook method just before the panel is made visible.- Overrides:
beforeShowin classBasePanel
-
setFlowContext
public void setFlowContext(Actor value)
Sets the flow context.- Specified by:
setFlowContextin interfaceFlowContextHandler- Parameters:
value- the actor
-
getFlowContext
public Actor getFlowContext()
Returns the flow context, if any.- Specified by:
getFlowContextin interfaceFlowContextHandler- Returns:
- the actor, null if none available
-
customizePopupMenu
public void customizePopupMenu(CanvasPanel source, JPopupMenu menu)
For customizing the popup menu.- Specified by:
customizePopupMenuin interfacePopupMenuCustomizer<CanvasPanel>- Parameters:
source- the source, e.g., eventmenu- the menu to customize
-
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:
setUndoin interfaceUndoHandler- Parameters:
value- the undo manager to use
-
getUndo
public Undo getUndo()
Returns the current undo manager, can be null.- Specified by:
getUndoin interfaceUndoHandler- Returns:
- the undo manager, if any
-
isUndoSupported
public boolean isUndoSupported()
Returns whether an Undo manager is currently available.- Specified by:
isUndoSupportedin interfaceUndoHandler- Returns:
- true if an undo manager is set
-
undo
public void undo()
performs an undo if possible.- Specified by:
undoin interfaceUndoHandlerWithQuickAccess
-
redo
public void redo()
performs a redo if possible.- Specified by:
redoin interfaceUndoHandlerWithQuickAccess
-
getState
public ObjectAnnotationPanel.AnnotationsState getState()
Returns the current state.- Returns:
- the state
-
setState
public void setState(ObjectAnnotationPanel.AnnotationsState state)
Restores the state of the layer.- Parameters:
state- the state
-
addUndoPoint
public void addUndoPoint(String comment)
Adds an undo point with the given comment.- Specified by:
addUndoPointin interfaceUndoHandlerWithQuickAccess- 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:
undoOccurredin interfaceUndoListener- 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
-
getAnnotationsPanel
public AbstractAnnotationsDisplayPanel getAnnotationsPanel()
Returns the annotations panel.- Returns:
- the panel in 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
-
addToolOptionsUpdatedListener
public void addToolOptionsUpdatedListener(ChangeListener l)
Adds the listener for when tool options have been updated.- Parameters:
l- the listener to add
-
removeToolOptionsUpdatedListener
public void removeToolOptionsUpdatedListener(ChangeListener l)
Removes the listener for when tool options have been updated.- Parameters:
l- the listener to remove
-
toolOptionsUpdated
public void toolOptionsUpdated()
Gets called when the options in a tool got updated.
-
setToolOptions
public void setToolOptions(Map<String,Object> value)
Updates the tools with these options.- Parameters:
value- the options to use for updating the tools
-
getToolOptions
public Map<String,Object> getToolOptions()
Retrieves the current options.- Returns:
- the options for the tools
-
saveToolOptions
public void saveToolOptions(PlaceholderFile optionsFile, LoggingSupporter logger)
Saves the tool options to the specified JSON file.- Parameters:
optionsFile- the JSON file to save tologger- for logging messages
-
loadToolOptions
public void loadToolOptions(PlaceholderFile optionsFile, LoggingSupporter logger)
Restores the tool options from the JSON file.- Parameters:
optionsFile- the JSON file to load/parselogger- for logging messages
-
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
-
setStopFlowButtonVisible
public void setStopFlowButtonVisible(boolean value)
Sets whether to show the stop flow button.- Parameters:
value- true if to show
-
isStopFlowButtonVisible
public boolean isStopFlowButtonVisible()
Returns whether to show the stop flow button.- Returns:
- true if to show
-
stopFlow
public void stopFlow()
Stops the flow execution, if a flow context is set and the stop button visible.
-
setMaxMinVisible
public void setMaxMinVisible(boolean value)
Sets whether the max/min button is visible.- Parameters:
value- true if visible
-
isMaxMinVisible
public boolean isMaxMinVisible()
Returns whether the max/min button is visible.- Returns:
- true if visible
-
toggleWindowSize
public void toggleWindowSize()
Toggles the window size between normal and maximized.
-
setHelpVisible
public void setHelpVisible(boolean value)
Sets whether the help button is visible.- Parameters:
value- true if visible
-
isHelpVisible
public boolean isHelpVisible()
Returns whether the help button is visible.- Returns:
- true if visible
-
help
public String help()
Returns the help string.- Returns:
- the help
-
showHelp
public void showHelp()
Displays the help in a dialog.
-
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
-
clearInteractionLog
public void clearInteractionLog()
Clears the interaction log.- Specified by:
clearInteractionLogin interfaceInteractionLogManager
-
addInteractionLog
public void addInteractionLog(InteractionEvent e)
Adds the interaction event to the log.- Specified by:
addInteractionLogin interfaceInteractionLogManager- Parameters:
e- the event to add
-
hasInteractionLog
public boolean hasInteractionLog()
Checks whether there have been any interactions recorded.- Specified by:
hasInteractionLogin interfaceInteractionLogManager- Returns:
- true if interactions are available
-
getInteractionLog
public List<InteractionEvent> getInteractionLog()
Returns the interaction log.- Specified by:
getInteractionLogin interfaceInteractionLogManager- Returns:
- the log, null if nothing recorded
-
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:
cleanUpin interfaceCleanUpHandler
-
-