From a9427148c854d6151fd98f532fbf04186df42ace Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Wed, 20 Mar 2024 11:36:11 +0100 Subject: [PATCH] update: map appearance --- app/lib/widgets/choropleth_map.dart | 30 ++++++++++++++++++++-------- app/lib/widgets/main_layout.dart | 2 +- server/sql_db/icedb | Bin 49152 -> 49152 bytes 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/app/lib/widgets/choropleth_map.dart b/app/lib/widgets/choropleth_map.dart index f2e258d2..c8455d93 100644 --- a/app/lib/widgets/choropleth_map.dart +++ b/app/lib/widgets/choropleth_map.dart @@ -3,6 +3,8 @@ import 'dart:typed_data'; import 'package:flutter/material.dart'; import 'package:syncfusion_flutter_maps/maps.dart'; +import 'package:latlong2/latlong.dart'; + import '../data_classes.dart'; /// A class containing thickness data for each subdivision of the map. @@ -38,6 +40,7 @@ class _ChoroplethMapState extends State<ChoroplethMap> { late MapShapeSource mapShapeSource; late final MapZoomPanBehavior _zoomPanBehavior = MapZoomPanBehavior(); List<SubDiv> subdivisions = <SubDiv>[]; + int count = 0; @override @@ -47,8 +50,25 @@ class _ChoroplethMapState extends State<ChoroplethMap> { for (Measurement measurement in widget.measurements) { for (SubDiv subdivision in measurement.subDivs) { subdivisions.add(subdivision); + print("SubDivID: ${subdivision.sub_div_id}"); + count++; } }; + + // NB temporary filler + for (var i = count; i < 250; i++) { + SubDiv subdivision = SubDiv( + sub_div_id: i.toString(), + groupID: 0, + minThickness: 0.0, + avgThickness: 0.0, + center: LatLng(0.0, 0.0), + accuracy: 0.0, + color: Colors.grey, + savedColor: Colors.grey, + ); + subdivisions.add(subdivision); + } } @override @@ -61,13 +81,12 @@ class _ChoroplethMapState extends State<ChoroplethMap> { source: MapShapeSource.memory( // Map polygon widget.relation, // JSON coordinates from server shapeDataField: 'sub_div_id', - dataCount: widget.measurements.length, + dataCount: 250, primaryValueMapper: (int index) => subdivisions[index].sub_div_id, shapeColorValueMapper: (int index) => subdivisions[index].color, ), - //color: Colors.blue.shade400, // Map color zoomPanBehavior: _zoomPanBehavior, - strokeColor: Colors.black, + strokeColor: Colors.blue.shade50, // Shape selection selectedIndex: selectedIndex, onSelectionChanged: (int index) { @@ -79,11 +98,6 @@ class _ChoroplethMapState extends State<ChoroplethMap> { }); widget.onSelectionChanged(selectedIndex); }, - selectionSettings: MapSelectionSettings( - color: Colors.orange, - strokeColor: Colors.red[900], - strokeWidth: 3, - ), ), ], ), diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart index e51ef19e..ae2a233a 100644 --- a/app/lib/widgets/main_layout.dart +++ b/app/lib/widgets/main_layout.dart @@ -152,7 +152,7 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { '${lastUpdate?.hour}:${lastUpdate?.minute}' : '${lastUpdate?.day}-${lastUpdate?.month}-${lastUpdate?.year}') : ''}', style: GoogleFonts.dmSans( - fontSize: 13, + fontSize: 14, color: Colors.black, ), ), diff --git a/server/sql_db/icedb b/server/sql_db/icedb index 602683cee2f038cd7944555292871f26c31a5827..f72af9b3586a8d3546eeb065f92c8eba1b20ed47 100644 GIT binary patch delta 292 zcmZo@U~Xt&o*>OAI#I@%QFLR%l6*BmUOy)Ov-~spQ~1qzm+@WZE#xcU^Ws~_$H04= z&zN77pNTh~*Kf0+fC{fNzaS?k2O}6Tv$Jz>G6@K9a)P;xi~>yTATYVGc84M_CnqO6 zJ3A+fgD5X2BO@mxJ0~M23on<0+Ds6b#WdNgE|iIZVe-PdL=%2~kP#dpb6NPAn3-AA z(&YI-LhOu;jO;9YOb%iUV8F%1Z2v6{3?`e^pHma$uVLV?;s4G5h5s%8GyW$2h5YyU zukoMbKgPe0e;fZg{+av}`8ziY3Iy@1va)b;FbcA<a56Fq2(Ys-GBUF8^FwGpJ_yar KyLn-Mya50|Og3x) delta 161 zcmZo@U~Xt&o*>OAFj2;tQD9@jl6)B+-a-ccv-~spQ~1qzm+@WZE#xcU^Ws~_$H04g zv!FmA@8rVT9f~TPoSf|J?3^qP3YWT$=-=Go;FtKiRc=R+gKCj3Ul@zzWUsnVCVr;L z3+ocO85kH$z{=U#Cl}OfPByDQC&R<Pkb(a<{}=wZ{LlCo^55gX#($3g82>*0ZT#yt O3ko#yZ(i6RZvX(q8Zp-Z -- GitLab