diff --git a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart index 2e7c438..91c316e 100644 --- a/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart +++ b/lib/Screens/Configurations/Section/SubSection/Map/showNewOrUpdateGeoPoint.dart @@ -32,6 +32,26 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct }); } + var defaultPosition = LatLong(50.429333, 4.891434); // Default Namur + var pointPosition; + + if(geoPointDTO.geometry != null) { + switch(geoPointDTO.geometry!.type) { + case "Point": + var coordinates = geoPointDTO.geometry!.coordinates as List; + pointPosition = LatLong(coordinates.first, coordinates.last); + break; + case "LineString": + pointPosition = LatLong(50.429333, 4.891434); // TODO default Namur + break; + case "Polygon": + pointPosition = LatLong(50.429333, 4.891434); // TODO default Namur + break; + } + } + + LatLong initPosition = geoPointDTO.geometry == null ? defaultPosition : pointPosition; + Size size = MediaQuery.of(context).size; showDialog( builder: (BuildContext context) => AlertDialog( @@ -51,7 +71,7 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct height: 350, child: FlutterLocationPicker( initZoom: 14, - initPosition: /*geoPointDTO.latitude == null && geoPointDTO.longitude == null ?*/ LatLong(50.429333, 4.891434) /*: LatLong(double.parse(geoPointDTO.latitude!), double.parse(geoPointDTO.longitude!))*/, + initPosition: initPosition, minZoomLevel: 0, maxZoomLevel: 17, markerIcon: const Icon( @@ -78,13 +98,12 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct onError: (e) => print(e), selectLocationButtonLeadingIcon: const Icon(Icons.check, color: kPrimaryColor), onPicked: (pickedData) { - print("TODO !"); - /*geoPointDTO.latitude = pickedData.latLong.latitude.toString(); - geoPointDTO.longitude = pickedData.latLong.longitude.toString();*/ + geoPointDTO.geometry = new GeometryDTO(type: "Point", coordinates: [pickedData.latLong.latitude, pickedData.latLong.longitude]); }, onChanged: (pickedData) { - /*print("onChanged"); - print(pickedData.latLong.latitude); + print("onChanged"); + geoPointDTO.geometry = new GeometryDTO(type: "Point", coordinates: [pickedData.latLong.latitude, pickedData.latLong.longitude]); + /*print(pickedData.latLong.latitude); print(pickedData.latLong.longitude); print(pickedData.address); print(pickedData.addressData);*/ @@ -353,11 +372,11 @@ void showNewOrUpdateGeoPoint(MapDTO mapDTO, GeoPointDTO? inputGeoPointDTO, Funct color: kPrimaryColor, textColor: kWhite, press: () { - print("TODO"); - /*if (geoPointDTO.latitude != null && geoPointDTO.longitude != null) { + //print("TODO"); + if (geoPointDTO.geometry != null && geoPointDTO.geometry!.coordinates != null) { getResult(geoPointDTO); Navigator.of(context).pop(); - }*/ + } }, fontSize: 20, ), diff --git a/lib/api/openApiTest.dart b/lib/api/openApiTest.dart index 3d85b11..d3fc535 100644 --- a/lib/api/openApiTest.dart +++ b/lib/api/openApiTest.dart @@ -1,4 +1,4 @@ -// Openapi Generator last run: : 2025-11-21T15:08:31.489558 +// Openapi Generator last run: : 2025-11-27T16:46:46.408321 import 'package:openapi_generator_annotations/openapi_generator_annotations.dart'; @Openapi( diff --git a/lib/api/swagger.yaml b/lib/api/swagger.yaml index 9afaa9a..aca6c9e 100644 --- a/lib/api/swagger.yaml +++ b/lib/api/swagger.yaml @@ -4,7 +4,7 @@ "info": { "title": "Manager Service", "description": "API Manager Service", - "version": "Version Alpha" + "version": "Version Alpha 0.0" }, "servers": [ { @@ -4341,7 +4341,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/GeoPoint" + "$ref": "#/components/schemas/GeoPointDTO" } } } diff --git a/manager_api_new/.openapi-generator/FILES b/manager_api_new/.openapi-generator/FILES index f3f9ec0..5e137b6 100644 --- a/manager_api_new/.openapi-generator/FILES +++ b/manager_api_new/.openapi-generator/FILES @@ -281,9 +281,3 @@ lib/model/video_dto.dart lib/model/weather_dto.dart lib/model/web_dto.dart pubspec.yaml -test/game_dto_all_of_puzzle_image_test.dart -test/game_dto_test.dart -test/game_types_test.dart -test/guided_path_section_game_test.dart -test/section_game_all_of_game_puzzle_image_test.dart -test/section_game_test.dart diff --git a/manager_api_new/README.md b/manager_api_new/README.md index 835bf79..3cfcc46 100644 --- a/manager_api_new/README.md +++ b/manager_api_new/README.md @@ -3,7 +3,7 @@ API Manager Service This Dart package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: Version Alpha +- API version: Version Alpha 0.0 - Generator version: 7.9.0 - Build package: org.openapitools.codegen.languages.DartClientCodegen diff --git a/manager_api_new/doc/SectionMapApi.md b/manager_api_new/doc/SectionMapApi.md index 5e1c5ee..348f749 100644 --- a/manager_api_new/doc/SectionMapApi.md +++ b/manager_api_new/doc/SectionMapApi.md @@ -417,7 +417,7 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **sectionMapUpdate** -> GeoPoint sectionMapUpdate(geoPointDTO) +> GeoPointDTO sectionMapUpdate(geoPointDTO) @@ -446,7 +446,7 @@ Name | Type | Description | Notes ### Return type -[**GeoPoint**](GeoPoint.md) +[**GeoPointDTO**](GeoPointDTO.md) ### Authorization diff --git a/manager_api_new/lib/api/section_map_api.dart b/manager_api_new/lib/api/section_map_api.dart index 1c2e9c1..d1aacde 100644 --- a/manager_api_new/lib/api/section_map_api.dart +++ b/manager_api_new/lib/api/section_map_api.dart @@ -577,7 +577,7 @@ class SectionMapApi { /// Parameters: /// /// * [GeoPointDTO] geoPointDTO (required): - Future sectionMapUpdate( + Future sectionMapUpdate( GeoPointDTO geoPointDTO, ) async { final response = await sectionMapUpdateWithHttpInfo( @@ -593,8 +593,8 @@ class SectionMapApi { response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync( await _decodeBodyBytes(response), - 'GeoPoint', - ) as GeoPoint; + 'GeoPointDTO', + ) as GeoPointDTO; } return null; }