diff --git a/backend/context-service/resources/ATM/schemas.py b/backend/context-service/resources/ATM/schemas.py index 1dfe9489..c065325b 100644 --- a/backend/context-service/resources/ATM/schemas.py +++ b/backend/context-service/resources/ATM/schemas.py @@ -2,10 +2,35 @@ from api.schemas import MetadataSchema from apiflask.fields import Dict, String, Float, List, Integer -class MetadataSchemaATM(MetadataSchema): +from apiflask import Schema, fields +from marshmallow import pre_load +class PlaneMetadataSchemaATM(MetadataSchema): + id_plane = String() ApDest = Dict() Current_airspeed = Float() Latitude = Float() Longitude = Float() wpList = List(Dict()) - id_plane = Integer() + +class MetadataSchemaATM(MetadataSchema): + airplanes = List(fields.Nested(PlaneMetadataSchemaATM), required=True) + + # Backward compatibility: optional fields for the single airplane case + ApDest = Dict(required=False) + Current_airspeed = Float(required=False) + Latitude = Float(required=False) + Longitude = Float(required=False) + wpList = List(Dict(), required=False) + + @pre_load + def handle_backward_compatibility(self, data, **kwargs): + # If the new 'airplanes' field is not provided, assume the old format. + if 'airplanes' not in data: + airplane = {} + for field in ['ApDest', 'Current_airspeed', 'Latitude', 'Longitude', 'wpList']: + if field in data: + airplane[field] = data[field] + # Provide a default id_plane if not present. + airplane.setdefault('id_plane', "X") + data['airplanes'] = [airplane] + return data \ No newline at end of file diff --git a/backend/recommendation-service/resources/Railway/manager.py b/backend/recommendation-service/resources/Railway/manager.py index 85b0a9b7..881de5c0 100644 --- a/backend/recommendation-service/resources/Railway/manager.py +++ b/backend/recommendation-service/resources/Railway/manager.py @@ -1,4 +1,4 @@ -# backend/recommendation-service/resources/RTE/manager.py +# backend/recommendation-service/resources/Railway/manager.py from api.manager.base_manager import BaseRecommendationManager diff --git a/frontend/public/img/icons/map_markers/DA.svg b/frontend/public/img/icons/map_markers/ATM.svg similarity index 100% rename from frontend/public/img/icons/map_markers/DA.svg rename to frontend/public/img/icons/map_markers/ATM.svg diff --git a/frontend/public/img/icons/map_markers/SNCF.svg b/frontend/public/img/icons/map_markers/Railway.svg similarity index 100% rename from frontend/public/img/icons/map_markers/SNCF.svg rename to frontend/public/img/icons/map_markers/Railway.svg diff --git a/frontend/src/components/organisms/Map.vue b/frontend/src/components/organisms/Map.vue index 81e4841d..be58466b 100644 --- a/frontend/src/components/organisms/Map.vue +++ b/frontend/src/components/organisms/Map.vue @@ -83,11 +83,12 @@ import { useMapStore } from '@/stores/components/map' import type { Waypoint } from '@/types/components/map' import { criticalityToColor, maxCriticality } from '@/utils/utils' -withDefaults( +const props = withDefaults( defineProps<{ tileLayers?: string[] contextClick?: (waypoint: Waypoint) => void waypointClick?: (waypoint: Waypoint) => void + autoFit?: boolean }>(), { tileLayers: () => ['http://{s}.tile.osm.org/{z}/{x}/{y}.png'], @@ -103,9 +104,17 @@ const lockView = ref(true) const zoom = ref(6) const map = ref() -watch(mapStore.contextWaypoints, () => { - toggleLockView() -}) +watch( + () => mapStore.contextWaypoints, + () => { + if (props.autoFit) { + toggleLockView() + } + +} +) + + watch(appStore.panels, () => { map.value.leafletObject.invalidateSize() }) diff --git a/frontend/src/entities/ATM/CAB/Context.vue b/frontend/src/entities/ATM/CAB/Context.vue index b030d08a..14b20887 100644 --- a/frontend/src/entities/ATM/CAB/Context.vue +++ b/frontend/src/entities/ATM/CAB/Context.vue @@ -3,18 +3,17 @@ +