Package wprover
Class CTrace
- java.lang.Object
-
- wprover.CClass
-
- wprover.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 Summary
Constructors Constructor Description CTrace(CPoint p)Constructs a CTrace object with the specified point.CTrace(CPoint p, CPoint po, Circle o)Constructs a CTrace object with the specified points and circle.CTrace(CPoint p, CPoint po, CLine o)Constructs a CTrace object with the specified points and line.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddTracePoint(int i, double x, double y)Adds a trace point at the specified index with the given coordinates.voidaddTracePoint(int x, int y)Adds a trace point with the given coordinates.voiddraw(java.awt.Graphics2D g2)Draws the trace using the specified Graphics2D object.voiddraw(java.awt.Graphics2D g2, boolean selected)Draws the trace using the specified Graphics2D object, with an option to select it.voiddrawALN(int x, int y, int x1, int y1, java.awt.Graphics2D g2)Draws a line segment between two points using the specified Graphics2D object.java.lang.StringgetDescription()Returns the description of the trace.CClassgetOnObject()Returns the object associated with the trace.CPointgetonPoint()Returns the point on the trace.CPointgetPoint()Returns the point associated with the trace.intgetPointSize()Returns the number of points in the trace.booleanisDrawLines()Checks if lines are drawn for the trace.booleanisTracePt(CPoint pt)Checks if the specified point is the trace point.voidLoad(java.io.DataInputStream in, DrawProcess dp)Loads the trace from a DataInputStream.voidmove(double dx, double dy)Moves the trace by the specified delta values.doubleRoud_length()Calculates the round length of the trace.voidSave(java.io.DataOutputStream out)Saves the trace to a DataOutputStream.voidSavePS(java.io.FileOutputStream fp, int stype)Saves the trace to a PostScript file.booleanselect(double x, double y)Selects the trace based on the specified coordinates.voidsetDLns(boolean r)Sets whether to draw lines for the trace.voidsetNumPts(int n)Sets the number of points for the trace.voidsoft(int i)Softens the trace at the specified index.voidsoftEdge()Softens the edges of the trace.java.lang.StringTypeString()Returns the type string of the trace.-
Methods inherited from class wprover.CClass
copy, get_type, getColor, getColorIndex, getname, getPSLineString, hasNameSet, isdraw, saveSuper, saveSuperColor, setAttr, setAttrAux, setColor, setDash, setInFlashing, setWidth, stopFlash, toString, visible
-
-
-
-
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 tracepo- the point on the lineo- the line 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 objectselected- 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 pointy- the y coordinate of the first pointx1- the x coordinate of the second pointy1- the y coordinate of the second pointg2- the Graphics2D object
-
draw
public void draw(java.awt.Graphics2D g2)
Draws the trace using the specified Graphics2D object.
-
TypeString
public java.lang.String TypeString()
Returns the type string of the trace.- Specified by:
TypeStringin classCClass- Returns:
- the type string of the trace
-
getDescription
public java.lang.String getDescription()
Returns the description of the trace.- Specified by:
getDescriptionin classCClass- 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 coordinatey- 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 valuedy- the delta y value
-
SavePS
public void SavePS(java.io.FileOutputStream fp, int stype) throws java.io.IOExceptionSaves the trace to a PostScript file.
-
Save
public void Save(java.io.DataOutputStream out) throws java.io.IOExceptionSaves the trace to a DataOutputStream.
-
Load
public void Load(java.io.DataInputStream in, DrawProcess dp) throws java.io.IOExceptionLoads the trace from a DataInputStream.
-
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 pointx- the x coordinate of the trace pointy- 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 pointy- 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
-
-