Skip to content

Commit

Permalink
front: remove schematic
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaswurtz committed Oct 8, 2023
1 parent b95abdf commit 50aa455
Show file tree
Hide file tree
Showing 42 changed files with 1,800 additions and 2,881 deletions.
4 changes: 0 additions & 4 deletions front/public/locales/en/map-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
"tags": "Compositions",
"tivs": "Speed limits",
"terrain3DExaggeration": "3D relief scale",
"tracksources": {
"geographic": "Geographic",
"schematic": "Schematic"
},
"tvds": "Track circuits",
"zone": "Zone"
}
4 changes: 0 additions & 4 deletions front/public/locales/fr/map-settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@
"tags": "Compositions",
"tivs": "Limites de vitesse",
"terrain3DExaggeration": "Échelle du relief en 3D",
"tracksources": {
"geographic": "Géographique",
"schematic": "Schématique"
},
"tvds": "Circuits de voie",
"zone": "Zone"
}
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,6 @@ export const BasePointEditionLayers: FC<{
colors: colors[mapStyle],
signalsList: [type],
symbolsList: SIGNALS_TO_SYMBOLS[type] || [],
sourceLayer: 'geo',
isEmphasized: true,
showIGNBDORTHO: false,
layersSettings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Feature, FeatureCollection, LineString, Point } from 'geojson';
import { getInfraID } from 'reducers/osrdconf/selectors';
import { flattenEntity } from 'applications/editor/data/utils';
import { featureCollection } from '@turf/helpers';
import { CatenaryEntity, SourceLayer, TrackSectionEntity } from 'types';
import { CatenaryEntity, TrackSectionEntity } from 'types';
import colors from 'common/Map/Consts/colors';
import GeoJSONs, { SourcesDefinitionsIndex } from 'common/Map/Layers/GeoJSONs';
import { getEntities, getEntity } from 'applications/editor/data/api';
Expand Down Expand Up @@ -63,7 +63,6 @@ export const CatenaryEditionLayers: FC = () => {

const layersProps = useMemo(() => {
const context = {
sourceLayer: 'geo' as SourceLayer,
prefix: mapStyle === 'blueprint' ? 'SCHB ' : '',
colors: colors[mapStyle],
signalsList: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Feature, FeatureCollection, LineString, Point } from 'geojson';
import { getInfraID } from 'reducers/osrdconf/selectors';
import { flattenEntity } from 'applications/editor/data/utils';
import { featureCollection } from '@turf/helpers';
import { SourceLayer, SpeedSectionEntity, TrackSectionEntity } from 'types';
import { SpeedSectionEntity, TrackSectionEntity } from 'types';
import colors from 'common/Map/Consts/colors';
import GeoJSONs, { SourcesDefinitionsIndex } from 'common/Map/Layers/GeoJSONs';
import { getEntities, getEntity } from 'applications/editor/data/api';
Expand Down Expand Up @@ -76,7 +76,6 @@ export const SpeedSectionEditionLayers: FC = () => {

const layersProps = useMemo(() => {
const context = {
sourceLayer: 'geo' as SourceLayer,
prefix: mapStyle === 'blueprint' ? 'SCHB ' : '',
colors: colors[mapStyle],
signalsList: [],
Expand Down
204 changes: 52 additions & 152 deletions front/src/applications/referenceMap/Map.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { isNil } from 'lodash';
import React, { useCallback, useEffect, useState, useRef } from 'react';
import React, { useCallback, useEffect, useRef } from 'react';
import { useParams } from 'react-router-dom';
import ReactMapGL, { AttributionControl, ScaleControl, MapRef } from 'react-map-gl/maplibre';
import { useDispatch, useSelector } from 'react-redux';
import { updateViewport, Viewport } from 'reducers/map';
import { RootState } from 'reducers';
import { MapLayerMouseEvent } from 'maplibre-gl';

import { LAYER_GROUPS_ORDER, LAYERS } from 'config/layerOrder';
import { getTerrain3DExaggeration } from 'reducers/map/selectors';
Expand Down Expand Up @@ -36,7 +35,6 @@ import SNCF_PSL from 'common/Map/Layers/extensions/SNCF/SNCF_PSL';
import Switches from 'common/Map/Layers/Switches';
import TracksGeographic from 'common/Map/Layers/TracksGeographic';
import TracksOSM from 'common/Map/Layers/TracksOSM';
import TracksSchematic from 'common/Map/Layers/TracksSchematic';
import colors from 'common/Map/Consts/colors';
import osmBlankStyle from 'common/Map/Layers/osmBlankStyle';
import { CUSTOM_ATTRIBUTION } from 'common/Map/const';
Expand All @@ -45,11 +43,11 @@ import LineSearchLayer from 'common/Map/Layers/LineSearchLayer';
import 'common/Map/Map.scss';

function Map() {
const { viewport, mapSearchMarker, mapStyle, mapTrackSources, showOSM, layersSettings } =
useSelector((state: RootState) => state.map);
const { viewport, mapSearchMarker, mapStyle, showOSM, layersSettings } = useSelector(
(state: RootState) => state.map
);
const terrain3DExaggeration = useSelector(getTerrain3DExaggeration);
const mapRef = useRef<MapRef | null>(null);
const [idHover, setIdHover] = useState<string | undefined>(undefined);
const { urlLat, urlLon, urlZoom, urlBearing, urlPitch } = useParams();
const { fullscreen } = useSelector((state: RootState) => state.main);
const dispatch = useDispatch();
Expand All @@ -73,14 +71,6 @@ function Map() {
});
};

const onFeatureHover = (e: MapLayerMouseEvent) => {
if (e.features && e.features[0] !== undefined && e.features[0].properties) {
setIdHover(e.features[0].properties.id);
} else {
setIdHover(undefined);
}
};

const defineInteractiveLayers = () => {
const interactiveLayersLocal = [];
if (layersSettings.tvds) {
Expand Down Expand Up @@ -129,7 +119,6 @@ function Map() {
height: e.target.getContainer().offsetHeight,
});
}}
onMouseOver={onFeatureHover}
interactiveLayerIds={defineInteractiveLayers()}
touchZoomRotate
maxPitch={85}
Expand Down Expand Up @@ -159,147 +148,58 @@ function Map() {
/>
</>
)}
<Platforms
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.PLATFORMS.GROUP]}
/>

{/* Have to duplicate objects with sourceLayer to avoid cache problems */}
{mapTrackSources === 'geographic' ? (
<>
<Platforms
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.PLATFORMS.GROUP]}
/>

<TracksGeographic
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.TRACKS_GEOGRAPHIC.GROUP]}
/>
<TracksOSM
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.TRACKS_OSM.GROUP]}
/>

<Routes
geomType="geo"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.ROUTES.GROUP]}
/>
<OperationalPoints
geomType="geo"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.OPERATIONAL_POINTS.GROUP]}
/>
<Catenaries
geomType="geo"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.CATENARIES.GROUP]}
/>
<NeutralSections
geomType="geo"
layerOrder={LAYER_GROUPS_ORDER[LAYERS.DEAD_SECTIONS.GROUP]}
/>
<BufferStops
geomType="geo"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.BUFFER_STOPS.GROUP]}
/>
<Detectors
geomType="geo"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.DETECTORS.GROUP]}
/>
<Switches
geomType="geo"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SWITCHES.GROUP]}
/>

<SpeedLimits
geomType="geo"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]}
/>
<SNCF_PSL
geomType="geo"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]}
/>

<Signals
sourceTable="signals"
colors={colors[mapStyle]}
sourceLayer="geo"
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SIGNALS.GROUP]}
/>
<LineSearchLayer
geomType="geo"
layerOrder={LAYER_GROUPS_ORDER[LAYERS.LINE_SEARCH.GROUP]}
/>
</>
) : (
<>
<TracksSchematic
colors={colors[mapStyle]}
idHover={idHover}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.TRACKS_SCHEMATIC.GROUP]}
/>
<TracksGeographic
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.TRACKS_GEOGRAPHIC.GROUP]}
/>
<TracksOSM
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.TRACKS_OSM.GROUP]}
/>

<Routes
geomType="sch"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.ROUTES.GROUP]}
/>
<OperationalPoints
geomType="sch"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.OPERATIONAL_POINTS.GROUP]}
/>
<Catenaries
geomType="sch"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.CATENARIES.GROUP]}
/>
<NeutralSections
geomType="sch"
layerOrder={LAYER_GROUPS_ORDER[LAYERS.DEAD_SECTIONS.GROUP]}
/>
<BufferStops
geomType="sch"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.BUFFER_STOPS.GROUP]}
/>
<Detectors
geomType="sch"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.DETECTORS.GROUP]}
/>
<Switches
geomType="sch"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SWITCHES.GROUP]}
/>
<Routes colors={colors[mapStyle]} layerOrder={LAYER_GROUPS_ORDER[LAYERS.ROUTES.GROUP]} />
<OperationalPoints
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.OPERATIONAL_POINTS.GROUP]}
/>
<Catenaries
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.CATENARIES.GROUP]}
/>
<NeutralSections layerOrder={LAYER_GROUPS_ORDER[LAYERS.DEAD_SECTIONS.GROUP]} />
<BufferStops
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.BUFFER_STOPS.GROUP]}
/>
<Detectors
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.DETECTORS.GROUP]}
/>
<Switches
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SWITCHES.GROUP]}
/>

<SpeedLimits
geomType="sch"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]}
/>
<SNCF_PSL
geomType="sch"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]}
/>
<SpeedLimits
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]}
/>
<SNCF_PSL
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SPEED_LIMITS.GROUP]}
/>

<Signals
sourceTable="signals"
colors={colors[mapStyle]}
sourceLayer="sch"
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SIGNALS.GROUP]}
/>
<LineSearchLayer
geomType="sch"
layerOrder={LAYER_GROUPS_ORDER[LAYERS.LINE_SEARCH.GROUP]}
/>
</>
)}
<Signals
sourceTable="signals"
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.SIGNALS.GROUP]}
/>
<LineSearchLayer layerOrder={LAYER_GROUPS_ORDER[LAYERS.LINE_SEARCH.GROUP]} />

{mapSearchMarker !== undefined && (
<SearchMarker data={mapSearchMarker} colors={colors[mapStyle]} />
Expand Down
9 changes: 4 additions & 5 deletions front/src/common/Map/Layers/BufferStops.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,23 +39,22 @@ export function getBufferStopsLayerProps(params: { sourceTable?: string }): Omit

interface BufferStopsProps {
colors: Theme;
geomType: string;
layerOrder: number;
}

const BufferStops: FC<BufferStopsProps> = ({ geomType, layerOrder }) => {
const BufferStops: FC<BufferStopsProps> = ({ layerOrder }) => {
const infraID = useSelector(getInfraID);
const { layersSettings } = useSelector((state: RootState) => state.map);

return layersSettings.bufferstops ? (
<Source
id={`osrd_bufferstoplayer_${geomType}`}
id="osrd_bufferstoplayer_geo"
type="vector"
url={`${MAP_URL}/layer/buffer_stops/mvt/${geomType}/?infra=${infraID}`}
url={`${MAP_URL}/layer/buffer_stops/mvt/geo/?infra=${infraID}`}
>
<OrderedLayer
{...getBufferStopsLayerProps({ sourceTable: 'buffer_stops' })}
id={`chartis/osrd_bufferstoplayer/${geomType}`}
id="chartis/osrd_bufferstoplayer/geo"
layerOrder={layerOrder}
/>
</Source>
Expand Down
15 changes: 7 additions & 8 deletions front/src/common/Map/Layers/Catenaries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { isNil } from 'lodash';

interface CatenariesProps {
colors: Theme;
geomType: string;
layerOrder: number;
}

Expand Down Expand Up @@ -125,7 +124,7 @@ export function getCatenariesTextParams({
export default function Catenaries(props: CatenariesProps) {
const { layersSettings } = useSelector((state: RootState) => state.map);
const infraID = useSelector(getInfraID);
const { geomType, colors, layerOrder } = props;
const { colors, layerOrder } = props;
const catenariesParams: LayerProps = getCatenariesProps({ colors, sourceTable: 'catenaries' });
const catenariesTextParams: LayerProps = getCatenariesTextParams({
colors,
Expand All @@ -135,20 +134,20 @@ export default function Catenaries(props: CatenariesProps) {
if (layersSettings.catenaries) {
return (
<Source
id={`catenaries_${geomType}`}
id="catenaries_geo"
type="vector"
url={`${MAP_URL}/layer/catenaries/mvt/${geomType}/?infra=${infraID}`}
url={`${MAP_URL}/layer/catenaries/mvt/geo/?infra=${infraID}`}
>
<OrderedLayer
{...catenariesParams}
// beforeId={`chartis/tracks-${geomType}/main`}
id={`chartis/catenaries/${geomType}`}
// beforeId={`chartis/tracks-geo/main`}
id="chartis/catenaries/geo"
layerOrder={layerOrder}
/>
<OrderedLayer
{...catenariesTextParams}
// beforeId={`chartis/tracks-${geomType}/main`}
id={`chartis/catenaries_names/${geomType}`}
// beforeId={`chartis/tracks-geo/main`}
id="chartis/catenaries_names/geo"
layerOrder={layerOrder}
/>
</Source>
Expand Down
Loading

0 comments on commit 50aa455

Please sign in to comment.