Package wprover

Class CDistance


  • public class CDistance
    extends CClass
    Represents a distance measurement between two points in a geometric context. This class extends CClass and provides methods for drawing, saving, and loading distance measurements.
    • Constructor Detail

      • CDistance

        public CDistance()
        Default constructor for CDistance.
      • CDistance

        public CDistance​(CPoint p1,
                         CPoint p2)
        Constructs a CDistance object with the specified start and end points.
        Parameters:
        p1 - the start point
        p2 - the end point
    • Method Detail

      • TypeString

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

        public java.lang.String getDescription()
        Gets the description of the distance.
        Specified by:
        getDescription in class CClass
        Returns:
        the description of the distance
      • drag

        public void drag​(double xx,
                         double yy)
        Drags the distance to a new position.
        Parameters:
        xx - the x-coordinate of the new position
        yy - the y-coordinate of the new position
      • select

        public boolean select​(double xx,
                              double yy)
        Selects the distance if the given coordinates are within its range.
        Parameters:
        xx - the x-coordinate
        yy - the y-coordinate
        Returns:
        true if the distance is selected, false otherwise
      • draw

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

        public void draw​(java.awt.Graphics2D g2,
                         boolean isSelected)
        Draws the distance with the option to highlight if selected.
        Parameters:
        g2 - the Graphics2D object
        isSelected - true if the distance is selected, false otherwise
      • SavePS

        public void SavePS​(java.io.FileOutputStream fp,
                           int stype)
                    throws java.io.IOException
        Saves the distance to a PostScript file.
        Specified by:
        SavePS in class CClass
        Parameters:
        fp - the file output stream
        stype - the show 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 distance data to an output stream.
        Overrides:
        Save in class CClass
        Parameters:
        out - the data output stream
        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 distance data from an input stream.
        Overrides:
        Load in class CClass
        Parameters:
        in - the data input stream
        dp - the draw process
        Throws:
        java.io.IOException - if an I/O error occurs