|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.acm.seguin.uml.line.SegmentedLine
public class SegmentedLine
SegmentedLine.
For future builds, it may be worth considering caching the points above and below the line for an efficiency increase when there are lots of lines to paint.
Field Summary | |
---|---|
protected double |
scalingFactor
Description of the Field |
protected Vertex[] |
vertices
The set of vertices on the line |
protected int[] |
Xs
This array is used only during the paint method for drawing polylines |
protected int[] |
Ys
This array is used only during the paint method for drawing polylines |
Constructor Summary | |
---|---|
SegmentedLine(EndPointPanel start,
EndPointPanel end)
Constructor for the SegmentedLine object |
Method Summary | |
---|---|
void |
componentHidden(java.awt.event.ComponentEvent cevt)
Description of the Method |
void |
componentMoved(java.awt.event.ComponentEvent cevt)
Description of the Method |
void |
componentResized(java.awt.event.ComponentEvent cevt)
Description of the Method |
void |
componentShown(java.awt.event.ComponentEvent cevt)
Description of the Method |
void |
drag(java.awt.Point point)
Drag the current vertex |
protected void |
drawArrow(java.awt.Graphics2D g)
Draws the arrow and the last segment |
void |
drop()
The point was dropped |
protected java.awt.Point |
getArrowPointAbove()
Determine the point at which the last segment should stop |
protected java.awt.Point |
getArrowPointBelow()
Determine the point at which the last segment should stop |
protected java.awt.Color |
getColor()
|
EndPointPanel |
getEndPanel()
|
protected java.awt.Point |
getShortPoint()
Determine the point at which the last segment should stop |
EndPointPanel |
getStartPanel()
|
protected java.awt.Stroke |
getStroke()
|
boolean |
hit(java.awt.Point attempt)
Description of the Method |
boolean |
isBothEndsSelected()
Determines if both the start and end points are selected |
void |
load(java.lang.String buffer)
Loads a segmented line from a buffer |
boolean |
match(EndPointPanel start,
EndPointPanel end)
Determines whether this panel matches the two desired end points |
void |
paint(java.awt.Graphics g)
Draws the segmented line |
void |
save(java.io.PrintWriter output)
Saves a segmented to the output stream |
protected void |
saveEndPanel(java.io.PrintWriter output)
Saves the end panel |
protected void |
savePanel(java.io.PrintWriter output,
EndPointPanel panel)
Saves a panel |
protected void |
saveStartPanel(java.io.PrintWriter output)
Saves the start panel |
protected void |
saveVertices(java.io.PrintWriter output)
Saves the vertices |
void |
scale(double value)
Scales the entire line |
void |
select(boolean way)
Description of the Method |
void |
shift(int x,
int y)
Shifts the entire line |
protected void |
updateEnd()
Updates the location of the end vertex |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Vertex[] vertices
protected int[] Xs
protected int[] Ys
protected double scalingFactor
Constructor Detail |
---|
public SegmentedLine(EndPointPanel start, EndPointPanel end)
start
- Panel that the segmented line starts atend
- End point of the panelMethod Detail |
---|
public boolean isBothEndsSelected()
public EndPointPanel getStartPanel()
public EndPointPanel getEndPanel()
public void paint(java.awt.Graphics g)
g
- Description of Parameterprotected java.awt.Stroke getStroke()
public void select(boolean way)
way
- Description of Parameterpublic boolean hit(java.awt.Point attempt)
attempt
- Description of Parameter
public void drag(java.awt.Point point)
point
- New location of the current vertexpublic void drop()
public void componentHidden(java.awt.event.ComponentEvent cevt)
componentHidden
in interface java.awt.event.ComponentListener
cevt
- Description of Parameterpublic void componentMoved(java.awt.event.ComponentEvent cevt)
componentMoved
in interface java.awt.event.ComponentListener
cevt
- Description of Parameterpublic void componentResized(java.awt.event.ComponentEvent cevt)
componentResized
in interface java.awt.event.ComponentListener
cevt
- Description of Parameterpublic void componentShown(java.awt.event.ComponentEvent cevt)
componentShown
in interface java.awt.event.ComponentListener
cevt
- Description of Parameterpublic void save(java.io.PrintWriter output)
output
- the output streampublic boolean match(EndPointPanel start, EndPointPanel end)
start
- the starting panel to be matchedend
- the ending panel to be matched
public void load(java.lang.String buffer)
buffer
- the buffer containing the verticespublic void shift(int x, int y)
x
- the amount to shift in the x coordinatey
- the amount to shift in the y coordinatepublic void scale(double value)
value
- the amount to scaleprotected java.awt.Point getShortPoint()
protected java.awt.Point getArrowPointAbove()
protected java.awt.Point getArrowPointBelow()
protected void updateEnd()
protected java.awt.Color getColor()
protected void drawArrow(java.awt.Graphics2D g)
g
- the graphics objectprotected void saveStartPanel(java.io.PrintWriter output)
output
- the output streamprotected void saveEndPanel(java.io.PrintWriter output)
output
- the output streamprotected void savePanel(java.io.PrintWriter output, EndPointPanel panel)
output
- the output streampanel
- the panel to be savedprotected void saveVertices(java.io.PrintWriter output)
output
- the output stream
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |