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: remove no longer used SignalsNames #10739

Merged
merged 1 commit into from
Feb 11, 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
30 changes: 1 addition & 29 deletions front/src/applications/editor/data/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,13 @@ import bearing from '@turf/bearing';
import { compare } from 'fast-json-patch';
import type { Position } from 'geojson';
import type { JSONSchema7 } from 'json-schema';
import { isArray, isNil, isObject, uniq } from 'lodash';
import { isArray, isNil, isObject } from 'lodash';
import { v4 as uuid } from 'uuid';

import type { EditoastType } from 'applications/editor/consts';
import type { CreateOperation, DeleteOperation, UpdateOperation } from 'applications/editor/types';
import type { EditorEntity, EditorSchema } from 'applications/editor/typesEditorEntity';
import type { PostInfraByInfraIdObjectsAndObjectTypeApiResponse } from 'common/api/osrdEditoastApi';
import {
ALL_SIGNAL_LAYERS_SET,
SIGNALS_TO_SYMBOLS,
type SignalType,
} from 'common/Map/Consts/SignalsNames';

// Quick helper to get a "promised" setTimeout:
export function setTimeoutPromise(ms: number) {
Expand Down Expand Up @@ -58,29 +53,6 @@ export function cleanSymbolType(type: string): string {
return (type || '').replace(/(^[" ]|[" ]$)/g, '');
}

export function getSignalsList(editorData: EditorEntity[]): SignalType[] {
const SIGNAL_TYPE_KEY = 'extensions_sncf_installation_type';
const signalTypes = Object.keys(
editorData.reduce(
(iter, feature) =>
feature.objType === 'Signal' && (feature.properties || {})[SIGNAL_TYPE_KEY]
? { ...iter, [(feature.properties || {})[SIGNAL_TYPE_KEY]]: true }
: iter,
{}
)
).map(cleanSymbolType);

return signalTypes.filter((signal: string): signal is SignalType => {
if (ALL_SIGNAL_LAYERS_SET.has(signal)) return true;
console.warn(`The signal type "${signal}" is not handled yet.`);
return false;
});
}
export function getSymbolsList(editorData: EditorEntity[]): SignalType[] {
const signalTypes = getSignalsList(editorData);
return uniq(signalTypes.flatMap((s) => SIGNALS_TO_SYMBOLS[s]));
}

export function getAngle(p1: Position | undefined, p2: Position | undefined): number {
if (!Array.isArray(p1) || !Array.isArray(p2)) return 0;
return bearing(p1, p2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export const ElectrificationEditionLayers = () => {
const context = {
prefix: mapStyle === 'blueprint' ? 'SCHB ' : '',
colors: colors[mapStyle],
signalsList: [],
symbolsList: [],
isEmphasized: true,
showIGNBDORTHO,
layersSettings,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ export const SpeedSectionEditionLayers = () => {
const context = {
prefix: mapStyle === 'blueprint' ? 'SCHB ' : '',
colors: colors[mapStyle],
signalsList: [],
symbolsList: [],
isEmphasized: true,
showIGNBDORTHO,
layersSettings,
Expand Down
Loading
Loading