Package wprover

Class DrawProcess

  • All Implemented Interfaces:
    java.awt.event.ActionListener, java.awt.print.Printable, java.util.EventListener
    Direct Known Subclasses:
    DrawTextProcess

    public class DrawProcess
    extends DrawBase
    implements java.awt.print.Printable, java.awt.event.ActionListener
    DrawProcess is a class that handles the drawing and processing of geometric objects. It extends the DrawBase class and implements the Printable and ActionListener interfaces.
    • Constructor Detail

      • DrawProcess

        public DrawProcess()
    • Method Detail

      • stateChange

        public void stateChange()
        Toggles the status state.
      • setCalMode1

        public void setCalMode1()
        Sets the calculation mode to 1.
      • setCalMode0

        public void setCalMode0()
        Sets the calculation mode to 0.
      • gterm

        public GTerm gterm()
        Retrieves the GTerm object.
        Returns:
        the GTerm object
      • clearConstruction

        public void clearConstruction()
        Clears the construction and resets the nd value.
      • resetUndo

        public void resetUndo()
        Resets the current undo structure's ID to the current ID count.
      • getName

        public java.lang.String getName()
        Retrieves the name of the current object.
        Returns:
        the name of the current object
      • setRecal

        public void setRecal​(boolean r)
        Sets the recalculation flag.
        Parameters:
        r - the recalculation flag to set
      • setName

        public void setName​(java.lang.String s)
        Sets the name of the current object.
        Parameters:
        s - the name to set
      • stopTrack

        public void stopTrack()
        Stops tracking the current point.
      • startTrackPt

        public void startTrackPt​(CPoint pt)
        Starts tracking a given point.
        Parameters:
        pt - the point to start tracking
      • getParameterByindex

        public Param getParameterByindex​(int index)
        Retrieves a parameter by its index.
        Parameters:
        index - the index of the parameter to retrieve
        Returns:
        the parameter with the specified index, or null if not found
      • getLastConstructedPoint

        public CPoint getLastConstructedPoint()
        Retrieves the last constructed point.
        Returns:
        the last constructed point, or null if no points exist
      • getPointById

        public CPoint getPointById​(int id)
        Retrieves a point by its ID.
        Parameters:
        id - the ID of the point to retrieve
        Returns:
        the point with the specified ID, or null if not found
      • getAllConstraint

        public java.util.Vector getAllConstraint()
        Retrieves all constraints.
        Returns:
        a vector containing all constraints
      • getConstraintByid

        public Constraint getConstraintByid​(int id)
        Retrieves a constraint by its ID.
        Parameters:
        id - the ID of the constraint to retrieve
        Returns:
        the constraint with the specified ID, or null if not found
      • getLineByid

        public CLine getLineByid​(int id)
        Retrieves a line by its ID.
        Parameters:
        id - the ID of the line to retrieve
        Returns:
        the line with the specified ID, or null if not found
      • getCircleByid

        public Circle getCircleByid​(int id)
        Retrieves a circle by its ID.
        Parameters:
        id - the ID of the circle to retrieve
        Returns:
        the circle with the specified ID, or null if not found
      • getTraceById

        public CTrace getTraceById​(int id)
        Retrieves a trace by its ID.
        Parameters:
        id - the ID of the trace to retrieve
        Returns:
        the trace with the specified ID, or null if not found
      • getAngleByid

        public CAngle getAngleByid​(int id)
        Retrieves an angle by its ID.
        Parameters:
        id - the ID of the angle to retrieve
        Returns:
        the angle with the specified ID, or null if not found
      • getAllSolidObj

        public java.util.Vector getAllSolidObj()
        Retrieves all solid objects.
        Returns:
        a vector containing all solid objects
      • getOjbectById

        public CClass getOjbectById​(int id)
        Retrieves an object by its ID.
        Parameters:
        id - the ID of the object to retrieve
        Returns:
        the object with the specified ID, or null if not found
      • getObjectInListById

        public CClass getObjectInListById​(int id,
                                          java.util.Vector v)
        Retrieves an object from a list by its ID.
        Parameters:
        id - the ID of the object to retrieve
        v - the list to search
        Returns:
        the object with the specified ID, or null if not found
      • getUndoById

        public wprover.UndoStruct getUndoById​(int id)
        Retrieves an UndoStruct object by its ID.
        Parameters:
        id - the ID of the UndoStruct to retrieve
        Returns:
        the UndoStruct object with the specified ID, or null if not found
      • addDiagramUpdaterListener

        public void addDiagramUpdaterListener​(DiagramUpdater d)
        Adds a DiagramUpdater listener to the list of updater listeners.
        Parameters:
        d - the DiagramUpdater listener to add
      • RemoveDiagramUpdaterListener

        public void RemoveDiagramUpdaterListener​(DiagramUpdater d)
        Removes a DiagramUpdater listener from the list of updater listeners.
        Parameters:
        d - the DiagramUpdater listener to remove
      • clearAll

        public void clearAll()
        Clears all geometric objects and resets the drawing state.
      • setSavedTag

        public void setSavedTag()
        Sets the saved tag to indicate that the current state is saved.
      • isitSaved

        public boolean isitSaved()
        Checks if the current state is saved.
        Returns:
        true if the current state is saved, false otherwise
      • getAnimateC

        public AnimateC getAnimateC()
        Retrieves the AnimateC object.
        Returns:
        the AnimateC object
      • getFile

        public java.io.File getFile()
        Retrieves the current file.
        Returns:
        the current file
      • setFile

        public void setFile​(java.io.File f)
        Sets the current file.
        Parameters:
        f - the file to set
      • getSelectList

        public java.util.Vector getSelectList()
        Retrieves the list of selected objects.
        Returns:
        the list of selected objects
      • SetSnap

        public void SetSnap​(boolean snap)
        Sets the snap mode.
        Parameters:
        snap - true to enable snap mode, false to disable
      • getStatus

        public int getStatus()
        Retrieves the current status.
        Returns:
        the current status
      • setStatus

        public void setStatus​(int t)
        Sets the current status.
        Parameters:
        t - the status to set
      • isSnap

        public boolean isSnap()
        Checks if snap mode is enabled.
        Returns:
        true if snap mode is enabled, false otherwise
      • SetGrid

        public void SetGrid​(boolean grid)
        Sets the grid mode.
        Parameters:
        grid - true to enable grid mode, false to disable
      • isDrawGrid

        public boolean isDrawGrid()
        Checks if grid mode is enabled.
        Returns:
        true if grid mode is enabled, false otherwise
      • setMeshStep

        public void setMeshStep​(boolean add)
        Adjusts the mesh step size.
        Parameters:
        add - true to increase the mesh step size, false to decrease
      • getPolyList

        public TPoly getPolyList()
        Retrieves the polynomial list.
        Returns:
        the polynomial list
      • getPBList

        public TPoly getPBList()
        Retrieves the PB list.
        Returns:
        the PB list
      • getPBMono

        public java.util.Vector getPBMono()
        Returns a vector containing copies of the TMono objects from the pblist.
        Returns:
        a vector of TMono objects.
      • printNDGS

        public void printNDGS()
        Prints the nondegenerate conditions derived from the TPoly list. Simplifies each TMono condition, prints each condition and the final combined condition.
      • getNDGS

        public java.util.Vector getNDGS()
        Computes and returns the nondegenerate conditions for the current TPoly. Extracts TMono elements from the pblist, pairs them based on degree, computes and reduces the differences, and collects the resulting conditions.
        Returns:
        a vector of computed nondegenerate conditions.
      • reCalculate

        public boolean reCalculate()
        Recalculates the diagram by transforming all points and updating parameters. Restores previous values if the recalculation fails, triggers diagram updates, and recalculates traces and texts.
        Returns:
        true if recalculation is successful, false otherwise.
      • calculate_text

        public void calculate_text()
        Calculates the text values for all CText objects in the text list. If the text type is VALUE_TEXT, it calculates the value and updates the text value.
      • translate_back

        public void translate_back​(double x1,
                                   double y1,
                                   double sin,
                                   double cos)
        Translates all points back to their original positions after transformation.
        Parameters:
        x1 - the x-coordinate translation
        y1 - the y-coordinate translation
        sin - the sine of the rotation angle
        cos - the cosine of the rotation angle
      • recal_allFlash

        public void recal_allFlash()
        Recalculates all flash animations in the flash list.
      • calculate_trace

        public void calculate_trace()
        Calculates the trace points for all CTrace objects in the trace list.
      • getParameter

        public double[] getParameter()
        Retrieves the current parameter values.
        Returns:
        an array of parameter values
      • setParameter

        public void setParameter​(double[] r)
        Sets the parameter values.
        Parameters:
        r - an array of parameter values to set
      • BackupParameter

        public void BackupParameter​(double[] rr,
                                    boolean b)
        Backs up or restores the parameter values.
        Parameters:
        rr - an array to store or restore parameter values
        b - a boolean indicating whether to back up (true) or restore (false) the values
      • setParameterValue

        public void setParameterValue​(double[] dd)
        Sets the parameter values and translates points back if necessary.
        Parameters:
        dd - an array of parameter values to set
      • calculate_allResults

        public java.util.Vector calculate_allResults()
        Calculates all results from the polygons.
        Returns:
        a Vector containing result arrays for each parameter configuration.
      • calculate_allpt

        public boolean calculate_allpt​(boolean d)
        Calculates all points based on current parameter values.
        Parameters:
        d - a flag indicating whether to perform dynamic recalculations
        Returns:
        true if all points are calculated successfully; false otherwise.
      • popLeadingVariableDialog

        public void popLeadingVariableDialog()
        Opens the dialog for selecting the leading variable.
      • calv_parameter

        public void calv_parameter()
        Calculates and updates parameter values based on specific angle constraints.
      • fd_pt_on_which_circle

        public Circle fd_pt_on_which_circle​(CPoint pt)
        Finds and returns the circle on which the specified point lies.
        Parameters:
        pt - the point to check
        Returns:
        the Circle if the point is on a circle; null otherwise.
      • fd_pt_on_which_line

        public CLine fd_pt_on_which_line​(CPoint pt)
        Finds and returns the line on which the specified point lies.
        Parameters:
        pt - the point to check
        Returns:
        the CLine if the point is on a line; null otherwise.
      • calculate_ocir

        public double[] calculate_ocir​(CPoint pt)
        Calculates the corresponding point on a circle.
        Parameters:
        pt - the point used for the calculation
        Returns:
        an array containing x and y coordinates of the calculated point, or null if not applicable.
      • calculate_oline

        public double[] calculate_oline​(CPoint pt)
        Calculates the intersection point on a line based on the given point.
        Parameters:
        pt - the point used for the calculation
        Returns:
        an array containing x and y coordinates of the calculated intersection point, or null if not applicable.
      • calculate_lccc

        public boolean calculate_lccc​(CPoint cp,
                                      double[] r)
        Calculates and adjusts the given point based on a line-circle or circle-circle constraint.
        Parameters:
        cp - the point to adjust
        r - an array containing candidate coordinates
        Returns:
        true if the point is set successfully according to constraints; false otherwise.
      • calculate_a_point

        public boolean calculate_a_point​(CPoint p,
                                         boolean d)
        Calculates the coordinates for a given point using its defining parameters and constraints.
        Parameters:
        p - the point to calculate
        d - a flag that, if true, forces dynamic recalculation using constraint equations
        Returns:
        true if the point is calculated successfully; false otherwise.
      • calcu_m1

        public double[] calcu_m1​(TMono m)
        Calculates the values of a polynomial.

        This method calculates the values of a given polynomial using the provided parameters. If the result is null, it attempts to find the polynomial in the polynomial list and calculate its values.

        Parameters:
        m - the polynomial to calculate
        Returns:
        an array of calculated values, or null if the calculation fails
      • pushbackup

        public void pushbackup()
        Backs up the current parameter values.

        This method saves the current values of the parameters into the backup array.

      • calform

        public double[] calform​(int lv,
                                Param[] p)
        Calculates the values of two polynomials.

        This method calculates the values of two polynomials with the same leading variable.

        Parameters:
        lv - the leading variable
        p - the array of parameters
        Returns:
        an array of calculated values, or null if the calculation fails
      • charsetAndAddPoly

        public void charsetAndAddPoly​(boolean calcu)
        Adds polynomials to the list and optimizes them.

        This method adds polynomials to the list, optimizes them, and recalculates the values if necessary.

        Parameters:
        calcu - a boolean indicating whether to recalculate the values
      • optmizePolynomial

        public void optmizePolynomial()
        Optimizes the polynomial list.

        This method optimizes the polynomial list by adding zero constraints for certain points.

      • addZeron

        public void addZeron​(int x,
                             int[] zeron)
        Adds a zero constraint for a given variable.

        This method adds a zero constraint for a given variable to the zero constraints array.

        Parameters:
        x - the variable index
        zeron - the array of zero constraints
      • mulSolutionSelect

        public boolean mulSolutionSelect​(CPoint p)
        Selects multiple solutions for a given point.

        This method selects multiple solutions for a given point by calculating the possible values and adding them to the solution list.

        Parameters:
        p - the point for which to select multiple solutions
        Returns:
        true if the selection is successful, false otherwise
      • ErasedADecidedPoint

        public void ErasedADecidedPoint​(CPoint p)
        Erases a decided point from the polynomial list.

        This method removes a point from the polynomial list and adjusts the list accordingly. It also updates the parameter counter.

        Parameters:
        p - the point to be erased
      • SetDimension

        public void SetDimension​(double x,
                                 double y)
        Sets the dimensions of the drawing area.
        Parameters:
        x - the width of the drawing area
        y - the height of the drawing area
      • GetCurrentAction

        public int GetCurrentAction()
        Retrieves the current action type.
        Returns:
        the current action type
      • setParameter

        public void setParameter​(int v1,
                                 int v2)
        Sets the parameters for the drawing process.
        Parameters:
        v1 - the first parameter
        v2 - the second parameter
      • SetCurrentAction

        public void SetCurrentAction​(int type)
        Sets the current action type and updates the UI accordingly.
        Parameters:
        type - the action type to set
      • fd_edmark

        public Cedmark fd_edmark​(CPoint p1,
                                 CPoint p2)
        Finds an edmark object between two points.
        Parameters:
        p1 - the first point
        p2 - the second point
        Returns:
        the found edmark object, or null if not found
      • setcurrentStatus

        public void setcurrentStatus​(int status)
        Sets the current status.
        Parameters:
        status - the status to set
      • nextProveStep

        public boolean nextProveStep()
        Proceeds to the next step in the proof process.
        Returns:
        true if the next step is successfully executed, false otherwise
      • provePlay

        public void provePlay​(int num)
        Starts the proof play with a specified timer interval.
        Parameters:
        num - the timer interval in milliseconds
      • proveStop

        public void proveStop()
        Stops the proof play.
      • run_to_prove

        public boolean run_to_prove​(wprover.UndoStruct u,
                                    wprover.UndoStruct u1)
        Runs the proof process to a specific step.
        Parameters:
        u - the current undo structure
        u1 - the target undo structure
        Returns:
        true if the process is successfully executed, false otherwise
      • runto

        public void runto()
        Runs the proof process to the current undo structure.
      • runto1

        public void runto1​(wprover.UndoStruct u)
        Runs the proof process to a specific undo structure.
        Parameters:
        u - the target undo structure
      • all_flash_finished

        public boolean all_flash_finished()
        Checks if all flash animations are finished.
        Returns:
        true if all flash animations are finished, false otherwise
      • checkCPfieldExists

        public boolean checkCPfieldExists()
        Checks if the construction proof field exists.
        Returns:
        true if the construction proof field exists, false otherwise
      • prove_run_to_end

        public void prove_run_to_end()
        Runs the proof process to the end.
      • getSnap

        public double[] getSnap​(double x,
                                double y)
        Retrieves the snap coordinates based on the grid settings.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        an array containing the snapped x and y coordinates
      • DWMouseWheel

        public void DWMouseWheel​(double x,
                                 double y,
                                 int n,
                                 int rt)
        Handles the mouse wheel event for zooming in and out.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        n - the number of notches the mouse wheel was rotated
        rt - the rotation direction (positive for zoom in, negative for zoom out)
      • DWMouseDbClick

        public void DWMouseDbClick​(double x,
                                   double y)
        Handles the double-click event on the drawing window.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • defineSpecificAngle

        public void defineSpecificAngle()
        Defines a specific angle constraint.
      • getParaForSpecificAngle

        public Param getParaForSpecificAngle​(int ang)
        Retrieves the parameter associated with a specific angle constraint.
        Parameters:
        ang - the specific angle value
        Returns:
        the parameter associated with the specific angle constraint, or null if not found
      • getSpecificAngleList

        public java.util.Vector getSpecificAngleList()
        Retrieves a list of specific angle constraints.
        Returns:
        a vector containing the specific angle constraints
      • viewElementFromXY

        public boolean viewElementFromXY​(double x,
                                         double y)
        Views an element from the specified coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        true if an element is viewed, false otherwise
      • popSelect

        public java.lang.Object popSelect​(java.util.Vector v,
                                          int x,
                                          int y)
        Displays a selection dialog if multiple objects are selected.
        Parameters:
        v - the vector of selected objects
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the selected object, or null if no object is selected
      • DWMouseRightDown

        public void DWMouseRightDown​(double x,
                                     double y)
        Handles the right mouse button down event.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • DWMouseRightClick

        public void DWMouseRightClick​(double x,
                                      double y)
        Handles the right mouse button click event.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • RightMenuPopup

        public void RightMenuPopup​(double x,
                                   double y)
        Displays a right-click context menu at the specified coordinates.
        Parameters:
        x - the x-coordinate where the menu should be displayed
        y - the y-coordinate where the menu should be displayed
      • SelectFromAList

        public void SelectFromAList​(java.util.Vector v1,
                                    java.util.Vector v2,
                                    double x,
                                    double y)
        Selects objects from one list and adds them to another based on coordinates.
        Parameters:
        v1 - the list to which selected objects are added
        v2 - the list from which objects are selected
        x - the x-coordinate for selection
        y - the y-coordinate for selection
      • SelectAllFromXY

        public void SelectAllFromXY​(java.util.Vector v,
                                    double x,
                                    double y,
                                    int type)
        Selects all objects from various lists based on coordinates and type.
        Parameters:
        v - the list to which selected objects are added
        x - the x-coordinate for selection
        y - the y-coordinate for selection
        type - the type of objects to select (0: point preferential, 1: geometry object only, 2: all, etc.)
      • SelectNameText

        public void SelectNameText​(java.util.Vector v,
                                   double x,
                                   double y)
        Selects text objects based on coordinates.
        Parameters:
        v - the list to which selected text objects are added
        x - the x-coordinate for selection
        y - the y-coordinate for selection
      • SelectOneFromXY

        public CClass SelectOneFromXY​(double x,
                                      double y,
                                      int type)
        Selects a single object from various lists based on coordinates and type.
        Parameters:
        x - the x-coordinate for selection
        y - the y-coordinate for selection
        type - the type of objects to select (0: point preferential, 1: geometry object only, 2: all, etc.)
        Returns:
        the selected object, or null if no object is selected
      • getSmartPV

        public void getSmartPV​(CPoint p1,
                               CPoint p2)
        Adjusts the coordinates of the second point to align with the first point if they are close enough.
        Parameters:
        p1 - the first point
        p2 - the second point
      • clearSelection

        public void clearSelection()
        Clears the selection list.
      • addToSelectList

        public void addToSelectList​(java.lang.Object c)
        Adds an object to the selection list.
        Parameters:
        c - the object to add
      • OnCatch

        public java.util.Vector OnCatch​(double x,
                                        double y)
        Selects objects based on coordinates and adds them to the catch list.
        Parameters:
        x - the x-coordinate for selection
        y - the y-coordinate for selection
        Returns:
        the list of selected objects
      • check_animation

        public boolean check_animation​(CPoint p,
                                       CLine ln)
        Checks if a point can be animated along a line.
        Parameters:
        p - the point to check
        ln - the line to check
        Returns:
        true if the point can be animated along the line, false otherwise
      • DWButtonDown

        public void DWButtonDown​(double x,
                                 double y)
        Handles the "mouse down" (button press) event within the drawing canvas.

        This method interprets user input based on the current action mode (such as SELECT, MOVE, D_POINT, etc.) and performs corresponding geometry-related operations. These may include selecting or modifying points, creating lines, circles, constraints, or initiating transformations.

        Behavior depends on CurrentAction, which is evaluated in a large switch-case structure that includes many interactive drawing modes.

        Overrides:
        DWButtonDown in class DrawBase
        Parameters:
        x - The x-coordinate of the mouse click, in screen or canvas coordinates
        y - The y-coordinate of the mouse click, in screen or canvas coordinates
        See Also:
        DrawBase.CurrentAction, DrawBase.SelectList, DrawBase.CatchPoint, DrawBase.STATUS
      • add_free_transform

        public void add_free_transform()
        Adds a free transform to the selected polygon.

        This method creates a transformed copy of the selected polygon, adds a constraint for the transformation, and updates the polygon list. It also clears the selection and resets the status.

      • meetTwoObject

        public CPoint meetTwoObject​(java.lang.Object obj1,
                                    java.lang.Object obj2,
                                    boolean d,
                                    double x,
                                    double y)
        Finds the intersection point of two geometric objects.
        Parameters:
        obj1 - the first geometric object (CLine or Circle)
        obj2 - the second geometric object (CLine or Circle)
        d - a boolean flag indicating some condition (not specified)
        x - the x-coordinate for the intersection calculation
        y - the y-coordinate for the intersection calculation
        Returns:
        the intersection point, or null if no intersection is found
      • addSelectPoint

        public void addSelectPoint​(double x,
                                   double y)
        Adds a point to the selection list based on the given coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • addALine

        public CLine addALine​(int t,
                              CPoint p1,
                              CPoint p2)
        Adds a line between two points to the line list.
        Parameters:
        t - the type of the line
        p1 - the first point
        p2 - the second point
        Returns:
        the added line, or the existing line if it already exists
      • getConstructionFromDraw

        public java.util.Vector getConstructionFromDraw()
        Retrieves the construction steps from the drawing.
        Returns:
        a vector containing the construction steps
      • findPolygon

        public CPolygon findPolygon​(java.util.Vector v)
        Finds a polygon in the polygon list that matches the given vector of points.
        Parameters:
        v - the vector of points
        Returns:
        the matching polygon, or null if no match is found
      • findPolygon1

        public CPolygon findPolygon1​(java.util.Vector v)
        Finds a polygon in the polygon list that matches the given vector of points, considering rotational and directional equivalence.
        Parameters:
        v - the vector of points
        Returns:
        the matching polygon, or null if no match is found
      • canAutoAnimate

        public boolean canAutoAnimate()
        Checks if auto animation is possible.
        Returns:
        true if auto animation is possible, false otherwise
      • autoAnimate

        public boolean autoAnimate()
        Toggles auto animation on or off.
        Returns:
        true if auto animation is started, false if it is stopped
      • autoShowstep

        public void autoShowstep()
        Automatically shows the next step in the construction.
      • autoUndoRedo

        public void autoUndoRedo()
        Toggles automatic undo and redo actions.
      • actionPerformed

        public void actionPerformed​(java.awt.event.ActionEvent e)
        Handles action events triggered by the timer or other sources.
        Specified by:
        actionPerformed in interface java.awt.event.ActionListener
        Parameters:
        e - the action event
      • updateFlashDelay

        public void updateFlashDelay()
        Updates the delay for all flash objects in the flash list.
      • setTimerDelay

        public void setTimerDelay​(int delay)
        Sets the delay for the timer.
        Parameters:
        delay - the delay in milliseconds
      • viewElement

        public void viewElement​(CClass obj)
        Displays the properties of the specified object in the dialog.
        Parameters:
        obj - the object to view
      • animationStart

        public void animationStart()
        Starts the animation.
      • animationStop

        public void animationStop()
        Stops the animation and recalculates the drawing.
      • animationOntime

        public void animationOntime()
        Updates the animation on each timer tick and recalculates the drawing.
      • CatchList

        public CClass CatchList​(java.util.Vector v,
                                double x,
                                double y)
        Selects an object from the list based on the given coordinates.
        Parameters:
        v - the list of objects
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the selected object, or null if no object is selected
      • CatchAngle

        public CAngle CatchAngle​(double x,
                                 double y)
        Selects an angle from the list based on the given coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the selected angle, or null if no angle is selected
      • dialog_addText

        public void dialog_addText​(CText tc,
                                   int x,
                                   int y)
        Displays a dialog to add or edit text at the specified coordinates.
        Parameters:
        tc - the text object
        x - the x-coordinate
        y - the y-coordinate
      • SmartgetApointFromXY

        public CPoint SmartgetApointFromXY​(double x,
                                           double y)
        Adds a point at the specified coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the added point
      • SmartgetApointFromXY

        public CPoint SmartgetApointFromXY​(double x,
                                           double y,
                                           java.lang.String name)
        Adds a point with the specified name at the given coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        name - the name of the point
        Returns:
        the added point
      • addPointToList

        public void addPointToList​(CPoint p)
        Adds a point to the point list and assigns a name if not already set.
        Parameters:
        p - the point to add
      • getPointNameByCount

        public java.lang.String getPointNameByCount​(int n)
        Generates a point name based on the given count.
        Parameters:
        n - the count used to generate the point name
        Returns:
        the generated point name
      • addAngleToList

        public void addAngleToList​(CAngle ag)
        Adds an angle to the angle list if it is not already present.
        Parameters:
        ag - the angle to add
      • addLineToList

        public void addLineToList​(CLine line)
        Adds a line to the line list if it is not already present.
        Parameters:
        line - the line to add
      • addPolygonToList

        public void addPolygonToList​(CPolygon p)
        Adds a polygon to the polygon list if it is not already present.
        Parameters:
        p - the polygon to add
      • drawLineAndAdd

        public void drawLineAndAdd​(CPoint p1,
                                   CPoint p2)
        Draws a line between two points and adds it to the line list if it does not already exist.
        Parameters:
        p1 - the first point
        p2 - the second point
      • addCircleToList

        public void addCircleToList​(Circle c)
        Adds a circle to the circle list if it is not already present.
        Parameters:
        c - the circle to add
      • addObjectToList

        public boolean addObjectToList​(java.lang.Object obj,
                                       java.util.Vector list)
        Adds an object to the specified list if it is not already present.
        Parameters:
        obj - the object to add
        list - the list to which the object is added
        Returns:
        true if the object was added, false otherwise
      • addConstraintToList

        public void addConstraintToList​(Constraint cs)
        Adds a constraint to the constraint list if it is not already present.
        Parameters:
        cs - the constraint to add
      • removeConstraintFromList

        public void removeConstraintFromList​(Constraint cs)
        Removes a constraint from the constraint list.
        Parameters:
        cs - the constraint to remove
      • clearAllConstraint

        public void clearAllConstraint()
        Clears all constraints from the constraint list.
      • SelectByRect

        public void SelectByRect​(double x1,
                                 double y1,
                                 double x2,
                                 double y2)
        Selects and adds objects (points, lines, circles, and texts) that lie within the rectangular region defined by the two diagonal points (x1, y1) and (x2, y2).
        Parameters:
        x1 - the x-coordinate of the first corner of the rectangle
        y1 - the y-coordinate of the first corner of the rectangle
        x2 - the x-coordinate of the opposite corner of the rectangle
        y2 - the y-coordinate of the opposite corner of the rectangle
      • DWButtonUp

        public void DWButtonUp​(double x,
                               double y)
        Handles the mouse button release (up) event by applying snap adjustments and executing actions based on the current drawing mode (e.g., line creation, point selection, or transformation).
        Parameters:
        x - the x-coordinate where the mouse button was released
        y - the y-coordinate where the mouse button was released
      • smartPVDragLine

        public void smartPVDragLine()
        Adjusts the position of a free-moving point along its connecting line segments to ensure proper alignment. The method checks nearby points on the connected line and snaps the point to the corresponding x or y value if within a defined pixel threshold.
      • DWMouseDrag

        public void DWMouseDrag​(double x,
                                double y)
        Processes mouse drag events and updates the position of objects accordingly based on the current drawing action. Applies snapping if enabled, and updates positions of points and transformations for the active drawing mode.
        Parameters:
        x - the current x-coordinate during the drag
        y - the current y-coordinate during the drag
      • add_PFOOT

        public void add_PFOOT​(CLine line,
                              CPoint p1,
                              CPoint p)
        Adds a perpendicular foot from a point to a line.
        Parameters:
        line - the line to which the perpendicular foot is added
        p1 - the point from which the perpendicular foot is drawn
        p - the perpendicular foot point
      • objectsListMoved

        public void objectsListMoved​(java.util.Vector list,
                                     double dx,
                                     double dy)
        Moves all objects in the list by the given delta values.
        Parameters:
        list - the list of objects to move
        dx - the delta x value
        dy - the delta y value
      • DWMouseMove

        public void DWMouseMove​(double x,
                                double y)
        This method is used to move the catch point to the nearest point on the object.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • SmartmoveCatchPt

        public void SmartmoveCatchPt​(double x,
                                     double y)
        Moves the catch point to the specified coordinates if a point is found at those coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • SmartmoveCatchLine

        public void SmartmoveCatchLine​(double x,
                                       double y)
        Moves the catch point to the specified coordinates if a line is found at those coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • SmartmoveCatch

        public void SmartmoveCatch​(double x,
                                   double y)
        Moves the catch point to the specified coordinates, considering all types of objects.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • SmartmoveCatch

        public void SmartmoveCatch​(double x,
                                   double y,
                                   int type)
        Moves the catch point to the specified coordinates, considering specific types of objects.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        type - the type of objects to consider (0: All, 1: Point Only, 2: Line Only, 3: Circle Only, 4: Point and Line, 5: Point and Circle, 6: Line and Circle)
      • moveCatch

        public void moveCatch​(double x,
                              double y)
        Moves the catch point to the specified coordinates, considering points, lines, and circles.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • get_Catch_Intersection

        public void get_Catch_Intersection​(double x,
                                           double y)
        Finds the intersection point of two objects (lines or circles) in the catch list.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
      • Smart

        public boolean Smart​(CPoint p,
                             double x,
                             double y)
        Sets the given point to the specified coordinates and checks if it is on any geometric object.
        Parameters:
        p - the point to set
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        true if the point is on an object, false otherwise
      • SmartAddPoint

        public CPoint SmartAddPoint​(double x,
                                    double y)
        Adds a new point to the drawing at the specified coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the created point, or an existing point if one is found at the coordinates
      • SmartAddPoint

        public CPoint SmartAddPoint​(double x,
                                    double y,
                                    java.lang.String name)
        Adds a new point to the drawing at the specified coordinates with a given name.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        name - the name of the new point
        Returns:
        the created point, or an existing point if one is found at the coordinates
      • SelectALine

        public CLine SelectALine​(double x,
                                 double y)
        Selects a line from the drawing that is near the specified coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the selected line, or null if no line is found
      • SelectACircle

        public Circle SelectACircle​(double x,
                                    double y)
        Selects a circle from the drawing that is near the specified coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the selected circle, or null if no circle is found
      • SelectAPoint

        public CPoint SelectAPoint​(double x,
                                   double y)
        Selects a point from the drawing that is near the specified coordinates.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the selected point, or null if no point is found
      • doFlash

        public void doFlash()
        Starts and stops the flashing process for flash items in the flash list.
      • clearFlash

        public void clearFlash()
        Clears all flash items from the flash list.
      • addFlash

        public void addFlash​(JFlash f)
        Adds a flash item to the flash list and starts it.
        Parameters:
        f - the flash item to add
      • getCommonPoint

        public CPoint getCommonPoint​(CPoint p1,
                                     CPoint p2,
                                     CPoint p3,
                                     CPoint p4)
        Finds the common point between two lines or a line and a point.
        Parameters:
        p1 - the first point
        p2 - the second point
        p3 - the third point
        p4 - the fourth point
        Returns:
        the common point if found, otherwise null
      • addCgFlash

        public void addCgFlash​(JCgFlash f1,
                               JCgFlash f2,
                               JFlash f)
        Adds two JCgFlash items and a JFlash item to the flash list.
        Parameters:
        f1 - the first JCgFlash item
        f2 - the second JCgFlash item
        f - the JFlash item
      • startFlash

        public void startFlash()
        Starts the flashing process for flash items in the flash list.
      • addFlash2

        public void addFlash2​(JFlash f)
        Adds the specified flash object before any existing JRedoStepFlash in the flash list.
        Parameters:
        f - the flash object to add
      • addFlash1

        public void addFlash1​(JFlash f)
        Adds the specified flash object and starts it immediately if it is the only flash item.
        Parameters:
        f - the flash object to add
      • addFlashx

        public void addFlashx​(JFlash f)
        Adds the specified flash object to the flash list if not already present. For JAngleFlash instances, adjusts the flash radius based on the number of similar flash objects.
        Parameters:
        f - the flash object to add
      • isFlashFinished

        public boolean isFlashFinished()
        Checks whether the flash process is finished.
        Returns:
        true if there are no flash items or the sole flash item has finished; false otherwise
      • drawFlash

        public void drawFlash​(java.awt.Graphics2D g2)
        Draws all flash items to the provided Graphics2D object, starts flash processes if necessary, and triggers a proof run when all flashes are finished.
        Parameters:
        g2 - the graphics context used for drawing
      • paintPoint

        public void paintPoint​(java.awt.Graphics g)
        Paints the current drawing scene including grid, undo objects, various shape lists, flashes, points, texts, and catch objects. Also draws additional components such as the track point.
        Parameters:
        g - the graphics context used for painting
      • drawTrackpt

        public void drawTrackpt​(java.awt.Graphics2D g2)
        Draws the tracking point on the given Graphics2D context and adds it to the corresponding trace list.
        Parameters:
        g2 - the graphics context used for drawing
      • getTraceByPt

        public CTrace getTraceByPt​(CPoint pt)
        Returns the trace object that contains the current tracking point.
        Parameters:
        pt - the point used to identify the corresponding trace
        Returns:
        the matching CTrace if found; otherwise, null
      • setSmartPVLine

        public void setSmartPVLine​(CPoint p1,
                                   CPoint p2)
        Adjusts the position of point p2 relative to point p1 to enforce a smart horizontal or vertical alignment.
        Parameters:
        p1 - the reference point
        p2 - the point to be adjusted
      • drawSmartPVLine

        public void drawSmartPVLine​(CPoint p1,
                                    CPoint p2,
                                    java.awt.Graphics2D g2)
        Draws a smart PV (parallel or vertical/horizontal) line between p1 and p2. If the line is nearly horizontal or vertical and sufficiently long, the line is extended accordingly.
        Parameters:
        p1 - the starting point of the line
        p2 - the target point for alignment and extension
        g2 - the graphics context used for drawing
      • drawCurrentAct

        public void drawCurrentAct​(java.awt.Graphics2D g2)
        Draws the current action environment including auxiliary lines, selection outlines, and other drawing components based on the current action state.
        Parameters:
        g2 - the graphics context used for drawing
      • setFirstPnt

        public void setFirstPnt​(double x,
                                double y)
        Sets the first point for transformation and updates the translation offsets.
        Parameters:
        x - the new x-coordinate
        y - the new y-coordinate
      • setTransformStatus

        public void setTransformStatus​(int t)
        Sets the transformation status and updates related points and selections.

        When t is 0, the selection is cleared. When t is 2, the first point's coordinates are updated based on current catch values and a repaint is requested.

        Parameters:
        t - the new transformation status
      • repaint

        public void repaint()
        Requests a repaint of the panel.
      • addFlashPolygon

        public void addFlashPolygon​(CPolygon p1,
                                    CPolygon p2,
                                    int t,
                                    boolean ct,
                                    double xc,
                                    double yc)
        Adds a flash polygon effect between two polygons.
        Parameters:
        p1 - the first polygon
        p2 - the second polygon
        t - the flash type identifier
        ct - a flag for custom behavior
        xc - the x coordinate for the flash center
        yc - the y coordinate for the flash center
      • drawAuxLine

        public void drawAuxLine​(int x,
                                int y,
                                double k,
                                java.awt.Graphics2D g2)
        Draws an auxiliary line with a dashed stroke based on a given slope.
        Parameters:
        x - the x coordinate of the starting point
        y - the y coordinate of the starting point
        k - the slope of the line
        g2 - the Graphics2D context used for drawing
      • addisoAngle

        public boolean addisoAngle​(CPoint p1,
                                   CPoint p2,
                                   CPoint p,
                                   int type)
        Adds an isosceles angle constraint by adjusting the third point.
        Parameters:
        p1 - the first point defining the base of the triangle
        p2 - the second point defining the base of the triangle
        p - the point to be adjusted to form an isosceles triangle
        type - the angle type indicator (0 for standard isosceles)
        Returns:
        true if the constraint is successfully added, false otherwise
      • addsquare

        public boolean addsquare​(CPoint p1,
                                 CPoint p2,
                                 CPoint p)
        Constructs a square by using two initial points and adjusting a third point.
        Parameters:
        p1 - the first point on the square
        p2 - the second point on the square
        p - a point used to determine the orientation and size of the square
        Returns:
        true if the square is successfully constructed, false otherwise
      • add_line

        public void add_line​(CPoint p1,
                             CPoint p2)
        Adds a line defined by two points to the drawing. If the line already exists, the points are added to it.
        Parameters:
        p1 - the first endpoint of the line
        p2 - the second endpoint of the line
      • SmartPoint

        public CPoint SmartPoint​(CPoint p)
        Finds a point in the drawing that matches the given point's coordinates.
        Parameters:
        p - the point to match
        Returns:
        the matching point if found, otherwise null
      • SmartPLine

        public CLine SmartPLine​(CPoint p)
        Finds a line in the drawing that contains the given point.
        Parameters:
        p - the point to match
        Returns:
        the matching line if found, otherwise null
      • SmartPCircle

        public Circle SmartPCircle​(CPoint p)
        Finds a circle in the drawing that contains the given point.
        Parameters:
        p - the point to match
        Returns:
        the matching circle if found, otherwise null
      • SmartPointOnLine

        public CLine SmartPointOnLine​(double x,
                                      double y)
        Finds a line in the drawing that is near the given coordinates.
        Parameters:
        x - the x-coordinate to match
        y - the y-coordinate to match
        Returns:
        the matching line if found, otherwise null
      • CreateANewPoint

        public CPoint CreateANewPoint​(double x,
                                      double y)
        Creates a new point with the given coordinates.
        Parameters:
        x - the x-coordinate of the new point
        y - the y-coordinate of the new point
        Returns:
        the created point, or null if the parameter limit is exceeded
      • CreateANewPoint

        public CPoint CreateANewPoint​(double x,
                                      double y,
                                      java.lang.String name)
        Creates a new point with the given coordinates and name.
        Parameters:
        x - the x-coordinate of the new point
        y - the y-coordinate of the new point
        name - the name of the new point
        Returns:
        the created point, or null if the parameter limit is exceeded
      • MeetDefineAPoint

        public CPoint MeetDefineAPoint​(CLine line1,
                                       CLine line2)
        Finds or creates a point at the intersection of two lines.
        Parameters:
        line1 - the first line
        line2 - the second line
        Returns:
        the intersection point, or null if the lines are parallel or already intersect
      • MeetDefineAPoint

        public CPoint MeetDefineAPoint​(CLine line1,
                                       CLine line2,
                                       boolean unique)
        Finds or creates a point at the intersection of two lines, optionally ensuring uniqueness.
        Parameters:
        line1 - the first line
        line2 - the second line
        unique - whether to ensure the intersection point is unique
        Returns:
        the intersection point, or null if the lines are parallel or already intersect
      • MeetLCToDefineAPoint

        public CPoint MeetLCToDefineAPoint​(CLine line,
                                           Circle c,
                                           boolean m,
                                           double x,
                                           double y)
        Finds or creates a point at the intersection of a line and a circle.
        Parameters:
        line - the line
        c - the circle
        m - whether to move the point to the given coordinates
        x - the x-coordinate to move the point to
        y - the y-coordinate to move the point to
        Returns:
        the intersection point, or null if the line and circle do not intersect
      • MeetCCToDefineAPoint

        public CPoint MeetCCToDefineAPoint​(Circle c1,
                                           Circle c2,
                                           boolean m,
                                           double x,
                                           double y)
        Finds or creates a point at the intersection of two circles.
        Parameters:
        c1 - the first circle
        c2 - the second circle
        m - whether to move the point to the given coordinates
        x - the x-coordinate to move the point to
        y - the y-coordinate to move the point to
        Returns:
        the intersection point, or null if the circles do not intersect
      • AddPointToLineX

        public void AddPointToLineX​(CPoint p,
                                    CLine ln)
        Adds a point to a line if it is not already on the line.
        Parameters:
        p - the point to add
        ln - the line to add the point to
      • AddPointToCircle

        public void AddPointToCircle​(CPoint p,
                                     Circle c,
                                     boolean un)
        Adds a point to a circle and optionally adds an undo action.
        Parameters:
        p - the point to add
        c - the circle to add the point to
        un - whether to add an undo action
      • AddPointToLine

        public void AddPointToLine​(CPoint p,
                                   CLine line)
        Adds a point to a line and adds an undo action.
        Parameters:
        p - the point to add
        line - the line to add the point to
      • AddPointToLine

        public void AddPointToLine​(CPoint p,
                                   CLine line,
                                   boolean un)
        Adds a point to a line and optionally adds an undo action.
        Parameters:
        p - the point to add
        line - the line to add the point to
        un - whether to add an undo action
      • addADecidedPointWithUnite

        public CPoint addADecidedPointWithUnite​(CPoint p)
        Adds a decided point to the list and checks for common points.
        Parameters:
        p - the point to add
        Returns:
        the common point if found, otherwise null
      • eraseAPoly

        public void eraseAPoly​(TMono m)
        Erases a polynomial from the list.
        Parameters:
        m - the polynomial to erase
      • CheckCommonPoint

        public CPoint CheckCommonPoint​(CPoint p)
        Checks for a common point in the list.
        Parameters:
        p - the point to check
        Returns:
        the common point if found, otherwise null
      • isPointAlreadyExists

        public CPoint isPointAlreadyExists​(CPoint p)
        Checks if a point already exists in the list.
        Parameters:
        p - the point to check
        Returns:
        the existing point if found, otherwise null
      • SetVarable

        public void SetVarable()
        Sets variables for the points in the list.
      • SelectAPolygon

        public CPolygon SelectAPolygon​(double x,
                                       double y)
        Selects a polygon that contains the specified point.
        Parameters:
        x - the x coordinate of the selection point.
        y - the y coordinate of the selection point.
        Returns:
        the selected polygon, or null if no polygon is selected.
      • SelectFromAList

        public CClass SelectFromAList​(java.util.Vector list,
                                      double x,
                                      double y)
        Selects the first object from the given list that is hit by the specified coordinates.
        Parameters:
        list - the list of objects to search.
        x - the x coordinate of the selection point.
        y - the y coordinate of the selection point.
        Returns:
        the selected object, or null if none are hit.
      • re_generate_all_poly

        public void re_generate_all_poly()
        Regenerates all polynomial representations, clears current constraints, and optimizes polynomials based on the existing constraints.
      • openOutputFile

        public java.io.DataOutputStream openOutputFile​(java.lang.String path)
                                                throws java.io.IOException
        Opens an output file at the specified path.
        Parameters:
        path - the file path where the output file is to be created.
        Returns:
        a DataOutputStream for writing to the file.
        Throws:
        java.io.IOException - if an error occurs while opening or creating the file.
      • Save_global

        public void Save_global​(java.io.DataOutputStream out)
                         throws java.io.IOException
        Saves the global state to the specified output stream.
        Parameters:
        out - the output stream to save the global state to
        Throws:
        java.io.IOException - if an I/O error occurs
      • Load_global

        public void Load_global​(java.io.DataInputStream in)
                         throws java.io.IOException
        Loads the global state from the specified input stream.
        Parameters:
        in - the input stream to load the global state from
        Throws:
        java.io.IOException - if an I/O error occurs
      • print

        public int print​(java.awt.Graphics graphics,
                         java.awt.print.PageFormat pageFormat,
                         int pageIndex)
                  throws java.awt.print.PrinterException
        Prints the drawing on the specified page.
        Specified by:
        print in interface java.awt.print.Printable
        Parameters:
        graphics - the graphics context
        pageFormat - the page format
        pageIndex - the index of the page to print
        Returns:
        PAGE_EXISTS if the page is rendered successfully, NO_SUCH_PAGE otherwise
        Throws:
        java.awt.print.PrinterException - if a printer error occurs
      • PrintContent

        public void PrintContent()
        Prints the content of the current drawing. Sets up the printer job and page format, and initiates the print dialog. If the user confirms the print dialog, it attempts to print the content.
      • addText

        public void addText​(CText tx)
        Adds a text object to the drawing. If the text object is not null and successfully added to the text list, it adds an undo action for the addition.
        Parameters:
        tx - the text object to add
      • addNodeToUndoList

        public void addNodeToUndoList​(wprover.UndoStruct un)
        Adds an undo structure to the undo list.
        Parameters:
        un - the undo structure to add
      • UndoAdded

        public wprover.UndoStruct UndoAdded​(java.lang.Object tip)
        Adds an undo action with a specified tip message.
        Parameters:
        tip - the tip message for the undo action
        Returns:
        the added undo structure
      • UndoAdded

        public wprover.UndoStruct UndoAdded​(java.lang.Object tip,
                                            boolean gr)
        Adds an undo action with a specified tip message and a flag to generate proof.
        Parameters:
        tip - the tip message for the undo action
        gr - whether to generate proof
        Returns:
        the added undo structure
      • UndoAdded

        public wprover.UndoStruct UndoAdded​(java.lang.Object tip,
                                            boolean gr,
                                            boolean m)
        Adds an undo action with a specified tip message, a flag to generate proof, and a flag to update the manual input bar.
        Parameters:
        tip - the tip message for the undo action
        gr - whether to generate proof
        m - whether to update the manual input bar
        Returns:
        the added undo structure
      • UndoAdded

        public void UndoAdded()
        Adds a default undo action with a generic message.
      • UndoPure

        public void UndoPure()
        Performs a pure undo operation. Calls `doFlash` and repeatedly calls `Undo_stepPure` until it returns false. Regenerates all polygons and calls `doFlash` again.
      • Undo

        public void Undo()
        Performs an undo operation. Repeatedly calls `Undo_step` until it returns false.
      • redo

        public void redo()
        Performs a redo operation. Repeatedly calls `redo_step` until it returns null.
      • undo_step

        public boolean undo_step​(wprover.UndoStruct Undo)
        Performs a single undo step.
        Parameters:
        Undo - the undo structure
        Returns:
        true if the undo step was successful, false otherwise
      • undo_step

        public boolean undo_step​(wprover.UndoStruct Undo,
                                 boolean rg)
        Performs a single undo step with an option to regenerate and recalculate.
        Parameters:
        Undo - the undo structure
        rg - whether to regenerate and recalculate
        Returns:
        true if the undo step was successful, false otherwise
      • isRedoAtEnd

        public boolean isRedoAtEnd()
        Checks if the redo list is empty.
        Returns:
        true if the redo list is empty, false otherwise
      • Undo_stepPure

        public boolean Undo_stepPure()
        Performs a pure undo step. Clears the selection and catch list, and moves the undo structure from the undo list to the redo list.
        Returns:
        true if the undo step was successful, false otherwise
      • Undo_step

        public boolean Undo_step()
        Performs an undo step. Clears the selection and catch list, and moves the undo structure from the undo list to the redo list.
        Returns:
        true if the undo step was successful, false otherwise
      • getUndolistSize

        public int getUndolistSize()
        Gets the size of the undo list.
        Returns:
        the size of the undo list
      • getRedolistSize

        public int getRedolistSize()
        Gets the size of the redo list.
        Returns:
        the size of the redo list
      • moveUndoObjectFromList

        public void moveUndoObjectFromList​(java.util.Vector v1,
                                           java.util.Vector v2,
                                           int pc1,
                                           int pc2)
        Moves undo objects from one list to another based on their IDs.
        Parameters:
        v1 - the destination list
        v2 - the source list
        pc1 - the starting ID
        pc2 - the ending ID
      • selectUndoObjectFromList

        public void selectUndoObjectFromList​(java.util.Vector v1,
                                             java.util.Vector v2,
                                             int pc1,
                                             int pc2)
        Selects undo objects from one list to another based on their IDs.
        Parameters:
        v1 - the destination list
        v2 - the source list
        pc1 - the starting ID
        pc2 - the ending ID
      • setUndoStructForDisPlay

        public void setUndoStructForDisPlay​(wprover.UndoStruct u,
                                            boolean compulsory_flash)
        Sets the undo structure for display. If the provided undo structure is not null and flashing is enabled, the method retrieves all associated flash objects and initiates a flash display.
        Parameters:
        u - the undo structure to display
        compulsory_flash - if true, forces the flash display regardless of the internal flag
      • flash_node_by_id

        public void flash_node_by_id​(int id)
        Searches through the undo list for an undo structure whose id range contains the given id, then sets it for display with compulsory flashing.
        Parameters:
        id - the identifier used to locate the corresponding undo structure
      • getObjectFlash

        public JObjectFlash getObjectFlash​(CClass cc)
        Creates and returns a flash object for the given graphical component.
        Parameters:
        cc - the graphical object to be flashed
        Returns:
        the flash object containing the given component
      • setObjectListForFlash

        public void setObjectListForFlash​(CClass cc)
        Creates a flash effect for a single graphical object by wrapping it in a vector and invoking the flash display mechanism.
        Parameters:
        cc - the graphical object to set for flash display
      • setObjectListForFlash

        public void setObjectListForFlash​(java.util.Vector list,
                                          javax.swing.JPanel p)
        Sets a list of objects for flash display on the specified panel.
        Parameters:
        list - the list of objects to be flashed
        p - the panel on which the flash effect should be displayed
      • setObjectListForFlash

        public void setObjectListForFlash​(java.util.Vector list)
        Sets a list of objects for flash display using the default panel.
        Parameters:
        list - the list of objects to be flashed
      • setUndoListForFlash

        public void setUndoListForFlash​(java.util.Vector list)
        Extracts all flashable objects from each undo structure in the provided list and sets them for flash display.
        Parameters:
        list - the list of undo structures whose associated objects will be flashed
      • setUndoListForFlash1

        public void setUndoListForFlash1​(java.util.Vector list)
        Extracts all flashable objects from each undo structure in the provided list and sets them for flash display using an alternative flash mechanism.
        Parameters:
        list - the list of undo structures whose associated objects will be flashed
      • stopUndoFlash

        public void stopUndoFlash()
        Stops any active undo flash display by clearing the flash queue.
      • redo_step

        public boolean redo_step​(wprover.UndoStruct Undo)
        Performs a redo step for the provided undo structure. If the undo structure represents a combined or prove node, it recursively redoes each sub-node. Otherwise, it restores various elements and recalculates the state.
        Parameters:
        Undo - the undo structure to be redone
        Returns:
        true if the redo step is successful
      • already_redo

        public boolean already_redo​(wprover.UndoStruct u)
        Determines whether a given undo structure is not present in the redo list.
        Parameters:
        u - the undo structure to check
        Returns:
        true if the structure is not already in the redo list, false otherwise
      • redo_step

        public wprover.UndoStruct redo_step​(boolean cf)
        Performs a redo step with the option to clear the flash display. It retrieves the most recent redo step, updates the internal lists, and returns the corresponding undo structure.
        Parameters:
        cf - if true, clears any active flash display prior to redoing the step
        Returns:
        the undo structure that was redone, or null if no redo step is available
      • redo_step

        public wprover.UndoStruct redo_step()
        Performs a redo step with flash clearing enabled by default.
        Returns:
        the undo structure that was redone, or null if no redo step is available
      • fd_point

        public CPoint fd_point​(int index)
        Finds a point by its index.
        Parameters:
        index - the index of the point
        Returns:
        the point if found, null otherwise
      • fd_angle_4p

        public CAngle fd_angle_4p​(CPoint p1,
                                  CPoint p2,
                                  CPoint p3,
                                  CPoint p4)
        Finds an angle defined by four points.
        Parameters:
        p1 - the first point
        p2 - the second point
        p3 - the third point
        p4 - the fourth point
        Returns:
        the angle if found, null otherwise
      • fd_angle_m

        public CAngle fd_angle_m​(CPoint p1,
                                 CPoint p2,
                                 CPoint p3,
                                 CPoint p4)
        Finds an angle defined by four points (alternative method).
        Parameters:
        p1 - the first point
        p2 - the second point
        p3 - the third point
        p4 - the fourth point
        Returns:
        the angle if found, null otherwise
      • fd_angle

        public CAngle fd_angle​(CAngle ag)
        Finds an angle that matches the given angle.
        Parameters:
        ag - the angle to match
        Returns:
        the matching angle if found, null otherwise
      • add_rcircle

        public Circle add_rcircle​(int o,
                                  int a,
                                  int b)
        Adds a circle defined by three points.
        Parameters:
        o - the first point
        a - the second point
        b - the third point
        Returns:
        the added circle
      • addCr

        public Circle addCr​(int o,
                            int a)
        Adds a circle defined by two points.
        Parameters:
        o - the first point
        a - the second point
        Returns:
        the added circle
      • fd_rcircle

        public Circle fd_rcircle​(int o,
                                 int a,
                                 int b)
        Finds a circle defined by three points.
        Parameters:
        o - the first point
        a - the second point
        b - the third point
        Returns:
        the circle if found, null otherwise
      • fd_circle

        public Circle fd_circle​(int o,
                                int a)
        Finds a circle defined by two points.
        Parameters:
        o - the first point
        a - the second point
        Returns:
        the circle if found, null otherwise
      • fd_circleOR

        public Circle fd_circleOR​(CPoint o,
                                  CPoint p1,
                                  CPoint p2)
        Finds a circle defined by an origin and two radius points.
        Parameters:
        o - the origin point
        p1 - the first radius point
        p2 - the second radius point
        Returns:
        the circle if found, null otherwise
      • fd_circle

        public Circle fd_circle​(int a,
                                int b,
                                int c)
        Finds a circle defined by three points.
        Parameters:
        a - the first point
        b - the second point
        c - the third point
        Returns:
        the circle if found, null otherwise
      • addedMark

        public Cedmark addedMark​(int a,
                                 int b)
        Adds a mark between two points.
        Parameters:
        a - the first point
        b - the second point
        Returns:
        the added mark
      • addedMark

        public Cedmark addedMark​(CPoint p1,
                                 CPoint p2)
        Adds a mark between two points.
        Parameters:
        p1 - the first point
        p2 - the second point
        Returns:
        the added mark
      • resetAux

        public void resetAux()
        Resets auxiliary counters and performs an undo step.
      • flashStep

        public void flashStep​(java.util.Vector v)
        Initiates a flash using the provided vector of objects.
        Parameters:
        v - the vector containing objects to flash
      • getAngleSimpleName

        public java.lang.String getAngleSimpleName()
        Computes and returns a simple name for an angle based on the current angle count.
        Returns:
        a string representing the angle name
      • setCurrentDrawPanel

        public void setCurrentDrawPanel​(javax.swing.JPanel panel)
        Sets the current drawing panel.
        Parameters:
        panel - the JPanel to set as the current drawing panel
      • setCurrentInstance

        public void setCurrentInstance​(GExpert gx)
        Sets the current geometry expert instance and updates the drawing panel accordingly.
        Parameters:
        gx - the GExpert instance to set as the current instance
      • getANewParam

        public Param getANewParam()
        Creates and returns a new parameter, updating the parameter counter.
        Returns:
        a new instance of Param
      • add_sp_angle_value

        public int add_sp_angle_value​(int v)
        Adds a special angle value.
        Parameters:
        v - the input value to compute the special angle value
        Returns:
        the x-index of the parameter corresponding to the added angle
      • need_save

        public boolean need_save()
        Checks if the current state needs to be saved.

        The state is considered modified if there are points, text objects, other elements, or more than one parameter.

        Returns:
        true if there are unsaved changes, false otherwise
      • fd_polygon

        public CPolygon fd_polygon​(Circle c)
        Finds a polygon associated with the given circle.

        The method searches through the polygon list for a polygon of a specific type that matches the circle's properties.

        Parameters:
        c - the circle to search for the corresponding polygon
        Returns:
        the found polygon or null if none match
      • reduce

        public TMono reduce​(TMono m)
        Reduces a given TMono object using the current parameters.

        This method creates a copy of the input TMono and applies reduction based on the available parameters.

        Parameters:
        m - the TMono object to reduce
        Returns:
        the reduced TMono object
      • onDBClick

        public void onDBClick​(CClass c)
        Handles double-click events on a CClass object.

        Depending on the type of the object, this method either opens an editor or performs a view action.

        Parameters:
        c - the CClass object that was double-clicked
      • roundn

        public double roundn​(double r,
                             int n)
        Rounds a double value to a specified number of decimal places.
        Parameters:
        r - the value to round
        n - the number of decimal places
        Returns:
        the rounded value
      • calculate

        public double calculate​(CTextValue ct)
        Calculates the numerical value of a given CTextValue expression.

        This method evaluates the expression represented by the CTextValue object using basic arithmetic operations and mathematical functions.

        Parameters:
        ct - the CTextValue object representing the expression
        Returns:
        the calculated numerical value
      • addCalculationPX

        public final void addCalculationPX​(CPoint p)
        Adds a calculation for the X-coordinate of a point.

        This method creates a text representation of the X-coordinate calculation for the provided point.

        Parameters:
        p - the point for which the X-coordinate calculation is added
      • addCalculationPY

        public final void addCalculationPY​(CPoint p)
        Adds a calculation for the Y-coordinate of a point.

        This method creates a text representation of the Y-coordinate calculation for the provided point.

        Parameters:
        p - the point for which the Y-coordinate calculation is added
      • addCalculationPolygon

        public final void addCalculationPolygon​(CPolygon poly)
        Adds a polygon calculation displaying its area.

        Constructs a text object representing the area calculation for the provided polygon.

        Parameters:
        poly - the polygon for which the area calculation is added
      • addLineSlope

        public final void addLineSlope​(CLine ln)
        Adds a calculation for the slope of a line.

        This method creates a text representation of the slope calculation for the given line based on its two supporting points.

        Parameters:
        ln - the line for which the slope calculation is added
      • addCalculationCircle

        public final void addCalculationCircle​(Circle c,
                                               int t)
        Adds a calculation for a circle based on the specified type.

        Depending on the type parameter, the method adds a text representation for the area, girth, or radius calculation of the circle.

        Parameters:
        c - the circle for which the calculation is added
        t - the type of calculation (0 for area, 1 for girth, other for radius)
      • getTextLocation

        public void getTextLocation​(CText t1)
        Determines the location for a text object. Calculates an appropriate position for the text object based on existing text objects.
        Parameters:
        t1 - the text object for which the location is determined
      • cancelCurrentAction

        public void cancelCurrentAction()
        Cancels the current action and resets relevant states. This method clears selections, resets action-related variables, repaints the panel, and performs undo operations if necessary.
      • getActionType

        public int getActionType​(int ac)
        Returns the action type based on the given action code.
        Parameters:
        ac - the action code
        Returns:
        an integer representing the action type, or -1 if not recognized
      • addCTMark

        public void addCTMark​(CLine ln1,
                              CLine ln2)
        Adds a perpendicularity mark between two given lines if they are perpendicular.
        Parameters:
        ln1 - the first line
        ln2 - the second line
      • addCTMark

        public void addCTMark​(CPoint p1,
                              CPoint p2,
                              CPoint p3,
                              CPoint p4)
        Adds a perpendicularity mark by deriving lines from two pairs of points.
        Parameters:
        p1 - the first point of the first line
        p2 - the second point of the first line
        p3 - the first point of the second line
        p4 - the second point of the second line
      • PolygonTransPointsCreated

        public void PolygonTransPointsCreated​(CPolygon poly)
        Translates the polygon's points and creates corresponding oriented segments.
        Parameters:
        poly - the polygon whose points are to be transformed
      • addOrientedSegment

        public void addOrientedSegment​(CPoint p1,
                                       CPoint p2,
                                       CPoint px,
                                       double x,
                                       double y)
        Creates a new oriented segment for a given point and its transformed coordinates.
        Parameters:
        p1 - the first reference point
        p2 - the second reference point
        px - the original point for segment generation
        x - the transformed x-coordinate
        y - the transformed y-coordinate
      • LoadGGB2

        public boolean LoadGGB2​(java.io.DataInputStream in,
                                java.lang.String path)
                         throws java.io.IOException
        Loads a GeoGebra file and processes its construction steps. Disclaimer: New version that iterates over the ggb construction element
        Parameters:
        in - the data input stream of the file
        path - the file path
        Returns:
        true if loaded successfully, false otherwise
        Throws:
        java.io.IOException - if an I/O error occurs
      • GetFraction

        public static int[] GetFraction​(double input)