-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTrain.java
More file actions
213 lines (207 loc) · 6.1 KB
/
Train.java
File metadata and controls
213 lines (207 loc) · 6.1 KB
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
package RouteMapMaker;
import java.util.ArrayList;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.paint.Color;
public class Train implements Cloneable{
public static final DoubleArrayWrapper NORMAL_LINE = new DoubleArrayWrapper(null);
private ObservableList<TrainStop> stops;//この運転系統の駅オブジェクトを保持する。
private StringProperty name = new SimpleStringProperty();//駅名
private ColorWrapper lineColor = new ColorWrapper();
private ColorWrapper markColor = new ColorWrapper();
private ColorWrapper staColor = new ColorWrapper();
private IntegerProperty lineWidth = new SimpleIntegerProperty();
private IntegerProperty lineDistance = new SimpleIntegerProperty();
private StopMark mark;
private IntegerProperty markSize = new SimpleIntegerProperty();
private IntegerProperty staSize = new SimpleIntegerProperty();
private BooleanProperty tategaki = new SimpleBooleanProperty(true);//trueなら縦書き。
private IntegerProperty edgeFixA = new SimpleIntegerProperty();//端の補正をどれだけするか。
private IntegerProperty edgeFixB = new SimpleIntegerProperty();
private DoubleArrayWrapper lineDash;//ラインの破線パターン。nullでただの線。
public Train(String name){
stops = FXCollections.observableArrayList();
this.name.set(name);
//初期設定
lineColor.set(Color.BLACK);
markColor.set(Color.WHITE);
staColor.set(Color.BLACK);
lineWidth.set(10);
lineDistance.set(0);
mark = StopMark.CIRCLE;
markSize.set(8);
tategaki.set(true);
staSize.set(15);
edgeFixA.set(0);
edgeFixB.set(0);
lineDash = NORMAL_LINE;
}
public ObservableList<TrainStop> getStops(){
return stops;
}
public void setName(String n){
name.set(n);
}
public StringProperty getNameProperty(){
return this.name;
}
public String getName(){
return name.get();
}
public void setLineColor(Color c){
lineColor.set(c);
}
public ColorWrapper getLineColorProperty(){
return this.lineColor;
}
public Color getLineColor(){
return lineColor.get();
}
public void setMarkColor(Color c){
markColor.set(c);
}
public ColorWrapper getMarkColorProperty(){
return this.markColor;
}
public Color getMarkColor(){
return markColor.get();
}
public void setStaColor(Color c){
staColor.set(c);
}
public ColorWrapper getStaColorProperty(){
return this.staColor;
}
public Color getStaColor(){
return staColor.get();
}
public void setColorsInDouble(double[][] param){
/*[A][B]
* A:0LineColor、1MarkColor、2StaColor
* B:0red、1green、2blue、3opacity
*/
lineColor.set(new Color(param[0][0],param[0][1],param[0][2],param[0][3]));
markColor.set(new Color(param[1][0],param[1][1],param[1][2],param[1][3]));
staColor.set(new Color(param[2][0],param[2][1],param[2][2],param[2][3]));
}
public double[][] getColorsInDouble(){
double[][] cc = new double[3][4];
cc[0][0] = lineColor.get().getRed();
cc[0][1] = lineColor.get().getGreen();
cc[0][2] = lineColor.get().getBlue();
cc[0][3] = lineColor.get().getOpacity();
cc[1][0] = markColor.get().getRed();
cc[1][1] = markColor.get().getGreen();
cc[1][2] = markColor.get().getBlue();
cc[1][3] = markColor.get().getOpacity();
cc[2][0] = staColor.get().getRed();
cc[2][1] = staColor.get().getGreen();
cc[2][2] = staColor.get().getBlue();
cc[2][3] = staColor.get().getOpacity();
return cc;
}
public int getLineWidth(){
return lineWidth.get();
}
public IntegerProperty getLineWidthProperty(){
return this.lineWidth;
}
public void setLineWidth(int d){
lineWidth.set(d);
}
public int getLineDistance(){
return lineDistance.get();
}
public IntegerProperty getLineDistanceProperty(){
return this.lineDistance;
}
public void setLineDistance(int i){
this.lineDistance.set(i);
}
public StopMark getMark(){
return mark;
}
public void setMark(StopMark m){
this.mark = m;
}
public int getMarkSize(){
return markSize.get();
}
public IntegerProperty getMarkSizeProperty(){
return this.markSize;
}
public void setMarkSize(int size){
this.markSize.set(size);
}
public boolean isTategaki(){
return tategaki.get();
}
public void setTategaki(boolean b){
this.tategaki.set(b);
}
public int getStaSize(){
return staSize.get();
}
public IntegerProperty getStaSizeProperty(){
return staSize;
}
public void setStaSize(int i){
this.staSize.set(i);
}
public int getEdgeA(){
return this.edgeFixA.get();
}
public IntegerProperty getEdgeAProperty(){
return this.edgeFixA;
}
public void setEdgeA(int i){
this.edgeFixA.set(i);
}
public int getEdgeB(){
return this.edgeFixB.get();
}
public IntegerProperty getEdgeBProperty(){
return this.edgeFixB;
}
public void setEdgeB(int i){
this.edgeFixB.set(i);
}
public DoubleArrayWrapper getLineDash(){
return this.lineDash;
}
public void setLineDash(DoubleArrayWrapper d){
this.lineDash = d;
}
@Override
public Train clone(){
Train t = null;
try {
t = (Train)super.clone();
t.stops = FXCollections.observableArrayList();
for(TrainStop ts: this.stops){
t.stops.add(ts);
}
t.name = new SimpleStringProperty(this.name.get());
t.lineColor = new ColorWrapper(this.lineColor.get());
t.markColor = new ColorWrapper(this.markColor.get());
t.staColor = new ColorWrapper(this.staColor.get());
t.lineWidth = new SimpleIntegerProperty(this.lineWidth.get());
t.lineDistance = new SimpleIntegerProperty(this.lineDistance.get());
t.markSize = new SimpleIntegerProperty(this.markSize.get());
t.staSize = new SimpleIntegerProperty(this.staSize.get());
t.edgeFixA = new SimpleIntegerProperty(this.edgeFixA.get());
t.edgeFixB = new SimpleIntegerProperty(this.edgeFixB.get());
t.tategaki = new SimpleBooleanProperty(this.tategaki.get());
} catch (CloneNotSupportedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return t;
}
}