|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectkaapo.Observable
kaapo.project.DiagramComponentWrapper
kaapo.project.ConnectionWrapper
public class ConnectionWrapper
An ConnectionWrapper is used to wrap a Connection. Wrappers contain all the metainformation for a Connection such as its path and connection ends. This way it is possible to include a Connection into several different Diagrams easily just by creating multiple wrappers for it.
All connection wrappers are directed: they have a start point and an end point. This is true even for connections that aren't logically directed, e.g. non-directed network arcs. Connections are between two components; n-ary connections are not supported by this class.
The connection may be between two elements, two connections or any combination of them. Also, either or both end points of the connection may be empty.
Field Summary |
---|
Fields inherited from class kaapo.project.DiagramComponentWrapper |
---|
dcgraphics, dComponent, inConnections, outConnections |
Constructor Summary | |
---|---|
ConnectionWrapper(Connection connection,
DiagramComponentWrapper startComponent,
DiagramComponentWrapper endComponent,
Point2D[] path)
Constructs a new ConnectionWrapper . |
Method Summary | |
---|---|
void |
addPathSegment(boolean toStart)
Adds a segment either to the start or end of the path. |
static double[][] |
calcUnitVectors(double startX,
double startY,
double endX,
double endY)
Calculate orthogonal unit vectors v and w based on the line given as parameter. |
static double[][] |
calcUnitVectors(Point2D startPoint,
Point2D endPoint)
Calculate orthogonal unit vectors v and w based on the line given as parameter. |
void |
generatePathBetween(Point2D startPoint,
Point2D endPoint)
Generates a path between the two points given and calls setPath() with the new path as parameter. |
DiagramComponentWrapper |
getEndComponent()
Returns the end component wrapper. |
Point2D |
getEndPoint()
Returns the ending point of the connection. |
Point2D[] |
getPath()
Returns the connection path. |
DiagramComponentWrapper |
getStartComponent()
Returns the start component wrapper. |
Point2D |
getStartPoint()
Returns the starting point of the connection. |
boolean |
isDirect()
Tells whether the connection is direct. |
void |
movePathSegment(int pathIndex,
Point2D change)
Moves the specified segment in the path by the given amount. |
void |
moveXY(double changeX,
double changeY,
Selection selection)
Moves the conection path. |
void |
setEndComponent(DiagramComponentWrapper endComponent,
boolean updateComponents)
Sets the end component wrapper. |
void |
setPath(Point2D[] path)
Sets the path to a completely new path. |
void |
setStartComponent(DiagramComponentWrapper startComponent,
boolean updateComponents)
Sets the start component. |
Methods inherited from class kaapo.project.DiagramComponentWrapper |
---|
addConnection, canMove, canResize, getDCGraphics, getDiagramComponent, getInConnections, getOutConnections, reinstateConnections, removeAllConnections, removeConnection |
Methods inherited from class kaapo.Observable |
---|
addObserver, notifyObservers, notifyObservers, removeAllObservers, removeObserver, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConnectionWrapper(Connection connection, DiagramComponentWrapper startComponent, DiagramComponentWrapper endComponent, Point2D[] path)
ConnectionWrapper
.
connection
- the Connection
startComponent
- the start elementendComponent
- the end elementpath
- the path to followMethod Detail |
---|
public DiagramComponentWrapper getStartComponent()
public void setStartComponent(DiagramComponentWrapper startComponent, boolean updateComponents)
startComponent
- The startComponent to set.updateComponents
- public DiagramComponentWrapper getEndComponent()
public void setEndComponent(DiagramComponentWrapper endComponent, boolean updateComponents)
endComponent
- The endComponent to set.public Point2D[] getPath()
public void setPath(Point2D[] path)
path
- The new path to set.public void generatePathBetween(Point2D startPoint, Point2D endPoint)
startPoint
- The starting point for the new path.endPoint
- The ending point for the new path.public void movePathSegment(int pathIndex, Point2D change)
pathIndex
- The number of the segment to be moved.change
- The amount by which the segment is to be moved.public void addPathSegment(boolean toStart)
toStart
- A value of true adds a segment to the
start of the path. False adds it to the end.public void moveXY(double changeX, double changeY, Selection selection)
moveXY
in class DiagramComponentWrapper
changeX
- change in xchangeY
- change in yselection
- all the moved DiagramComponentsDiagramComponentWrapper.moveXY(double, double, Selection)
public boolean isDirect()
public Point2D getStartPoint()
public static double[][] calcUnitVectors(double startX, double startY, double endX, double endY)
This is an assistant method for connection-related classes.
startX
- the x coordinate of the start pointstartY
- the y coordinate of the start pointendX
- the x coordinate of the end pointendY
- the y coordinate of the end point
public static double[][] calcUnitVectors(Point2D startPoint, Point2D endPoint)
This is an assistant method for connection-related classes.
startPoint
- the x coordinates of the start pointendPoint
- the y coordinates of the start point
public Point2D getEndPoint()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |