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
,PopupMenuCustomizer<CanvasPanel>
,UndoHandler
,UndoHandlerWithQuickAccess
,UndoListener
,InteractionLogManager
,PopupMenuCustomizer
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
public class ObjectAnnotationPanel extends BasePanel implements CleanUpHandler, UndoHandlerWithQuickAccess, UndoListener, InteractionLogManager, PopupMenuCustomizer
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 class
ObjectAnnotationPanel.AnnotationsState
For 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 Tool
m_ActiveTool
the active tool.protected Set<ChangeListener>
m_AnnotationChangeListeners
the listeners for annotation changes.protected AbstractAnnotator
m_Annotator
the annotator.protected BaseFlatButton
m_ButtonBrightness
the button for applying the values.protected BaseFlatButton
m_ButtonRedo
the button for performing a redo.protected BaseToggleButton
m_ButtonShowAnnotations
for toggling the visibility of the annotations.protected BaseFlatButton
m_ButtonUndo
the button for performing an undo.protected BaseFlatButton
m_ButtonUsePreviousReport
the button for using the last report.protected BaseFlatButton
m_ButtonZoom
the button for applying the zoom.protected BaseFlatButton
m_ButtonZoomBestFit
the button for best fit zoom.protected BaseFlatButton
m_ButtonZoomClear
the button for clearing zoom.protected BaseFlatButton
m_ButtonZoomIn
the button for zooming in.protected BaseFlatButton
m_ButtonZoomOut
the button for zooming out.protected String
m_CurrentLabel
the current label.protected List<InteractionEvent>
m_InteractionLog
the interaction log.protected KeyListener
m_LastKeyListener
the last key listener in use.protected MouseListener
m_LastMouseListener
the last mouse listener in use.protected MouseMotionListener
m_LastMouseMotionListener
the last mouse motion listener in use.protected AbstractMouseClickProcessor
m_MouseClickProcessor
the mouse click processor.protected Overlay
m_Overlay
the overlay.protected AbstractAnnotationsDisplayPanel
m_PanelAnnotations
the annotations panel.protected BasePanel
m_PanelAnnotationsAndTools
the annotations + tools panel.protected JPanel
m_PanelBrightness
the panel for the brightness controls.protected CanvasPanel
m_PanelCanvas
the canvas in use.protected AbstractLabelSelectorPanel
m_PanelLabelSelector
the label selector panel.protected JPanel
m_PanelToolButtons
the panel with the buttons.protected BasePanel
m_PanelToolOptions
the panel for displaying the tool options.protected BasePanel
m_PanelTools
the tools panel.protected JPanel
m_PanelUndo
the panel for the undo/redo controls.protected JPanel
m_PanelUsePreviousReport
the panel for the last button controls.protected JPanel
m_PanelZoom
the panel for the zoom controls.protected Report
m_PreviousReport
the report from the previous session.protected BaseScrollPane
m_ScrollPane
the JScrollPane that embeds the paint panel.protected boolean
m_ShowAnnotations
whether to show the annotations.protected BaseSplitPane
m_SplitPaneAnnotationsAndTools
the split pane for annotations/tools.protected BaseSplitPane
m_SplitPaneLeft
the left split panel (label selector | rest).protected BaseSplitPane
m_SplitPaneRight
the right split pane (image | annotations).protected BaseSplitPane
m_SplitPaneTools
the split pane for the tools.protected BaseStatusBar
m_StatusBar
the status bar label.protected NumberTextField
m_TextBrightness
the brightness to use.protected NumberTextField
m_TextZoom
the text field for the zoom.protected List<Tool>
m_Tools
the tools.protected Undo
m_Undo
the undo manager.static double
ZOOM_FACTOR
the 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 void
addAnnotationChangeListener(ChangeListener l)
Adds the listener for annotation changes.void
addInteractionLog(InteractionEvent e)
Adds the interaction event to the log.void
addUndoPoint(String comment)
Adds an undo point with the given comment.void
annotationsChanged(Object source)
For notifying everyone that the annotations have changedprotected void
applyPreviousReport()
Applies the previous report, if possible.void
bestFitZoom()
Fits the image.void
cleanUp()
Cleans up data structures, frees up memory.void
clear()
Clears: label, image, annotations, interaction log, undo.void
clearInteractionLog()
Clears the interaction log.void
clearZoom()
Clears the zoom.void
customizePopupMenu(CanvasPanel source, JPopupMenu menu)
For customizing the popup menu.protected void
finishInit()
Finishes the initialization.Tool
getActiveTool()
Returns the currently active tool.double
getActualZoom()
Returns the actual zoom (taking best fit into account if set).AbstractAnnotationsDisplayPanel
getAnnotationsPanel()
Returns the annotations panel.AbstractAnnotator
getAnnotator()
Returns the current annotator.boolean
getBestFit()
Sets whether to use best fit.float
getBrightness()
Returns the brightness in use.CanvasPanel
getCanvas()
Returns the canvas.String
getCurrentLabel()
Returns the current label in use.BufferedImage
getImage()
Returns the image on display.List<InteractionEvent>
getInteractionLog()
Returns the interaction log.InteractionLoggingFilter
getInteractionLoggingFilter()
Returns the interaction log filter in use.AbstractLabelSelectorPanel
getLabelSelectorPanel()
Returns the label selector panel.int
getLeftDividerLocation()
Returns the left divider location.AbstractMouseClickProcessor
getMouseClickProcessor()
Returns the current mouse click processor.LocatedObjects
getObjects()
Returns the current located objects.Overlay
getOverlay()
Returns the current overlay.Report
getPreviousReport()
Returns the previous report.Report
getReport()
Returns the current report.int
getRightDividerLocation()
Returns the right divider location.BaseScrollPane
getScrollPane()
Returns the scrollpane.boolean
getShowAnnotations()
Returns whether the annotations are shown.ObjectAnnotationPanel.AnnotationsState
getState()
Returns the current state.Undo
getUndo()
Returns the current undo manager, can be null.double
getZoom()
Returns the current zoom.boolean
hasInteractionLog()
Checks whether there have been any interactions recorded.protected void
initGUI()
Initializes the widgets.protected void
initialize()
Initializes the members.boolean
isBrightnessVisible()
Returns whether the brightness controls are visible or not.boolean
isUndoSupported()
Returns whether an Undo manager is currently available.boolean
isUndoVisible()
Returns whether the undo controls are visible or not.boolean
isUsePreviousReportVisible()
Returns whether the controls for using the previous report are visible or not.boolean
isZoomVisible()
Returns whether the zoom controls are visible or not.void
labelChanged(Object source)
For notifying everyone that the label have changedstatic void
main(String[] args)
For testing only.Point
mouseToPixelLocation(Point mousePos)
Turns the mouse position into pixel location.protected void
notifyAnnotationChangeListeners()
Notifies all annotation change listeners.protected void
notifyTools()
Notifies all tools to update.Point
pixelToMouseLocation(Point pixelPos)
Converts the pixel position (at 100% scale) to a mouse location.void
preselectCurrentLabel(String label)
Pre-selects the label.void
redo()
performs a redo if possible.void
removeAnnotationChangeListener(ChangeListener l)
Removes the listener for annotation changes.void
setAnnotationsPanel(AbstractAnnotationsDisplayPanel value)
Sets the annotations panel.void
setAnnotator(AbstractAnnotator value)
Sets and installs the annotator.void
setBestFit(boolean value)
Sets whether to use best fit or specified scale.void
setBrightness(float value)
Sets the brightness to use.void
setBrightnessVisible(boolean value)
Sets whether the brightness controls are visible or not.void
setCurrentLabel(String value)
Sets the current label to use.void
setImage(BufferedImage value)
Sets the image to display.void
setInteractionLoggingFilter(InteractionLoggingFilter value)
Sets the interaction log filter to use.void
setLabelSelectorPanel(AbstractLabelSelectorPanel value)
Sets the label selector panel.void
setLeftDividerLocation(double value)
Sets the proportional location for the left divider.void
setLeftDividerLocation(int value)
Sets the location of the left divider.void
setMouseClickProcessor(AbstractMouseClickProcessor value)
Sets the mouse click processor to use.void
setObjects(LocatedObjects value)
Sets the located objects to use.void
setOverlay(Overlay value)
Sets the overlay to use.void
setPreviousReport(Report value)
Sets the previous report.void
setReport(Report value)
Sets the report to display.void
setRightDividerLocation(double value)
Sets the proportional location for the right divider.void
setRightDividerLocation(int value)
Sets the location of the right divider.void
setShowAnnotations(boolean value)
Sets whether the annotations are to be shown.void
setState(ObjectAnnotationPanel.AnnotationsState state)
Restores the state of the layer.void
setUndo(Undo value)
Sets the undo manager to use, can be null if no undo-support wanted.void
setUndoVisible(boolean value)
Sets whether the undo controls are visible or not.void
setUsePreviousReportVisible(boolean value)
Sets whether the controls for using the previous report are visible or not.void
setZoom(double value)
Sets the zoom.void
setZoomVisible(boolean value)
Sets whether the zoom controls are visible or not.void
showStatus(String msg)
Displays a message.void
undo()
performs an undo if possible.void
undoOccurred(UndoEvent e)
An undo event, like add or remove, has occurred.void
update()
Updates the image, buttons, status.void
update(boolean doLayout)
Updates the image.void
updateButtons()
Updates the state of the buttons.void
updateStatus()
Updates the status bar.void
updateStatus(Point pos)
Updates the status bar.void
zoomIn()
Zooms in.void
zoomOut()
Zooms out.-
Methods inherited from class adams.gui.core.BasePanel
afterHide, afterShow, beforeHide, beforeShow, 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_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_ActiveTool
protected Tool m_ActiveTool
the active tool.
-
m_ShowAnnotations
protected boolean m_ShowAnnotations
whether to show the annotations.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classBasePanel
-
finishInit
protected void finishInit()
Finishes the initialization.- Overrides:
finishInit
in classBasePanel
-
customizePopupMenu
public void customizePopupMenu(CanvasPanel source, JPopupMenu menu)
For customizing the popup menu.- Specified by:
customizePopupMenu
in 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:
setUndo
in interfaceUndoHandler
- Parameters:
value
- the undo manager to use
-
getUndo
public Undo getUndo()
Returns the current undo manager, can be null.- Specified by:
getUndo
in interfaceUndoHandler
- Returns:
- the undo manager, if any
-
isUndoSupported
public boolean isUndoSupported()
Returns whether an Undo manager is currently available.- Specified by:
isUndoSupported
in interfaceUndoHandler
- Returns:
- true if an undo manager is set
-
undo
public void undo()
performs an undo if possible.- Specified by:
undo
in interfaceUndoHandlerWithQuickAccess
-
redo
public void redo()
performs a redo if possible.- Specified by:
redo
in 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:
addUndoPoint
in 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:
undoOccurred
in 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
-
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
-
clearInteractionLog
public void clearInteractionLog()
Clears the interaction log.- Specified by:
clearInteractionLog
in interfaceInteractionLogManager
-
addInteractionLog
public void addInteractionLog(InteractionEvent e)
Adds the interaction event to the log.- Specified by:
addInteractionLog
in interfaceInteractionLogManager
- Parameters:
e
- the event to add
-
hasInteractionLog
public boolean hasInteractionLog()
Checks whether there have been any interactions recorded.- Specified by:
hasInteractionLog
in interfaceInteractionLogManager
- Returns:
- true if interactions are available
-
getInteractionLog
public List<InteractionEvent> getInteractionLog()
Returns the interaction log.- Specified by:
getInteractionLog
in 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:
cleanUp
in interfaceCleanUpHandler
-
-