Package wprover
Class DrawData
- java.lang.Object
-
- wprover.DrawData
-
public class DrawData extends java.lang.ObjectDrawData 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.
-
-
Field Summary
Fields Modifier and Type Field Description static intanglecolorstatic intangledashstatic intanglewidthstatic intcindexjava.util.Vectorcolorliststatic intDASH8java.util.Vectordashliststatic intdindexstatic intLIGHTCOLORstatic intpointcolorstatic intpointcolor_decidedstatic intpointcolor_half_decidedstatic intpolygoncolorstatic intREDstatic inttractcolorstatic intWIDTH2java.util.Vectorwidthliststatic intwindex
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intaddColor(java.awt.Color co)Adds a new color to the color list if it is not already present.static java.awt.ColorgetColor(int index)Returns the color corresponding to the given index.static intgetColorCounter()Returns the number of available colors.static intgetColorIndex(java.awt.Color color)Returns the index of the specified color in the color list.static java.awt.ColorgetColorSinceRed(int n)Returns a color offset from the default angle color.static java.awt.ColorgetCurrentColor()Returns the current color based on the current color index.static doublegetDash(int index)Returns the dash value at the specified index.static intgetDashCounter()Returns the number of available dash configurations.static doublegetWidth(int index)Returns the width value at the specified index.static intgetWidthCounter()Returns the number of available widths.static voidLoad(java.io.DataInputStream in, DrawProcess dp)Loads color configurations from the specified data input stream.static voidreset()Resets the DrawData instance by reinitializing it to default values.static voidSave(java.io.DataOutputStream out)Saves additional color configurations to the specified data output stream.static voidSavePS(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 voidsetAuxStatus()Sets the color, dash, and width indices to the auxiliary status.static voidsetDefaultStatus()Resets the color, dash, and width indices to the default status.static voidsetProveStatus()Sets the color, dash, and width indices to the prove status.
-
-
-
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
public static final int pointcolor
- See Also:
- Constant Field Values
-
pointcolor_half_decided
public static final int pointcolor_half_decided
- See Also:
- Constant Field Values
-
pointcolor_decided
public static final int pointcolor_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.IOExceptionSaves the color, dash, and width configuration to the specified PostScript file.- Parameters:
vc- the vector containing color indicesvd- the vector containing dash indicesvw- the vector containing width indicesfp- the file output stream to write tostype- 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.IOExceptionSaves 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.IOExceptionLoads color configurations from the specified data input stream.- Parameters:
in- the data input stream to read fromdp- the DrawProcess instance used for object mapping- Throws:
java.io.IOException- if an I/O error occurs while reading
-
-