-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPointNode.java
57 lines (49 loc) · 962 Bytes
/
PointNode.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
56
57
import java.awt.*;
import java.awt.geom.*;
/**
An inivisible node that is used in the toolbar to draw an
edge.
*/
public class PointNode implements Node
{
/**
Constructs a point node with coordinates (0, 0)
*/
public PointNode()
{
point = new Point2D.Double();
}
public void draw(Graphics2D g2)
{
}
public void translate(double dx, double dy)
{
point.setLocation(point.getX() + dx,
point.getY() + dy);
}
public boolean contains(Point2D p)
{
return false;
}
public Rectangle2D getBounds()
{
return new Rectangle2D.Double(point.getX(),
point.getY(), 0, 0);
}
public Point2D getConnectionPoint(Point2D other)
{
return point;
}
public Object clone()
{
try
{
return super.clone();
}
catch (CloneNotSupportedException exception)
{
return null;
}
}
private Point2D point;
}