-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStation.java
More file actions
192 lines (184 loc) · 5.4 KB
/
Station.java
File metadata and controls
192 lines (184 loc) · 5.4 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
package RouteMapMaker;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
public class Station {//駅に関する情報を保持するクラス
public static final int TEXT_RIGHT = 10;
public static final int TEXT_LEFT = 9;
public static final int TEXT_BOTTOM = 11;
public static final int TEXT_TOP = 12;
public static final int TEXT_CENTER = 13;
public static final int TEXT_UNSET = -11;
public static final int REGULAR = 0;
public static final int ITALIC = 1;
public static final int BOLD = 2;
public static final int BOLD_ITALIC = 3;
public static final int STYLE_UNSET = 4;
private StringProperty name = new SimpleStringProperty();//駅名
private BooleanProperty pointSet = new SimpleBooleanProperty(false);//固定座標があるか否か
private DoubleProperty x = new SimpleDoubleProperty(0.0);//固定座標x
private DoubleProperty y = new SimpleDoubleProperty(0.0);//固定座標y
private int stationConnection = 0;
private IntegerProperty textLocation = new SimpleIntegerProperty(TEXT_UNSET);//駅ごとの駅名表示位置
private BooleanProperty tategaki = new SimpleBooleanProperty(true);//縦書きか横書きか。trueなら縦書き
private IntegerProperty size = new SimpleIntegerProperty(0);//駅ごとに設定される文字サイズ。0は経路準拠
private IntegerProperty style = new SimpleIntegerProperty(STYLE_UNSET);//駅ごとに設定される文字スタイル
private IntegerProperty nameX = new SimpleIntegerProperty(0);//駅名の描画位置のズレ
private IntegerProperty nameY = new SimpleIntegerProperty(0);
private BooleanProperty shiftOnStation = new SimpleBooleanProperty(false);//描画位置修正を駅ごとの設定に従うか否か
private double[] shiftCoor = new double[2];//mapDrawで使う一時保管用の変数。他の場所で使うなかれ。保存しない。
private boolean isdrawn = false;//その駅名がすでに描画されたか。駅名多重描画の防止に使う。駅座標変換フラグにも使う。
public Station(String name){
setName(name);
}
public void setName(String name){
this.name.set(name);
}
public StringProperty getNameProperty(){
return this.name;
}
public String getName(){
return name.get();
}
public void setPoint(double x, double y){
this.x.set(x);
this.y.set(y);
pointSet.set(true);
}
public DoubleProperty[] getPointProperty(){
DoubleProperty[] dpa = new DoubleProperty[2];
dpa[0] = this.x;
dpa[1] = this.y;
return dpa;
}
public void erasePoint(){
pointSet.set(false);
}
public BooleanProperty getPointSetProperty(){
return this.pointSet;
}
public boolean isSet(){
return pointSet.get();
}
public double[] getPoint(){
if(pointSet.get()){
double[] p = new double[2];
p[0] = x.get();
p[1] = y.get();
return p;
}else{
throw new IllegalArgumentException();
}
}
public void plusConnection(){
stationConnection ++;
}
public void minusConnection(){
stationConnection --;
}
public void setConnection(int c){
stationConnection = c;
}
public int getConnection(){
return stationConnection;
}
public void setInterPoint(double x, double y){
pointSet.set(false);
this.x.set(x);
this.y.set(y);
}
public double[] getInterPoint(){
if(pointSet.get()){
throw new IllegalArgumentException();
}else{
double[] p = new double[2];
p[0] = x.get();
p[1] = y.get();
return p;
}
}
public void setTextLocation(int muki){
this.textLocation.set(muki);
}
public IntegerProperty getTextLocationProperty(){
return this.textLocation;
}
public int getTextLocation(){
return textLocation.get();
}
public void setTategaki(boolean b) {
tategaki.set(b);
}
public BooleanProperty getTategakiProperty() {
return tategaki;
}
public boolean isTategaki() {
return tategaki.get();
}
public double[] getPointUS(){//isSetを考慮しません。使うのは全ての座標が決定した後にしましょう。
double[] p = new double[2];
p[0] = x.get();
p[1] = y.get();
return p;
}
public int getNameSize(){
return size.get();
}
public IntegerProperty getNameSizeProperty(){
return this.size;
}
public void setNameSize(int i){
this.size.set(i);
}
public int getNameStyle(){
return this.style.get();
}
public IntegerProperty getNameStyleProperty(){
return this.style;
}
public void setNameStyle(int i){
this.style.set(i);
}
public void setNameX(int i){
this.nameX.set(i);
}
public void setNameY(int i){
this.nameY.set(i);
}
public IntegerProperty getNameXProperty(){
return this.nameX;
}
public IntegerProperty getNameYProperty(){
return this.nameY;
}
public int[] getNameZure(){
int[] ia = {nameX.get(), nameY.get()};
return ia;
}
public boolean shiftBasedOnStation(){
return this.shiftOnStation.get();
}
public BooleanProperty getShiftOnStationProperty(){
return this.shiftOnStation;
}
public void setShiftBase(boolean b){
this.shiftOnStation.set(b);
}
public double[] getShiftCoor(){
return this.shiftCoor;
}
public void setShiftCoor(double[] ia){
this.shiftCoor = ia;
}
public boolean isDrawn(){
return this.isdrawn;
}
public void setDrawn(boolean b){
this.isdrawn = b;
}
}