Skip to content

Commit 18c5ad1

Browse files
committed
front: lpv: wip with panels
1 parent 8e0b847 commit 18c5ad1

File tree

4 files changed

+56
-93
lines changed

4 files changed

+56
-93
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
}

front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV_PANELS.js

+40-67
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,20 @@
11
import React from 'react';
22
import { Source, Layer } from 'react-map-gl';
33

4-
function Panel() {
5-
const MAP_URL = 'https://tiles.carto.graou.info';
4+
function Panels() {
65
const blueprintPrefix = '';
6+
const filter = [
7+
'all',
8+
['in', 'type_if', 'CHEVRON', 'R', 'TIV D FIXE', 'TIVD C FIX', 'TIVD B FIX', 'Z'],
9+
];
710

811
const panelParams = {
912
id: 'panelParams',
1013
type: 'symbol',
1114
source: 'signalisation',
1215
'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-
],
16+
minzoom: 10,
17+
filter,
7518
layout: {
7619
'text-font': ['Open Sans Regular'],
7720
'text-size': 9,
@@ -137,7 +80,7 @@ function Panel() {
13780
'PN...',
13881
['concat', blueprintPrefix, ['get', 'type_if']],
13982
],
140-
'icon-size': ['step', ['zoom'], 0.2, 15, 0.4],
83+
'icon-size': ['step', ['zoom'], 0.3, 15, 0.4],
14184
'text-offset': [
14285
'step',
14386
['zoom'],
@@ -192,16 +135,46 @@ function Panel() {
192135
},
193136
};
194137

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+
195167
return (
196168
<Source
197169
id="panel"
198170
type="vector"
199-
url={`${MAP_URL}/data/signalisation.json`}
171+
url="https://osm.osrd.fr/data/signalisation.json"
200172
source-layer="signalisation_angles"
201173
>
174+
<Layer {...mastParams} />
202175
<Layer {...panelParams} />
203176
</Source>
204177
);
205178
}
206179

207-
export default Panel;
180+
export default Panels;

0 commit comments

Comments
 (0)