Class Edit
-
- All Implemented Interfaces:
CleanUpHandler
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,SizeOfHandler
,CustomizableTool
,Tool
,Serializable
public class Edit extends AbstractToolWithParameterPanel
For editing existing annotations.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_BoundingBox
whether to edit bboxes.protected LocatedObject
m_Object
the affected object.protected PolygonVertices
m_PolygonVertices
the polygon plotter to use.protected String
m_Prefix
the object prefix to use.protected JRadioButton
m_RadioBoundingBox
the radio button for bounding box.protected JRadioButton
m_RadioPolygon
the radio button for polygon.protected boolean
m_Selected
whether a vertex was selected.protected List<LocatedObject>
m_SelectedObjects
the currently selected object.protected int
m_SelectionTolerance
the tolerance in pixels for selecting a vertex.protected BaseTextField
m_TextPrefix
the object prefix to use.protected NumberTextField
m_TextSelectionTolerance
the tolerance in pixels for selecting a vertex.protected Point
m_VertexNew
the new vertex.protected Point
m_VertexOld
the old vertex.-
Fields inherited from class adams.gui.visualization.object.tools.AbstractToolWithParameterPanel
m_ButtonApply
-
Fields inherited from class adams.gui.visualization.object.tools.AbstractTool
m_CanvasPanel, m_KeyListener, m_Listener, m_Modified, m_MotionListener, m_PanelFullOptions, m_PanelOptions
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Edit()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activate()
Gets called to activate the tool.protected void
addOptions(ParameterPanel paramPanel)
Fills the parameter panel with the options.protected boolean
addVertex(LocatedObject objectOld, Point vertex)
Adds the vertex to the specified object.protected Cursor
createCursor()
Creates the mouse cursor to use.protected ToolKeyAdapter
createKeyListener()
Creates the key listener to use.protected ToolMouseAdapter
createMouseListener()
Creates the mouse listener to use.protected ToolMouseMotionAdapter
createMouseMotionListener()
Creates the mouse motion listener to use.void
deactivate()
Gets called to deactivate the tool.protected void
doApply()
Applies the settings.Icon
getIcon()
The icon of the tool.String
getName()
The name of the tool.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.protected boolean
isHit(Point p, int tolerance, int x, int y)
Checks whether a vertex is close enough to the specified point clicked by the user.protected void
selectObjects(Point p)
Attempts to select the object(s) at the specified location.protected com.github.fracpete.javautils.struct.Struct2<LocatedObject,Point>
selectVertex(Point p)
Returns the vertex that is associated with the location in the image.protected boolean
updateVertex(LocatedObject objectOld, Point vertexOld, Point vertexNew)
Updates the selected object using the old/new vertices.protected void
updateVertexOverlays()
Updates overlay(s) for the vertices.-
Methods inherited from class adams.gui.visualization.object.tools.AbstractToolWithParameterPanel
applyOptions, createOptionPanel
-
Methods inherited from class adams.gui.visualization.object.tools.AbstractTool
apply, checkBeforeApply, cleanUp, createApplyButton, getCanvas, getCursor, getImage, getKeyListener, getMouseListener, getMouseMotionListener, getOptionPanel, getZoom, hasImage, isModified, setApplyButtonState, setCanvas, update
-
Methods inherited from class adams.core.logging.CustomLoggingLevelObject
setLoggingLevel
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface adams.core.CleanUpHandler
cleanUp
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.gui.visualization.object.tools.Tool
getCanvas, getCursor, getImage, getKeyListener, getMouseListener, getMouseMotionListener, getOptionPanel, getZoom, hasImage, isModified, setCanvas, update
-
-
-
-
Field Detail
-
m_RadioBoundingBox
protected JRadioButton m_RadioBoundingBox
the radio button for bounding box.
-
m_RadioPolygon
protected JRadioButton m_RadioPolygon
the radio button for polygon.
-
m_TextSelectionTolerance
protected NumberTextField m_TextSelectionTolerance
the tolerance in pixels for selecting a vertex.
-
m_TextPrefix
protected BaseTextField m_TextPrefix
the object prefix to use.
-
m_BoundingBox
protected boolean m_BoundingBox
whether to edit bboxes.
-
m_SelectionTolerance
protected int m_SelectionTolerance
the tolerance in pixels for selecting a vertex.
-
m_Prefix
protected String m_Prefix
the object prefix to use.
-
m_SelectedObjects
protected List<LocatedObject> m_SelectedObjects
the currently selected object.
-
m_PolygonVertices
protected PolygonVertices m_PolygonVertices
the polygon plotter to use.
-
m_Selected
protected boolean m_Selected
whether a vertex was selected.
-
m_Object
protected LocatedObject m_Object
the affected object.
-
m_VertexOld
protected Point m_VertexOld
the old vertex.
-
m_VertexNew
protected Point m_VertexNew
the new vertex.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Returns:
- a description suitable for displaying in the gui
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractTool
-
getName
public String getName()
The name of the tool.- Returns:
- the name
-
getIcon
public Icon getIcon()
The icon of the tool.- Returns:
- the icon
-
createCursor
protected Cursor createCursor()
Creates the mouse cursor to use.- Specified by:
createCursor
in classAbstractTool
- Returns:
- the cursor
-
updateVertexOverlays
protected void updateVertexOverlays()
Updates overlay(s) for the vertices.
-
selectObjects
protected void selectObjects(Point p)
Attempts to select the object(s) at the specified location.- Parameters:
p
- the image location to select the annotation(s) from
-
isHit
protected boolean isHit(Point p, int tolerance, int x, int y)
Checks whether a vertex is close enough to the specified point clicked by the user.- Parameters:
p
- the point clicked by the usertolerance
- the tolerance in pixelsx
- the x position of the vertexy
- the y position of the vertex- Returns:
- true if close enough
-
selectVertex
protected com.github.fracpete.javautils.struct.Struct2<LocatedObject,Point> selectVertex(Point p)
Returns the vertex that is associated with the location in the image.- Parameters:
p
- the location in the image- Returns:
- the vertex, null if no hit
-
updateVertex
protected boolean updateVertex(LocatedObject objectOld, Point vertexOld, Point vertexNew)
Updates the selected object using the old/new vertices.- Parameters:
objectOld
- the affected objectvertexOld
- the old vertexvertexNew
- the new vertex- Returns:
- whether updated successfully
-
addVertex
protected boolean addVertex(LocatedObject objectOld, Point vertex)
Adds the vertex to the specified object.- Parameters:
objectOld
- the object to updatevertex
- the vertex to add- Returns:
- whether updated successfully
-
createMouseListener
protected ToolMouseAdapter createMouseListener()
Creates the mouse listener to use.- Specified by:
createMouseListener
in classAbstractTool
- Returns:
- the listener, null if not applicable
-
createMouseMotionListener
protected ToolMouseMotionAdapter createMouseMotionListener()
Creates the mouse motion listener to use.- Specified by:
createMouseMotionListener
in classAbstractTool
- Returns:
- the listener, null if not applicable
-
createKeyListener
protected ToolKeyAdapter createKeyListener()
Creates the key listener to use.- Overrides:
createKeyListener
in classAbstractTool
- Returns:
- the listener, null if not applicable
-
doApply
protected void doApply()
Applies the settings.- Specified by:
doApply
in classAbstractTool
-
addOptions
protected void addOptions(ParameterPanel paramPanel)
Fills the parameter panel with the options.- Specified by:
addOptions
in classAbstractToolWithParameterPanel
- Parameters:
paramPanel
- for adding the options to
-
activate
public void activate()
Gets called to activate the tool.- Specified by:
activate
in interfaceTool
- Overrides:
activate
in classAbstractTool
-
deactivate
public void deactivate()
Gets called to deactivate the tool.- Specified by:
deactivate
in interfaceTool
- Overrides:
deactivate
in classAbstractTool
-
-