Package wprover

Class DrawData


  • public class DrawData
    extends java.lang.Object
    DrawData is a utility class that manages color, dash, and width configurations for drawing operations. It provides methods to add colors, retrieve color and dash values, and save/load configurations.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int addColor​(java.awt.Color co)
      Adds a new color to the color list if it is not already present.
      static java.awt.Color getColor​(int index)
      Returns the color corresponding to the given index.
      static int getColorCounter()
      Returns the number of available colors.
      static int getColorIndex​(java.awt.Color color)
      Returns the index of the specified color in the color list.
      static java.awt.Color getColorSinceRed​(int n)
      Returns a color offset from the default angle color.
      static java.awt.Color getCurrentColor()
      Returns the current color based on the current color index.
      static double getDash​(int index)
      Returns the dash value at the specified index.
      static int getDashCounter()
      Returns the number of available dash configurations.
      static double getWidth​(int index)
      Returns the width value at the specified index.
      static int getWidthCounter()
      Returns the number of available widths.
      static void Load​(java.io.DataInputStream in, DrawProcess dp)
      Loads color configurations from the specified data input stream.
      static void reset()
      Resets the DrawData instance by reinitializing it to default values.
      static void Save​(java.io.DataOutputStream out)
      Saves additional color configurations to the specified data output stream.
      static void SavePS​(java.util.Vector vc, java.util.Vector vd, java.util.Vector vw, java.io.FileOutputStream fp, int stype)
      Saves the color, dash, and width configuration to the specified PostScript file.
      static void setAuxStatus()
      Sets the color, dash, and width indices to the auxiliary status.
      static void setDefaultStatus()
      Resets the color, dash, and width indices to the default status.
      static void setProveStatus()
      Sets the color, dash, and width indices to the prove status.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • RED

        public static int RED
      • DASH8

        public static int DASH8
      • WIDTH2

        public static int WIDTH2
      • LIGHTCOLOR

        public static int LIGHTCOLOR
      • cindex

        public static int cindex
      • dindex

        public static int dindex
      • windex

        public static int windex
      • pointcolor_half_decided

        public static final int pointcolor_half_decided
        See Also:
        Constant Field Values
      • polygoncolor

        public static int polygoncolor
      • anglecolor

        public static int anglecolor
      • anglewidth

        public static int anglewidth
      • angledash

        public static int angledash
      • tractcolor

        public static int tractcolor
      • colorlist

        public java.util.Vector colorlist
      • dashlist

        public java.util.Vector dashlist
      • widthlist

        public java.util.Vector widthlist
    • Method Detail

      • getWidthCounter

        public static int getWidthCounter()
        Returns the number of available widths.
        Returns:
        the total width count
      • getWidth

        public static double getWidth​(int index)
        Returns the width value at the specified index.
        Parameters:
        index - the index of the width value to retrieve
        Returns:
        the width value as a double
      • getDashCounter

        public static int getDashCounter()
        Returns the number of available dash configurations.
        Returns:
        the total dash count
      • getDash

        public static double getDash​(int index)
        Returns the dash value at the specified index.
        Parameters:
        index - the index of the dash value to retrieve
        Returns:
        the dash value as a double
      • getColorCounter

        public static int getColorCounter()
        Returns the number of available colors.
        Returns:
        the total color count
      • getColorSinceRed

        public static java.awt.Color getColorSinceRed​(int n)
        Returns a color offset from the default angle color.
        Parameters:
        n - the offset from the angle color index
        Returns:
        the calculated Color object
      • getColor

        public static java.awt.Color getColor​(int index)
        Returns the color corresponding to the given index. The index wraps around the color list.
        Parameters:
        index - the index of the color to retrieve
        Returns:
        the Color object, or null if index is negative
      • addColor

        public static int addColor​(java.awt.Color co)
        Adds a new color to the color list if it is not already present.
        Parameters:
        co - the Color to add
        Returns:
        the new total count of colors, or the existing index plus one if already present
      • setDefaultStatus

        public static void setDefaultStatus()
        Resets the color, dash, and width indices to the default status.
      • setProveStatus

        public static void setProveStatus()
        Sets the color, dash, and width indices to the prove status.
      • setAuxStatus

        public static void setAuxStatus()
        Sets the color, dash, and width indices to the auxiliary status.
      • getColorIndex

        public static int getColorIndex​(java.awt.Color color)
        Returns the index of the specified color in the color list.
        Parameters:
        color - the Color to search for
        Returns:
        the index of the color, or -1 if not found
      • getCurrentColor

        public static java.awt.Color getCurrentColor()
        Returns the current color based on the current color index.
        Returns:
        the current Color object
      • reset

        public static void reset()
        Resets the DrawData instance by reinitializing it to default values.
      • SavePS

        public static void SavePS​(java.util.Vector vc,
                                  java.util.Vector vd,
                                  java.util.Vector vw,
                                  java.io.FileOutputStream fp,
                                  int stype)
                           throws java.io.IOException
        Saves the color, dash, and width configuration to the specified PostScript file.
        Parameters:
        vc - the vector containing color indices
        vd - the vector containing dash indices
        vw - the vector containing width indices
        fp - the file output stream to write to
        stype - the style type (0 for color, 1 for gray, 2 for black & white)
        Throws:
        java.io.IOException - if an I/O error occurs while writing
      • Save

        public static void Save​(java.io.DataOutputStream out)
                         throws java.io.IOException
        Saves additional color configurations to the specified data output stream.
        Parameters:
        out - the data output stream to write to
        Throws:
        java.io.IOException - if an I/O error occurs while writing
      • Load

        public static void Load​(java.io.DataInputStream in,
                                DrawProcess dp)
                         throws java.io.IOException
        Loads color configurations from the specified data input stream.
        Parameters:
        in - the data input stream to read from
        dp - the DrawProcess instance used for object mapping
        Throws:
        java.io.IOException - if an I/O error occurs while reading