-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPort.java
86 lines (73 loc) · 1.87 KB
/
Port.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import java.awt.Color;
import java.awt.Graphics;
import java.util.ArrayList;
import java.util.List;
public class Port {
private int Conn_Pt_x= 0;
private int Conn_Pt_y= 0;
private int lup_x = 0;
private int lup_y = 0;
private int square_shpae_width = 10;
private static Graphics draw13;
private boolean port_draw = true;
private List<Connection_line> Group_Of_Link_Lines = new ArrayList<Connection_line>();
public Port(){}
public Port(int Conn_Pt_x, int Conn_Pt_y)
{
this.Conn_Pt_x = Conn_Pt_x;
this.Conn_Pt_y = Conn_Pt_y;
this.lup_x =this.Conn_Pt_x - this.square_shpae_width/2;
this.lup_y =this.Conn_Pt_y - this.square_shpae_width/2;
}
public void Update_Port_Center(Point move)
{
Conn_Pt_x = Conn_Pt_x + (int)move.getX();
Conn_Pt_y = Conn_Pt_y + (int)move.getY();
}
public static void Set_Port_Graphics(Graphics cs)
{
draw13 = cs;
}
public Point get_port_center()
{
return new Point(Conn_Pt_x, Conn_Pt_y);
}
public Port(int center_x, int center_y, Graphics canvas)
{
lup_x = center_x - square_shpae_width/2;
lup_y = center_y - square_shpae_width/2;
draw13 = canvas;
if(draw13 ==null )
{
System.out.println("Port: canvas problem.");
}
else
{
//System.out.println("May not be canvas problem.");
}
}
public void set_draw_port_false()
{
port_draw = false;
}
public void set_draw_port_true()
{
port_draw = true;
}
public void draw_port()
{
if(port_draw )
{
draw13.setColor(Color.BLACK);
draw13.fillRect(Conn_Pt_x - square_shpae_width/2, Conn_Pt_y - square_shpae_width/2, square_shpae_width, square_shpae_width);
}
}
public void Add_Link_Lines(Connection_line line_added)
{
Group_Of_Link_Lines.add(line_added);
}
public List<Connection_line> Get_Group_Of_Link_Lines()
{
return Group_Of_Link_Lines;
}
}