Skip to content

Commit 518433d

Browse files
nicolaswurtzflomonster
authored andcommitted
front: lpv: add osm panels
1 parent d1174bb commit 518433d

File tree

4 files changed

+196
-26
lines changed

4 files changed

+196
-26
lines changed

front/src/assets/mapstyles/OSMStyle.json

+3-11
Original file line numberDiff line numberDiff line change
@@ -1054,19 +1054,11 @@
10541054
"source": "openmaptiles",
10551055
"source-layer": "building",
10561056
"type": "fill-extrusion",
1057-
"minzoom": 15,
1057+
"minzoom": 0,
10581058
"paint": {
10591059
"fill-extrusion-color": "#aaa",
1060-
"fill-extrusion-height": [
1061-
"interpolate", ["linear"], ["zoom"],
1062-
15, 0,
1063-
15.05, ["get", "render_height"]
1064-
],
1065-
"fill-extrusion-base": [
1066-
"interpolate", ["linear"], ["zoom"],
1067-
15, 0,
1068-
15.05, ["get", "render_min_height"]
1069-
],
1060+
"fill-extrusion-height": ["get", "render_height"],
1061+
"fill-extrusion-base": ["get", "render_min_height"],
10701062
"fill-extrusion-opacity": 0.6
10711063
}
10721064
},

front/src/common/Map/Layers/SignalingType.js

+9-11
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,15 @@ export default function SignalingType(props) {
2727
},
2828
};
2929

30-
return (
31-
layersSettings.signalingtype && (
32-
<Source
33-
id={`osrd_signaling_type_${geomType}`}
34-
type="vector"
35-
url={`${MAP_URL}/layer/signaling_sections/mvt/${geomType}/?infra=${infraID}`}
36-
>
37-
<Layer {...layerdef} id={`chartis/osrd_signaling_type/${geomType}`} />
38-
</Source>
39-
)
40-
);
30+
return layersSettings.signalingtype ? (
31+
<Source
32+
id={`osrd_signaling_type_${geomType}`}
33+
type="vector"
34+
url={`${MAP_URL}/layer/signaling_sections/mvt/${geomType}/?infra=${infraID}`}
35+
>
36+
<Layer {...layerdef} id={`chartis/osrd_signaling_type/${geomType}`} />
37+
</Source>
38+
) : null;
4139
}
4240

4341
SignalingType.propTypes = {

front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { MAP_URL } from 'common/Map/const';
88
import { Theme } from 'types';
99

1010
// REMOVE BEFORE PROD
11-
import Panel from './SNCF_LPV_PANELS';
11+
import Panels from './SNCF_LPV_PANELS';
1212

1313
interface SNCF_LPVProps {
1414
geomType: string;
@@ -94,7 +94,7 @@ export default function SNCF_LPV(props: SNCF_LPVProps) {
9494
filter: speedSectionFilter,
9595
layout: {
9696
visibility: 'visible',
97-
'line-cap': 'square',
97+
'line-cap': ['step', ['zoom'], 'round', 15, 'square'],
9898
},
9999
paint: {
100100
'line-color': '#747678',
@@ -113,7 +113,7 @@ export default function SNCF_LPV(props: SNCF_LPVProps) {
113113
filter: speedSectionFilter,
114114
layout: {
115115
visibility: 'visible',
116-
'line-cap': 'square',
116+
'line-cap': ['step', ['zoom'], 'round', 15, 'square'],
117117
},
118118
paint: {
119119
'line-color': [
@@ -168,7 +168,7 @@ export default function SNCF_LPV(props: SNCF_LPVProps) {
168168
beforeId={`chartis/osrd_sncf_lpv_points/${geomType}`}
169169
/>
170170
</Source>
171-
<Panel />
171+
<Panels />
172172
</>
173173
);
174174
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
import React from 'react';
2+
import { Source, Layer } from 'react-map-gl';
3+
4+
function Panels() {
5+
const blueprintPrefix = '';
6+
const filter = [
7+
'all',
8+
['in', 'type_if', 'CHEVRON', 'R', 'TIV D FIXE', 'TIVD C FIX', 'TIVD B FIX', 'Z'],
9+
];
10+
11+
const panelParams = {
12+
id: 'panelParams',
13+
type: 'symbol',
14+
source: 'signalisation',
15+
'source-layer': 'signalisation_angles',
16+
minzoom: 10,
17+
filter,
18+
layout: {
19+
'text-font': ['Open Sans Regular'],
20+
'text-size': 9,
21+
'icon-image': [
22+
'case',
23+
['==', ['get', 'type_if'], 'CHEVRON'],
24+
['concat', blueprintPrefix, 'CHEVRON BAS'],
25+
['==', ['get', 'type_if'], 'DESTI'],
26+
['concat', blueprintPrefix, 'VIDE'],
27+
['==', ['get', 'type_if'], 'DIVERS'],
28+
['concat', blueprintPrefix, 'VIDE'],
29+
['==', ['get', 'type_if'], 'IDD'],
30+
['case', ['==', ['get', 'position'], 'D'], 'IDD GAUCHE', 'IDD DROIT'],
31+
['==', ['get', 'type_if'], 'JAL ARRET'],
32+
['concat', blueprintPrefix, 'JAL ARR'],
33+
['==', ['get', 'type_if'], 'TECS'],
34+
[
35+
'case',
36+
['==', ['get', 'position'], 'D'],
37+
['concat', blueprintPrefix, 'TECS G'],
38+
['concat', blueprintPrefix, 'TECS D'],
39+
],
40+
['==', ['get', 'type_if'], 'TSCS'],
41+
[
42+
'case',
43+
['==', ['get', 'position'], 'D'],
44+
['concat', blueprintPrefix, 'TSCS G'],
45+
['concat', blueprintPrefix, 'TSCS D'],
46+
],
47+
['==', ['get', 'type_if'], 'TIV D FIXE'],
48+
['concat', blueprintPrefix, 'TIV D FIXE 60'],
49+
['==', ['get', 'type_if'], 'TIV R FIXE'],
50+
['concat', blueprintPrefix, 'TIV R FIXE 60'],
51+
['==', ['get', 'type_if'], 'TIV D MOB'],
52+
['concat', blueprintPrefix, 'TIV D MOB 60'],
53+
['==', ['get', 'type_if'], 'TIV R MOB'],
54+
['concat', blueprintPrefix, 'TIV R MOB 60'],
55+
['==', ['get', 'type_if'], 'TIVD B FIX'],
56+
['concat', blueprintPrefix, 'TIVD B FIX 60'],
57+
['==', ['get', 'type_if'], 'ARRET VOY'],
58+
['concat', blueprintPrefix, 'ARRET VOY TT'],
59+
['==', ['get', 'type_if'], 'GARE'],
60+
'GARE',
61+
['==', ['get', 'type_if'], 'SECT'],
62+
'SECT',
63+
['==', ['get', 'type_if'], 'ARRET'],
64+
'ARRET',
65+
['==', ['get', 'type_if'], 'ARRET A'],
66+
'ARRET A',
67+
['==', ['get', 'type_if'], 'IMP'],
68+
'IMP',
69+
['==', ['get', 'type_if'], 'BP EXE'],
70+
'BP EXE',
71+
['==', ['get', 'type_if'], 'BP FIN'],
72+
'BP FIN',
73+
['==', ['get', 'type_if'], 'APPROETSA'],
74+
'APPROETSA',
75+
['==', ['get', 'type_if'], 'P'],
76+
'P',
77+
['==', ['get', 'type_if'], 'PN'],
78+
'PN',
79+
['==', ['get', 'type_if'], 'PN...'],
80+
'PN...',
81+
['concat', blueprintPrefix, ['get', 'type_if']],
82+
],
83+
'icon-size': ['step', ['zoom'], 0.3, 15, 0.4],
84+
'text-offset': [
85+
'step',
86+
['zoom'],
87+
['literal', [1.5, 0]],
88+
15,
89+
[
90+
'case',
91+
['==', ['get', 'position'], 'D'],
92+
['literal', [4, -1]],
93+
['==', ['get', 'position'], 'G'],
94+
['literal', [-4, -1]],
95+
['literal', [4, 0]],
96+
],
97+
],
98+
'icon-offset': [
99+
'step',
100+
['zoom'],
101+
['literal', [1.5, 0]],
102+
15,
103+
[
104+
'case',
105+
['==', ['get', 'position'], 'D'],
106+
['literal', [80, -100]],
107+
['==', ['get', 'position'], 'G'],
108+
['literal', [-80, -100]],
109+
['literal', [0, 0]],
110+
],
111+
],
112+
'icon-rotation-alignment': 'map',
113+
'text-rotation-alignment': 'map',
114+
'icon-rotate': ['get', 'angle'],
115+
'text-rotate': ['get', 'angle'],
116+
'icon-allow-overlap': true,
117+
'text-allow-overlap': true,
118+
'icon-ignore-placement': false,
119+
'text-justify': [
120+
'case',
121+
['==', ['get', 'position'], 'D'],
122+
'left',
123+
['==', ['get', 'position'], 'G'],
124+
'right',
125+
'center',
126+
],
127+
'text-anchor': [
128+
'case',
129+
['==', ['get', 'position'], 'D'],
130+
'left',
131+
['==', ['get', 'position'], 'G'],
132+
'right',
133+
'center',
134+
],
135+
},
136+
};
137+
138+
const mastParams = {
139+
id: 'mast2',
140+
type: 'symbol',
141+
source: 'signalisation',
142+
'source-layer': 'signalisation_angles',
143+
minzoom: 15,
144+
filter,
145+
layout: {
146+
'text-font': ['Open Sans Regular'],
147+
'text-size': 8,
148+
'text-field': '',
149+
'text-allow-overlap': true,
150+
'text-ignore-placement': true,
151+
'icon-image': [
152+
'case',
153+
['==', ['get', 'position'], 'D'],
154+
'MATD',
155+
['==', ['get', 'position'], 'G'],
156+
'MATG',
157+
'',
158+
],
159+
'icon-size': 1,
160+
'icon-rotation-alignment': 'map',
161+
'icon-rotate': ['get', 'angle'],
162+
'icon-allow-overlap': true,
163+
'icon-ignore-placement': true,
164+
},
165+
};
166+
167+
return (
168+
<Source
169+
id="panel"
170+
type="vector"
171+
url="https://osm.osrd.fr/data/signalisation.json"
172+
source-layer="signalisation_angles"
173+
>
174+
<Layer {...mastParams} />
175+
<Layer {...panelParams} />
176+
</Source>
177+
);
178+
}
179+
180+
export default Panels;

0 commit comments

Comments
 (0)