Package wprover

Class CTrace


  • public class CTrace
    extends CClass
    CTrace is a class that represents a trace of points in a graphical application. It extends the CClass class and provides methods to manage and draw the trace.
    • Constructor Detail

      • CTrace

        public CTrace​(CPoint p)
        Constructs a CTrace object with the specified point.
        Parameters:
        p - the point associated with the trace
      • CTrace

        public CTrace​(CPoint p,
                      CPoint po,
                      CLine o)
        Constructs a CTrace object with the specified points and line.
        Parameters:
        p - the point associated with the trace
        po - the point on the line
        o - the line associated with the trace
      • CTrace

        public CTrace​(CPoint p,
                      CPoint po,
                      Circle o)
        Constructs a CTrace object with the specified points and circle.
        Parameters:
        p - the point associated with the trace
        po - the point on the circle
        o - the circle associated with the trace
    • Method Detail

      • isTracePt

        public boolean isTracePt​(CPoint pt)
        Checks if the specified point is the trace point.
        Parameters:
        pt - the point to check
        Returns:
        true if the specified point is the trace point, false otherwise
      • setDLns

        public void setDLns​(boolean r)
        Sets whether to draw lines for the trace.
        Parameters:
        r - true to draw lines, false otherwise
      • isDrawLines

        public boolean isDrawLines()
        Checks if lines are drawn for the trace.
        Returns:
        true if lines are drawn, false otherwise
      • setNumPts

        public void setNumPts​(int n)
        Sets the number of points for the trace.
        Parameters:
        n - the number of points
      • draw

        public void draw​(java.awt.Graphics2D g2,
                         boolean selected)
        Draws the trace using the specified Graphics2D object, with an option to select it.
        Parameters:
        g2 - the Graphics2D object
        selected - whether the trace is selected
      • drawALN

        public void drawALN​(int x,
                            int y,
                            int x1,
                            int y1,
                            java.awt.Graphics2D g2)
        Draws a line segment between two points using the specified Graphics2D object.
        Parameters:
        x - the x coordinate of the first point
        y - the y coordinate of the first point
        x1 - the x coordinate of the second point
        y1 - the y coordinate of the second point
        g2 - the Graphics2D object
      • draw

        public void draw​(java.awt.Graphics2D g2)
        Draws the trace using the specified Graphics2D object.
        Overrides:
        draw in class CClass
        Parameters:
        g2 - the Graphics2D object
      • TypeString

        public java.lang.String TypeString()
        Returns the type string of the trace.
        Specified by:
        TypeString in class CClass
        Returns:
        the type string of the trace
      • getDescription

        public java.lang.String getDescription()
        Returns the description of the trace.
        Specified by:
        getDescription in class CClass
        Returns:
        the description of the trace
      • select

        public boolean select​(double x,
                              double y)
        Selects the trace based on the specified coordinates.
        Parameters:
        x - the x coordinate
        y - the y coordinate
        Returns:
        true if the trace is selected, false otherwise
      • move

        public void move​(double dx,
                         double dy)
        Moves the trace by the specified delta values.
        Parameters:
        dx - the delta x value
        dy - the delta y value
      • SavePS

        public void SavePS​(java.io.FileOutputStream fp,
                           int stype)
                    throws java.io.IOException
        Saves the trace to a PostScript file.
        Specified by:
        SavePS in class CClass
        Parameters:
        fp - the FileOutputStream to write to
        stype - the stroke type
        Throws:
        java.io.IOException - if an I/O error occurs
      • Save

        public void Save​(java.io.DataOutputStream out)
                  throws java.io.IOException
        Saves the trace to a DataOutputStream.
        Overrides:
        Save in class CClass
        Parameters:
        out - the DataOutputStream to write to
        Throws:
        java.io.IOException - if an I/O error occurs
      • Load

        public void Load​(java.io.DataInputStream in,
                         DrawProcess dp)
                  throws java.io.IOException
        Loads the trace from a DataInputStream.
        Overrides:
        Load in class CClass
        Parameters:
        in - the DataInputStream to read from
        dp - the DrawProcess used for loading
        Throws:
        java.io.IOException - if an I/O error occurs
      • addTracePoint

        public void addTracePoint​(int i,
                                  double x,
                                  double y)
        Adds a trace point at the specified index with the given coordinates.
        Parameters:
        i - the index to add the trace point
        x - the x coordinate of the trace point
        y - the y coordinate of the trace point
      • addTracePoint

        public void addTracePoint​(int x,
                                  int y)
        Adds a trace point with the given coordinates.
        Parameters:
        x - the x coordinate of the trace point
        y - the y coordinate of the trace point
      • softEdge

        public void softEdge()
        Softens the edges of the trace.
      • soft

        public void soft​(int i)
        Softens the trace at the specified index.
        Parameters:
        i - the index to soften
      • Roud_length

        public double Roud_length()
        Calculates the round length of the trace.
        Returns:
        the round length of the trace
      • getPoint

        public CPoint getPoint()
        Returns the point associated with the trace.
        Returns:
        the point associated with the trace
      • getonPoint

        public CPoint getonPoint()
        Returns the point on the trace.
        Returns:
        the point on the trace
      • getOnObject

        public CClass getOnObject()
        Returns the object associated with the trace.
        Returns:
        the object associated with the trace
      • getPointSize

        public int getPointSize()
        Returns the number of points in the trace.
        Returns:
        the number of points in the trace