1 package org.molwind.graph;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import java.util.UUID;
21
22 import org.molwind.model.WorldEntity;
23 import java.awt.geom.Point2D;
24 import org.molwind.model.PlacedWorldEntity;
25 import java.awt.Color;
26 import java.awt.Paint;
27
28
29
30
31
32
33
34
35
36 public class DefaultEntityVertex implements EntityVertex {
37
38 private String id;
39 private WorldEntity entity;
40 public Color color = Color.YELLOW;
41
42
43
44
45
46 public DefaultEntityVertex() {
47 super();
48 id = String.valueOf(UUID.randomUUID().toString());
49 entity = null;
50 }
51
52
53
54
55
56
57
58
59
60
61
62 public String getId() {
63 return id;
64 }
65
66
67
68
69
70
71
72 public void setId(final String newId) {
73 this.id = newId;
74 }
75
76
77
78
79
80
81
82 public WorldEntity getEntity() {
83 return entity;
84 }
85
86
87
88
89
90
91
92 public void setEntity(final WorldEntity newEntity) {
93 this.entity = newEntity;
94 }
95
96
97
98
99
100
101
102
103
104 public Point2D.Double getPosition(){
105 PlacedWorldEntity pwe = (PlacedWorldEntity)entity;
106 double x = pwe.getX();
107 double y = pwe.getY();
108
109 return new Point2D.Double(x,y);
110
111
112 }
113
114
115
116
117
118
119
120
121 public void setPosition(Point2D.Double position){
122 PlacedWorldEntity pwe = (PlacedWorldEntity)entity;
123 pwe.setX(position.getX());
124 pwe.setY(position.getY());
125
126
127 }
128
129
130
131
132
133
134
135
136 public String toString(){
137 return getId();
138
139 }
140
141
142
143 }