Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

front: reorganize infra object layers #10319

Merged
merged 1 commit into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions front/src/applications/editor/Map.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,12 @@ import { CUSTOM_ATTRIBUTION } from 'common/Map/const';
import colors from 'common/Map/Consts/colors';
import Background from 'common/Map/Layers/Background';
import { useMapBlankStyle } from 'common/Map/Layers/blankStyle';
import NeutralSections from 'common/Map/Layers/extensions/SNCF/NeutralSections';
import Hillshade from 'common/Map/Layers/Hillshade';
import IGN_BD_ORTHO from 'common/Map/Layers/IGN_BD_ORTHO';
import IGN_CADASTRE from 'common/Map/Layers/IGN_CADASTRE';
import IGN_SCAN25 from 'common/Map/Layers/IGN_SCAN25';
import { NeutralSectionsLayer, OperationalPointsLayer } from 'common/Map/Layers/InfraObjectLayers';
import LineSearchLayer from 'common/Map/Layers/LineSearchLayer';
import OperationalPoints from 'common/Map/Layers/OperationalPoints';
import OSM from 'common/Map/Layers/OSM';
import { Platforms as PlatformsLayer } from 'common/Map/Layers/Platforms';
import SearchMarker from 'common/Map/Layers/SearchMarker';
Expand Down Expand Up @@ -326,7 +325,7 @@ const MapUnplugged = ({
)}

{editorState.editorLayers.has('neutral_sections') && (
<NeutralSections
<NeutralSectionsLayer
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.DEAD_SECTIONS.GROUP]}
infraID={infraID}
Expand All @@ -335,7 +334,7 @@ const MapUnplugged = ({
)}

{editorState.editorLayers.has('operational_points') && (
<OperationalPoints
<OperationalPointsLayer
colors={colors[mapStyle]}
layerOrder={LAYER_GROUPS_ORDER[LAYERS.OPERATIONAL_POINTS.GROUP]}
infraID={infraID}
Expand Down
2 changes: 1 addition & 1 deletion front/src/applications/editor/components/EntitySumUp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import type { TrackSectionEntity } from 'applications/editor/tools/trackEdition/
import type { EditorEntity } from 'applications/editor/typesEditorEntity';
import type { InfraError } from 'common/api/osrdEditoastApi';
import { LoaderFill } from 'common/Loaders';
import { getSpeedSectionsNameString } from 'common/Map/Layers/SpeedLimits';
import { getSpeedSectionsNameString } from 'common/Map/Layers/InfraObjectLayers/SpeedLimits';
import { useInfraID } from 'common/osrdContext';
import { type AppDispatch, useAppDispatch } from 'store';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ import type { PointEditionState } from 'applications/editor/tools/pointEdition/t
import type { ExtendedEditorContextType } from 'applications/editor/types';
import type { EditorEntity } from 'applications/editor/typesEditorEntity';
import colors from 'common/Map/Consts/colors';
import GeoJSONs, { EditorSource, SourcesDefinitionsIndex } from 'common/Map/Layers/GeoJSONs';
import GeoJSONs, {
EditorSource,
SourcesDefinitionsIndex,
} from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import { useInfraID } from 'common/osrdContext';
import { getMap } from 'reducers/map/selectors';
import { NULL_GEOMETRY } from 'types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { getTrackRangeFeatures, isOnModeMove } from 'applications/editor/tools/r
import type { TrackSectionEntity } from 'applications/editor/tools/trackEdition/types';
import type { ExtendedEditorContextType } from 'applications/editor/types';
import colors from 'common/Map/Consts/colors';
import GeoJSONs, { SourcesDefinitionsIndex } from 'common/Map/Layers/GeoJSONs';
import GeoJSONs, { SourcesDefinitionsIndex } from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import { useInfraID } from 'common/osrdContext';
import { getMap } from 'reducers/map/selectors';
import { useAppDispatch } from 'store';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import type { TrackSectionEntity } from 'applications/editor/tools/trackEdition/
import type { ExtendedEditorContextType } from 'applications/editor/types';
import type { EditorEntity } from 'applications/editor/typesEditorEntity';
import colors from 'common/Map/Consts/colors';
import GeoJSONs, { SourcesDefinitionsIndex } from 'common/Map/Layers/GeoJSONs';
import GeoJSONs, { SourcesDefinitionsIndex } from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import { useInfraID } from 'common/osrdContext';
import { getMap } from 'reducers/map/selectors';
import { useAppDispatch } from 'store';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ import {
import type { ExtendedEditorContextType } from 'applications/editor/types';
import type { EditorEntity } from 'applications/editor/typesEditorEntity';
import colors from 'common/Map/Consts/colors';
import GeoJSONs from 'common/Map/Layers/GeoJSONs';
import GeoJSONs from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import {
getRoutesLineLayerProps,
getRoutesPointLayerProps,
getRoutesTextLayerProps,
} from 'common/Map/Layers/Routes';
} from 'common/Map/Layers/InfraObjectLayers/Routes';
import { useInfraID } from 'common/osrdContext';
import { getMap } from 'reducers/map/selectors';
import { useAppDispatch } from 'store';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import EditorContext from 'applications/editor/context';
import type { SelectionState } from 'applications/editor/tools/selection/types';
import type { ExtendedEditorContextType } from 'applications/editor/types';
import colors from 'common/Map/Consts/colors';
import GeoJSONs from 'common/Map/Layers/GeoJSONs';
import GeoJSONs from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import { useInfraID } from 'common/osrdContext';
import { getMap } from 'reducers/map/selectors';
import type { Zone } from 'types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,11 @@ import useSwitch from 'applications/editor/tools/switchEdition/useSwitch';
import type { TrackSectionEntity } from 'applications/editor/tools/trackEdition/types';
import type { ExtendedEditorContextType } from 'applications/editor/types';
import colors from 'common/Map/Consts/colors';
import GeoJSONs from 'common/Map/Layers/GeoJSONs';
import { getSwitchesLayerProps, getSwitchesNameLayerProps } from 'common/Map/Layers/Switches';
import GeoJSONs from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import {
getSwitchesLayerProps,
getSwitchesNameLayerProps,
} from 'common/Map/Layers/InfraObjectLayers/Switches';
import { useInfraID } from 'common/osrdContext';
import { getMap } from 'reducers/map/selectors';
import { useAppDispatch } from 'store';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { POINTS_LAYER_ID, TRACK_LAYER_ID } from 'applications/editor/tools/track
import type { TrackEditionState } from 'applications/editor/tools/trackEdition/types';
import type { ExtendedEditorContextType } from 'applications/editor/types';
import colors from 'common/Map/Consts/colors';
import GeoJSONs from 'common/Map/Layers/GeoJSONs';
import GeoJSONs from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import { useInfraID } from 'common/osrdContext';
import { getMap } from 'reducers/map/selectors';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { TRACK_LAYER_ID, POINTS_LAYER_ID } from 'applications/editor/tools/trackEdition/consts';
import type { ExtendedEditorContextType } from 'applications/editor/types';
import colors from 'common/Map/Consts/colors';
import GeoJSONs from 'common/Map/Layers/GeoJSONs';
import GeoJSONs from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import { useInfraID } from 'common/osrdContext';
import { getMap } from 'reducers/map/selectors';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,44 +10,53 @@ import { useSelector } from 'react-redux';

import type { Layer as LayerType } from 'applications/editor/consts';
import { MAP_TRACK_SOURCE, MAP_URL } from 'common/Map/const';
import { getBufferStopsLayerProps } from 'common/Map/Layers/BufferStops';
import { lineNameLayer, lineNumberLayer, trackNameLayer } from 'common/Map/Layers/commonLayers';
import { getDetectorsLayerProps, getDetectorsNameLayerProps } from 'common/Map/Layers/Detectors';
import {
getElectrificationsProps,
getElectrificationsTextParams,
} from 'common/Map/Layers/Electrifications';
import {
getLineErrorsLayerProps,
getLineTextErrorsLayerProps,
getPointErrorsLayerProps,
getPointTextErrorsLayerProps,
} from 'common/Map/Layers/Errors';
import geoMainLayer from 'common/Map/Layers/geographiclayers';
import { getBufferStopsLayerProps } from 'common/Map/Layers/InfraObjectLayers/BufferStops';
import {
getDetectorsLayerProps,
getDetectorsNameLayerProps,
} from 'common/Map/Layers/InfraObjectLayers/Detectors';
import {
getElectrificationsProps,
getElectrificationsTextParams,
} from 'common/Map/Layers/InfraObjectLayers/Electrifications';
import {
getPSLSpeedLineBGLayerProps,
getPSLSpeedLineLayerProps,
getPSLSpeedValueLayerProps,
} from 'common/Map/Layers/extensions/SNCF/PSL';
import { getPSLSignsLayerProps } from 'common/Map/Layers/extensions/SNCF/PSLSigns';
import geoMainLayer from 'common/Map/Layers/geographiclayers';
import { getPointLayerProps, getSignalLayerProps } from 'common/Map/Layers/geoSignalsLayers';
import getKPLabelLayerProps from 'common/Map/Layers/KPLabel';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
import { Platforms } from 'common/Map/Layers/Platforms';
} from 'common/Map/Layers/InfraObjectLayers/extensions/SNCF/PSL';
import { getPSLSignsLayerProps } from 'common/Map/Layers/InfraObjectLayers/extensions/SNCF/PSLSigns';
import {
getPointLayerProps,
getSignalLayerProps,
} from 'common/Map/Layers/InfraObjectLayers/geoSignalsLayers';
import getKPLabelLayerProps from 'common/Map/Layers/InfraObjectLayers/getKPLabelLayerProps';
import {
getFilterBySpeedSectionsTag,
getSpeedSectionsLineLayerProps,
getSpeedSectionsPointLayerProps,
getSpeedSectionsTextLayerProps,
} from 'common/Map/Layers/SpeedLimits';
import { getSwitchesLayerProps, getSwitchesNameLayerProps } from 'common/Map/Layers/Switches';
} from 'common/Map/Layers/InfraObjectLayers/SpeedLimits';
import {
getSwitchesLayerProps,
getSwitchesNameLayerProps,
} from 'common/Map/Layers/InfraObjectLayers/Switches';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
import { Platforms } from 'common/Map/Layers/Platforms';
import type { LayerContext } from 'common/Map/Layers/types';
import { LAYER_ENTITIES_ORDERS, LAYER_GROUPS_ORDER, LAYERS } from 'config/layerOrder';
import type { RootState } from 'reducers';
import type { MapState } from 'reducers/map';
import type { Theme } from 'types';

import getMastLayerProps from './mastLayerProps';
import getMastLayerProps from '../mastLayerProps';

const POINT_ENTITIES_MIN_ZOOM = 12;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { Source, type LayerProps } from 'react-map-gl/maplibre';
import { useSelector } from 'react-redux';

import { MAP_URL } from 'common/Map/const';
import getKPLabelLayerProps from 'common/Map/Layers/KPLabel';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
import { getLayersSettings } from 'reducers/map/selectors';
import type { Theme } from 'types';

import getKPLabelLayerProps from './getKPLabelLayerProps';

type OperationalPointsProps = {
colors: Theme;
layerOrder: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { getLayersSettings, getMapStyle } from 'reducers/map/selectors';
import type { Theme } from 'types';

import { getPointLayerProps, getSignalLayerProps } from './geoSignalsLayers';
import getKPLabelLayerProps from './KPLabel';
import getKPLabelLayerProps from './getKPLabelLayerProps';

interface PlatformProps {
colors: Theme;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type LayerProps, Source, type SymbolLayer } from 'react-map-gl/maplibre
import { useSelector } from 'react-redux';

import { MAP_URL } from 'common/Map/const';
import getKPLabelLayerProps from 'common/Map/Layers/KPLabel';
import getKPLabelLayerProps from 'common/Map/Layers/InfraObjectLayers/getKPLabelLayerProps';
import getMastLayerProps from 'common/Map/Layers/mastLayerProps';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
import type { LayerContext } from 'common/Map/Layers/types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ import { type LayerProps, Source } from 'react-map-gl/maplibre';
import { useSelector } from 'react-redux';

import { MAP_URL } from 'common/Map/const';
import NeutralSectionSigns from 'common/Map/Layers/extensions/SNCF/NeutralSectionSigns';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
import { getLayersSettings } from 'reducers/map/selectors';
import type { Theme } from 'types';

import NeutralSectionSigns from './NeutralSectionSigns';

type NeutralSectionsProps = {
colors: Theme;
layerOrder: number;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable react/jsx-pascal-case */

import type { TFunction } from 'i18next';
import { isNil } from 'lodash';
import { useTranslation } from 'react-i18next';
Expand All @@ -8,13 +7,17 @@ import type { LineLayer, SymbolLayer } from 'react-map-gl/maplibre';
import { useSelector } from 'react-redux';

import { MAP_URL } from 'common/Map/const';
import SNCF_PSL_Signs from 'common/Map/Layers/extensions/SNCF/PSLSigns';
import {
getSpeedSectionsName,
getFilterBySpeedSectionsTag,
} from 'common/Map/Layers/InfraObjectLayers/SpeedLimits';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
import { getSpeedSectionsName, getFilterBySpeedSectionsTag } from 'common/Map/Layers/SpeedLimits';
import type { RootState } from 'reducers';
import type { MapState } from 'reducers/map';
import type { Theme, OmitLayer } from 'types';

import SNCF_PSL_Signs from './PSLSigns';

interface SNCF_PSLProps {
colors: Theme;
layerOrder?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Source } from 'react-map-gl/maplibre';
import { useSelector } from 'react-redux';

import { MAP_URL } from 'common/Map/const';
import getKPLabelLayerProps from 'common/Map/Layers/KPLabel';
import getKPLabelLayerProps from 'common/Map/Layers/InfraObjectLayers/getKPLabelLayerProps';
import getMastLayerProps from 'common/Map/Layers/mastLayerProps';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
import type { LayerContext } from 'common/Map/Layers/types';
Expand Down
6 changes: 6 additions & 0 deletions front/src/common/Map/Layers/InfraObjectLayers/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import InfraObjectLayers from './InfraObjectLayers';

export { default as OperationalPointsLayer } from './OperationalPoints';
export { default as NeutralSectionsLayer } from './extensions/SNCF/NeutralSections';

export default InfraObjectLayers;
2 changes: 1 addition & 1 deletion front/src/common/Map/WarpedMap/DataLoader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import mapStyleJson from 'assets/mapstyles/OSMStyle.json';
import { OSM_URL } from 'common/Map/const';
import colors from 'common/Map/Consts/colors';
import { useMapBlankStyle } from 'common/Map/Layers/blankStyle';
import GeoJSONs from 'common/Map/Layers/GeoJSONs';
import GeoJSONs from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import OrderedLayer from 'common/Map/Layers/OrderedLayer';
import { simplifyFeature, type BBox2d } from 'common/Map/WarpedMap/core/helpers';
import { useInfraID } from 'common/osrdContext';
Expand Down
5 changes: 4 additions & 1 deletion front/src/common/Map/WarpedMap/WarpedMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ import type { Layer as LayerType } from 'applications/editor/consts';
import colors from 'common/Map/Consts/colors';
import { ALL_SIGNAL_LAYERS } from 'common/Map/Consts/SignalsNames';
import { useMapBlankStyle } from 'common/Map/Layers/blankStyle';
import { EditorSource, SourcesDefinitionsIndex } from 'common/Map/Layers/GeoJSONs';
import {
EditorSource,
SourcesDefinitionsIndex,
} from 'common/Map/Layers/InfraObjectLayers/GeoJSONs';
import OrderedLayer, { type OrderedLayerProps } from 'common/Map/Layers/OrderedLayer';
import { genOSMLayerProps } from 'common/Map/Layers/OSM';
import type { LayerContext } from 'common/Map/Layers/types';
Expand Down
Loading