|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectdesigntools.Wire
Class to represent a wire which is internally represented as a set of points
| Constructor Summary | |
Wire(java.awt.Point startPoint,
java.awt.Color colour,
Workspace workspace)
Wire constructor |
|
| Method Summary | |
void |
connect(java.awt.Point point)
If wire starts / ends at an input/output connection of a circuit component update the variables sourceComponent or targetComponent |
boolean |
disconnect(CircuitComponent comp)
If this wire connects to comp, update the other end and return true, else false. |
void |
draw(java.awt.Graphics2D g)
Draw the wire. |
ConnectedWires |
getConnectedWires()
|
int |
getPointCount()
|
boolean |
isWirePoint(java.awt.Point point)
|
void |
lineTo(java.awt.Point bendPoint)
Add a significant point to the wire. |
void |
removeLastPoint()
If the wire consists of more that one point calling this procedure removed the last point recorded |
void |
removePoint(java.awt.Point bendPoint)
Remove a point from the wire |
void |
removeWire()
Removes wire from workspace and updates connected components accordingly. |
void |
setSelected(boolean selected)
Indicate if the wire is selected by the user |
void |
sketchLineTo(java.awt.Point mousePoint)
This sketches a line from the last wire bend / start to the current mouse position It is needed to show the user the wire section they are drawing. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Wire(java.awt.Point startPoint,
java.awt.Color colour,
Workspace workspace)
startPoint - Wire start pointcolour - Colour of wireworkspace - Workspace onto which the wire will be placed.
Required for checking Circuit Components being connected| Method Detail |
public void connect(java.awt.Point point)
point - The wire pointpublic ConnectedWires getConnectedWires()
public void lineTo(java.awt.Point bendPoint)
bendPoint - The point to addpublic void sketchLineTo(java.awt.Point mousePoint)
mousePoint - Current point of mouse to which a line should be sketchedpublic void removePoint(java.awt.Point bendPoint)
bendPoint - The point to removepublic void removeLastPoint()
public void setSelected(boolean selected)
selected - true if wire is selectedpublic int getPointCount()
public boolean isWirePoint(java.awt.Point point)
point - The point to test
public void draw(java.awt.Graphics2D g)
g - Graphics Objectpublic void removeWire()
public boolean disconnect(CircuitComponent comp)
comp - The circuit component to disconnect from the wire
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||