diff --git a/chartos/chartos.yml b/chartos/chartos.yml index 2ee356238e9..138a7c5ac34 100644 --- a/chartos/chartos.yml +++ b/chartos/chartos.yml @@ -25,14 +25,12 @@ on_field: geographic cache_duration: 3600 data_expr: signal.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_signalmodel signal on signal.obj_id = layer.obj_id and signal.infra_id = layer.infra_id - name: sch on_field: schematic cache_duration: 3600 data_expr: signal.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_signalmodel signal on signal.obj_id = layer.obj_id and signal.infra_id = layer.infra_id @@ -44,16 +42,39 @@ on_field: geographic cache_duration: 3600 data_expr: speed_section.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_speedsectionmodel speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id + where: + - not (speed_section.data @? '$.extensions.lpv_sncf.z') - name: sch on_field: schematic cache_duration: 3600 data_expr: speed_section.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_speedsectionmodel speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id + where: + - not (speed_section.data @? '$.extensions.lpv_sncf.z') + +- name: lpv + table_name: osrd_infra_speedsectionlayer + id_field: id + views: + - name: geo + on_field: geographic + cache_duration: 3600 + data_expr: speed_section.data + joins: + - inner join osrd_infra_speedsectionmodel speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id + where: + - speed_section.data @? '$.extensions.lpv_sncf.z' + - name: sch + on_field: schematic + cache_duration: 3600 + data_expr: speed_section.data + joins: + - inner join osrd_infra_speedsectionmodel speed_section on speed_section.obj_id = layer.obj_id and speed_section.infra_id = layer.infra_id + where: + - speed_section.data @? '$.extensions.lpv_sncf.z' - name: track_section_links table_name: osrd_infra_tracksectionlinklayer @@ -63,14 +84,12 @@ on_field: geographic cache_duration: 3600 data_expr: track_section_link.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_tracksectionlinkmodel track_section_link on track_section_link.obj_id = layer.obj_id and track_section_link.infra_id = layer.infra_id - name: sch on_field: schematic cache_duration: 3600 data_expr: track_section_link.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_tracksectionlinkmodel track_section_link on track_section_link.obj_id = layer.obj_id and track_section_link.infra_id = layer.infra_id @@ -82,14 +101,12 @@ on_field: geographic cache_duration: 3600 data_expr: switch.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_switchmodel switch on switch.obj_id = layer.obj_id and switch.infra_id = layer.infra_id - name: sch on_field: schematic cache_duration: 3600 data_expr: switch.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_switchmodel switch on switch.obj_id = layer.obj_id and switch.infra_id = layer.infra_id @@ -101,14 +118,12 @@ on_field: geographic cache_duration: 3600 data_expr: detector.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_detectormodel detector on detector.obj_id = layer.obj_id and detector.infra_id = layer.infra_id - name: sch on_field: schematic cache_duration: 3600 data_expr: detector.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_detectormodel detector on detector.obj_id = layer.obj_id and detector.infra_id = layer.infra_id @@ -120,14 +135,12 @@ on_field: geographic cache_duration: 3600 data_expr: buffer_stop.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_bufferstopmodel buffer_stop on buffer_stop.obj_id = layer.obj_id and buffer_stop.infra_id = layer.infra_id - name: sch on_field: schematic cache_duration: 3600 data_expr: buffer_stop.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_bufferstopmodel buffer_stop on buffer_stop.obj_id = layer.obj_id and buffer_stop.infra_id = layer.infra_id @@ -139,14 +152,12 @@ on_field: geographic cache_duration: 3600 data_expr: route.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_routemodel route on route.obj_id = layer.obj_id and route.infra_id = layer.infra_id - name: sch on_field: schematic cache_duration: 3600 data_expr: route.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_routemodel route on route.obj_id = layer.obj_id and route.infra_id = layer.infra_id @@ -158,14 +169,12 @@ on_field: geographic cache_duration: 3600 data_expr: operational_point.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_operationalpointmodel operational_point on operational_point.obj_id = layer.obj_id and operational_point.infra_id = layer.infra_id - name: sch on_field: schematic cache_duration: 3600 data_expr: operational_point.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_operationalpointmodel operational_point on operational_point.obj_id = layer.obj_id and operational_point.infra_id = layer.infra_id @@ -177,14 +186,12 @@ on_field: geographic cache_duration: 3600 data_expr: catenary.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_catenarymodel catenary on catenary.obj_id = layer.obj_id and catenary.infra_id = layer.infra_id - name: sch on_field: schematic cache_duration: 3600 data_expr: catenary.data - exclude_fields: [geo, sch] joins: - inner join osrd_infra_catenarymodel catenary on catenary.obj_id = layer.obj_id and catenary.infra_id = layer.infra_id @@ -196,9 +203,7 @@ on_field: geographic cache_duration: 3600 data_expr: layer.information - exclude_fields: [geo, sch] - name: sch on_field: schematic cache_duration: 3600 data_expr: layer.information - exclude_fields: [geo, sch] \ No newline at end of file diff --git a/chartos/chartos/config.py b/chartos/chartos/config.py index 4b874b9f175..f6c07235bca 100644 --- a/chartos/chartos/config.py +++ b/chartos/chartos/config.py @@ -27,6 +27,7 @@ class View: exclude_fields: List[str] = field(compare=False) joins: List[JoinExpr] = field(compare=False) cache_duration: int = field(compare=False) + where: List[str] = field(compare=False) @staticmethod def parse(data): @@ -37,6 +38,7 @@ def parse(data): data.get("exclude_fields", []), data.get("joins", []), data["cache_duration"], + data.get("where", []), ) def todict(self): diff --git a/chartos/chartos/views.py b/chartos/chartos/views.py index 1d3cd97e388..0607f28be90 100644 --- a/chartos/chartos/views.py +++ b/chartos/chartos/views.py @@ -1,5 +1,6 @@ import json from collections import defaultdict +from functools import reduce from typing import Any, Dict, List, Mapping, NewType, Tuple from asyncpg import Connection @@ -141,6 +142,8 @@ async def mvt_query(psql, layer, infra, view: View, z: int, x: int, y: int) -> b f"{' '.join(view.joins)} " # filter by infra f"WHERE layer.infra_id = $4 " + # Where view conditions + f"{reduce(lambda base, cond: f'{base} AND ({cond}) ', view.where, '')}" # we only want objects which are inside the tile BBox f"AND {view.on_field} && bbox.geom " # exclude geometry collections @@ -287,6 +290,8 @@ async def get_objects_in_bbox( f"{' '.join(view.joins)} " # Filter by infra "WHERE layer.infra_id = $1 " + # Where view conditions + f"{reduce(lambda base, cond: f'{base} AND ({cond}) ', view.where, '')}" # Filter by objects inside the bounding box f"AND layer.{view.on_field} && ST_Transform(ST_MakeEnvelope($2, $3, $4, $5, 4326), 3857)" ) diff --git a/front/public/locales/fr/map-settings.json b/front/public/locales/fr/map-settings.json index 984133c1efd..72840df2d51 100644 --- a/front/public/locales/fr/map-settings.json +++ b/front/public/locales/fr/map-settings.json @@ -19,6 +19,7 @@ "signalisation": "Signalisation", "showOSM": "Afficher le fond de carte", "showOSMtracksections": "Afficher les voies OSM", + "sncf_lpv": "Limites permanentes de vitesse", "speedlimits": "Vitesses limites", "stops": "Pancartes d'arrêt", "switches": "Appareils de voie", @@ -28,5 +29,6 @@ "geographic": "Géographique", "schematic": "Schématique" }, - "tvds": "Circuits de voie" + "tvds": "Circuits de voie", + "zone": "Zone" } diff --git a/front/src/applications/carto/Map.js b/front/src/applications/carto/Map.js index 7bf163f5881..9637414d1e4 100644 --- a/front/src/applications/carto/Map.js +++ b/front/src/applications/carto/Map.js @@ -21,8 +21,8 @@ import SearchMarker from 'common/Map/Layers/SearchMarker'; import SignalingType from 'common/Map/Layers/SignalingType'; import Signals from 'common/Map/Layers/Signals'; import SpeedLimits from 'common/Map/Layers/SpeedLimits'; +import SNCF_LPV from 'common/Map/Layers/extensions/SNCF/SNCF_LPV'; import Switches from 'common/Map/Layers/Switches'; -import TVDs from 'common/Map/Layers/TVDs'; import TracksGeographic from 'common/Map/Layers/TracksGeographic'; import TracksOSM from 'common/Map/Layers/TracksOSM'; import TracksSchematic from 'common/Map/Layers/TracksSchematic'; @@ -128,16 +128,16 @@ function Map() { {/* Have to duplicate objects with sourceLayer to avoid cache problems in mapbox */} {mapTrackSources === 'geographic' ? ( <> - - + - + + @@ -145,10 +145,12 @@ function Map() { ) : ( <> + - + + diff --git a/front/src/assets/mapstyles/OSMStyle.json b/front/src/assets/mapstyles/OSMStyle.json index 2dd11ef8d08..c78fb8c2549 100644 --- a/front/src/assets/mapstyles/OSMStyle.json +++ b/front/src/assets/mapstyles/OSMStyle.json @@ -1054,19 +1054,11 @@ "source": "openmaptiles", "source-layer": "building", "type": "fill-extrusion", - "minzoom": 15, + "minzoom": 0, "paint": { "fill-extrusion-color": "#aaa", - "fill-extrusion-height": [ - "interpolate", ["linear"], ["zoom"], - 15, 0, - 15.05, ["get", "render_height"] - ], - "fill-extrusion-base": [ - "interpolate", ["linear"], ["zoom"], - 15, 0, - 15.05, ["get", "render_min_height"] - ], + "fill-extrusion-height": ["get", "render_height"], + "fill-extrusion-base": ["get", "render_min_height"], "fill-extrusion-opacity": 0.6 } }, diff --git a/front/src/common/BootstrapSNCF/SwitchSNCF/SwitchSNCF.js b/front/src/common/BootstrapSNCF/SwitchSNCF/SwitchSNCF.js index ff9abf77cbe..219dd81d72b 100644 --- a/front/src/common/BootstrapSNCF/SwitchSNCF/SwitchSNCF.js +++ b/front/src/common/BootstrapSNCF/SwitchSNCF/SwitchSNCF.js @@ -50,7 +50,7 @@ export default class SwitchSNCF extends Component { id={optionId} name={name} className="custom-control-input" - checked={option.value === checkedName} + checked={checked} onChange={onChange} value={option.value} /> diff --git a/front/src/common/Map/Consts/colors.ts b/front/src/common/Map/Consts/colors.ts index 75724301141..82f5a749e01 100644 --- a/front/src/common/Map/Consts/colors.ts +++ b/front/src/common/Map/Consts/colors.ts @@ -36,6 +36,14 @@ const colors: Record = { text: '#555555', halo: '#eee', }, + lpv: { + pointtext: '#5b5b5b', + pointhalo: '#ffffff', + detailtext: '#555555', + detailhalo: '#ffffff', + text: '#4d4f53', + halo: '#ffffff', + }, mapmarker: { text: '#0088ce', circle: '#0088ce', @@ -98,7 +106,7 @@ const colors: Record = { pointhalo: '#5b5b5b', detailtext: '#555555', detailhalo: '#ffffff', - text: '#555555', + text: '#4d4f53', halo: '#ffffff', }, station: { @@ -164,6 +172,14 @@ const colors: Record = { text: '#4895ef', halo: '#0b011d', }, + lpv: { + pointtext: '#eeeeee', + pointhalo: '#3a86ff', + detailtext: '#3a86ff', + detailhalo: '#0b011d', + text: '#3a86ff', + halo: '#000000', + }, mapmarker: { text: '#ffaa39', circle: '#ffaa39', @@ -292,6 +308,14 @@ const colors: Record = { text: bpLight, halo: bpBg, }, + lpv: { + pointtext: bpLight, + pointhalo: bpBg, + detailtext: bpLight, + detailhalo: bpBg, + text: bpLight, + halo: bpBg, + }, mapmarker: { text: bpMedium, circle: bpLight, diff --git a/front/src/common/Map/Layers/OperationalPoints.js b/front/src/common/Map/Layers/OperationalPoints.js index cfc30b49117..10d2fbc3774 100644 --- a/front/src/common/Map/Layers/OperationalPoints.js +++ b/front/src/common/Map/Layers/OperationalPoints.js @@ -22,7 +22,7 @@ export default function OperationalPoints(props) { const layerName = { type: 'symbol', 'source-layer': 'operational_points', - minzoom: 9, + minzoom: 9.5, layout: { 'text-field': [ 'concat', @@ -57,12 +57,12 @@ export default function OperationalPoints(props) { const layerNameShort = { type: 'symbol', 'source-layer': 'operational_points', - maxzoom: 9, + maxzoom: 9.5, minzoom: 7, layout: { 'text-field': [ 'concat', - ['get', 'trigram'], + ['get', 'extensions_sncf_trigram'], ' ', [ 'case', diff --git a/front/src/common/Map/Layers/SignalingType.js b/front/src/common/Map/Layers/SignalingType.js index 8164237a83e..8c93323792a 100644 --- a/front/src/common/Map/Layers/SignalingType.js +++ b/front/src/common/Map/Layers/SignalingType.js @@ -27,17 +27,15 @@ export default function SignalingType(props) { }, }; - return ( - layersSettings.signalingtype && ( - - - - ) - ); + return layersSettings.signalingtype ? ( + + + + ) : null; } SignalingType.propTypes = { diff --git a/front/src/common/Map/Layers/SpeedLimits.tsx b/front/src/common/Map/Layers/SpeedLimits.tsx index 2781199094a..05913eac0a0 100644 --- a/front/src/common/Map/Layers/SpeedLimits.tsx +++ b/front/src/common/Map/Layers/SpeedLimits.tsx @@ -2,8 +2,6 @@ import React from 'react'; import { useSelector } from 'react-redux'; import { Layer, Source, LayerProps } from 'react-map-gl'; -import PropTypes from 'prop-types'; - import { RootState } from 'reducers'; import { MAP_URL } from 'common/Map/const'; import { Theme } from 'types'; diff --git a/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV.tsx b/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV.tsx new file mode 100644 index 00000000000..26c8eff10c7 --- /dev/null +++ b/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV.tsx @@ -0,0 +1,176 @@ +import React from 'react'; +import { useSelector } from 'react-redux'; +import { Layer, Source, LayerProps } from 'react-map-gl'; +import { useTranslation } from 'react-i18next'; + +import { RootState } from 'reducers'; +import { MAP_URL } from 'common/Map/const'; +import { Theme } from 'types'; + +// REMOVE BEFORE PROD +import Panels from './SNCF_LPV_PANELS'; + +interface SNCF_LPVProps { + geomType: string; + colors: Theme; +} + +export default function SNCF_LPV(props: SNCF_LPVProps) { + const { t } = useTranslation('map-settings'); + const { layersSettings } = useSelector((state: RootState) => state.map); + const { infraID } = useSelector((state: RootState) => state.osrdconf); + const { geomType, colors } = props; + + const tag = `speed_limit_by_tag_${layersSettings.speedlimittag}`; + const speedLimitByTagName = [ + 'round', + ['*', 3.6, ['case', ['!=', ['get', tag], null], ['get', tag], ['get', 'speed_limit']]], + ]; + + const speedSectionFilter = ['any', ['has', 'speed_limit'], ['has', tag]]; + + const speedValuePointParams: LayerProps = { + type: 'symbol', + 'source-layer': 'lpv', + minzoom: 9, + maxzoom: 24, + filter: speedSectionFilter, + layout: { + visibility: 'none', + 'text-font': ['Roboto Bold'], + 'symbol-placement': 'point', + 'text-field': ['to-string', speedLimitByTagName], + 'text-size': 12, + 'icon-allow-overlap': false, + 'icon-ignore-placement': false, + 'text-justify': 'left', + 'text-allow-overlap': false, + 'text-ignore-placement': false, + }, + paint: { + 'text-color': colors.lpv.pointtext, + 'text-halo-color': colors.lpv.pointhalo, + 'text-halo-width': 7, + 'text-opacity': 1, + }, + }; + + const speedValueParams: LayerProps = { + type: 'symbol', + 'source-layer': 'lpv', + minzoom: 9, + maxzoom: 24, + filter: speedSectionFilter, + layout: { + visibility: 'visible', + 'text-font': ['Roboto Bold'], + 'symbol-placement': 'line-center', + 'text-field': [ + 'concat', + t('zone').toUpperCase(), + ' ', + ['to-string', speedLimitByTagName], + 'km/h', + ], + 'text-size': 10, + 'text-justify': 'left', + 'text-allow-overlap': false, + 'text-ignore-placement': false, + 'text-offset': [0, -1], + }, + paint: { + 'text-color': colors.lpv.text, + 'text-halo-color': colors.lpv.halo, + 'text-halo-width': 1, + 'text-opacity': 1, + }, + }; + + const speedLineBGParams: LayerProps = { + type: 'line', + 'source-layer': 'lpv', + minzoom: 6, + maxzoom: 24, + filter: speedSectionFilter, + layout: { + visibility: 'visible', + 'line-cap': ['step', ['zoom'], 'round', 15, 'square'], + }, + paint: { + 'line-color': '#747678', + 'line-width': 3, + 'line-offset': 0, + 'line-opacity': 1, + 'line-gap-width': 7, + }, + }; + + const speedLineParams: LayerProps = { + type: 'line', + 'source-layer': 'lpv', + minzoom: 6, + maxzoom: 24, + filter: speedSectionFilter, + layout: { + visibility: 'visible', + 'line-cap': ['step', ['zoom'], 'round', 15, 'square'], + }, + paint: { + 'line-color': [ + 'let', + 'speed_limit', + speedLimitByTagName, + [ + 'case', + ['all', ['>', ['var', 'speed_limit'], 220]], + 'rgba(145, 211, 255, 1)', + ['all', ['>', ['var', 'speed_limit'], 160], ['<=', ['var', 'speed_limit'], 220]], + 'rgba(137, 247, 216, 1)', + ['all', ['>=', ['var', 'speed_limit'], 140], ['<=', ['var', 'speed_limit'], 160]], + 'rgba(158, 255, 119, 1)', + ['all', ['>=', ['var', 'speed_limit'], 100], ['<', ['var', 'speed_limit'], 140]], + 'rgba(224, 254, 100, 1)', + ['all', ['>', ['var', 'speed_limit'], 60], ['<', ['var', 'speed_limit'], 100]], + 'rgba(253, 244, 121, 1)', + ['all', ['<=', ['var', 'speed_limit'], 60], ['>', ['var', 'speed_limit'], 30]], + 'rgba(251, 178, 134, 1)', + ['all', ['<=', ['var', 'speed_limit'], 30]], + 'rgba(239, 81, 81, 1)', + 'rgba(185, 185, 185, 1)', + ], + ], + 'line-width': 3, + 'line-offset': 0, + 'line-opacity': 1, + 'line-gap-width': 7, + 'line-dasharray': [1, 2], + }, + }; + + if (layersSettings.sncf_lpv) { + return ( + <> + + + + + + + + + ); + } + return null; +} diff --git a/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV_PANELS.js b/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV_PANELS.js new file mode 100644 index 00000000000..54897d4aa51 --- /dev/null +++ b/front/src/common/Map/Layers/extensions/SNCF/SNCF_LPV_PANELS.js @@ -0,0 +1,180 @@ +import React from 'react'; +import { Source, Layer } from 'react-map-gl'; + +function Panels() { + const blueprintPrefix = ''; + const filter = [ + 'all', + ['in', 'type_if', 'CHEVRON', 'R', 'TIV D FIXE', 'TIVD C FIX', 'TIVD B FIX', 'Z'], + ]; + + const panelParams = { + id: 'panelParams', + type: 'symbol', + source: 'signalisation', + 'source-layer': 'signalisation_angles', + minzoom: 10, + filter, + layout: { + 'text-font': ['Open Sans Regular'], + 'text-size': 9, + 'icon-image': [ + 'case', + ['==', ['get', 'type_if'], 'CHEVRON'], + ['concat', blueprintPrefix, 'CHEVRON BAS'], + ['==', ['get', 'type_if'], 'DESTI'], + ['concat', blueprintPrefix, 'VIDE'], + ['==', ['get', 'type_if'], 'DIVERS'], + ['concat', blueprintPrefix, 'VIDE'], + ['==', ['get', 'type_if'], 'IDD'], + ['case', ['==', ['get', 'position'], 'D'], 'IDD GAUCHE', 'IDD DROIT'], + ['==', ['get', 'type_if'], 'JAL ARRET'], + ['concat', blueprintPrefix, 'JAL ARR'], + ['==', ['get', 'type_if'], 'TECS'], + [ + 'case', + ['==', ['get', 'position'], 'D'], + ['concat', blueprintPrefix, 'TECS G'], + ['concat', blueprintPrefix, 'TECS D'], + ], + ['==', ['get', 'type_if'], 'TSCS'], + [ + 'case', + ['==', ['get', 'position'], 'D'], + ['concat', blueprintPrefix, 'TSCS G'], + ['concat', blueprintPrefix, 'TSCS D'], + ], + ['==', ['get', 'type_if'], 'TIV D FIXE'], + ['concat', blueprintPrefix, 'TIV D FIXE 60'], + ['==', ['get', 'type_if'], 'TIV R FIXE'], + ['concat', blueprintPrefix, 'TIV R FIXE 60'], + ['==', ['get', 'type_if'], 'TIV D MOB'], + ['concat', blueprintPrefix, 'TIV D MOB 60'], + ['==', ['get', 'type_if'], 'TIV R MOB'], + ['concat', blueprintPrefix, 'TIV R MOB 60'], + ['==', ['get', 'type_if'], 'TIVD B FIX'], + ['concat', blueprintPrefix, 'TIVD B FIX 60'], + ['==', ['get', 'type_if'], 'ARRET VOY'], + ['concat', blueprintPrefix, 'ARRET VOY TT'], + ['==', ['get', 'type_if'], 'GARE'], + 'GARE', + ['==', ['get', 'type_if'], 'SECT'], + 'SECT', + ['==', ['get', 'type_if'], 'ARRET'], + 'ARRET', + ['==', ['get', 'type_if'], 'ARRET A'], + 'ARRET A', + ['==', ['get', 'type_if'], 'IMP'], + 'IMP', + ['==', ['get', 'type_if'], 'BP EXE'], + 'BP EXE', + ['==', ['get', 'type_if'], 'BP FIN'], + 'BP FIN', + ['==', ['get', 'type_if'], 'APPROETSA'], + 'APPROETSA', + ['==', ['get', 'type_if'], 'P'], + 'P', + ['==', ['get', 'type_if'], 'PN'], + 'PN', + ['==', ['get', 'type_if'], 'PN...'], + 'PN...', + ['concat', blueprintPrefix, ['get', 'type_if']], + ], + 'icon-size': ['step', ['zoom'], 0.3, 15, 0.4], + 'text-offset': [ + 'step', + ['zoom'], + ['literal', [1.5, 0]], + 15, + [ + 'case', + ['==', ['get', 'position'], 'D'], + ['literal', [4, -1]], + ['==', ['get', 'position'], 'G'], + ['literal', [-4, -1]], + ['literal', [4, 0]], + ], + ], + 'icon-offset': [ + 'step', + ['zoom'], + ['literal', [1.5, 0]], + 15, + [ + 'case', + ['==', ['get', 'position'], 'D'], + ['literal', [80, -100]], + ['==', ['get', 'position'], 'G'], + ['literal', [-80, -100]], + ['literal', [0, 0]], + ], + ], + 'icon-rotation-alignment': 'map', + 'text-rotation-alignment': 'map', + 'icon-rotate': ['get', 'angle'], + 'text-rotate': ['get', 'angle'], + 'icon-allow-overlap': true, + 'text-allow-overlap': true, + 'icon-ignore-placement': false, + 'text-justify': [ + 'case', + ['==', ['get', 'position'], 'D'], + 'left', + ['==', ['get', 'position'], 'G'], + 'right', + 'center', + ], + 'text-anchor': [ + 'case', + ['==', ['get', 'position'], 'D'], + 'left', + ['==', ['get', 'position'], 'G'], + 'right', + 'center', + ], + }, + }; + + const mastParams = { + id: 'mast2', + type: 'symbol', + source: 'signalisation', + 'source-layer': 'signalisation_angles', + minzoom: 15, + filter, + layout: { + 'text-font': ['Open Sans Regular'], + 'text-size': 8, + 'text-field': '', + 'text-allow-overlap': true, + 'text-ignore-placement': true, + 'icon-image': [ + 'case', + ['==', ['get', 'position'], 'D'], + 'MATD', + ['==', ['get', 'position'], 'G'], + 'MATG', + '', + ], + 'icon-size': 1, + 'icon-rotation-alignment': 'map', + 'icon-rotate': ['get', 'angle'], + 'icon-allow-overlap': true, + 'icon-ignore-placement': true, + }, + }; + + return ( + + + + + ); +} + +export default Panels; diff --git a/front/src/common/Map/Settings/MapSettingsLayers.js b/front/src/common/Map/Settings/MapSettingsLayers.js index 7d7cf79cc53..c6f7f41c6be 100644 --- a/front/src/common/Map/Settings/MapSettingsLayers.js +++ b/front/src/common/Map/Settings/MapSettingsLayers.js @@ -12,7 +12,7 @@ import SwitchesSVGFile from 'assets/pictures/layersicons/switches.svg'; import DetectorsSVGFile from 'assets/pictures/layersicons/detectors.svg'; import SwitchSNCF, { SWITCH_TYPES } from 'common/BootstrapSNCF/SwitchSNCF/SwitchSNCF'; -function FormatSwitch(props) { +export function FormatSwitch(props) { const dispatch = useDispatch(); const { t } = useTranslation(['map-settings']); const { layersSettings } = useSelector((state) => state.map); @@ -45,17 +45,8 @@ function FormatSwitch(props) { ); } -function BufferStopSVG() { - return Buffer stop icon; -} -function DetectorsSVG() { - return Buffer stop icon; -} -function OPsSVG() { - return Buffer stop icon; -} -function SwitchesSVG() { - return Buffer stop icon; +export function Icon2SVG(file, altName) { + return {altName}; } export default function MapSettingsLayers() { @@ -65,10 +56,13 @@ export default function MapSettingsLayers() { } disabled /> } disabled /> } color="text-orange" /> - } /> - } /> - } /> - } /> + + + + ); } diff --git a/front/src/common/Map/Settings/MapSettingsSignals.js b/front/src/common/Map/Settings/MapSettingsSignals.js index f6350de330d..d692342a5f8 100644 --- a/front/src/common/Map/Settings/MapSettingsSignals.js +++ b/front/src/common/Map/Settings/MapSettingsSignals.js @@ -4,17 +4,15 @@ import { useTranslation } from 'react-i18next'; import { updateSignalsSettings } from 'reducers/map'; import SwitchSNCF from 'common/BootstrapSNCF/SwitchSNCF/SwitchSNCF'; import stopsIcon from 'assets/pictures/layersicons/layer_stops.svg'; -import tivsIcon from 'assets/pictures/layersicons/layer_tivs.svg'; import lightsIcon from 'assets/pictures/layersicons/layer_signal.svg'; export default function MapSettingsSignals() { const { signalsSettings } = useSelector((state) => state.map); const dispatch = useDispatch(); const { t } = useTranslation(['map-settings']); - const CONSTS_SETTINGS = ['all', 'stops', 'tivs', 'lights']; + const CONSTS_SETTINGS = ['all', 'stops', 'lights']; const CONSTS_SVG = { stops: stopsIcon, - tivs: tivsIcon, lights: lightsIcon, }; diff --git a/front/src/common/Map/Settings/MapSettingsSpeedLimits.js b/front/src/common/Map/Settings/MapSettingsSpeedLimits.js index b999bfa22d2..dd45f9c1edd 100644 --- a/front/src/common/Map/Settings/MapSettingsSpeedLimits.js +++ b/front/src/common/Map/Settings/MapSettingsSpeedLimits.js @@ -9,6 +9,8 @@ import SelectImprovedSNCF from 'common/BootstrapSNCF/SelectImprovedSNCF'; import DotsLoader from 'common/DotsLoader/DotsLoader'; import { get } from 'common/requests'; import { setFailure } from 'reducers/main'; +import TIVsSVGFile from 'assets/pictures/layersicons/layer_tivs.svg'; +import { FormatSwitch as SimpleFormatSwitch, Icon2SVG } from './MapSettingsLayers'; function FormatSwitch(props) { const dispatch = useDispatch(); @@ -78,7 +80,7 @@ function FormatSwitch(props) { {t(name)} -
+
{speedLimitsTags ? ( } /> +
); } diff --git a/front/src/reducers/map.ts b/front/src/reducers/map.ts index a9758983fd6..c0a07cdf273 100644 --- a/front/src/reducers/map.ts +++ b/front/src/reducers/map.ts @@ -58,7 +58,6 @@ export interface MapState { all: boolean; stops: boolean; lights: boolean; - tivs: boolean; }; layersSettings: { bufferstops: boolean; @@ -67,6 +66,7 @@ export interface MapState { operationalpoints: boolean; routes: boolean; signalingtype: boolean; + sncf_lpv: boolean; speedlimittag: unknown; speedlimits: boolean; switches: boolean; @@ -97,7 +97,6 @@ export const initialState: MapState = { all: false, stops: true, lights: false, - tivs: false, }, layersSettings: { bufferstops: false, @@ -106,6 +105,7 @@ export const initialState: MapState = { operationalpoints: false, routes: false, signalingtype: true, + sncf_lpv: false, speedlimittag: undefined, speedlimits: false, switches: false, diff --git a/front/yarn.lock b/front/yarn.lock index f568d28b1e2..9b37da47e2b 100644 --- a/front/yarn.lock +++ b/front/yarn.lock @@ -2394,7 +2394,6 @@ dependencies: "@babel/types" "^7.3.0" -<<<<<<< HEAD "@types/d3-array@*": version "3.0.3" resolved "https://registry.yarnpkg.com/@types/d3-array/-/d3-array-3.0.3.tgz#87d990bf504d14ad6b16766979d04e943c046dac" @@ -2605,10 +2604,7 @@ "@types/d3-transition" "*" "@types/d3-zoom" "*" -"@types/eslint@^7.28.2": -======= "@types/eslint@^7.29.0": ->>>>>>> 6965a725 (front: avoid reducer file & folder with same name (osrdsimulation)) version "7.29.0" resolved "https://registry.yarnpkg.com/@types/eslint/-/eslint-7.29.0.tgz#e56ddc8e542815272720bb0b4ccc2aff9c3e1c78" integrity sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==