Skip to content
Snippets Groups Projects
Commit e75526a5 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: IceStats to list in SubDiv

parent 8b30f20c
No related branches found
No related tags found
1 merge request!12Clhp map
...@@ -13,6 +13,7 @@ const String mapEndpoint = "update_map"; ...@@ -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 String selectedLake = 'Mjøsa'; // Init to Mjøsa, NB should be initialised to last selected lake
Uint8List selectedRelation = Uint8List(0); Uint8List selectedRelation = Uint8List(0);
List<Measurement> selectedMarkerList = []; List<Measurement> selectedMarkerList = [];
Measurement? selectedTile;
LatLng mapCenter = LatLng(60.8000, 10.8471); LatLng mapCenter = LatLng(60.8000, 10.8471);
DateTime ?lastUpdate; // Last time data was fetched from server DateTime ?lastUpdate; // Last time data was fetched from server
......
...@@ -9,7 +9,7 @@ class Measurement { ...@@ -9,7 +9,7 @@ class Measurement {
String bodyOfWater; String bodyOfWater;
LatLng center; LatLng center;
List <SubDiv> subDivs; List <SubDiv> subDivs;
IceStats iceStats; List<IceStats> iceStats;
Measurement({ Measurement({
required this.measurementID, required this.measurementID,
...@@ -29,7 +29,9 @@ class Measurement { ...@@ -29,7 +29,9 @@ class Measurement {
bodyOfWater: json['BodyOfWater'] ?? 'nil', bodyOfWater: json['BodyOfWater'] ?? 'nil',
center: LatLng(json['CenterLat'], json['CenterLon']), center: LatLng(json['CenterLat'], json['CenterLon']),
subDivs: (json['Subdivisions'] as List<dynamic>).map((data) => SubDiv.fromJson(data)).toList(), 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() ?? [],
); );
} }
} }
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fl_chart/fl_chart.dart'; import 'package:fl_chart/fl_chart.dart';
import '../../consts.dart';
class BarData extends StatefulWidget { class BarData extends StatefulWidget {
const BarData({super.key}); const BarData({super.key});
......
...@@ -32,7 +32,6 @@ class MapContainerWidget extends StatefulWidget { ...@@ -32,7 +32,6 @@ class MapContainerWidget extends StatefulWidget {
class _MapContainerWidgetState extends State<MapContainerWidget> { class _MapContainerWidgetState extends State<MapContainerWidget> {
Measurement? selectedTile; // Containing data for selected marker
bool isMinimized = true; // Quick view box state tacker bool isMinimized = true; // Quick view box state tacker
bool satLayer = false; // Satellite layer visibility tracker bool satLayer = false; // Satellite layer visibility tracker
......
No preview for this file type
...@@ -41,7 +41,8 @@ def get_all_markers(self, cursor, waterBodyName): ...@@ -41,7 +41,8 @@ def get_all_markers(self, cursor, waterBodyName):
'CenLatitude': row[12], 'CenLatitude': row[12],
'CenLongitude': row[13], 'CenLongitude': row[13],
'Accuracy': row[14], '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 # Check if measurement ID already exists in measurement_data
...@@ -85,7 +86,8 @@ def get_all_markers(self, cursor, waterBodyName): ...@@ -85,7 +86,8 @@ def get_all_markers(self, cursor, waterBodyName):
'CenLatitude': 7.0, 'CenLatitude': 7.0,
'CenLongitude': 8.0, 'CenLongitude': 8.0,
'Accuracy': 1.0, 'Accuracy': 1.0,
'Color': calculateColor(avg_thickness) 'Color': calculateColor(avg_thickness),
'IceStats': ()
} }
sub_divisions.append(subdivision) sub_divisions.append(subdivision)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment