diff --git a/app/lib/consts.dart b/app/lib/consts.dart index b3f948567476401e91e837cb80e12693e5477c4a..3c0d9840e6cc66c50b04dfcaaf56407b9dc72392 100644 --- a/app/lib/consts.dart +++ b/app/lib/consts.dart @@ -13,6 +13,7 @@ const String mapEndpoint = "update_map"; String selectedLake = 'Mjøsa'; // Init to Mjøsa, NB should be initialised to last selected lake Uint8List selectedRelation = Uint8List(0); List<Measurement> selectedMarkerList = []; +Measurement? selectedTile; LatLng mapCenter = LatLng(60.8000, 10.8471); DateTime ?lastUpdate; // Last time data was fetched from server diff --git a/app/lib/data_classes.dart b/app/lib/data_classes.dart index 45188019b24a6f73392b2d7fdc56d0c092549fa5..165ca83c1f8747c561d22c5dd17b29ad0b9e7941 100644 --- a/app/lib/data_classes.dart +++ b/app/lib/data_classes.dart @@ -9,7 +9,7 @@ class Measurement { String bodyOfWater; LatLng center; List <SubDiv> subDivs; - IceStats iceStats; + List<IceStats> iceStats; Measurement({ required this.measurementID, @@ -29,7 +29,9 @@ class Measurement { bodyOfWater: json['BodyOfWater'] ?? 'nil', center: LatLng(json['CenterLat'], json['CenterLon']), subDivs: (json['Subdivisions'] as List<dynamic>).map((data) => SubDiv.fromJson(data)).toList(), - iceStats: IceStats.fromJson(json['IceStats']), + iceStats: (json['IceStats'] as List<dynamic>?) + ?.map((data) => IceStats.fromJson(data)) + .toList() ?? [], ); } } diff --git a/app/lib/widgets/bar_graph/bar_data.dart b/app/lib/widgets/bar_graph/bar_data.dart index 779be9ba11facef3956b7ecb64b7c9bde795fe41..0a098fadf15870e8c7393d5edae59a435e5fbbec 100644 --- a/app/lib/widgets/bar_graph/bar_data.dart +++ b/app/lib/widgets/bar_graph/bar_data.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:fl_chart/fl_chart.dart'; +import '../../consts.dart'; + class BarData extends StatefulWidget { const BarData({super.key}); diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart index d0874add77e1b6118ac21a667a05e852e3cced27..29c4256c963ba917862a404a8d2edcd9059543fd 100644 --- a/app/lib/widgets/main_layout.dart +++ b/app/lib/widgets/main_layout.dart @@ -32,7 +32,6 @@ class MapContainerWidget extends StatefulWidget { class _MapContainerWidgetState extends State<MapContainerWidget> { - Measurement? selectedTile; // Containing data for selected marker bool isMinimized = true; // Quick view box state tacker bool satLayer = false; // Satellite layer visibility tracker diff --git a/server/map_handler/__pycache__/get_measurements.cpython-311.pyc b/server/map_handler/__pycache__/get_measurements.cpython-311.pyc index 05ef1c7e71b422c77e6e0540aa3e05eb6b2979b2..a4fe25102572eb8dc40b8e672a1229eb71507cf5 100644 Binary files a/server/map_handler/__pycache__/get_measurements.cpython-311.pyc and b/server/map_handler/__pycache__/get_measurements.cpython-311.pyc differ diff --git a/server/map_handler/get_measurements.py b/server/map_handler/get_measurements.py index e3f02a6278d383dda372a5ae3850279299d53d40..3a7977636544e37ab50373ac0a18fc2b92a2e219 100644 --- a/server/map_handler/get_measurements.py +++ b/server/map_handler/get_measurements.py @@ -41,7 +41,8 @@ def get_all_markers(self, cursor, waterBodyName): 'CenLatitude': row[12], 'CenLongitude': row[13], 'Accuracy': row[14], - 'Color': calculateColor(row[11]) # NB color calculated based on average thickness, should be minimum + 'Color': calculateColor(row[11]), # NB color calculated based on average thickness, should be minimum + 'IceStats': () # NB temp empty, add ice stats later } # Check if measurement ID already exists in measurement_data @@ -85,7 +86,8 @@ def get_all_markers(self, cursor, waterBodyName): 'CenLatitude': 7.0, 'CenLongitude': 8.0, 'Accuracy': 1.0, - 'Color': calculateColor(avg_thickness) + 'Color': calculateColor(avg_thickness), + 'IceStats': () } sub_divisions.append(subdivision)