@@ -54,6 +54,58 @@ class Railway {
54
54
constructor ( ) {
55
55
this . hue = 35 ;
56
56
}
57
+ bridgeCasing = function ( ) {
58
+ var layer = baseRailLayer (
59
+ this . railClass ,
60
+ "bridgeCasing" ,
61
+ this . brunnel ,
62
+ this . minZoomBridge ,
63
+ this . service ,
64
+ this . constraints
65
+ ) ;
66
+ layer . layout = {
67
+ "line-cap" : "butt" ,
68
+ "line-join" : "bevel" ,
69
+ visibility : "visible" ,
70
+ } ;
71
+ layer . paint = {
72
+ "line-color" : "black" ,
73
+ "line-width" : {
74
+ base : railExp ,
75
+ stops : this . bridgeCasingWidth ,
76
+ } ,
77
+ } ;
78
+ if ( this . constraints != null ) {
79
+ layer . filter . push ( this . constraints ) ;
80
+ }
81
+ return layer ;
82
+ } ;
83
+ bridgeFill = function ( ) {
84
+ var layer = baseRailLayer (
85
+ this . railClass ,
86
+ "bridgeFill" ,
87
+ this . brunnel ,
88
+ this . minZoomBridge ,
89
+ this . service ,
90
+ this . constraints
91
+ ) ;
92
+ layer . layout = {
93
+ "line-cap" : "butt" ,
94
+ "line-join" : "bevel" ,
95
+ visibility : "visible" ,
96
+ } ;
97
+ layer . paint = {
98
+ "line-color" : "white" ,
99
+ "line-width" : {
100
+ base : railExp ,
101
+ stops : this . bridgeFillWidth ,
102
+ } ,
103
+ } ;
104
+ if ( this . constraints != null ) {
105
+ layer . filter . push ( this . constraints ) ;
106
+ }
107
+ return layer ;
108
+ } ;
57
109
fill = function ( ) {
58
110
var layer = baseRailLayer (
59
111
this . railClass ,
@@ -119,19 +171,19 @@ class Rail extends Railway {
119
171
this . service = false ;
120
172
121
173
this . minZoom = 10 ;
174
+ this . minZoomBridge = 15 ;
175
+ this . lineWeight = 0.4 ;
122
176
123
- this . fillWidth = [
124
- [ 8 , 0.4 ] ,
125
- [ 12 , 1.2 ] ,
126
- [ 20 , 5 ] ,
127
- ] ;
128
177
this . dashWidth = [
129
178
[ 8 , 1.6 ] ,
130
179
[ 12 , 4.8 ] ,
131
180
[ 20 , 20 ] ,
132
181
] ;
182
+ this . fillWidth = Util . zoomMultiply ( this . dashWidth , this . lineWeight ) ;
183
+ this . bridgeFillWidth = Util . zoomMultiply ( this . dashWidth , 1.1 ) ;
184
+ this . bridgeCasingWidth = Util . zoomMultiply ( this . dashWidth , 1.3 ) ;
133
185
134
- this . dashArray = [ 0. 2, 4 ] ;
186
+ this . dashArray = [ this . lineWeight / 2 , 4 ] ;
135
187
136
188
this . fillColor = [
137
189
"interpolate" ,
@@ -150,13 +202,11 @@ class RailService extends Rail {
150
202
super ( ) ;
151
203
this . service = true ;
152
204
153
- this . fillWidth = [
154
- [ 8 , 0.2 ] ,
155
- [ 12 , 0.6 ] ,
156
- [ 20 , 2.5 ] ,
157
- ] ;
205
+ this . lineWeight = 0.2 ;
206
+
207
+ this . fillWidth = Util . zoomMultiply ( this . dashWidth , this . lineWeight ) ;
158
208
159
- this . dashArray = [ 0.1 , 4 ] ;
209
+ this . dashArray = [ this . lineWeight / 2 , 4 ] ;
160
210
161
211
this . constraints = null ;
162
212
}
@@ -170,19 +220,19 @@ class NarrowGauge extends Railway {
170
220
this . service = false ;
171
221
172
222
this . minZoom = 10 ;
223
+ this . minZoomBridge = 15 ;
224
+ this . lineWeight = 0.4 ;
173
225
174
- this . fillWidth = [
175
- [ 8 , 0.3 ] ,
176
- [ 12 , 0.9 ] ,
177
- [ 20 , 3.8 ] ,
178
- ] ;
179
226
this . dashWidth = [
180
227
[ 8 , 1.2 ] ,
181
228
[ 12 , 3.6 ] ,
182
229
[ 20 , 15 ] ,
183
230
] ;
231
+ this . fillWidth = Util . zoomMultiply ( this . dashWidth , this . lineWeight ) ;
232
+ this . bridgeFillWidth = Util . zoomMultiply ( this . dashWidth , 1.1 ) ;
233
+ this . bridgeCasingWidth = Util . zoomMultiply ( this . dashWidth , 1.3 ) ;
184
234
185
- this . dashArray = [ 0.15 , 4 ] ;
235
+ this . dashArray = [ this . lineWeight / 2 , 4 ] ;
186
236
187
237
this . fillColor = [
188
238
"interpolate" ,
@@ -201,13 +251,11 @@ class NarrowGaugeService extends NarrowGauge {
201
251
super ( ) ;
202
252
this . service = true ;
203
253
204
- this . fillWidth = [
205
- [ 8 , 0.15 ] ,
206
- [ 12 , 0.5 ] ,
207
- [ 20 , 1.9 ] ,
208
- ] ;
254
+ this . lineWeight = 0.2 ;
255
+
256
+ this . fillWidth = Util . zoomMultiply ( this . dashWidth , this . lineWeight ) ;
209
257
210
- this . dashArray = [ 0.1 , 4 ] ;
258
+ this . dashArray = [ this . lineWeight / 2 , 4 ] ;
211
259
212
260
this . constraints = null ;
213
261
}
0 commit comments