Repository navigation
Expand file tree
/
Copy pathindex.html
More file actions
899 lines (798 loc) · 50.9 KB
/
Copy pathindex.html
File metadata and controls
899 lines (798 loc) · 50.9 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
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
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Been — Global Travel Map</title>
<link rel="preconnect" href="https://cdn.jsdelivr.net" crossorigin>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.css"
onerror="this.onerror=null;this.href='https://unpkg.com/leaflet@1.9.4/dist/leaflet.css'">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tailwindcss@2.2.19/dist/tailwind.min.css"
onerror="this.onerror=null;this.href='https://unpkg.com/tailwindcss@2.2.19/dist/tailwind.min.css'">
<script src="https://cdn.jsdelivr.net/npm/react@18.3.1/umd/react.production.min.js" crossorigin
onerror="this.onerror=null;this.src='https://unpkg.com/react@18.3.1/umd/react.production.min.js'"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@18.3.1/umd/react-dom.production.min.js" crossorigin
onerror="this.onerror=null;this.src='https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js'"></script>
<script src="https://cdn.jsdelivr.net/npm/@babel/standalone@7.26.9/babel.min.js"
onerror="this.onerror=null;this.src='https://unpkg.com/@babel/standalone@7.26.9/babel.min.js'"></script>
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js"
onerror="this.onerror=null;this.src='https://unpkg.com/leaflet@1.9.4/dist/leaflet.js'"></script>
<style>
html, body, #root { height: 100%; margin: 0; }
.custom-scrollbar::-webkit-scrollbar { width: 3px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #475569; border-radius: 10px; }
.leaflet-container { background: #f1f5f9 !important; }
.leaflet-tooltip {
border: none !important;
box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1) !important;
border-radius: 6px !important;
padding: 4px 10px !important;
font-size: 10px !important;
font-weight: bold !important;
color: #1e293b !important;
}
.sidebar-stat-bar { transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
</style>
</head>
<body>
<div id="root">
<div id="boot-loading" style="display:flex;align-items:center;justify-content:center;height:100%;font-family:system-ui,sans-serif;color:#64748b;">
Loading map…
</div>
</div>
<script>
setTimeout(function () {
var root = document.getElementById('root');
var loading = document.getElementById('boot-loading');
if (loading && root && root.contains(loading) && !window.React) {
root.innerHTML = '<div style="padding:24px;font-family:system-ui,sans-serif;max-width:520px;margin:40px auto;color:#334155;line-height:1.6">'
+ '<h2 style="margin:0 0 12px">页面资源加载失败</h2>'
+ '<p>通常是网络无法访问 JS CDN(jsdelivr / unpkg)。请尝试:</p>'
+ '<ul><li>刷新页面(Cmd/Ctrl + Shift + R)</li><li>换网络或开代理后再试</li><li>稍等片刻后重试</li></ul>'
+ '<p style="color:#64748b;font-size:14px">https://figsama.github.io/Been/</p></div>';
}
}, 15000);
</script>
<script type="text/babel">
// 统一的地理坐标数据库 [lat, lon, name]
const LOCATION_DATA = {
// 机场
"CTU": [30.5785, 103.9471, "成都双流", "CN"],
"DUJ": [30.9880, 103.6464, "都江堰", "CN"],
"JZG": [33.2500, 104.2367, "九寨沟", "CN"],
"PEK": [40.0799, 116.6031, "北京首都", "CN"],
"SFO": [37.6189, -122.3750, "旧金山", "US"],
"LAX": [33.9416, -118.4085, "洛杉矶", "US"],
"SAN": [32.7157, -117.1611, "圣迭戈", "US"],
"BER": [37.8715, -122.2730, "伯克利", "US"],
"SZX": [22.6393, 113.8122, "深圳宝安", "CN"],
"PKX": [39.5098, 116.4105, "北京大兴", "CN"],
"DGU": [23.0207, 113.7518, "东莞", "CN"],
"ZHU": [22.2710, 113.5767, "珠海", "CN"],
"XMN": [24.5440, 118.1277, "厦门高崎", "CN"],
"HGH": [30.2295, 120.4344, "杭州萧山", "CN"],
"ZHO": [29.9853, 122.2078, "舟山", "CN"],
"SHA": [31.2304, 121.4737, "上海", "CN"],
"HAK": [20.0231, 110.4589, "海口美兰", "CN"],
"KIX": [34.4320, 135.2304, "大阪关西", "JP"],
"HND": [35.5494, 139.7798, "东京羽田", "JP"],
"CKG": [29.7192, 106.6417, "重庆江北", "CN"],
"TJ": [29.8, 106.3, "统景", "CN"],
"TFU": [30.3125, 104.4444, "成都天府", "CN"],
"CAI": [30.1219, 31.4056, "开罗", "EG"],
"LHR": [51.4700, -0.4543, "伦敦希思罗", "GB"],
"LTN": [51.8747, -0.3683, "伦敦卢顿", "GB"],
"SSH": [27.9772, 34.3942, "沙姆沙伊赫", "EG"],
"ASW": [23.9644, 32.8197, "阿斯旺", "EG"],
"HRG": [27.1783, 33.8461, "赫尔格达", "EG"],
"IST": [41.2753, 28.7519, "伊斯坦布尔", "TR"],
"STN": [51.8860, 0.2389, "伦敦斯坦斯特德", "GB"],
"DLM": [36.7131, 28.7925, "达拉曼", "TR"],
"ASR": [38.7704, 35.4950, "开塞利", "TR"],
"SAW": [40.8987, 29.3092, "萨比哈格克琴", "TR"],
"BGW": [33.2625, 44.2344, "巴格达", "IQ"],
"IKA": [35.4161, 51.1522, "德微兰", "IR"],
"BFS": [54.6575, -6.2158, "贝尔法斯特", "GB"],
"ORK": [51.8413, -8.4911, "科克", "IE"],
"EDI": [55.9508, -3.3615, "爱丁堡", "GB"],
"SJJ": [43.8247, 18.3314, "萨拉热窝", "BA"],
"LGW": [51.1481, -0.1903, "伦敦盖特威克", "GB"],
"PVG": [31.1443, 121.8083, "上海浦东", "CN"],
"KMG": [24.9922, 102.9292, "昆明长水", "CN"],
"DAC": [23.8433, 90.3978, "达卡", "BD"],
"FDP": [23.6061, 89.8333, "法里德布尔", "BD"],
"DLT": [23.6833, 89.7667, "达乌拉特迪亚", "BD"],
"CGP": [22.2496, 91.8133, "吉大港", "BD"],
"COX": [21.4272, 92.0058, "柯克斯巴扎尔", "BD"],
"MAD": [40.4839, -3.5680, "马德里", "ES"],
"BGY": [45.6739, 9.7042, "米兰/贝尔加莫", "IT"],
"KRK": [50.0777, 19.7848, "克劳科夫", "PL"],
"BGO": [60.2934, 5.2181, "卑尔根", "NO"],
"OSL": [60.1975, 11.1004, "奥斯陆", "NO"],
"ARN": [59.6519, 17.9186, "斯德哥尔摩", "SE"],
"VBY": [57.6628, 18.3461, "维斯比", "SE"],
"CRL": [50.4592, 4.4538, "布鲁塞尔/沙勒罗瓦", "BE"],
"SDR": [43.4271, -3.8200, "桑坦德", "ES"],
"HAV": [22.9892, -82.4091, "哈瓦那", "CU"],
"LIM": [-12.0219, -77.1143, "利马", "PE"],
"PEM": [-12.5833, -69.1833, "马尔多纳多港", "PE"],
"CUZ": [-13.5357, -71.9387, "库斯科", "PE"],
"AQP": [-16.3411, -71.5831, "阿雷基帕", "PE"],
"CJC": [-22.4892, -68.9103, "卡拉马", "CL"],
"SCL": [-33.3930, -70.7858, "圣地亚哥", "CL"],
"PMC": [-41.4350, -73.0939, "蒙特港", "CL"],
"PNT": [-51.6789, -72.5028, "纳塔莱斯港", "CL"],
"PUQ": [-53.0026, -70.8546, "蓬塔阿雷纳斯", "CL"],
"BOG": [4.7016, -74.1469, "波哥大", "CO"],
"MEX": [19.4361, -99.0719, "墨西哥城", "MX"],
"TLC": [19.3371, -99.5660, "托卢卡", "MX"],
"TIJ": [32.5411, -116.9700, "蒂华纳", "MX"],
"JHG": [21.9740, 100.7597, "西双版纳", "CN"],
"VTE": [17.9883, 102.5633, "万象", "LA"],
"LHW": [36.5167, 103.6167, "兰州", "CN"],
"URC": [43.9071, 87.4742, "乌鲁木齐", "CN"],
"YIN": [43.9300, 81.3300, "伊宁", "CN"],
"SLM": [44.8300, 81.3300, "赛里木湖", "CN"],
"IQN": [35.5300, 104.6200, "庆阳", "CN"],
"WUH": [30.7838, 114.2081, "武汉", "CN"],
"SHE": [41.6395, 123.4833, "沈阳", "CN"],
"DLC": [38.9656, 121.5386, "大连", "CN"],
"TNA": [36.8572, 117.2161, "济南", "CN"],
"JIN": [35.4146, 116.5871, "济宁", "CN"],
"AQG": [30.5842, 117.0519, "安庆", "CN"],
"TSN": [39.1244, 117.3461, "天津", "CN"],
"DMK": [13.9126, 100.6067, "曼谷廊曼", "TH"],
"RGN": [16.9073, 96.1332, "仰光", "MM"],
"MDL": [21.7039, 95.9672, "曼德勒", "MM"],
"BGN": [21.1717, 94.8586, "蒲甘", "MM"],
"NYU": [21.2025, 94.9167, "良吾", "MM"],
"HEH": [20.7472, 96.7921, "Heho", "MM"],
"NPY": [20.55, 96.92, "娘瑞", "MM"],
"BKK": [13.6925, 100.7500, "曼谷素万那普", "TH"],
"CAN": [23.3924, 113.2988, "广州白云", "CN"],
"SJW": [38.2806, 114.6972, "石家庄正定", "CN"],
"BDG": [38.8743, 115.4646, "保定", "CN"],
"TYN": [37.7469, 112.6285, "太原武宿", "CN"],
"XIY": [34.4471, 108.7519, "西安咸阳", "CN"],
"HKG": [22.3080, 113.9185, "香港", "HK"],
"UBN": [47.8436, 106.7649, "乌兰巴托成吉思汗", "MN"],
"IKT": [52.2680, 104.3880, "伊尔库茨克", "RU"],
"MFM": [22.1496, 113.5916, "澳门", "MO"],
"PUS": [35.1795, 128.9382, "釜山金海", "KR"],
"ICN": [37.4602, 126.4407, "首尔仁川", "KR"],
"BZB": [39.1267, 116.3914, "霸州北", "CN"],
"SZB": [22.6117, 114.0292, "深圳北", "CN"],
"QZZ": [24.9583, 118.5828, "泉州", "CN"],
"XAB": [34.3789, 108.9377, "西安北", "CN"],
"HZZ": [33.0777, 107.0233, "汉中", "CN"],
"MXN": [33.1536, 106.6736, "勉县", "CN"],
"ULN": [47.9185, 106.9176, "乌兰巴托", "MN"],
"UUD": [51.8335, 107.5840, "乌兰乌德", "RU"],
"SEL": [37.5547, 126.9707, "首尔", "KR"],
"PUSC": [35.1149, 129.0419, "釜山", "KR"],
"KTI": [11.5476, 104.8442, "金边德崇", "KH"],
"PNH": [11.5564, 104.9282, "金边", "KH"],
"REP": [13.3633, 103.8564, "暹粒", "KH"],
// 铁路与城市
"LON": [51.5074, -0.1278, "伦敦", "GB"],
"BJS": [39.9042, 116.4074, "北京", "CN"],
"HRB": [45.7569, 126.6424, "哈尔滨", "CN"],
"YCH": [47.7275, 128.8993, "伊春", "CN"],
"JYI": [48.8914, 130.3977, "嘉荫", "CN"],
"LXA": [29.6469, 91.1172, "拉萨", "CN"],
"LJG": [26.8721, 100.2273, "丽江", "CN"],
"DLI": [25.5916, 100.2290, "大理", "CN"],
"YXN": [24.4442, 100.1264, "云县", "CN"],
"FC": [24.5928, 99.9288, "凤庆", "CN"],
"NCG": [28.6759, 115.8921, "南昌", "CN"],
"FZU": [26.0745, 119.2965, "福州", "CN"],
"JJG": [29.7051, 115.9818, "九江", "CN"],
"JDZ": [29.2885, 117.1864, "景德镇", "CN"],
"GLN": [25.2736, 110.2901, "桂林", "CN"],
"ASG": [41.1075, 122.9946, "鞍山", "CN"],
"ZZU": [24.5129, 117.6471, "漳州", "CN"],
"WQN": [39.3854, 117.0435, "武清", "CN"],
"DAG": [38.8, 117.4, "大港", "CN"],
"RQU": [38.7456, 116.0954, "任丘", "CN"],
"QHD": [39.9354, 119.6003, "秦皇岛", "CN"],
"FEN": [41.2097, 116.6458, "丰宁", "CN"],
"OSA": [34.6937, 135.5023, "大阪", "JP"],
"KYT": [35.0116, 135.7681, "京都", "JP"],
"NGO": [35.1815, 136.9066, "名古屋", "JP"],
"TYO": [35.6895, 139.6917, "东京", "JP"],
"YHM": [35.4437, 139.6380, "横滨", "JP"],
"LXR": [25.6872, 32.6396, "卢克索", "EG"],
"DAU": [23.8239, 89.7570, "Daulatdia", "BD"],
"LPQ": [19.8850, 102.1347, "琅勃拉邦", "LA"],
"KPF": [18.3000, 101.7000, "关西瀑布", "LA"],
"VRE": [18.9247, 102.4489, "万荣", "LA"],
// 新增公路城市
"KDN": [43.3440, 82.8870, "库尔德宁", "CN"],
"BRJ": [48.0772, 86.8524, "布尔津", "CN"],
"LNZ": [29.6541, 94.3610, "林芝", "CN"],
"NAQ": [31.4764, 92.0577, "那曲", "CN"],
"DUB": [53.3498, -6.2603, "都柏林", "IE"],
"GLY": [53.2707, -9.0568, "高威", "IE"],
// 新增铁路点
"LSH": [35.8000, 116.0800, "梁山", "CN"],
"CBG": [52.2053, 0.1218, "剑桥", "GB"],
"PLI": [37.8170, 120.7500, "蓬莱", "CN"],
// 新增公路点 - 土耳其
"KAS": [36.2023, 29.6375, "卡什", "TR"],
"AYT": [36.8969, 30.7133, "安塔利亚", "TR"],
"GME": [38.6431, 34.8289, "格雷梅", "TR"],
// 新增公路点 - 中东
"MSL": [36.3489, 43.1577, "摩苏尔", "IQ"],
"EBL": [36.1911, 44.0091, "埃尔比勒", "IQ"],
"ISF": [32.6546, 51.6680, "伊斯法罕", "IR"],
"SYZ": [29.5918, 52.5837, "设拉子", "IR"],
"PPS": [29.9351, 52.8916, "波斯波利斯", "IR"],
// 新增公路点 - 埃及
"SIW": [29.2032, 25.5195, "锡瓦", "EG"],
// 新增公路点 - 欧洲与南美
"ARI": [-18.4783, -70.3126, "阿里卡", "CL"],
"ATC": [-22.9087, -68.1997, "阿塔卡马", "CL"],
"TCQ": [-18.0147, -70.2536, "Tacna", "PE"],
// 新增铁路站点
"BJN": [39.8650, 116.3786, "北京南", "CN"],
"SHH": [31.1942, 121.3194, "上海虹桥", "CN"],
// 新增越南城市
"SGN": [10.8167, 106.6333, "胡志明", "VN"],
"DLAT": [11.9416, 108.4392, "大叻", "VN"],
"NHA": [12.2388, 109.1967, "芽庄", "VN"],
"DAD": [16.0447, 108.1716, "岘港", "VN"]
};
// 航空数据
const pastFlightData = [
["CTU", "PEK"], ["PEK", "CTU"], ["PEK", "SFO"], ["LAX", "PEK"], ["PEK", "SZX"],
["SZX", "PKX"], ["XMN", "PKX"], ["PKX", "SZX"], ["SZX", "HGH"], ["HGH", "PKX"],
["PKX", "HAK"], ["HAK", "PEK"], ["PKX", "KIX"], ["HND", "PKX"], ["CKG", "PKX"],
["PEK", "CTU"], ["TFU", "CAI"], ["CAI", "TFU"], ["CTU", "PEK"], ["PEK", "SZX"],
["SZX", "PKX"], ["PEK", "LHR"], ["LTN", "SSH"], ["SSH", "CAI"], ["CAI", "ASW"],
["HRG", "LTN"], ["LTN", "IST"], ["IST", "LTN"], ["STN", "DLM"], ["ASR", "SAW"],
["SAW", "BGW"], ["IKA", "SAW"], ["SAW", "STN"], ["STN", "BFS"], ["ORK", "EDI"],
["STN", "SJJ"], ["SJJ", "LTN"], ["LGW", "PVG"], ["PVG", "PEK"], ["PKX", "KMG"],
["KMG", "DAC"], ["CGP", "DAC"], ["DAC", "PKX"], ["PKX", "KMG"], ["KMG", "HGH"],
["HGH", "MAD"], ["MAD", "BGY"], ["BGY", "KRK"], ["KRK", "BGO"], ["BGO", "OSL"],
["OSL", "ARN"], ["ARN", "VBY"], ["VBY", "ARN"], ["ARN", "CRL"], ["CRL", "SDR"],
["MAD", "HAV"], ["HAV", "LIM"], ["LIM", "PEM"], ["PEM", "CUZ"], ["CUZ", "AQP"],
["CJC", "SCL"], ["SCL", "PMC"], ["PMC", "PNT"], ["PUQ", "PMC"], ["PMC", "SCL"],
["SCL", "BOG"], ["BOG", "MEX"], ["TLC", "TIJ"], ["LAX", "TFU"], ["CTU", "PEK"],
["PKX", "SZX"], ["SZX", "JHG"], ["VTE", "KMG"], ["KMG", "SZX"], ["SZX", "LHW"],
["LHW", "URC"], ["URC", "YIN"], ["YIN", "LHW"], ["LHW", "IQN"], ["IQN", "SZX"],
["SZX", "WUH"], ["WUH", "SHE"], ["DLC", "TNA"], ["TNA", "SZX"],
["CAN", "SJW"], ["TYN", "SZX"], ["SZX", "AQG"], ["AQG", "TSN"], ["TSN", "AQG"], ["AQG", "SZX"],
["SZX", "PEK"], ["TYN", "SZX"], ["NYU", "HEH"],
["SZX", "PEK"], ["PKX", "SZX"], ["SZX", "XIY"], ["XIY", "SZX"], ["HKG", "UBN"],
["IKT", "CAN"], ["SZX", "PEK"], ["PEK", "SZX"], ["MFM", "PUS"], ["ICN", "HKG"],
["SZX", "DMK"], ["DMK", "RGN"], ["MDL", "DMK"], ["BKK", "SZX"],
["CAN", "KTI"], ["KTI", "HKG"],
["PEK", "SZX"], ["SZX", "PEK"], ["PEK", "SZX"],
["SZX", "SHA"], ["SHA", "PKX"], ["PKX", "SGN"]
];
const futureFlightData = [];
// 铁路数据
const railwayData = [
{ name: "英国东海岸主线 (ECML)", color: "#ef4444", path: ["EDI", "LON"], waypoints: [[54.97, -1.61], [53.95, -1.08]] },
{ name: "京哈高铁", color: "#ef4444", path: ["BJS", "HRB"], waypoints: [[39.12, 117.19], [41.79, 123.42]] },
{ name: "哈尔滨 - 伊春 往返", color: "#ef4444", path: ["HRB", "YCH"], waypoints: [[46.63, 127.14]] },
{ name: "北京 - 乌鲁木齐 往返", color: "#ef4444", path: ["BJS", "URC"], waypoints: [[40.81, 111.67], [38.48, 106.27], [39.74, 98.49]] },
{ name: "北京 - 拉萨 往返", color: "#ef4444", path: ["BJS", "LXA"], waypoints: [[34.26, 108.94], [36.61, 101.77], [36.40, 94.90], [32.26, 92.06]] },
{ name: "昆明 - 大理", color: "#ef4444", path: ["KMG", "DLI"], waypoints: [[25.04, 101.52], [25.59, 100.22]] },
{ name: "大理 - 丽江", color: "#ef4444", path: ["DLI", "LJG"], waypoints: [[26.87, 100.22]] },
{ name: "大理 - 云县", color: "#ef4444", path: ["DLI", "YXN"], waypoints: [[25.02, 100.18]] },
{ name: "北京 - 南昌 - 福州", color: "#ef4444", path: ["BJS", "FZU"], waypoints: [[36.06, 114.38], [34.75, 113.62], [30.59, 114.30], [28.67, 115.89], [27.94, 117.63]] },
{ name: "北京 - 九江", color: "#ef4444", path: ["BJS", "JJG"], waypoints: [[36.06, 114.38], [34.75, 113.62], [31.5, 115.0]] },
{ name: "九江 - 景德镇", color: "#ef4444", path: ["JJG", "JDZ"], waypoints: [[29.7, 116.0]] },
{ name: "北京 - 桂林 往返", color: "#ef4444", path: ["BJS", "GLN"], waypoints: [[34.75, 113.62], [30.59, 114.30], [28.22, 112.93], [26.89, 112.60]] },
{ name: "沈阳 - 鞍山", color: "#ef4444", path: ["SHE", "ASG"] },
{ name: "鞍山 - 大连", color: "#ef4444", path: ["ASG", "DLC"], waypoints: [[40.65, 122.22]] },
{ name: "石家庄 - 太原", color: "#ef4444", path: ["SJW", "TYN"] },
{ name: "福州 - 漳州 - 厦门", color: "#ef4444", path: ["FZU", "XMN"], waypoints: [[25.45, 119.01], [24.51, 117.64]] },
{ name: "大阪 - 名古屋 (途经京都)", color: "#ef4444", path: ["OSA", "NGO"], waypoints: [[35.01, 135.76], [35.18, 136.90]] },
{ name: "名古屋 - 东京", color: "#ef4444", path: ["NGO", "TYO"], waypoints: [[35.14, 138.92]] },
{ name: "挪威卑尔根铁路", color: "#ef4444", path: ["BGO", "OSL"], waypoints: [[60.59, 7.21], [60.74, 7.82]] },
{ name: "埃及尼罗河铁路 (ASW-LXR)", color: "#ef4444", path: ["ASW", "LXR"], waypoints: [[24.89, 32.93]] },
{ name: "孟加拉国铁路 (达卡-法里德布尔)", color: "#ef4444", path: ["DAC", "FDP"] },
// 新增中老铁路
{ name: "中老铁路 (版纳-琅勃拉邦)", color: "#ef4444", path: ["JHG", "LPQ"], waypoints: [[21.17, 101.68], [20.45, 101.88]] },
{ name: "中老铁路 (琅勃拉邦-万荣)", color: "#ef4444", path: ["LPQ", "VRE"], waypoints: [[19.35, 102.35]] },
// 新增京蓬铁路
{ name: "京蓬往返 (北京-蓬莱)", color: "#ef4444", path: ["PEK", "PLI"], waypoints: [[36.6, 117.1], [36.7, 118.5], [37.5, 121.3]] },
// 新增美国西海岸铁路
{ name: "Pacific Surfliner (圣迭戈-洛杉矶)", color: "#ef4444", path: ["SAN", "LAX"], waypoints: [[33.7, -117.8], [33.9, -118.2]] },
// 新增京沪高铁支线
{ name: "京济南往返 (北京-济南)", color: "#ef4444", path: ["BJS", "TNA"], waypoints: [[38.5, 116.5], [37.5, 116.8], [37.0, 117.0]] },
{ name: "京济宁往返 (北京-济宁)", color: "#ef4444", path: ["BJS", "JIN"], waypoints: [[37.8, 116.3], [37.0, 116.4], [36.2, 116.5]] },
// 新增京沪高铁主线
{ name: "京沪高铁往返 (北京-上海)", color: "#ef4444", path: ["BJS", "SHA"], waypoints: [[38.2, 116.7], [37.0, 116.5], [35.8, 116.5], [34.6, 117.0], [33.5, 118.5], [32.5, 119.5], [31.8, 120.5]] },
{ name: "京杭高铁往返 (北京-杭州)", color: "#ef4444", path: ["BJS", "HGH"], waypoints: [[37.5, 116.8], [36.0, 116.8], [34.8, 117.2], [33.8, 118.0], [32.8, 119.0], [31.8, 120.0]] },
// 新增英国铁路
{ name: "伦敦 - 剑桥往返", color: "#ef4444", path: ["LON", "CBG"] },
// 新增京津冀铁路
{ name: "北京 - 任丘", color: "#ef4444", path: ["BJS", "RQU"] },
{ name: "北京 - 天津", color: "#ef4444", path: ["BJS", "TSN"] },
{ name: "任丘 - 天津", color: "#ef4444", path: ["RQU", "TSN"] },
{ name: "任丘 - 梁山", color: "#ef4444", path: ["RQU", "LSH"] },
{ name: "蓬莱 - 烟台", color: "#ef4444", path: ["PLI", "YT"] },
// 新增黑龙江铁路
{ name: "伊春 - 嘉荫", color: "#ef4444", path: ["YCH", "JYI"] },
{ name: "嘉荫 - 哈尔滨", color: "#ef4444", path: ["JYI", "HRB"], waypoints: [[47.2, 128.5], [46.5, 127.5]] },
// 新增京津冀铁路
{ name: "北京 - 保定", color: "#ef4444", path: ["BJS", "BDG"] },
{ name: "保定 - 石家庄", color: "#ef4444", path: ["BDG", "SJW"] },
{ name: "石家庄 - 太原", color: "#ef4444", path: ["SJW", "TYN"] },
{ name: "北京 - 霸州北", color: "#ef4444", path: ["BJS", "BZB"], waypoints: [[39.35, 116.45]] },
{ name: "深圳北 - 福州", color: "#ef4444", path: ["SZB", "FZU"], waypoints: [[24.8, 116.5], [26.2, 118.2]] },
{ name: "福州 - 泉州", color: "#ef4444", path: ["FZU", "QZZ"], waypoints: [[25.72, 119.15]] },
{ name: "泉州 - 深圳北", color: "#ef4444", path: ["QZZ", "SZB"], waypoints: [[24.4, 117.8], [23.2, 114.8]] },
{ name: "西安北 - 汉中", color: "#ef4444", path: ["XAB", "HZZ"], waypoints: [[33.85, 107.55]] },
{ name: "勉县 - 汉中", color: "#ef4444", path: ["MXN", "HZZ"] },
{ name: "汉中 - 西安北", color: "#ef4444", path: ["HZZ", "XAB"], waypoints: [[33.85, 107.55]] },
{ name: "跨蒙/西伯利亚铁路 (乌兰巴托 - 乌兰乌德 - 伊尔库茨克)", color: "#ef4444", path: ["ULN", "IKT"], waypoints: [[49.4868, 105.9228], [50.2333, 106.2000], [50.3833, 106.1167], [51.3500, 107.0000], [51.8335, 107.5840], [51.7136, 105.8694], [51.6628, 103.7081]] },
{ name: "韩国KTX (釜山 - 首尔)", color: "#ef4444", path: ["PUSC", "SEL"], waypoints: [[35.8714, 128.6014], [36.3504, 127.3845]] },
// 新增铁路
{ name: "深圳 - 任丘", color: "#ef4444", path: ["SZB", "RQU"], waypoints: [[25.0, 114.0], [28.5, 114.5], [32.0, 115.0], [36.0, 116.0], [38.0, 116.3]] },
{ name: "北京南 - 上海虹桥", color: "#ef4444", path: ["BJN", "SHH"], waypoints: [[38.2, 116.7], [37.0, 116.5], [35.8, 116.5], [34.6, 117.0], [33.5, 118.5], [32.5, 119.5], [31.8, 120.5]] },
{ name: "上海虹桥 - 北京南", color: "#ef4444", path: ["SHH", "BJN"], waypoints: [[31.8, 120.5], [32.5, 119.5], [33.5, 118.5], [34.6, 117.0], [35.8, 116.5], [37.0, 116.5], [38.2, 116.7]] }
];
// 公路数据
const roadData = [
{ name: "伊宁 - 库尔德宁 往返", color: "#10b981", path: ["YIN", "KDN"], waypoints: [[43.5, 82.2]] },
{ name: "乌鲁木齐 - 布尔津 往返", color: "#10b981", path: ["URC", "BRJ"], waypoints: [[44.3, 86.0], [46.2, 86.5]] },
{ name: "拉萨 - 林芝 (林拉公路)", color: "#10b981", path: ["LXA", "LNZ"], waypoints: [[29.8, 92.5], [29.9, 93.5]] },
{ name: "拉萨 - 那曲 (G6/G109)", color: "#10b981", path: ["LXA", "NAQ"], waypoints: [[30.5, 91.2]] },
{ name: "贝尔法斯特 - 都柏林", color: "#16a34a", path: ["BFS", "DUB"], waypoints: [[54.2, -6.3]] },
{ name: "都柏林 - 高威", color: "#16a34a", path: ["DUB", "GLY"], waypoints: [[53.3, -7.5]] },
{ name: "高威 - 科克", color: "#16a34a", path: ["GLY", "ORK"], waypoints: [[52.6, -8.9]] },
{ name: "都柏林 - 科克", color: "#16a34a", path: ["DUB", "ORK"] },
// 新增公路 - 土耳其
{ name: "土耳其南海岸 (达拉曼-卡什)", color: "#10b981", path: ["DLM", "KAS"] },
{ name: "土耳其海岸线 (卡什-安塔利亚)", color: "#10b981", path: ["KAS", "AYT"] },
{ name: "安塔利亚 - 格雷梅", color: "#10b981", path: ["AYT", "GME"], waypoints: [[37.5, 32.5]] },
// 新增公路 - 中东
{ name: "巴格达 - 摩苏尔 - 埃尔比勒", color: "#10b981", path: ["BGW", "MSL"] },
{ name: "摩苏尔 - 埃尔比勒", color: "#10b981", path: ["MSL", "EBL"] },
{ name: "埃尔比勒 - 德黑兰", color: "#10b981", path: ["EBL", "IKA"], waypoints: [[35.5, 47.5]] },
{ name: "伊朗环线 (德黑兰-伊斯法罕-设拉子)", color: "#10b981", path: ["IKA", "ISF"] },
{ name: "伊斯法罕 - 设拉子", color: "#10b981", path: ["ISF", "SYZ"] },
{ name: "设拉子 - 德黑兰", color: "#10b981", path: ["SYZ", "IKA"], waypoints: [[32.5, 52.0], [33.5, 51.5]] },
// 新增公路 - 埃及
{ name: "开罗 - 锡瓦 往返", color: "#10b981", path: ["CAI", "SIW"], waypoints: [[30.0, 28.5]] },
{ name: "尼罗河线 (开罗-卢克索)", color: "#10b981", path: ["CAI", "LXR"], waypoints: [[28.5, 31.0]] },
{ name: "卢克索 - 赫尔格达", color: "#10b981", path: ["LXR", "HRG"] },
{ name: "赫尔格达 - 开罗", color: "#10b981", path: ["HRG", "CAI"], waypoints: [[28.5, 32.5]] },
// 新增公路 - 欧洲与南美
{ name: "西班牙纵线 (桑坦德-马德里)", color: "#10b981", path: ["SDR", "MAD"], waypoints: [[42.0, -3.7]] },
{ name: "南美跨国线 (阿雷基帕-阿里卡)", color: "#10b981", path: ["AQP", "ARI"] },
{ name: "智利北段 (阿里卡-阿塔卡马)", color: "#10b981", path: ["ARI", "ATC"], waypoints: [[-20.5, -69.5]] },
{ name: "阿雷基帕 - Tacna", color: "#10b981", path: ["AQP", "TCQ"] },
{ name: "Tacna - Arica", color: "#10b981", path: ["TCQ", "ARI"] },
{ name: "阿塔卡马 - 卡拉马", color: "#10b981", path: ["ATC", "CJC"] },
{ name: "巴塔哥尼亚 (纳塔莱斯港-蓬塔阿雷纳斯)", color: "#10b981", path: ["PNT", "PUQ"], waypoints: [[-52.5, -71.5]] },
// 新增美国西海岸公路
{ name: "旧金山 - 伯克利", color: "#10b981", path: ["SFO", "BER"] },
{ name: "伯克利 - 洛杉矶 (沿海公路)", color: "#10b981", path: ["BER", "LAX"], waypoints: [[36.8, -122.0], [36.2, -121.8], [35.6, -121.0], [35.3, -120.7], [34.8, -120.0], [34.4, -119.7]] },
// 新增中老边境公路
{ name: "万荣 - 万象 (中老边境公路)", color: "#10b981", path: ["VRE", "VTE"] },
// 新增华北地区公路
{ name: "任丘 - 秦皇岛 (华北沿海公路)", color: "#10b981", path: ["RQU", "QHD"], waypoints: [[39.1, 116.8], [39.5, 117.8], [39.8, 118.8]] },
{ name: "任丘 - 丰宁 (燕山山区公路)", color: "#10b981", path: ["RQU", "FEN"], waypoints: [[39.5, 116.2], [40.2, 116.4], [40.8, 116.5]] },
// 新增四川旅游公路
{ name: "成都 - 都江堰 (岷江公路)", color: "#10b981", path: ["CTU", "DUJ"] },
{ name: "都江堰 - 九寨沟 (川西北公路)", color: "#10b981", path: ["DUJ", "JZG"], waypoints: [[31.8, 103.8], [32.5, 104.0], [33.0, 104.2]] },
{ name: "九寨沟 - 成都 (川西环线)", color: "#10b981", path: ["JZG", "CTU"], waypoints: [[32.8, 104.1], [32.2, 103.9], [31.5, 103.7]] },
// 新增珠三角公路网络
{ name: "深圳 - 东莞", color: "#10b981", path: ["SZX", "DGU"] },
{ name: "东莞 - 珠海", color: "#10b981", path: ["DGU", "ZHU"] },
{ name: "珠海 - 深圳", color: "#10b981", path: ["ZHU", "SZX"] },
{ name: "深圳 - 广州往返", color: "#10b981", path: ["SZX", "CAN"] },
// 新增长三角沿海公路
{ name: "杭州 - 舟山往返", color: "#10b981", path: ["HGH", "ZHO"], waypoints: [[30.2, 121.0], [30.0, 121.5]] },
// 新增重庆地区公路
{ name: "重庆 - 统景往返", color: "#10b981", path: ["CKG", "TJ"] },
// 新增京津地区公路
{ name: "北京 - 武清往返", color: "#10b981", path: ["BJS", "WQN"] },
{ name: "武清 - 大港往返", color: "#10b981", path: ["WQN", "DAG"] },
// 新增任丘地区公路
{ name: "任丘 - 武清", color: "#10b981", path: ["RQU", "WQN"] },
{ name: "任丘 - 济宁", color: "#10b981", path: ["RQU", "JIN"], waypoints: [[38.0, 116.5], [37.5, 116.8], [36.8, 116.9]] },
{ name: "梁山 - 济宁", color: "#10b981", path: ["LSH", "JIN"] },
{ name: "云县 - 凤庆", color: "#10b981", path: ["YXN", "FC"] },
// 新增中国新疆公路
{ name: "伊宁 - 赛里木湖", color: "#10b981", path: ["YIN", "SLM"] },
// 新增孟加拉国公路
{ name: "达卡 - 柯克斯巴扎尔", color: "#10b981", path: ["DAC", "COX"], waypoints: [[23.2, 90.8], [22.8, 91.8], [22.2, 91.9]] },
{ name: "法里德布尔 - 达乌拉特迪亚", color: "#10b981", path: ["FDP", "DLT"] },
{ name: "达乌拉特迪亚 - 达卡", color: "#10b981", path: ["DLT", "DAC"] },
// 新增老挝公路
// 新增缅甸公路
{ name: "仰光 - 蒲甘", color: "#10b981", path: ["RGN", "BGN"], waypoints: [[18.5, 96.5], [20.2, 95.2]] },
{ name: "Heho - 娘瑞", color: "#10b981", path: ["HEH", "NPY"] },
{ name: "娘瑞 - 曼德勒", color: "#10b981", path: ["NPY", "MDL"], waypoints: [[21.2, 96.5]] },
// 新增伊朗公路
{ name: "设拉子 - 波斯波利斯", color: "#10b981", path: ["SYZ", "PPS"] },
{ name: "柯克斯巴扎尔 - 吉大港", color: "#10b981", path: ["COX", "CGP"] },
{ name: "金边 - 暹粒", color: "#10b981", path: ["PNH", "REP"], waypoints: [[12.25, 104.55], [12.85, 104.15], [13.15, 103.75]] },
{ name: "暹粒 - 金边", color: "#10b981", path: ["REP", "PNH"], waypoints: [[13.15, 103.75], [12.85, 104.15], [12.25, 104.55]] },
{ name: "深圳 - 香港 (跨境大巴)", color: "#10b981", path: ["SZX", "HKG"], waypoints: [[22.52, 113.93], [22.42, 113.98], [22.35, 113.95]] },
// 新增越南公路
{ name: "胡志明 - 大叻", color: "#10b981", path: ["SGN", "DLAT"], waypoints: [[11.0, 107.0], [11.5, 107.8]] },
{ name: "大叻 - 芽庄", color: "#10b981", path: ["DLAT", "NHA"], waypoints: [[12.0, 108.7]] },
{ name: "芽庄 - 岘港", color: "#10b981", path: ["NHA", "DAD"], waypoints: [[13.5, 109.0], [14.8, 108.8]] }
];
const COUNTRY_NAMES = {
CN: "China", US: "United States", JP: "Japan", EG: "Egypt", TR: "Turkey",
IQ: "Iraq", IR: "Iran", GB: "United Kingdom", IE: "Ireland", BA: "Bosnia",
BD: "Bangladesh", ES: "Spain", IT: "Italy", PL: "Poland", NO: "Norway",
SE: "Sweden", BE: "Belgium", CU: "Cuba", PE: "Peru", CL: "Chile",
CO: "Colombia", MX: "Mexico", LA: "Laos", MM: "Myanmar", TH: "Thailand",
HK: "Hong Kong", MN: "Mongolia", KR: "South Korea", MO: "Macau",
KH: "Cambodia", RU: "Russia", VN: "Vietnam"
};
// Basemap: Tianditu (official 中国标准地图, EPSG:3857) when TK is set.
// Apply for a free browser key at https://console.tianditu.gov.cn/
// Whitelist: figsama.github.io and localhost
const TIANDITU_TK = '';
const addBasemapLayers = (map, L) => {
const wrapOpts = { noWrap: false, bounds: [[-90, -540], [90, 540]] };
if (TIANDITU_TK) {
const tdOpts = {
...wrapOpts,
subdomains: ['0', '1', '2', '3', '4', '5', '6', '7'],
maxZoom: 18,
attribution: '© Tianditu / NGCC'
};
const tk = TIANDITU_TK;
const wmts = (layer) =>
`https://t{s}.tianditu.gov.cn/${layer}_w/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=${layer === 'vec' ? 'vec' : 'eva'}&STYLE=default&TILEMATRIXSET=w&FORMAT=tiles&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}&tk=${tk}`;
L.tileLayer(wmts('vec'), tdOpts).addTo(map);
L.tileLayer(wmts('eva'), { ...tdOpts, attribution: '© Tianditu' }).addTo(map);
return;
}
// Fallback: Gaode — PRC-compliant boundaries (no API key; GCJ-02 tiles)
L.tileLayer('https://webrd0{s}.is.autonavi.com/appmaptile?lang=en&size=1&scale=1&style=8&x={x}&y={y}&z={z}', {
...wrapOpts,
subdomains: ['1', '2', '3', '4'],
maxZoom: 18,
attribution: '© AutoNavi'
}).addTo(map);
};
const App = () => {
const [activeTab, setActiveTab] = React.useState('all');
const mapContainerRef = React.useRef(null);
const mapInstanceRef = React.useRef(null);
const LRef = React.useRef(null);
const getPath = (nodes, waypoints) => {
let fullPath = [];
const start = LOCATION_DATA[nodes[0]];
const end = LOCATION_DATA[nodes[1]];
if (!start || !end) return [];
fullPath.push([start[0], start[1]]);
if (waypoints) waypoints.forEach(wp => fullPath.push(wp));
fullPath.push([end[0], end[1]]);
return fullPath;
};
const isDomesticRoute = (from, to) => {
const fromInfo = LOCATION_DATA[from];
const toInfo = LOCATION_DATA[to];
if (!fromInfo || !toInfo) return false;
// LOCATION_DATA: [lat, lon, 名称, 国家码]
const fromCountry = fromInfo.length >= 4 ? fromInfo[3] : 'CN';
const toCountry = toInfo.length >= 4 ? toInfo[3] : 'CN';
return fromCountry === toCountry;
};
const getCurvePath = (start, end, index) => {
const lat1 = start[0], lon1 = start[1];
let lat2 = end[0], lon2 = end[1];
// 处理跨 180 度线的逻辑:拉近终点经度
if (Math.abs(lon2 - lon1) > 180) {
if (lon2 > lon1) lon2 -= 360;
else lon2 += 360;
}
const curvature = 0.28 + (index * 0.08);
const midLat = (lat1 + lat2) / 2 + (lon2 - lon1) * curvature;
const midLon = (lon1 + lon2) / 2 - (lat2 - lat1) * curvature;
const points = [];
const steps = 80; // 减少点数提高性能
for (let i = 0; i <= steps; i++) {
const t = i / steps;
const lat = (1 - t) * (1 - t) * lat1 + 2 * (1 - t) * t * midLat + t * t * lat2;
const lon = (1 - t) * (1 - t) * lon1 + 2 * (1 - t) * t * midLon + t * t * lon2;
points.push([lat, lon]);
}
return points;
};
React.useEffect(() => {
LRef.current = window.L;
initMap();
return () => { if (mapInstanceRef.current) mapInstanceRef.current.remove(); };
}, []);
const calculateStats = () => {
const visitedCities = new Set();
const visitedCountries = new Set();
const countryCityCount = {};
// 收集所有路线中的城市
const allRoutes = [...pastFlightData, ...futureFlightData, ...railwayData.map(r => r.path), ...roadData.map(r => r.path)].flat();
allRoutes.forEach(code => {
if (LOCATION_DATA[code]) {
const [lat, lon, name, country] = LOCATION_DATA[code];
visitedCities.add(code);
if (country) {
visitedCountries.add(country);
if (!countryCityCount[country]) {
countryCityCount[country] = new Set();
}
countryCityCount[country].add(code);
}
}
});
// Convert Set to sorted stats; sidebar uses IATA/city codes (English UI)
const countryStats = Object.entries(countryCityCount).map(([country, cities]) => ({
country,
count: cities.size,
codes: Array.from(cities).sort()
})).sort((a, b) => b.count - a.count);
// 统计不同交通方式的次数
const flightCount = pastFlightData.length + futureFlightData.length;
const railwayCount = railwayData.length;
const roadCount = roadData.length;
return {
cities: visitedCities.size,
countries: visitedCountries.size,
countryStats,
flightCount,
railwayCount,
roadCount
};
};
const stats = calculateStats();
const totalSegments = stats.flightCount + stats.railwayCount + stats.roadCount;
const transportRows = [
{ key: 'flights', label: 'Flights', count: stats.flightCount, color: 'bg-sky-400', pct: totalSegments ? (stats.flightCount / totalSegments) * 100 : 0 },
{ key: 'rail', label: 'Rail', count: stats.railwayCount, color: 'bg-rose-400', pct: totalSegments ? (stats.railwayCount / totalSegments) * 100 : 0 },
{ key: 'road', label: 'Road', count: stats.roadCount, color: 'bg-emerald-400', pct: totalSegments ? (stats.roadCount / totalSegments) * 100 : 0 }
];
React.useEffect(() => {
if (mapInstanceRef.current) drawLayers();
}, [activeTab]);
const initMap = () => {
if (!LRef.current || !mapContainerRef.current) return;
const L = LRef.current;
const map = L.map(mapContainerRef.current, {
center: [35, 105], zoom: 4, zoomControl: false, attributionControl: true,
zoomSnap: 0.1, zoomDelta: 0.5, wheelPxPerZoomLevel: 250
});
addBasemapLayers(map, L);
mapInstanceRef.current = map;
drawLayers();
};
const drawLayers = () => {
const map = mapInstanceRef.current;
const L = LRef.current;
map.eachLayer(layer => {
if (layer instanceof L.Polyline || layer instanceof L.CircleMarker) map.removeLayer(layer);
});
const renderMulti = (drawFn) => [-360, 0, 360].forEach(o => drawFn(o));
// 绘制航线
if (activeTab === 'all' || activeTab === 'flight') {
const routeCounter = new Map();
// 绘制已运营航线(实线)
pastFlightData.forEach(route => {
const fromCode = route[0], toCode = route[1];
const fromInfo = LOCATION_DATA[fromCode];
const toInfo = LOCATION_DATA[toCode];
if (fromInfo && toInfo) {
const fromPos = [fromInfo[0], fromInfo[1]];
const toPos = [toInfo[0], toInfo[1]];
const sortedKey = [fromCode, toCode].sort().join('-');
const count = routeCounter.get(sortedKey) || 0;
routeCounter.set(sortedKey, count + 1);
const domestic = isDomesticRoute(fromCode, toCode);
let color = '#2563eb';
if (domestic) color = '#3b82f6';
if (!domestic) color = '#7c3aed';
const curvePoints = getCurvePath(fromPos, toPos, count);
renderMulti((o) => {
const offsetPoints = curvePoints.map(p => [p[0], p[1] + o]);
L.polyline(offsetPoints, {
color: color,
weight: 1.5,
opacity: 0.3
}).addTo(map);
});
}
});
// 绘制未来航线(虚线)
futureFlightData.forEach(route => {
const fromCode = route[0], toCode = route[1];
const fromInfo = LOCATION_DATA[fromCode];
const toInfo = LOCATION_DATA[toCode];
if (fromInfo && toInfo) {
const fromPos = [fromInfo[0], fromInfo[1]];
const toPos = [toInfo[0], toInfo[1]];
const sortedKey = [fromCode, toCode].sort().join('-');
const count = routeCounter.get(sortedKey) || 0;
routeCounter.set(sortedKey, count + 1);
const domestic = isDomesticRoute(fromCode, toCode);
let color = '#2563eb';
if (domestic) color = '#3b82f6';
if (!domestic) color = '#7c3aed';
const curvePoints = getCurvePath(fromPos, toPos, count);
renderMulti((o) => {
const offsetPoints = curvePoints.map(p => [p[0], p[1] + o]);
L.polyline(offsetPoints, {
color: color,
weight: 1.5,
opacity: 0.3
}).addTo(map);
});
}
});
}
// 绘制铁路
if (activeTab === 'all' || activeTab === 'land') {
railwayData.forEach(rail => {
const path = getPath(rail.path, rail.waypoints);
renderMulti((offset) => {
const offsetPath = path.map(p => [p[0], p[1] + offset]);
L.polyline(offsetPath, { color: rail.color, weight: 2, opacity: 0.5, dashArray: "5, 5" }).addTo(map).bindTooltip(`铁路: ${rail.name}`);
});
});
}
// 绘制公路
if (activeTab === 'all' || activeTab === 'land') {
roadData.forEach(road => {
const path = getPath(road.path, road.waypoints);
renderMulti((offset) => {
const offsetPath = path.map(p => [p[0], p[1] + offset]);
L.polyline(offsetPath, { color: road.color, weight: 2, opacity: 0.4 }).addTo(map).bindTooltip(`公路: ${road.name}`);
});
});
}
// 绘制节点
const usedNodes = new Set([
...pastFlightData.flat(),
...futureFlightData.flat(),
...railwayData.flatMap(r => [...r.path]),
...roadData.flatMap(r => [...r.path])
]);
usedNodes.forEach(code => {
const info = LOCATION_DATA[code];
if (info) {
renderMulti((offset) => {
L.circleMarker([info[0], info[1] + offset], {
radius: 3, fillColor: '#fff', color: '#334155', weight: 1.5, fillOpacity: 1
}).addTo(map).bindTooltip(`${info[2]} (${code})`);
});
}
});
};
return (
<div className="flex flex-col h-screen bg-slate-100 font-sans text-slate-900 overflow-hidden">
<header className="bg-white/90 backdrop-blur border-b border-slate-200/80 px-5 py-3 flex items-center justify-between shrink-0 z-20">
<div className="flex items-center gap-3">
<div className="w-9 h-9 rounded-xl bg-gradient-to-br from-emerald-500 to-teal-600 flex items-center justify-center text-white shadow-md shadow-emerald-500/20">
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.75} d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064" />
</svg>
</div>
<div>
<h1 className="text-base font-semibold tracking-tight text-slate-800">Been</h1>
<p className="text-[11px] text-slate-400 tracking-wide">Global transit map</p>
</div>
</div>
<div className="flex bg-slate-100/80 p-1 rounded-xl">
{[
{ id: 'all', label: 'All', icon: 'Globe' },
{ id: 'flight', label: 'Flights', icon: 'Plane' },
{ id: 'land', label: 'Land', icon: 'Car' }
].map(tab => (
<button
key={tab.id}
onClick={() => setActiveTab(tab.id)}
className={`flex items-center gap-1.5 px-4 py-1.5 rounded-lg transition-all text-xs font-medium ${
activeTab === tab.id ? 'bg-white shadow-sm text-emerald-700' : 'text-slate-500 hover:text-slate-700'
}`}
>
<svg className="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
{tab.icon === 'Globe' && <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M3.055 11H5a2 2 0 012 2v1a2 2 0 002 2 2 2 0 012 2v2.945M8 3.935V5.5A2.5 2.5 0 0010.5 8h.5a2 2 0 012 2 2 2 0 104 0 2 2 0 012-2h1.064M15 20.488V18a2 2 0 012-2h3.064" />}
{tab.icon === 'Plane' && <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8" />}
{tab.icon === 'Car' && <path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 17a2 2 0 11-4 0 2 2 0 014 0zM19 17a2 2 0 11-4 0 2 2 0 014 0z" />}
</svg>
{tab.label}
</button>
))}
</div>
</header>
<div className="flex-1 flex overflow-hidden">
<aside className="w-[150px] bg-slate-900 text-slate-100 flex flex-col shrink-0 z-10 border-r border-slate-800">
<div className="px-5 pt-5 pb-4 border-b border-slate-800">
<p className="text-[10px] font-semibold uppercase tracking-[0.22em] text-emerald-400/90">Overview</p>
<h2 className="text-xl font-light text-white mt-1 tracking-tight">Travel stats</h2>
</div>
<div className="p-5 flex-1 overflow-y-auto custom-scrollbar space-y-6">
<div className="grid grid-cols-2 gap-3">
<div className="rounded-2xl bg-slate-800/80 border border-slate-700/60 p-4">
<p className="text-[10px] uppercase tracking-wider text-slate-400 font-medium">Places</p>
<p className="text-3xl font-light text-white mt-1 tabular-nums">{stats.cities}</p>
</div>
<div className="rounded-2xl bg-slate-800/80 border border-slate-700/60 p-4">
<p className="text-[10px] uppercase tracking-wider text-slate-400 font-medium">Countries</p>
<p className="text-3xl font-light text-white mt-1 tabular-nums">{stats.countries}</p>
</div>
</div>
<section>
<div className="flex items-baseline justify-between mb-3">
<h3 className="text-xs font-semibold uppercase tracking-wider text-slate-400">By mode</h3>
<span className="text-[10px] text-slate-500 tabular-nums">{totalSegments} segments</span>
</div>
<div className="space-y-3">
{transportRows.map(row => (
<div key={row.key}>
<div className="flex items-center justify-between mb-1.5">
<span className="text-xs text-slate-300">{row.label}</span>
<span className="text-xs font-medium text-white tabular-nums">{row.count}</span>
</div>
<div className="h-1.5 rounded-full bg-slate-800 overflow-hidden">
<div className={`sidebar-stat-bar h-full rounded-full ${row.color}`} style={{ width: `${row.pct}%` }} />
</div>
</div>
))}
</div>
</section>
<section>
<h3 className="text-xs font-semibold uppercase tracking-wider text-slate-400 mb-3">Countries visited</h3>
<div className="space-y-2">
{stats.countryStats.map((countryStat, i) => (
<div key={i} className="group rounded-xl bg-slate-800/50 border border-slate-700/40 px-3 py-2.5 hover:border-slate-600/60 transition-colors">
<div className="flex items-center justify-between gap-2">
<div className="min-w-0">
<p className="text-sm text-white truncate">{COUNTRY_NAMES[countryStat.country] || countryStat.country}</p>
<p className="text-[10px] text-slate-500 mt-0.5">{countryStat.country}</p>
</div>
<span className="shrink-0 text-xs font-medium text-emerald-400 bg-emerald-400/10 px-2 py-0.5 rounded-md tabular-nums">
{countryStat.count}
</span>
</div>
<p className="text-[10px] text-slate-500 mt-2 font-mono leading-relaxed truncate group-hover:whitespace-normal group-hover:overflow-visible">
{countryStat.codes.slice(0, 8).join(' · ')}{countryStat.codes.length > 8 ? ` +${countryStat.codes.length - 8}` : ''}
</p>
</div>
))}
</div>
</section>
</div>
<div className="px-5 py-4 border-t border-slate-800 text-[10px] text-slate-500 leading-relaxed">
<span className="text-slate-400 font-medium">Been</span> — personal global travel atlas
</div>
</aside>
<div className="flex-1 relative bg-slate-100">
<div ref={mapContainerRef} className="w-full h-full z-10" />
<div className="absolute bottom-6 left-6 z-20">
<div className="bg-white/95 backdrop-blur-md px-4 py-3 rounded-xl shadow-lg border border-slate-200/80 flex gap-5 items-center">
<div className="space-y-2">
<div className="flex items-center gap-2">
<div className="w-5 h-0.5 bg-blue-400 rounded-full" />
<span className="text-[10px] font-medium text-slate-600">Domestic</span>
</div>
<div className="flex items-center gap-2">
<div className="w-5 h-0.5 bg-violet-600 rounded-full" />
<span className="text-[10px] font-medium text-slate-600">International</span>
</div>
<div className="flex items-center gap-2">
<div className="w-5 border-t border-dashed border-red-400" />
<span className="text-[10px] font-medium text-slate-600">Rail & road</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
);
};
ReactDOM.render(<App />, document.getElementById('root'));
</script>
</body>
</html>