-
Notifications
You must be signed in to change notification settings - Fork 1
/
EdgeUML.java
55 lines (43 loc) · 1.06 KB
/
EdgeUML.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.awt.geom.Point2D;
public class EdgeUML extends AbstractEdge {
private static final long serialVersionUID = 1L;
@Override
public void draw(Graphics2D g2) {
// TODO Auto-generated method stub
Line2D l = getConnectionPoints();
Point2D p1 = l.getP1();
Point2D p2 = l.getP2();
Double xDist = p1.getX() - p2.getX();
Double yDist = p1.getY() - p2.getY();
Double s2x, s2y, f2x, f2y;
Point2D temp;
if ( Math.abs(xDist) < Math.abs(yDist) )
{
s2x = p1.getX() - xDist/2;
s2y = p1.getY();
f2x = p1.getX() - xDist/2;
f2y = p2.getY();
}else{
s2x = p1.getX();
s2y = p2.getY() + yDist/2;
f2x = p2.getX();
f2y = p2.getY() + yDist/2;
}
g2.draw( new Line2D.Double(
p1.getX(), p1.getY(),
s2x, s2y) );
g2.draw( new Line2D.Double(
s2x, s2y,
f2x, f2y) );
g2.draw( new Line2D.Double(
f2x, f2y, p2.getX(), p2.getY()
) );
}
@Override
public boolean contains(Point2D aPoint) {
// TODO Auto-generated method stub
return false;
}
}