-
Notifications
You must be signed in to change notification settings - Fork 17
/
mosmetro.html
476 lines (472 loc) · 23 KB
/
mosmetro.html
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
<!DOCTYPE html>
<!--
Moscow Metro map. Canvas version.
View lines, stations and calc routes.
egax@bk.ru, 2013-24.
-->
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Карта метро Москвы в 2024 году с расчётом пути / Canvas векторная карта</title>
<meta name="description" content="Карта метро Москвы с действующими и строящимися линиями и станциями в 2024 году. Векторная карта метро Москвы в канвасе">
<meta name="keywords" content="карта, схема метро москвы, canvas векторная карта метро, moscow metro map">
<link rel="icon" href="img/fav.svg" type="image/svg+xml">
<link rel="stylesheet" href="css/style.css">
<style>html,body,table{overflow:hidden;margin:0;padding:0;width:100%;height:100%}</style>
<script src="/static/js/metrics.js" data-floor="1"></script>
</head>
<body>
<table style="border-collapse:collapse">
<tr style="height:1px; border-bottom:1px solid #f4f4f4">
<td width="1%" valign="center">
<a style="font-size:larger; line-height:1" href="/dbcartajs" title="Метро Москвы (на главную)">
<svg style="margin:-3px 0" fill="#ff4300" width="38px" height="20px" viewBox="6 5 12 8" role="img" xmlns="http://www.w3.org/2000/svg"><path d="M16.603 11.85l-2.481-6.26-2.092 3.66-2.092-3.66-2.481 6.262H6.74v.941h3.736v-.941h-.553l.538-1.555 1.569 2.57 1.569-2.57.538 1.555h-.553v.941h3.751v-.941zm5.335-1.912"/></svg>
</a>
</td>
<td align="center">
<select id="stl" style="width:80px"></select>
<select id="stl2" style="width:80px"></select>
<select id="cInches" style="width:100px"></select>
</td>
</tr>
<tr>
<td colspan="2" id="mcol" style="position:relative">
<div id="yandex_rtb_0" class="mh_f"></div>
</td>
</tr>
</table>
<script src="js/dbcarta.js"></script>
<script src="js/data/mosmetro.js"></script>
<script src="js/alg/bfs.js"></script>
<script>
// Center map
function centerMap(coords){
var pts = DV.toPoints(coords);
DV.centerCarta(pts[0] + DV.m.offset[0], pts[1] + DV.m.offset[1]);
DV.draw();
}
// Draw transparent rect above viewmap
function maskMap(){
var vs = DV.viewsizeOf(),
rect = [[vs[0], vs[1]], [vs[2], vs[1]], [vs[2], vs[3]], [vs[0], vs[3]]];
DV.mopt['selpath'] = {cls: 'Polygon', bg: 'rgba(255,255,255,0.9)', fg: 'transparent'};
DV.draw();
DV.paintCarta(rect, 'selpath');
// DV.paintBar();
}
// Diagonal size for ratio
function mds(o) {
return Math.sqrt(DV.sizeOf()[2]*DV.sizeOf()[2]+DV.sizeOf()[3]*DV.sizeOf()[3])/15*o/100;
}
// BFS func
function calcRoute(fromid, toid){
if (!fromid || !toid) { return; };
var inches=[]; // interchanges coords
[].slice.call(document.getElementById('cInches').options).map(function(o){
if(o.innerHTML.indexOf('\u2611')>-1){ // checked
inches = inches.concat(makecrds(MLNS.filter(function(a){ return a[0]==o.value; })));
}
});
var pinches=[], proutes=[]; // paths founded
BFS(MSTS, inches, makeind(MSTS, fromid), makeind(MSTS, toid),
[ // stop stations
makeind(MSTS, 's5_Suvorovskaya'),
makeind(MSTS, 's5_3_Rossyskaya'),
makeind(MSTS, 's8_3_Dorogomilovskaya'),
makeind(MSTS, 's8_4_Plyushchikha'),
makeind(MSTS, 's8_1_Volkhonka')
]).map(function(st,i,sts)
{
if(i < sts.length-1){
var cc=[], d=sts[i][2][0], e=sts[i+1][2][0], r0, r1, rr;
MLNS.map(function(b){
if((maketipn(b) == maketipn(sts[i])) && (maketipn(b) == maketipn(sts[i+1]))){
b[2].map(function(c,j){ // find coords between stations
r0 = Math.sqrt(Math.pow(d[0]-c[0],2)+Math.pow(d[1]-c[1],2));
r1 = Math.sqrt(Math.pow(e[0]-c[0],2)+Math.pow(e[1]-c[1],2));
rr = Math.sqrt(Math.pow(d[0]-e[0],2)+Math.pow(d[1]-e[1],2));
if((r0 <= rr) && (r1 <= rr)){
if(!inarray(cc,c)) cc.push(c);
}
});
}
});
if(cc.length<3) cc = cc.map(function(a){ return a.slice(0,2); }); //remove Q flag bezier without L
if(cc.length && //rotate first with last if indirect
(Math.sqrt(Math.pow(d[0]-cc[0][0],2)+Math.pow(d[1]-cc[0][1],2)))>=
(Math.sqrt(Math.pow(d[0]-cc[cc.length-1][0],2)+Math.pow(d[1]-cc[cc.length-1][1],2))))
{
if(!inarray(cc,e)) cc.unshift(e);
if(!inarray(cc,d)) cc.push(d);
} else {
if(!inarray(cc,d)) cc.unshift(d);
if(!inarray(cc,e)) cc.push(e);
}
if (inches.filter(function(m){ return (inarray(m,cc[0]) && inarray(m,cc[cc.length-1])); }).length) {
pinches.push( {coords: cc, st: st} );
} else {
proutes.push( {coords: cc, st: st} );
}
} else { // draw founded routes and stations
maskMap();
proutes.map(function(m){ // draw routes
DV.mopt['selpath'] = {cls: 'Line', width: 12, join: 'round', cap: 'round', fg: DV.mopt[m.st[0]].fg};
DV.paintCarta(m.coords, 'selpath');
});
pinches.map(function(m){ // draw pinches
DV.mopt['selpath'] = {cls: 'Line', width: 6, join: 'round', cap: 'round', fg: '#fafffa'};
DV.paintCarta(m.coords, 'selpath');
DV.mopt['selpath'] = {cls: 'Line', width: 2, join: 'round', cap: 'round', fg: DV.mopt[m.st[0]].fg};
DV.paintCarta(m.coords, 'selpath');
});
sts.map(function(st){ // draw stations with label above routes
DV.mopt['selstation'] = DV.extend({}, DV.mopt[st[0]]);
DV.mopt['selstation'].bg = '#f5f5dc';
DV.paintCarta(st[2], 'selstation', st[3]);
});
}
});
}
//
var stl = document.getElementById('stl');
stl.onchange = function(){
var v = this.value;
MSTS.filter(function(s){ return makeid(s) == v; }).map(function(st){
centerMap(st[2][0]);
maskMap();
DV.mopt['selstation'] = DV.extend({}, DV.mopt[st[0]]);
DV.mopt['selstation'].bg = 'gold';
DV.paintCarta(st[2], 'selstation', st[3]||st[1]);
calcRoute( stl.value, stl2.value );
});
};
var stl2 = document.getElementById('stl2');
stl2.onchange = function(){
var v = this.value;
MSTS.filter(function(s){ return makeid(s) == v; }).map(function(st){
centerMap(st[2][0]);
maskMap();
DV.mopt['selstation'] = DV.extend({}, DV.mopt[st[0]]);
DV.mopt['selstation'].bg = 'gold';
DV.paintCarta(st[2], 'selstation', st[3]||st[1]);
calcRoute( stl.value, stl2.value );
});
};
var cInches = document.getElementById('cInches');
cInches.onchange = function(){
var o=this.options[this.selectedIndex], s=o.innerHTML;
o.innerHTML = (s.indexOf('\u2611')>-1 ? ' ' : '\u2611')+' '+s.slice(s.search(' '));
this.selectedIndex = 0;
};
//
var DV = new dbCarta({
id: 'mcol',
height: document.getElementById('mcol').offsetHeight,
viewportx: 220,
viewporty: 220,
rbar: 0,
bg: 'rgb(250,255,250)',
scalebg: 'rgba(100,200,100,0.3)'
});
// define new layers
function route(o) { return DV.extend({cls: 'Line', width: mds(6), join: 'round', anchor: ['start', 'middle'], labelscale: 1}, o||{}); };
function route_ext(o){ return route(DV.extend({width: mds(4), dash: [mds(2),mds(4)]}, o||{})); };
function river(o) { return route(DV.extend({fg: '#daebf4', cap: 'round', labelcolor: '#5555ff', labelscale: 0}, o||{})); };
function rail(o) { return route(DV.extend({fg: '#ddd', width: mds(2), labelscale: 0}, o||{})); };
function rail_d(o) { return rail(DV.extend({fg: '#fff', dash: [mds(10),mds(10)]}, o||{})); };
function label(o) { return DV.extend({cls: 'Polygon', labelcolor:'#aaa', labelscale: 1, anchor: ['start', 'top']}, o||{}); };
function station(o) { return DV.extend({cls: 'Dot', bg: '#f5f5dc', size: mds(5), width: mds(2), scale: 1, labelscale: 1, labelpad: mds(3)}, o||{}); };
function st_mck(o) { return station(DV.extend({size: mds(3), labelcolor: 'gray', bg: o['fg']}, o)); };
function st_mcd(o) { return station(DV.extend({size: mds(2), labelcolor: 'gray', bg: o['fg']}, o)); };
function inch(o) { return route(DV.extend({fg: '#ccc', cap: 'round', width: mds(8)}, o||{})); };
function inch_d(o) { return inch(DV.extend({fg: '#fff', width: mds(5)}, o||{})); };
function inch_ext(o) { return inch(DV.extend({fg: '#eee', dash:[mds(2),mds(2)], width: mds(2)}, o||{})); };
function inch_mck(o) { return inch(DV.extend({fg: '#ccc', width: mds(2)}, o||{})); };
function inch_mcd(o) { return inch(DV.extend({fg: '#ccc', width: mds(2)}, o||{})); };
function inch_out(o) { return inch(DV.extend({fg: '#ccc', width: mds(2)}, o||{})); };
function inst_mck(o) { return st_mck(DV.extend({size: mds(3), labelcolor: o['fg']}, o)); };
function inst_mcd(o) { return st_mcd(DV.extend({size: mds(2), labelcolor: o['fg']}, o)); };
function inst(o) { return station(DV.extend({size: mds(4), labelcolor: o['fg'], bg: o['fg']}, o)); };
function inst_d(o) { return inst(DV.extend({size: mds(3), width: mds(1)}, o||{})); };
// lines
DV.extend(DV.mopt, {
r1: route( {fg: '#ed1b35'}),
r1_ext: route_ext({fg: '#ed1b35'}),
r2: route( {fg: '#44b85c'}),
r3: route( {fg: '#0078bf'}),
r3_ext: route_ext({fg: '#0078bf'}),
r4: route( {fg: '#19c1f3'}),
r4A: route( {fg: '#19c1f3'}),
r5: route( {fg: '#894e35'}),
r6: route( {fg: '#f58631'}),
r6_ext: route_ext({fg: '#f58631'}),
r7: route( {fg: '#8e479c'}),
r8: route( {fg: '#ffcb31'}),
r8_ext: route_ext({fg: '#ffcb31'}),
r9: route( {fg: '#a1a2a3'}),
r10: route( {fg: '#b3d445'}),
r11: route( {fg: '#79cdcd'}),
r11A: route( {fg: '#79cdcd'}),
r12: route( {fg: '#acbfe1'}),
r13: route( {fg: '#2c87c5', width: 2}),
r14: rail( {fg: '#f76093', width: 2}),
r14_d: rail_d( {width:2}),
r15: route( {fg: '#de62be'}),
r16: route( {fg: '#554d26'}),
r16_ext: route_ext({fg: '#554d26'}),
inch: inch(),
inch_d: inch_d(),
inch_ext: inch_ext(),
inch_mck: inch_mck(),
inch_mcd: inch_mcd(),
inch_out: inch_out(),
mkad: label( {fg: 'rgb(210,230,255)', bg: '#fff', anchor: ['center', 'middle']}),
moskvar: river( {width: 15}),
moskvac: river( {width: 5}),
strogino: river( {width: 5}),
vodootvod: river( {width: 5}),
yauza: river( {width: 5}),
nagatino: river( {width: 6}),
grebnoy: river( {width: 3}),
moskvar_t: river( {rotate: 48, anchor: ['start', 'middle']}),
moskvac_t: river( {rotate: -90, anchor: ['start', 'middle']}),
yauza_t: river( {rotate: 45, anchor: ['start', 'top']}),
t: rail(),
t_d: rail_d(),
rmcd1: rail( {fg: '#fa842f'}),
rmcd1_d: rail_d(),
rmcd2: rail( {fg: '#e29ec0'}),
rmcd2_d: rail_d(),
rmcd3: rail( {fg: '#e17a4b'}),
rmcd3_d: rail_d(),
rmcd4: rail( {fg: '#9cd9c0'}),
rmcd4_d: rail_d(),
svo_t: label( {anchor: ['end', 'middle']}),
svo_d_t: label( {anchor: ['end', 'top']}),
vko_t: label( {anchor: ['start', 'middle']}),
vko_d_t: label( {anchor: ['center','top']}),
dme_t: label( {anchor: ['start', 'middle']}),
dme_d_t: label( {anchor: ['center','top']})
});
// stations
DV.extend(DV.mopt, {
s1: station( {fg: DV.mopt['r1'].fg, anchor: ['start', 'middle']}),
s1_1: inst( {fg: DV.mopt['r1'].fg, anchor: ['start', 'middle']}),
s1_2: inst( {fg: DV.mopt['r1'].fg, anchor: ['end', 'middle']}),
s1_4: inst( {fg: DV.mopt['r1'].fg, anchor: ['start', 'top']}),
s1_5: station( {fg: DV.mopt['r1'].fg, anchor: ['end', 'middle']}),
s1_6: station( {fg: DV.mopt['r1'].fg, anchor: ['start', 'top']}),
s1_7: station( {fg: DV.mopt['r1'].fg}),
s1_8: station( {fg: DV.mopt['r1'].fg, anchor: ['start', 'bottom']}),
s2: station( {fg: DV.mopt['r2'].fg, anchor: ['start', 'middle']}),
s2_1: station( {fg: DV.mopt['r2'].fg}),
s2_2: inst( {fg: DV.mopt['r2'].fg, anchor: ['end', 'middle']}),
s2_3: inst( {fg: DV.mopt['r2'].fg}),
s2_4: station( {fg: DV.mopt['r2'].fg, anchor: ['end', 'middle']}),
s2_6: station( {fg: DV.mopt['r2'].fg, anchor: ['start', 'top']}),
s2_7: inst( {fg: DV.mopt['r2'].fg, anchor: ['end', 'top']}),
s3: station( {fg: DV.mopt['r3'].fg, anchor: ['start', 'middle']}),
s3_1: station( {fg: DV.mopt['r3'].fg, anchor: ['end', 'middle']}),
s3_3: inst( {fg: DV.mopt['r3'].fg, anchor: ['end', 'bottom']}),
s3_4: inst( {fg: DV.mopt['r3'].fg, anchor: ['start', 'top']}),
s3_5: inst( {fg: DV.mopt['r3'].fg, anchor: ['end', 'top']}),
s3_7: inst( {fg: DV.mopt['r3'].fg, anchor: ['end']}),
s4: station( {fg: DV.mopt['r4'].fg, anchor: ['start', 'middle']}),
s4_1: station( {fg: DV.mopt['r4'].fg, anchor: ['end', 'middle']}),
s4_2: inst( {fg: DV.mopt['r4'].fg, anchor: ['end', 'middle']}),
s4_3: station( {fg: DV.mopt['r4'].fg, anchor: ['start', 'bottom']}),
s4_5: inst_d( {fg: DV.mopt['r4'].fg}),
s4_6: station( {fg: DV.mopt['r4'].fg, anchor: ['center','bottom']}),
s4_7: station( {fg: DV.mopt['r4'].fg, anchor: ['end', 'top']}),
s4A: station( {fg: DV.mopt['r4A'].fg, anchor: ['start', 'middle']}),
s4A_1: inst( {fg: DV.mopt['r4A'].fg, anchor: ['start', 'bottom']}),
s4A_2: inst( {fg: DV.mopt['r4A'].fg, anchor: ['end', 'middle']}),
s5: inst( {fg: DV.mopt['r5'].fg}),
s5_1: inst( {fg: DV.mopt['r5'].fg, anchor: ['end', 'bottom']}),
s5_2: inst( {fg: DV.mopt['r5'].fg, anchor: ['start', 'middle']}),
s5_3: inst( {fg: DV.mopt['r5'].fg, anchor: ['start', 'bottom']}),
s6: station( {fg: DV.mopt['r6'].fg, anchor: ['start', 'middle']}),
s6_1: station( {fg: DV.mopt['r6'].fg, anchor: ['end', 'middle']}),
s6_2: inst( {fg: DV.mopt['r6'].fg, anchor: ['start', 'middle']}),
s6_3: inst( {fg: DV.mopt['r6'].fg, anchor: ['end', 'bottom']}),
s6_4: inst( {fg: DV.mopt['r6'].fg, anchor: ['start', 'top']}),
s6_5: inst( {fg: DV.mopt['r6'].fg, anchor: ['end', 'middle']}),
s6_6: station( {fg: DV.mopt['r6'].fg}),
s6_7: inst( {fg: DV.mopt['r6'].fg, anchor: ['start', 'bottom']}),
s7: station( {fg: DV.mopt['r7'].fg, anchor: ['end', 'middle']}),
s7_1: inst( {fg: DV.mopt['r7'].fg, anchor: ['end', 'middle']}),
s7_2: inst( {fg: DV.mopt['r7'].fg, anchor: ['start', 'bottom']}),
s7_3: inst( {fg: DV.mopt['r7'].fg, anchor: ['start', 'top']}),
s7_4: station( {fg: DV.mopt['r7'].fg, anchor: ['start', 'bottom']}),
s7_5: inst_d( {fg: DV.mopt['r7'].fg}),
s7_6: station( {fg: DV.mopt['r7'].fg}),
s7_7: station( {fg: DV.mopt['r7'].fg, anchor: ['center','bottom']}),
s7_8: station( {fg: DV.mopt['r7'].fg, anchor: ['end', 'top']}),
s7_9: station( {fg: DV.mopt['r7'].fg}),
s7_10: inst( {fg: DV.mopt['r7'].fg}),
s7_11: inst( {fg: DV.mopt['r7'].fg, anchor: ['end', 'bottom']}),
s8: station( {fg: DV.mopt['r8'].fg, anchor: ['start', 'middle']}),
s8_1: inst( {fg: DV.mopt['r8'].fg, anchor: ['start', 'middle']}),
s8_2: inst( {fg: DV.mopt['r8'].fg, anchor: ['start', 'top']}),
s8_3: inst( {fg: DV.mopt['r8'].fg, anchor: ['start', 'bottom']}),
s8_4: inst( {fg: DV.mopt['r8'].fg, anchor: ['end', 'middle']}),
s8_5: inst( {fg: DV.mopt['r8'].fg, anchor: ['end', 'bottom']}),
s8_6: inst_d( {fg: DV.mopt['r8'].fg}),
s9: station( {fg: DV.mopt['r9'].fg, anchor: ['start', 'middle']}),
s9_1: inst( {fg: DV.mopt['r9'].fg, anchor: ['end', 'middle']}),
s9_2: inst( {fg: DV.mopt['r9'].fg, anchor: ['start', 'middle']}),
s9_3: inst( {fg: DV.mopt['r9'].fg, anchor: ['start', 'top']}),
s9_4: station( {fg: DV.mopt['r9'].fg, anchor: ['end', 'middle']}),
s9_5: inst( {fg: DV.mopt['r9'].fg, anchor: ['start', 'bottom']}),
s9_6: inst( {fg: DV.mopt['r9'].fg, anchor: ['end', 'bottom']}),
s10: station( {fg: DV.mopt['r10'].fg, anchor: ['end', 'middle']}),
s10_1: station( {fg: DV.mopt['r10'].fg, anchor: ['start', 'middle']}),
s10_2: inst( {fg: DV.mopt['r10'].fg, anchor: ['start', 'middle']}),
s10_3: inst( {fg: DV.mopt['r10'].fg, anchor: ['center','top']}),
s10_4: inst_d( {fg: DV.mopt['r10'].fg}),
s10_5: station( {fg: DV.mopt['r10'].fg, anchor: ['end', 'top']}),
s10_6: inst( {fg: DV.mopt['r10'].fg}),
s11: station( {fg: DV.mopt['r11'].fg, anchor: ['start', 'top']}),
s11_1: station( {fg: DV.mopt['r11'].fg, anchor: ['start', 'middle']}),
s11_2: station( {fg: DV.mopt['r11'].fg, anchor: ['end', 'middle']}),
s11_3: inst( {fg: DV.mopt['r11'].fg}),
s11_4: inst( {fg: DV.mopt['r11'].fg, anchor: ['start', 'bottom']}),
s11_5: inst_d( {fg: DV.mopt['r11'].fg}),
s11_6: station( {fg: DV.mopt['r11'].fg, anchor: ['center','bottom']}),
s11_7: inst( {fg: DV.mopt['r11'].fg, anchor: ['start', 'middle']}),
s11_8: station( {fg: DV.mopt['r11'].fg, anchor: ['end', 'bottom']}),
s11_9: inst( {fg: DV.mopt['r11'].fg, anchor: ['end', 'middle']}),
s11_10: station( {fg: DV.mopt['r11'].fg, anchor: ['start', 'bottom']}),
s11_11: inst( {fg: DV.mopt['r11'].fg, anchor: ['start', 'top']}),
s11_12: inst( {fg: DV.mopt['r11'].fg, anchor: ['end', 'top']}),
s11_13: inst( {fg: DV.mopt['r11'].fg, anchor: ['end', 'top']}),
s11_14: inst( {fg: DV.mopt['r11'].fg, anchor: ['center','bottom']}),
s11_15: station( {fg: DV.mopt['r11'].fg, anchor: ['center','top']}),
s11A: inst_d( {fg: DV.mopt['r11A'].fg}),
s11A_1: station( {fg: DV.mopt['r11A'].fg, anchor: ['end', 'bottom']}),
s11A_2: inst( {fg: DV.mopt['r11A'].fg, anchor: ['end', 'middle']}),
s12: station( {fg: DV.mopt['r12'].fg, anchor: ['center','bottom']}),
s12_1: station( {fg: DV.mopt['r12'].fg, anchor: ['center','top']}),
s12_2: station( {fg: DV.mopt['r12'].fg, anchor: ['start', 'top']}),
s12_3: inst( {fg: DV.mopt['r12'].fg}),
s12_4: station( {fg: DV.mopt['r12'].fg, anchor: ['end', 'top']}),
s12_5: inst( {fg: DV.mopt['r12'].fg, anchor: ['start', 'middle']}),
s13: inst( {fg: DV.mopt['r13'].fg, anchor: ['center','top'], size: mds(2)}),
s13_1: inst( {fg: DV.mopt['r13'].fg, anchor: ['start', 'middle'], size: mds(2)}),
s14: st_mck( {fg: DV.mopt['r14'].fg, anchor: ['start', 'middle']}),
s14_1: st_mck( {fg: DV.mopt['r14'].fg, anchor: ['start', 'top']}),
s14_2: st_mck( {fg: DV.mopt['r14'].fg, anchor: ['end', 'middle']}),
s14_3: st_mck( {fg: DV.mopt['r14'].fg, anchor: ['end', 'bottom']}),
s14_4: st_mck( {fg: DV.mopt['r14'].fg, anchor: ['start', 'bottom']}),
s14_5: inst_mck({fg: DV.mopt['r14'].fg}),
s14_6: inst_mck({fg: DV.mopt['r14'].fg, anchor: ['start', 'top']}),
s14_7: inst_mck({fg: DV.mopt['r14'].fg, anchor: ['end', 'middle']}),
s14_8: inst_mck({fg: DV.mopt['r14'].fg, anchor: ['center','bottom']}),
s14_9: inst_mck({fg: DV.mopt['r14'].fg, anchor: ['start', 'bottom']}),
s15: station( {fg: DV.mopt['r15'].fg, anchor: ['start', 'middle']}),
s15_1: station( {fg: DV.mopt['r15'].fg, anchor: ['end', 'middle']}),
s15_2: inst( {fg: DV.mopt['r15'].fg, anchor: ['start', 'middle']}),
s15_3: inst_d( {fg: DV.mopt['r15'].fg, anchor: ['start', 'middle']}),
s16: station( {fg: DV.mopt['r16'].fg, anchor: ['start', 'middle']}),
s16_1: inst( {fg: DV.mopt['r16'].fg, anchor: ['start', 'top']}),
s16_2: inst_d( {fg: DV.mopt['r16'].fg, anchor: ['start', 'top']}),
smcd1: st_mcd( {fg: DV.mopt['rmcd1'].fg, anchor: ['start', 'middle']}),
smcd1_1: inst_mcd({fg: DV.mopt['rmcd1'].fg}),
smcd2: st_mcd( {fg: DV.mopt['rmcd2'].fg, anchor: ['start', 'middle']}),
smcd2_1: inst_mcd({fg: DV.mopt['rmcd2'].fg}),
smcd3: st_mcd( {fg: DV.mopt['rmcd3'].fg, anchor: ['start', 'middle']}),
smcd3_1: inst_mcd({fg: DV.mopt['rmcd3'].fg}),
smcd4: st_mcd( {fg: DV.mopt['rmcd4'].fg, anchor: ['start', 'middle']}),
smcd4_1: inst_mcd({fg: DV.mopt['rmcd4'].fg})
});
// add lines dashed
[].slice.call(MLNS).map(function(a){
if(DV.mopt[a[0]+'_d']){
MLNS.push( [a[0]+'_d'].concat(a.slice(1)) );
}
});
// callbacks
DV.extend(DV.clfunc, {
onmousemove: function(o, sd, dd, ev){
// if(o.m.pmap){
// var m = o.mflood[o.m.pmap];
// var rtype = 'r' + m['ftype'].split('_')[0].slice(1);
// var mlabel = (m['label'] || m['ftag']); // tooltip
// if(!m['label']) MSTS.filter(function(s){ return s[1] == m['ftag'] && s[3]; }).map(function(a){ mlabel = '<b>' + (a[3]||a[1]) + '</b>'});
// if(MLGN[rtype]) mlabel += '\n' + MLGN[rtype] + ' ('+ rtype + ')';
// console.log(mlabel);
// }
o.paintCoords(dd);
},
onclick: function(o, pts, ev) {
if (o.m.pmap) {
if(stl.class == 'selected' && stl.value != o.m.pmap){
stl2.class = 'selected';
stl2.value = o.m.pmap;
stl.class = '';
} else if (stl2.value != o.m.pmap) {
stl.class = 'selected';
stl.value = o.m.pmap;
stl2.class = '';
}
}
DV.draw();
calcRoute( stl.value, stl2.value );
if (stl.value) {
DV.mopt['selstation'] = DV.extend({}, DV.mopt[DV.mflood[stl.value].ftype]);
DV.mopt['selstation'].bg = 'gold';
DV.paintCarta(DV.mflood[stl.value].coords, 'selstation');
}
if (stl2.value) {
DV.mopt['selstation'] = DV.extend({}, DV.mopt[DV.mflood[stl2.value].ftype]);
DV.mopt['selstation'].bg = 'gold';
DV.paintCarta(DV.mflood[stl2.value].coords, 'selstation');
}
},
ondblclick: function() {
stl.selectedIndex = 0;
stl2.selectedIndex = 0;
DV.draw();
}
});
//
function optfunc(o, k, v, disabled) {
var el = document.createElement('option');
el.value = k;
el.innerHTML = v;
if(disabled) el.disabled = true;
o.appendChild(el);
};
// fill station list
optfunc(stl, '', 'Откуда...', true);
optfunc(stl2, '', 'Куда...', true);
[].slice.call(MSTS).sort(function(a,b){
return ((a[3]||a[1])>(b[3]||b[1])) ? -1 : 1;
}).map(function(a){
a[5] = true; // do ismap (show infobox)
optfunc(stl, a[0]+'_'+a[1], a[3]||a[1]);
optfunc(stl2, a[0]+'_'+a[1], a[3]||a[1]);
});
stl.selectedIndex = 0;
stl2.selectedIndex = 0;
// inches
optfunc(cInches, 'ch', 'Пересадки...', true);
optfunc(cInches, 'inch', '\u2611 Метро');
optfunc(cInches, 'inch_out', '  Внешние');
optfunc(cInches, 'inch_mck', '  МЦК');
optfunc(cInches, 'inch_mcd', '  МЦД');
optfunc(cInches, 'inch_ext', '  Строящиеся');
cInches.selectedIndex = 0;
DV.loadCarta(MLNS);
DV.loadCarta(MLBS);
DV.loadCarta(MSTS);
DV.scaleCarta( DV.sizeOf()[2]>DV.sizeOf()[3] ? 1 : 1.5 );
DV.draw();
delete MLNS;
delete MLBS;
delete MSTS;
if(window.addYaRTB_Block) addYaRTB_Block(0, false, YA_RTB[6]);
</script>
</body>
</html>