Skip to content

Commit 8e0b847

Browse files
nicolaswurtzflomonster
authored andcommitted
front: lpv: no spoilers
1 parent 64309f9 commit 8e0b847

File tree

1 file changed

+207
-0
lines changed

1 file changed

+207
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
import React from 'react';
2+
import { Source, Layer } from 'react-map-gl';
3+
4+
function Panel() {
5+
const MAP_URL = 'https://tiles.carto.graou.info';
6+
const blueprintPrefix = '';
7+
8+
const panelParams = {
9+
id: 'panelParams',
10+
type: 'symbol',
11+
source: 'signalisation',
12+
'source-layer': 'signalisation_angles',
13+
minzoom: 12,
14+
filter: [
15+
'all',
16+
[
17+
'in',
18+
'type_if',
19+
'APPROETSA',
20+
'ARRET VOY',
21+
'ARRET',
22+
'ARRET A',
23+
'ATC',
24+
'BP DIS',
25+
'BP EXE',
26+
'BP FIN',
27+
'CAB E',
28+
'CAB S',
29+
'CAB R',
30+
'CC FIN',
31+
'CC EXE',
32+
'CHEVRON',
33+
'DD',
34+
'DIVERS',
35+
'DEPOT',
36+
'DESTI',
37+
'FIN CAT',
38+
'G',
39+
'GABARIT',
40+
'GARE',
41+
'HEURT...',
42+
'IDD',
43+
'IDP',
44+
'IMP',
45+
'JAL MAN',
46+
'JAL ARRET',
47+
'L',
48+
'LGR',
49+
'LIMITETS',
50+
'LM',
51+
'MIBLAN VER',
52+
'P',
53+
'PN',
54+
'PN...',
55+
'R',
56+
'REP TGV',
57+
'REV',
58+
'SECT',
59+
'SIFFLER',
60+
'STOP',
61+
'STOP A',
62+
'TECS',
63+
'TIV D FIXE',
64+
'TIV R MOB',
65+
'TIV D MOB',
66+
'TIV PENDIS',
67+
'TIV PENEXE',
68+
'TIV PENREP',
69+
'TIVD C FIX',
70+
'TIVD B FIX',
71+
'TSCS',
72+
'Z',
73+
],
74+
],
75+
layout: {
76+
'text-font': ['Open Sans Regular'],
77+
'text-size': 9,
78+
'icon-image': [
79+
'case',
80+
['==', ['get', 'type_if'], 'CHEVRON'],
81+
['concat', blueprintPrefix, 'CHEVRON BAS'],
82+
['==', ['get', 'type_if'], 'DESTI'],
83+
['concat', blueprintPrefix, 'VIDE'],
84+
['==', ['get', 'type_if'], 'DIVERS'],
85+
['concat', blueprintPrefix, 'VIDE'],
86+
['==', ['get', 'type_if'], 'IDD'],
87+
['case', ['==', ['get', 'position'], 'D'], 'IDD GAUCHE', 'IDD DROIT'],
88+
['==', ['get', 'type_if'], 'JAL ARRET'],
89+
['concat', blueprintPrefix, 'JAL ARR'],
90+
['==', ['get', 'type_if'], 'TECS'],
91+
[
92+
'case',
93+
['==', ['get', 'position'], 'D'],
94+
['concat', blueprintPrefix, 'TECS G'],
95+
['concat', blueprintPrefix, 'TECS D'],
96+
],
97+
['==', ['get', 'type_if'], 'TSCS'],
98+
[
99+
'case',
100+
['==', ['get', 'position'], 'D'],
101+
['concat', blueprintPrefix, 'TSCS G'],
102+
['concat', blueprintPrefix, 'TSCS D'],
103+
],
104+
['==', ['get', 'type_if'], 'TIV D FIXE'],
105+
['concat', blueprintPrefix, 'TIV D FIXE 60'],
106+
['==', ['get', 'type_if'], 'TIV R FIXE'],
107+
['concat', blueprintPrefix, 'TIV R FIXE 60'],
108+
['==', ['get', 'type_if'], 'TIV D MOB'],
109+
['concat', blueprintPrefix, 'TIV D MOB 60'],
110+
['==', ['get', 'type_if'], 'TIV R MOB'],
111+
['concat', blueprintPrefix, 'TIV R MOB 60'],
112+
['==', ['get', 'type_if'], 'TIVD B FIX'],
113+
['concat', blueprintPrefix, 'TIVD B FIX 60'],
114+
['==', ['get', 'type_if'], 'ARRET VOY'],
115+
['concat', blueprintPrefix, 'ARRET VOY TT'],
116+
['==', ['get', 'type_if'], 'GARE'],
117+
'GARE',
118+
['==', ['get', 'type_if'], 'SECT'],
119+
'SECT',
120+
['==', ['get', 'type_if'], 'ARRET'],
121+
'ARRET',
122+
['==', ['get', 'type_if'], 'ARRET A'],
123+
'ARRET A',
124+
['==', ['get', 'type_if'], 'IMP'],
125+
'IMP',
126+
['==', ['get', 'type_if'], 'BP EXE'],
127+
'BP EXE',
128+
['==', ['get', 'type_if'], 'BP FIN'],
129+
'BP FIN',
130+
['==', ['get', 'type_if'], 'APPROETSA'],
131+
'APPROETSA',
132+
['==', ['get', 'type_if'], 'P'],
133+
'P',
134+
['==', ['get', 'type_if'], 'PN'],
135+
'PN',
136+
['==', ['get', 'type_if'], 'PN...'],
137+
'PN...',
138+
['concat', blueprintPrefix, ['get', 'type_if']],
139+
],
140+
'icon-size': ['step', ['zoom'], 0.2, 15, 0.4],
141+
'text-offset': [
142+
'step',
143+
['zoom'],
144+
['literal', [1.5, 0]],
145+
15,
146+
[
147+
'case',
148+
['==', ['get', 'position'], 'D'],
149+
['literal', [4, -1]],
150+
['==', ['get', 'position'], 'G'],
151+
['literal', [-4, -1]],
152+
['literal', [4, 0]],
153+
],
154+
],
155+
'icon-offset': [
156+
'step',
157+
['zoom'],
158+
['literal', [1.5, 0]],
159+
15,
160+
[
161+
'case',
162+
['==', ['get', 'position'], 'D'],
163+
['literal', [80, -100]],
164+
['==', ['get', 'position'], 'G'],
165+
['literal', [-80, -100]],
166+
['literal', [0, 0]],
167+
],
168+
],
169+
'icon-rotation-alignment': 'map',
170+
'text-rotation-alignment': 'map',
171+
'icon-rotate': ['get', 'angle'],
172+
'text-rotate': ['get', 'angle'],
173+
'icon-allow-overlap': true,
174+
'text-allow-overlap': true,
175+
'icon-ignore-placement': false,
176+
'text-justify': [
177+
'case',
178+
['==', ['get', 'position'], 'D'],
179+
'left',
180+
['==', ['get', 'position'], 'G'],
181+
'right',
182+
'center',
183+
],
184+
'text-anchor': [
185+
'case',
186+
['==', ['get', 'position'], 'D'],
187+
'left',
188+
['==', ['get', 'position'], 'G'],
189+
'right',
190+
'center',
191+
],
192+
},
193+
};
194+
195+
return (
196+
<Source
197+
id="panel"
198+
type="vector"
199+
url={`${MAP_URL}/data/signalisation.json`}
200+
source-layer="signalisation_angles"
201+
>
202+
<Layer {...panelParams} />
203+
</Source>
204+
);
205+
}
206+
207+
export default Panel;

0 commit comments

Comments
 (0)