Class DrawProcess
- java.lang.Object
-
- wprover.DrawBase
-
- wprover.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.
-
-
Field Summary
Fields Modifier and Type Field Description static intANIMATIONstatic intARROWstatic intAUTOSHOWSTEPstatic intCONSTRUCT_FROM_TEXTprotected CPointCTrackPtstatic intDEFINEPOLYstatic intDRAWTRIALLstatic intDRAWTRISQISOstatic intEQMARKstatic intEQUIVALENCEstatic intFREE_TRANSFORMprotected GTermgtstatic intHIDEOBJECTstatic intLOCUSstatic intMOVEstatic intMOVENAMEstatic intMULSELECTSOLUTIONprotected intndstatic intNTANGLEprotected javax.swing.JPanelpanelstatic intPARALLELOGRAMstatic intPROVEstatic intRA_TRAPEZOIDstatic intRAMARKstatic intRATIOstatic intRECTANGLEstatic intSANGLEstatic intSELECTstatic intSETCCTANGENTstatic intSETEQANGLE3Pstatic intSETEQSIDEstatic intSETTRACKstatic intSHOWOBJECTprotected booleanstatusstatic intTRANSFORMstatic intTRANSLATEstatic intTRAPEZOIDstatic intTRIANGLEprotected wprover.UndoStructU_Objstatic intVIEWELEMENTstatic intZOOM_INstatic intZOOM_OUT-
Fields inherited from class wprover.DrawBase
anglelist, BARYCENTER, CatchList, CatchPoint, CatchType, catchX, catchY, CCTANGENT, charset, circlelist, CIRCUMCENTER, constraintlist, CurrentAction, D_3PCIRCLE, D_ABLINE, D_ALINE, D_ANGLE, D_BLINE, D_CCLINE, D_CIR_BY_DIM, D_CIRCLE, D_CIRCLEBYRADIUS, D_IOSTRI, D_LINE, D_MIDPOINT, D_PARELINE, D_PERPLINE, D_PFOOT, D_POINT, D_POLYGON, D_PRATIO, D_PSQUARE, D_PTDISTANCE, D_SQUARE, D_TCLINE, D_TEXT, D_TRATIO, DISTANCE, distancelist, DRAWGRID, file, footMarkLength, footMarkShown, gridColor, GridX, GridY, gxInstance, H_LINE, Height, INCENTER, isPointOnIntersection, isPointOnObject, lan, linelist, LRATIO, MEET, MIRROR, mouseCatchX, mouseCatchY, mouseInside, MouseX, MouseY, name, ORTHOCENTER, otherlist, paraBackup, paraCounter, parameter, pblist, pcircleCounter, PERPWITHFOOT, plineCounter, pnameCounter, pointlist, poly, polygonlist, polylist, POOL, pptrans, SelectList, SETEQANGLE, SNAP, STATUS, textlist, tracelist, V_LINE, Width
-
-
Constructor Summary
Constructors Constructor Description DrawProcess()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidactionPerformed(java.awt.event.ActionEvent e)Handles action events triggered by the timer or other sources.voidadd_free_transform()Adds a free transform to the selected polygon.voidadd_line(CPoint p1, CPoint p2)Adds a line defined by two points to the drawing.voidadd_PFOOT(CLine line, CPoint p1, CPoint p)Adds a perpendicular foot from a point to a line.Circleadd_rcircle(int o, int a, int b)Adds a circle defined by three points.intadd_sp_angle_value(int v)Adds a special angle value.CPointaddADecidedPointWithUnite(CPoint p)Adds a decided point to the list and checks for common points.CLineaddALine(int t, CPoint p1, CPoint p2)Adds a line between two points to the line list.voidaddAngleToList(CAngle ag)Adds an angle to the angle list if it is not already present.voidaddCalculationCircle(Circle c, int t)Adds a calculation for a circle based on the specified type.voidaddCalculationPolygon(CPolygon poly)Adds a polygon calculation displaying its area.voidaddCalculationPX(CPoint p)Adds a calculation for the X-coordinate of a point.voidaddCalculationPY(CPoint p)Adds a calculation for the Y-coordinate of a point.voidaddCgFlash(JCgFlash f1, JCgFlash f2, JFlash f)Adds two JCgFlash items and a JFlash item to the flash list.voidaddCircleToList(Circle c)Adds a circle to the circle list if it is not already present.voidaddConstraintToList(Constraint cs)Adds a constraint to the constraint list if it is not already present.CircleaddCr(int o, int a)Adds a circle defined by two points.voidaddCTMark(CLine ln1, CLine ln2)Adds a perpendicularity mark between two given lines if they are perpendicular.voidaddCTMark(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Adds a perpendicularity mark by deriving lines from two pairs of points.voidaddDiagramUpdaterListener(DiagramUpdater d)Adds a DiagramUpdater listener to the list of updater listeners.CedmarkaddedMark(int a, int b)Adds a mark between two points.CedmarkaddedMark(CPoint p1, CPoint p2)Adds a mark between two points.voidaddFlash(JFlash f)Adds a flash item to the flash list and starts it.voidaddFlash1(JFlash f)Adds the specified flash object and starts it immediately if it is the only flash item.voidaddFlash2(JFlash f)Adds the specified flash object before any existing JRedoStepFlash in the flash list.voidaddFlashPolygon(CPolygon p1, CPolygon p2, int t, boolean ct, double xc, double yc)Adds a flash polygon effect between two polygons.voidaddFlashx(JFlash f)Adds the specified flash object to the flash list if not already present.booleanaddisoAngle(CPoint p1, CPoint p2, CPoint p, int type)Adds an isosceles angle constraint by adjusting the third point.voidaddLineSlope(CLine ln)Adds a calculation for the slope of a line.voidaddLineToList(CLine line)Adds a line to the line list if it is not already present.voidaddNodeToUndoList(wprover.UndoStruct un)Adds an undo structure to the undo list.booleanaddObjectToList(java.lang.Object obj, java.util.Vector list)Adds an object to the specified list if it is not already present.voidaddOrientedSegment(CPoint p1, CPoint p2, CPoint px, double x, double y)Creates a new oriented segment for a given point and its transformed coordinates.voidAddPointToCircle(CPoint p, Circle c, boolean un)Adds a point to a circle and optionally adds an undo action.voidAddPointToLine(CPoint p, CLine line)Adds a point to a line and adds an undo action.voidAddPointToLine(CPoint p, CLine line, boolean un)Adds a point to a line and optionally adds an undo action.voidAddPointToLineX(CPoint p, CLine ln)Adds a point to a line if it is not already on the line.voidaddPointToList(CPoint p)Adds a point to the point list and assigns a name if not already set.voidaddPolygonToList(CPolygon p)Adds a polygon to the polygon list if it is not already present.voidaddSelectPoint(double x, double y)Adds a point to the selection list based on the given coordinates.booleanaddsquare(CPoint p1, CPoint p2, CPoint p)Constructs a square by using two initial points and adjusting a third point.voidaddText(CText tx)Adds a text object to the drawing.voidaddToSelectList(java.lang.Object c)Adds an object to the selection list.voidaddZeron(int x, int[] zeron)Adds a zero constraint for a given variable.booleanall_flash_finished()Checks if all flash animations are finished.booleanalready_redo(wprover.UndoStruct u)Determines whether a given undo structure is not present in the redo list.voidanimationOntime()Updates the animation on each timer tick and recalculates the drawing.voidanimationStart()Starts the animation.voidanimationStop()Stops the animation and recalculates the drawing.booleanautoAnimate()Toggles auto animation on or off.voidautoShowstep()Automatically shows the next step in the construction.voidautoUndoRedo()Toggles automatic undo and redo actions.voidBackupParameter(double[] rr, boolean b)Backs up or restores the parameter values.double[]calcu_m1(TMono m)Calculates the values of a polynomial.doublecalculate(CTextValue ct)Calculates the numerical value of a given CTextValue expression.booleancalculate_a_point(CPoint p, boolean d)Calculates the coordinates for a given point using its defining parameters and constraints.booleancalculate_allpt(boolean d)Calculates all points based on current parameter values.java.util.Vectorcalculate_allResults()Calculates all results from the polygons.booleancalculate_lccc(CPoint cp, double[] r)Calculates and adjusts the given point based on a line-circle or circle-circle constraint.double[]calculate_ocir(CPoint pt)Calculates the corresponding point on a circle.double[]calculate_oline(CPoint pt)Calculates the intersection point on a line based on the given point.voidcalculate_text()Calculates the text values for all CText objects in the text list.voidcalculate_trace()Calculates the trace points for all CTrace objects in the trace list.double[]calform(int lv, Param[] p)Calculates the values of two polynomials.voidcalv_parameter()Calculates and updates parameter values based on specific angle constraints.booleancanAutoAnimate()Checks if auto animation is possible.voidcancelCurrentAction()Cancels the current action and resets relevant states.CAngleCatchAngle(double x, double y)Selects an angle from the list based on the given coordinates.CClassCatchList(java.util.Vector v, double x, double y)Selects an object from the list based on the given coordinates.voidcharsetAndAddPoly(boolean calcu)Adds polynomials to the list and optimizes them.booleancheck_animation(CPoint p, CLine ln)Checks if a point can be animated along a line.CPointCheckCommonPoint(CPoint p)Checks for a common point in the list.booleancheckCPfieldExists()Checks if the construction proof field exists.voidclearAll()Clears all geometric objects and resets the drawing state.voidclearAllConstraint()Clears all constraints from the constraint list.voidclearConstruction()Clears the construction and resets the nd value.voidclearFlash()Clears all flash items from the flash list.voidclearSelection()Clears the selection list.CPointCreateANewPoint(double x, double y)Creates a new point with the given coordinates.CPointCreateANewPoint(double x, double y, java.lang.String name)Creates a new point with the given coordinates and name.voiddefineSpecificAngle()Defines a specific angle constraint.voiddialog_addText(CText tc, int x, int y)Displays a dialog to add or edit text at the specified coordinates.voiddoFlash()Starts and stops the flashing process for flash items in the flash list.voiddrawAuxLine(int x, int y, double k, java.awt.Graphics2D g2)Draws an auxiliary line with a dashed stroke based on a given slope.voiddrawCurrentAct(java.awt.Graphics2D g2)Draws the current action environment including auxiliary lines, selection outlines, and other drawing components based on the current action state.voiddrawFlash(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.voiddrawLineAndAdd(CPoint p1, CPoint p2)Draws a line between two points and adds it to the line list if it does not already exist.voiddrawSmartPVLine(CPoint p1, CPoint p2, java.awt.Graphics2D g2)Draws a smart PV (parallel or vertical/horizontal) line between p1 and p2.voiddrawTrackpt(java.awt.Graphics2D g2)Draws the tracking point on the given Graphics2D context and adds it to the corresponding trace list.voidDWButtonDown(double x, double y)Handles the "mouse down" (button press) event within the drawing canvas.voidDWButtonUp(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).voidDWMouseDbClick(double x, double y)Handles the double-click event on the drawing window.voidDWMouseDrag(double x, double y)Processes mouse drag events and updates the position of objects accordingly based on the current drawing action.voidDWMouseMove(double x, double y)This method is used to move the catch point to the nearest point on the object.voidDWMouseRightClick(double x, double y)Handles the right mouse button click event.voidDWMouseRightDown(double x, double y)Handles the right mouse button down event.voidDWMouseWheel(double x, double y, int n, int rt)Handles the mouse wheel event for zooming in and out.voideraseAPoly(TMono m)Erases a polynomial from the list.voidErasedADecidedPoint(CPoint p)Erases a decided point from the polynomial list.CAnglefd_angle(CAngle ag)Finds an angle that matches the given angle.CAnglefd_angle_4p(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Finds an angle defined by four points.CAnglefd_angle_m(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Finds an angle defined by four points (alternative method).Circlefd_circle(int o, int a)Finds a circle defined by two points.Circlefd_circle(int a, int b, int c)Finds a circle defined by three points.Circlefd_circleOR(CPoint o, CPoint p1, CPoint p2)Finds a circle defined by an origin and two radius points.Cedmarkfd_edmark(CPoint p1, CPoint p2)Finds an edmark object between two points.CPointfd_point(int index)Finds a point by its index.CPolygonfd_polygon(Circle c)Finds a polygon associated with the given circle.Circlefd_pt_on_which_circle(CPoint pt)Finds and returns the circle on which the specified point lies.CLinefd_pt_on_which_line(CPoint pt)Finds and returns the line on which the specified point lies.Circlefd_rcircle(int o, int a, int b)Finds a circle defined by three points.CPolygonfindPolygon(java.util.Vector v)Finds a polygon in the polygon list that matches the given vector of points.CPolygonfindPolygon1(java.util.Vector v)Finds a polygon in the polygon list that matches the given vector of points, considering rotational and directional equivalence.voidflash_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.voidflashStep(java.util.Vector v)Initiates a flash using the provided vector of objects.voidget_Catch_Intersection(double x, double y)Finds the intersection point of two objects (lines or circles) in the catch list.intgetActionType(int ac)Returns the action type based on the given action code.java.util.VectorgetAllConstraint()Retrieves all constraints.java.util.VectorgetAllSolidObj()Retrieves all solid objects.ParamgetANewParam()Creates and returns a new parameter, updating the parameter counter.CAnglegetAngleByid(int id)Retrieves an angle by its ID.java.lang.StringgetAngleSimpleName()Computes and returns a simple name for an angle based on the current angle count.AnimateCgetAnimateC()Retrieves the AnimateC object.CirclegetCircleByid(int id)Retrieves a circle by its ID.CPointgetCommonPoint(CPoint p1, CPoint p2, CPoint p3, CPoint p4)Finds the common point between two lines or a line and a point.ConstraintgetConstraintByid(int id)Retrieves a constraint by its ID.java.util.VectorgetConstructionFromDraw()Retrieves the construction steps from the drawing.intGetCurrentAction()Retrieves the current action type.java.io.FilegetFile()Retrieves the current file.static int[]GetFraction(double input)CPointgetLastConstructedPoint()Retrieves the last constructed point.CLinegetLineByid(int id)Retrieves a line by its ID.java.lang.StringgetName()Retrieves the name of the current object.java.util.VectorgetNDGS()Computes and returns the nondegenerate conditions for the current TPoly.JObjectFlashgetObjectFlash(CClass cc)Creates and returns a flash object for the given graphical component.CClassgetObjectInListById(int id, java.util.Vector v)Retrieves an object from a list by its ID.CClassgetOjbectById(int id)Retrieves an object by its ID.ParamgetParaForSpecificAngle(int ang)Retrieves the parameter associated with a specific angle constraint.double[]getParameter()Retrieves the current parameter values.ParamgetParameterByindex(int index)Retrieves a parameter by its index.TPolygetPBList()Retrieves the PB list.java.util.VectorgetPBMono()Returns a vector containing copies of the TMono objects from the pblist.CPointgetPointById(int id)Retrieves a point by its ID.java.lang.StringgetPointNameByCount(int n)Generates a point name based on the given count.TPolygetPolyList()Retrieves the polynomial list.intgetRedolistSize()Gets the size of the redo list.java.util.VectorgetSelectList()Retrieves the list of selected objects.voidgetSmartPV(CPoint p1, CPoint p2)Adjusts the coordinates of the second point to align with the first point if they are close enough.double[]getSnap(double x, double y)Retrieves the snap coordinates based on the grid settings.java.util.VectorgetSpecificAngleList()Retrieves a list of specific angle constraints.intgetStatus()Retrieves the current status.voidgetTextLocation(CText t1)Determines the location for a text object.CTracegetTraceById(int id)Retrieves a trace by its ID.CTracegetTraceByPt(CPoint pt)Returns the trace object that contains the current tracking point.wprover.UndoStructgetUndoById(int id)Retrieves an UndoStruct object by its ID.intgetUndolistSize()Gets the size of the undo list.GTermgterm()Retrieves the GTerm object.booleanisDrawGrid()Checks if grid mode is enabled.booleanisFlashFinished()Checks whether the flash process is finished.booleanisitSaved()Checks if the current state is saved.CPointisPointAlreadyExists(CPoint p)Checks if a point already exists in the list.booleanisRedoAtEnd()Checks if the redo list is empty.booleanisSnap()Checks if snap mode is enabled.voidLoad_global(java.io.DataInputStream in)Loads the global state from the specified input stream.booleanLoadGGB2(java.io.DataInputStream in, java.lang.String path)Loads a GeoGebra file and processes its construction steps.CPointMeetCCToDefineAPoint(Circle c1, Circle c2, boolean m, double x, double y)Finds or creates a point at the intersection of two circles.CPointMeetDefineAPoint(CLine line1, CLine line2)Finds or creates a point at the intersection of two lines.CPointMeetDefineAPoint(CLine line1, CLine line2, boolean unique)Finds or creates a point at the intersection of two lines, optionally ensuring uniqueness.CPointMeetLCToDefineAPoint(CLine line, Circle c, boolean m, double x, double y)Finds or creates a point at the intersection of a line and a circle.CPointmeetTwoObject(java.lang.Object obj1, java.lang.Object obj2, boolean d, double x, double y)Finds the intersection point of two geometric objects.voidmoveCatch(double x, double y)Moves the catch point to the specified coordinates, considering points, lines, and circles.voidmoveUndoObjectFromList(java.util.Vector v1, java.util.Vector v2, int pc1, int pc2)Moves undo objects from one list to another based on their IDs.booleanmulSolutionSelect(CPoint p)Selects multiple solutions for a given point.booleanneed_save()Checks if the current state needs to be saved.booleannextProveStep()Proceeds to the next step in the proof process.voidobjectsListMoved(java.util.Vector list, double dx, double dy)Moves all objects in the list by the given delta values.java.util.VectorOnCatch(double x, double y)Selects objects based on coordinates and adds them to the catch list.voidonDBClick(CClass c)Handles double-click events on a CClass object.java.io.DataOutputStreamopenOutputFile(java.lang.String path)Opens an output file at the specified path.voidoptmizePolynomial()Optimizes the polynomial list.voidpaintPoint(java.awt.Graphics g)Paints the current drawing scene including grid, undo objects, various shape lists, flashes, points, texts, and catch objects.voidPolygonTransPointsCreated(CPolygon poly)Translates the polygon's points and creates corresponding oriented segments.voidpopLeadingVariableDialog()Opens the dialog for selecting the leading variable.java.lang.ObjectpopSelect(java.util.Vector v, int x, int y)Displays a selection dialog if multiple objects are selected.intprint(java.awt.Graphics graphics, java.awt.print.PageFormat pageFormat, int pageIndex)Prints the drawing on the specified page.voidPrintContent()Prints the content of the current drawing.voidprintNDGS()Prints the nondegenerate conditions derived from the TPoly list.voidprove_run_to_end()Runs the proof process to the end.voidprovePlay(int num)Starts the proof play with a specified timer interval.voidproveStop()Stops the proof play.voidpushbackup()Backs up the current parameter values.voidre_generate_all_poly()Regenerates all polynomial representations, clears current constraints, and optimizes polynomials based on the existing constraints.voidrecal_allFlash()Recalculates all flash animations in the flash list.booleanreCalculate()Recalculates the diagram by transforming all points and updating parameters.voidredo()Performs a redo operation.wprover.UndoStructredo_step()Performs a redo step with flash clearing enabled by default.wprover.UndoStructredo_step(boolean cf)Performs a redo step with the option to clear the flash display.booleanredo_step(wprover.UndoStruct Undo)Performs a redo step for the provided undo structure.TMonoreduce(TMono m)Reduces a given TMono object using the current parameters.voidremoveConstraintFromList(Constraint cs)Removes a constraint from the constraint list.voidRemoveDiagramUpdaterListener(DiagramUpdater d)Removes a DiagramUpdater listener from the list of updater listeners.voidrepaint()Requests a repaint of the panel.voidresetAux()Resets auxiliary counters and performs an undo step.voidresetUndo()Resets the current undo structure's ID to the current ID count.voidRightMenuPopup(double x, double y)Displays a right-click context menu at the specified coordinates.doubleroundn(double r, int n)Rounds a double value to a specified number of decimal places.booleanrun_to_prove(wprover.UndoStruct u, wprover.UndoStruct u1)Runs the proof process to a specific step.voidrunto()Runs the proof process to the current undo structure.voidrunto1(wprover.UndoStruct u)Runs the proof process to a specific undo structure.voidSave_global(java.io.DataOutputStream out)Saves the global state to the specified output stream.CircleSelectACircle(double x, double y)Selects a circle from the drawing that is near the specified coordinates.CLineSelectALine(double x, double y)Selects a line from the drawing that is near the specified coordinates.voidSelectAllFromXY(java.util.Vector v, double x, double y, int type)Selects all objects from various lists based on coordinates and type.CPointSelectAPoint(double x, double y)Selects a point from the drawing that is near the specified coordinates.CPolygonSelectAPolygon(double x, double y)Selects a polygon that contains the specified point.voidSelectByRect(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).CClassSelectFromAList(java.util.Vector list, double x, double y)Selects the first object from the given list that is hit by the specified coordinates.voidSelectFromAList(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.voidSelectNameText(java.util.Vector v, double x, double y)Selects text objects based on coordinates.CClassSelectOneFromXY(double x, double y, int type)Selects a single object from various lists based on coordinates and type.voidselectUndoObjectFromList(java.util.Vector v1, java.util.Vector v2, int pc1, int pc2)Selects undo objects from one list to another based on their IDs.voidsetCalMode0()Sets the calculation mode to 0.voidsetCalMode1()Sets the calculation mode to 1.voidSetCurrentAction(int type)Sets the current action type and updates the UI accordingly.voidsetCurrentDrawPanel(javax.swing.JPanel panel)Sets the current drawing panel.voidsetCurrentInstance(GExpert gx)Sets the current geometry expert instance and updates the drawing panel accordingly.voidsetcurrentStatus(int status)Sets the current status.voidSetDimension(double x, double y)Sets the dimensions of the drawing area.voidsetFile(java.io.File f)Sets the current file.voidsetFirstPnt(double x, double y)Sets the first point for transformation and updates the translation offsets.voidSetGrid(boolean grid)Sets the grid mode.voidsetMeshStep(boolean add)Adjusts the mesh step size.voidsetName(java.lang.String s)Sets the name of the current object.voidsetObjectListForFlash(java.util.Vector list)Sets a list of objects for flash display using the default panel.voidsetObjectListForFlash(java.util.Vector list, javax.swing.JPanel p)Sets a list of objects for flash display on the specified panel.voidsetObjectListForFlash(CClass cc)Creates a flash effect for a single graphical object by wrapping it in a vector and invoking the flash display mechanism.voidsetParameter(double[] r)Sets the parameter values.voidsetParameter(int v1, int v2)Sets the parameters for the drawing process.voidsetParameterValue(double[] dd)Sets the parameter values and translates points back if necessary.voidsetRecal(boolean r)Sets the recalculation flag.voidsetSavedTag()Sets the saved tag to indicate that the current state is saved.voidsetSmartPVLine(CPoint p1, CPoint p2)Adjusts the position of point p2 relative to point p1 to enforce a smart horizontal or vertical alignment.voidSetSnap(boolean snap)Sets the snap mode.voidsetStatus(int t)Sets the current status.voidsetTimerDelay(int delay)Sets the delay for the timer.voidsetTransformStatus(int t)Sets the transformation status and updates related points and selections.voidsetUndoListForFlash(java.util.Vector list)Extracts all flashable objects from each undo structure in the provided list and sets them for flash display.voidsetUndoListForFlash1(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.voidsetUndoStructForDisPlay(wprover.UndoStruct u, boolean compulsory_flash)Sets the undo structure for display.voidSetVarable()Sets variables for the points in the list.booleanSmart(CPoint p, double x, double y)Sets the given point to the specified coordinates and checks if it is on any geometric object.CPointSmartAddPoint(double x, double y)Adds a new point to the drawing at the specified coordinates.CPointSmartAddPoint(double x, double y, java.lang.String name)Adds a new point to the drawing at the specified coordinates with a given name.CPointSmartgetApointFromXY(double x, double y)Adds a point at the specified coordinates.CPointSmartgetApointFromXY(double x, double y, java.lang.String name)Adds a point with the specified name at the given coordinates.voidSmartmoveCatch(double x, double y)Moves the catch point to the specified coordinates, considering all types of objects.voidSmartmoveCatch(double x, double y, int type)Moves the catch point to the specified coordinates, considering specific types of objects.voidSmartmoveCatchLine(double x, double y)Moves the catch point to the specified coordinates if a line is found at those coordinates.voidSmartmoveCatchPt(double x, double y)Moves the catch point to the specified coordinates if a point is found at those coordinates.CircleSmartPCircle(CPoint p)Finds a circle in the drawing that contains the given point.CLineSmartPLine(CPoint p)Finds a line in the drawing that contains the given point.CPointSmartPoint(CPoint p)Finds a point in the drawing that matches the given point's coordinates.CLineSmartPointOnLine(double x, double y)Finds a line in the drawing that is near the given coordinates.voidsmartPVDragLine()Adjusts the position of a free-moving point along its connecting line segments to ensure proper alignment.voidstartFlash()Starts the flashing process for flash items in the flash list.voidstartTrackPt(CPoint pt)Starts tracking a given point.voidstateChange()Toggles the status state.voidstopTrack()Stops tracking the current point.voidstopUndoFlash()Stops any active undo flash display by clearing the flash queue.voidtranslate_back(double x1, double y1, double sin, double cos)Translates all points back to their original positions after transformation.voidUndo()Performs an undo operation.booleanundo_step(wprover.UndoStruct Undo)Performs a single undo step.booleanundo_step(wprover.UndoStruct Undo, boolean rg)Performs a single undo step with an option to regenerate and recalculate.booleanUndo_step()Performs an undo step.booleanUndo_stepPure()Performs a pure undo step.voidUndoAdded()Adds a default undo action with a generic message.wprover.UndoStructUndoAdded(java.lang.Object tip)Adds an undo action with a specified tip message.wprover.UndoStructUndoAdded(java.lang.Object tip, boolean gr)Adds an undo action with a specified tip message and a flag to generate proof.wprover.UndoStructUndoAdded(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.voidUndoPure()Performs a pure undo operation.voidupdateFlashDelay()Updates the delay for all flash objects in the flash list.voidviewElement(CClass obj)Displays the properties of the specified object in the dialog.booleanviewElementFromXY(double x, double y)Views an element from the specified coordinates.-
Methods inherited from class wprover.DrawBase
addCircle, addLine, check_cc_inter, check_lc_inter, check_same_side, check_triangle_inside, collv, containFreezedPoint, CreateATempPoint, decide_wu_identical, div_set, drawCatch, drawCatchInterCross, drawCatchObjName, drawCatchRect, drawcircle2p, drawCross, drawGrid, drawList, drawPerpFoot, drawpoint, drawPointNameLocation, drawPointOrCross, drawRect, drawSelect, drawTipRect, drawTipSquare, drawTipTirangle, drawTTFoot, fd_circle, fd_line, find_tmark, findCTMark, findPoint, getBounds, getCatchHVPoint, getPointList, getPoints, getPointSize, getPoolA, getPooln, getTMono, hvCatchPoint, intersect_cc, intersect_ll, isFrozen, isLineDrawn, isZero, near, printPoly, removeFromeListLastNElements, setAntiAlias, setCatchHVPoint, setCurrentDrawEnvironment, setLanguage, setMouseInside, signArea, unfreezeAllPoints, zoom_in, zoom_out
-
-
-
-
Field Detail
-
SELECT
public static final int SELECT
- See Also:
- Constant Field Values
-
MOVE
public static final int MOVE
- See Also:
- Constant Field Values
-
VIEWELEMENT
public static final int VIEWELEMENT
- See Also:
- Constant Field Values
-
TRANSLATE
public static final int TRANSLATE
- See Also:
- Constant Field Values
-
ZOOM_IN
public static final int ZOOM_IN
- See Also:
- Constant Field Values
-
ZOOM_OUT
public static final int ZOOM_OUT
- See Also:
- Constant Field Values
-
SETTRACK
public static final int SETTRACK
- See Also:
- Constant Field Values
-
ANIMATION
public static final int ANIMATION
- See Also:
- Constant Field Values
-
DEFINEPOLY
public static final int DEFINEPOLY
- See Also:
- Constant Field Values
-
MULSELECTSOLUTION
public static final int MULSELECTSOLUTION
- See Also:
- Constant Field Values
-
MOVENAME
public static final int MOVENAME
- See Also:
- Constant Field Values
-
AUTOSHOWSTEP
public static final int AUTOSHOWSTEP
- See Also:
- Constant Field Values
-
EQMARK
public static final int EQMARK
- See Also:
- Constant Field Values
-
PROVE
public static final int PROVE
- See Also:
- Constant Field Values
-
TRIANGLE
public static final int TRIANGLE
- See Also:
- Constant Field Values
-
HIDEOBJECT
public static final int HIDEOBJECT
- See Also:
- Constant Field Values
-
DRAWTRIALL
public static final int DRAWTRIALL
- See Also:
- Constant Field Values
-
DRAWTRISQISO
public static final int DRAWTRISQISO
- See Also:
- Constant Field Values
-
PARALLELOGRAM
public static final int PARALLELOGRAM
- See Also:
- Constant Field Values
-
RECTANGLE
public static final int RECTANGLE
- See Also:
- Constant Field Values
-
TRAPEZOID
public static final int TRAPEZOID
- See Also:
- Constant Field Values
-
RA_TRAPEZOID
public static final int RA_TRAPEZOID
- See Also:
- Constant Field Values
-
SETEQSIDE
public static final int SETEQSIDE
- See Also:
- Constant Field Values
-
SHOWOBJECT
public static final int SHOWOBJECT
- See Also:
- Constant Field Values
-
SETEQANGLE3P
public static final int SETEQANGLE3P
- See Also:
- Constant Field Values
-
SETCCTANGENT
public static final int SETCCTANGENT
- See Also:
- Constant Field Values
-
NTANGLE
public static final int NTANGLE
- See Also:
- Constant Field Values
-
SANGLE
public static final int SANGLE
- See Also:
- Constant Field Values
-
RATIO
public static final int RATIO
- See Also:
- Constant Field Values
-
RAMARK
public static final int RAMARK
- See Also:
- Constant Field Values
-
TRANSFORM
public static final int TRANSFORM
- See Also:
- Constant Field Values
-
EQUIVALENCE
public static final int EQUIVALENCE
- See Also:
- Constant Field Values
-
FREE_TRANSFORM
public static final int FREE_TRANSFORM
- See Also:
- Constant Field Values
-
LOCUS
public static final int LOCUS
- See Also:
- Constant Field Values
-
ARROW
public static final int ARROW
- See Also:
- Constant Field Values
-
CONSTRUCT_FROM_TEXT
public static final int CONSTRUCT_FROM_TEXT
- See Also:
- Constant Field Values
-
CTrackPt
protected CPoint CTrackPt
-
panel
protected javax.swing.JPanel panel
-
gt
protected GTerm gt
-
nd
protected int nd
-
U_Obj
protected wprover.UndoStruct U_Obj
-
status
protected boolean status
-
-
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 retrievev- 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 translationy1- the y-coordinate translationsin- the sine of the rotation anglecos- 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 valuesb- 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 adjustr- 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 calculated- 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 variablep- 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 indexzeron- 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 areay- 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 parameterv2- 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 pointp2- 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 structureu1- 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-coordinatey- 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-coordinatey- the y-coordinaten- the number of notches the mouse wheel was rotatedrt- 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-coordinatey- 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-coordinatey- 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 objectsx- the x-coordinatey- 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-coordinatey- the y-coordinate
-
DWMouseRightClick
public void DWMouseRightClick(double x, double y)Handles the right mouse button click event.- Parameters:
x- the x-coordinatey- 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 displayedy- 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 addedv2- the list from which objects are selectedx- the x-coordinate for selectiony- 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 addedx- the x-coordinate for selectiony- the y-coordinate for selectiontype- 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 addedx- the x-coordinate for selectiony- 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 selectiony- the y-coordinate for selectiontype- 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 pointp2- 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 selectiony- 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 checkln- 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:
DWButtonDownin classDrawBase- Parameters:
x- The x-coordinate of the mouse click, in screen or canvas coordinatesy- 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 calculationy- 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-coordinatey- 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 linep1- the first pointp2- 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:
actionPerformedin interfacejava.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 objectsx- the x-coordinatey- 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-coordinatey- 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 objectx- the x-coordinatey- the y-coordinate
-
SmartgetApointFromXY
public CPoint SmartgetApointFromXY(double x, double y)
Adds a point at the specified coordinates.- Parameters:
x- the x-coordinatey- 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-coordinatey- the y-coordinatename- 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 pointp2- 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 addlist- 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 rectangley1- the y-coordinate of the first corner of the rectanglex2- the x-coordinate of the opposite corner of the rectangley2- 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 releasedy- 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 dragy- 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 addedp1- the point from which the perpendicular foot is drawnp- 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 movedx- the delta x valuedy- 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-coordinatey- 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-coordinatey- 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-coordinatey- 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-coordinatey- 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-coordinatey- the y-coordinatetype- 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-coordinatey- 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-coordinatey- 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 setx- the x-coordinatey- 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-coordinatey- 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-coordinatey- the y-coordinatename- 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-coordinatey- 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-coordinatey- 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-coordinatey- 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 pointp2- the second pointp3- the third pointp4- 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 itemf2- the second JCgFlash itemf- 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:
trueif there are no flash items or the sole flash item has finished;falseotherwise
-
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 pointp2- 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 linep2- the target point for alignment and extensiong2- 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-coordinatey- the new y-coordinate
-
setTransformStatus
public void setTransformStatus(int t)
Sets the transformation status and updates related points and selections.When
tis 0, the selection is cleared. Whentis 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 polygonp2- the second polygont- the flash type identifierct- a flag for custom behaviorxc- the x coordinate for the flash centeryc- 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 pointy- the y coordinate of the starting pointk- the slope of the lineg2- 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 trianglep2- the second point defining the base of the trianglep- the point to be adjusted to form an isosceles triangletype- 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 squarep2- the second point on the squarep- 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 linep2- 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 matchy- 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 pointy- 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 pointy- the y-coordinate of the new pointname- 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 lineline2- 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 lineline2- the second lineunique- 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 linec- the circlem- whether to move the point to the given coordinatesx- the x-coordinate to move the point toy- 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 circlec2- the second circlem- whether to move the point to the given coordinatesx- the x-coordinate to move the point toy- 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 addln- 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 addc- the circle to add the point toun- 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 addline- 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 addline- the line to add the point toun- 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.IOExceptionOpens 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.IOExceptionSaves 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.IOExceptionLoads 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.PrinterExceptionPrints the drawing on the specified page.- Specified by:
printin interfacejava.awt.print.Printable- Parameters:
graphics- the graphics contextpageFormat- the page formatpageIndex- 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 actiongr- 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 actiongr- whether to generate proofm- 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 structurerg- 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 listv2- the source listpc1- the starting IDpc2- 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 listv2- the source listpc1- the starting IDpc2- 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 displaycompulsory_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 flashedp- 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 pointp2- the second pointp3- the third pointp4- 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 pointp2- the second pointp3- the third pointp4- 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 pointa- the second pointb- 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 pointa- 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 pointa- the second pointb- 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 pointa- 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 pointp1- the first radius pointp2- 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 pointb- the second pointc- 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 pointb- 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 pointp2- 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 roundn- 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 addedt- 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 lineln2- 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 linep2- the second point of the first linep3- the first point of the second linep4- 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 pointp2- the second reference pointpx- the original point for segment generationx- the transformed x-coordinatey- the transformed y-coordinate
-
LoadGGB2
public boolean LoadGGB2(java.io.DataInputStream in, java.lang.String path) throws java.io.IOExceptionLoads 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 filepath- 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)
-
-