Skip to content

Commit

Permalink
front: add start and destination icons in the scenario map
Browse files Browse the repository at this point in the history
Signed-off-by: theocrsb <[email protected]>
  • Loading branch information
theocrsb committed Oct 30, 2024
1 parent 0cce373 commit b535c1c
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
File renamed without changes
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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 (
<Source type="geojson" data={geojsonPath}>
<Marker longitude={startCoordinate[0]} latitude={startCoordinate[1]} anchor="bottom">
<img src={originIcon} alt="origin" />
</Marker>
<OrderedLayer
id="geojsonPathBackgroundLine"
type="line"
Expand All @@ -31,6 +40,9 @@ export default function RenderItinerary(props: RenderItineraryProps) {
layerOrder={layerOrder}
/>
<OrderedLayer id="geojsonPathLine" type="line" paint={paintLine} layerOrder={layerOrder} />
<Marker longitude={endCoordinate[0]} latitude={endCoordinate[1]} anchor="bottom">
<img src={destinationIcon} alt="destination" />
</Marker>
</Source>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit b535c1c

Please sign in to comment.