From b535c1cfdeaaeafaa99bb8770d4ddcaecb070253 Mon Sep 17 00:00:00 2001 From: theocrsb Date: Tue, 29 Oct 2024 11:04:34 +0100 Subject: [PATCH] front: add start and destination icons in the scenario map Signed-off-by: theocrsb --- .../components/StdcmForm/StdcmDestination.tsx | 2 +- .../stdcm/components/StdcmForm/StdcmOrigin.tsx | 2 +- .../stdcm/components/StdcmForm/StdcmVias.tsx | 2 +- .../pictures/{stdcm => mapMarkers}/destination.svg | 0 .../{stdcm => mapMarkers}/intermediate-point.svg | 0 .../pictures/{stdcm => mapMarkers}/start.svg | 0 .../SimulationResultsMap/RenderItinerary.tsx | 14 +++++++++++++- .../ManageTrainScheduleMap/ItineraryMarkers.tsx | 6 +++--- 8 files changed, 19 insertions(+), 7 deletions(-) rename front/src/assets/pictures/{stdcm => mapMarkers}/destination.svg (100%) rename front/src/assets/pictures/{stdcm => mapMarkers}/intermediate-point.svg (100%) rename front/src/assets/pictures/{stdcm => mapMarkers}/start.svg (100%) diff --git a/front/src/applications/stdcm/components/StdcmForm/StdcmDestination.tsx b/front/src/applications/stdcm/components/StdcmForm/StdcmDestination.tsx index 170218316c2..d63be132a17 100644 --- a/front/src/applications/stdcm/components/StdcmForm/StdcmDestination.tsx +++ b/front/src/applications/stdcm/components/StdcmForm/StdcmDestination.tsx @@ -2,7 +2,7 @@ import { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import DestinationIcon from 'assets/pictures/stdcm/destination.svg'; +import DestinationIcon from 'assets/pictures/mapMarkers/destination.svg'; import { useOsrdConfActions } from 'common/osrdContext'; import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf'; import type { PathStep } from 'reducers/osrdconf/types'; diff --git a/front/src/applications/stdcm/components/StdcmForm/StdcmOrigin.tsx b/front/src/applications/stdcm/components/StdcmForm/StdcmOrigin.tsx index e28f38c6ba9..1199484f1bd 100644 --- a/front/src/applications/stdcm/components/StdcmForm/StdcmOrigin.tsx +++ b/front/src/applications/stdcm/components/StdcmForm/StdcmOrigin.tsx @@ -2,7 +2,7 @@ import { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; -import OriginIcon from 'assets/pictures/stdcm/start.svg'; +import OriginIcon from 'assets/pictures/mapMarkers/start.svg'; import { useOsrdConfActions } from 'common/osrdContext'; import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf'; import type { PathStep } from 'reducers/osrdconf/types'; diff --git a/front/src/applications/stdcm/components/StdcmForm/StdcmVias.tsx b/front/src/applications/stdcm/components/StdcmForm/StdcmVias.tsx index f2fbe225083..e129def87d4 100644 --- a/front/src/applications/stdcm/components/StdcmForm/StdcmVias.tsx +++ b/front/src/applications/stdcm/components/StdcmForm/StdcmVias.tsx @@ -6,7 +6,7 @@ import { useTranslation } from 'react-i18next'; import nextId from 'react-id-generator'; import { useSelector } from 'react-redux'; -import IntermediatePointIcon from 'assets/pictures/stdcm/intermediate-point.svg'; +import IntermediatePointIcon from 'assets/pictures/mapMarkers/intermediate-point.svg'; import { useOsrdConfSelectors, useOsrdConfActions } from 'common/osrdContext'; import type { StdcmConfSliceActions } from 'reducers/osrdconf/stdcmConf'; import type { PathStep } from 'reducers/osrdconf/types'; diff --git a/front/src/assets/pictures/stdcm/destination.svg b/front/src/assets/pictures/mapMarkers/destination.svg similarity index 100% rename from front/src/assets/pictures/stdcm/destination.svg rename to front/src/assets/pictures/mapMarkers/destination.svg diff --git a/front/src/assets/pictures/stdcm/intermediate-point.svg b/front/src/assets/pictures/mapMarkers/intermediate-point.svg similarity index 100% rename from front/src/assets/pictures/stdcm/intermediate-point.svg rename to front/src/assets/pictures/mapMarkers/intermediate-point.svg diff --git a/front/src/assets/pictures/stdcm/start.svg b/front/src/assets/pictures/mapMarkers/start.svg similarity index 100% rename from front/src/assets/pictures/stdcm/start.svg rename to front/src/assets/pictures/mapMarkers/start.svg diff --git a/front/src/modules/simulationResult/components/SimulationResultsMap/RenderItinerary.tsx b/front/src/modules/simulationResult/components/SimulationResultsMap/RenderItinerary.tsx index 1af29c5a1fe..c43d05bf572 100644 --- a/front/src/modules/simulationResult/components/SimulationResultsMap/RenderItinerary.tsx +++ b/front/src/modules/simulationResult/components/SimulationResultsMap/RenderItinerary.tsx @@ -1,6 +1,8 @@ import type { Feature, LineString } from 'geojson'; -import { Source } from 'react-map-gl/maplibre'; +import { Marker, Source } from 'react-map-gl/maplibre'; +import destinationIcon from 'assets/pictures/mapMarkers/destination.svg'; +import originIcon from 'assets/pictures/mapMarkers/start.svg'; import OrderedLayer from 'common/Map/Layers/OrderedLayer'; interface RenderItineraryProps { @@ -21,8 +23,15 @@ export default function RenderItinerary(props: RenderItineraryProps) { 'line-color': '#158DCF', }; + const startCoordinate = geojsonPath.geometry.coordinates[0]; + const endCoordinate = + geojsonPath.geometry.coordinates[geojsonPath.geometry.coordinates.length - 1]; + return ( + + origin + + + destination + ); } diff --git a/front/src/modules/trainschedule/components/ManageTrainSchedule/ManageTrainScheduleMap/ItineraryMarkers.tsx b/front/src/modules/trainschedule/components/ManageTrainSchedule/ManageTrainScheduleMap/ItineraryMarkers.tsx index 3de309ec023..7b31d83ae86 100644 --- a/front/src/modules/trainschedule/components/ManageTrainSchedule/ManageTrainScheduleMap/ItineraryMarkers.tsx +++ b/front/src/modules/trainschedule/components/ManageTrainSchedule/ManageTrainScheduleMap/ItineraryMarkers.tsx @@ -7,10 +7,10 @@ import { Marker } from 'react-map-gl/maplibre'; import { useSelector } from 'react-redux'; import destinationSVG from 'assets/pictures/destination.svg'; +import stdcmDestination from 'assets/pictures/mapMarkers/destination.svg'; +import stdcmVia from 'assets/pictures/mapMarkers/intermediate-point.svg'; +import stdcmOrigin from 'assets/pictures/mapMarkers/start.svg'; import originSVG from 'assets/pictures/origin.svg'; -import stdcmDestination from 'assets/pictures/stdcm/destination.svg'; -import stdcmVia from 'assets/pictures/stdcm/intermediate-point.svg'; -import stdcmOrigin from 'assets/pictures/stdcm/start.svg'; import viaSVG from 'assets/pictures/via.svg'; import { useOsrdConfSelectors } from 'common/osrdContext'; import type { PathStep } from 'reducers/osrdconf/types';