Class Edit

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

      • Edit

        public Edit()
    • 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 class AbstractTool
      • 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 class AbstractTool
        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 user
        tolerance - the tolerance in pixels
        x - the x position of the vertex
        y - 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 object
        vertexOld - the old vertex
        vertexNew - 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 update
        vertex - the vertex to add
        Returns:
        whether updated successfully
      • doApply

        protected void doApply()
        Applies the settings.
        Specified by:
        doApply in class AbstractTool