Package wprover

Class CArrow


  • public class CArrow
    extends CClass
    Represents an arrow in a geometric drawing. The arrow is defined by its starting and ending points, angle, and length.
    • Field Detail

      • ANGLE

        public static int ANGLE
      • LENGTH

        public static int LENGTH
    • Constructor Detail

      • CArrow

        public CArrow​(CPoint p1,
                      CPoint p2)
        Constructs a CArrow object.
        Parameters:
        p1 - the starting point of the arrow
        p2 - the ending point of the arrow
    • Method Detail

      • TypeString

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

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

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

        public double getK()
        Gets the slope of the arrow.
        Returns:
        the slope of the arrow
      • distance

        public double distance​(double x,
                               double y)
        Calculates the distance from the given coordinates to the arrow.
        Parameters:
        x - the x-coordinate
        y - the y-coordinate
        Returns:
        the distance to the arrow
      • SavePS

        public void SavePS​(java.io.FileOutputStream fp,
                           int stype)
                    throws java.io.IOException
        Saves the arrow 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 arrow 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 arrow 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