From 17541bca13fb971b696b3760cb4c0659939b54f5 Mon Sep 17 00:00:00 2001 From: Sara <sarasdj@stud.ntnu.no> Date: Wed, 20 Mar 2024 16:54:38 +0100 Subject: [PATCH] update: tile selection --- app/lib/widgets/choropleth_map.dart | 18 +----------------- app/lib/widgets/main_layout.dart | 5 ++--- .../process_lidar_data.cpython-311.pyc | Bin 7193 -> 7193 bytes .../__pycache__/get_markers.cpython-311.pyc | Bin 3745 -> 3745 bytes .../__pycache__/get_relation.cpython-311.pyc | Bin 6415 -> 7057 bytes server/map/get_relation.py | 18 ++++++++++++++++++ 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/app/lib/widgets/choropleth_map.dart b/app/lib/widgets/choropleth_map.dart index 56452604..655b54ad 100644 --- a/app/lib/widgets/choropleth_map.dart +++ b/app/lib/widgets/choropleth_map.dart @@ -49,25 +49,9 @@ 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 @@ -80,7 +64,7 @@ class _ChoroplethMapState extends State<ChoroplethMap> { source: MapShapeSource.memory( // Map polygon widget.relation, // JSON coordinates from server shapeDataField: 'sub_div_id', - dataCount: 250, + dataCount: count, primaryValueMapper: (int index) => subdivisions[index].sub_div_id, shapeColorValueMapper: (int index) => subdivisions[index].color, ), diff --git a/app/lib/widgets/main_layout.dart b/app/lib/widgets/main_layout.dart index ae2a233a..9a204dc3 100644 --- a/app/lib/widgets/main_layout.dart +++ b/app/lib/widgets/main_layout.dart @@ -31,7 +31,6 @@ class MapContainerWidget extends StatefulWidget { class _MapContainerWidgetState extends State<MapContainerWidget> { Measurement? selectedTile; // Containing data for selected marker - int selectedTileIndex = 0; bool isMinimized = true; // Quick view box state tacker bool satLayer = false; // Satellite layer visibility tracker bool isTapped = false; // Button tap state tracker @@ -60,14 +59,14 @@ class _MapContainerWidgetState extends State<MapContainerWidget> { // Tile selection handler void handleSelection(int index) { setState(() { - selectedTileIndex = index; + selectedTile= widget.markerList[index]; }); } @override Widget build(BuildContext context) { // Initialise selectedMarker to first element in markerList - selectedTile ??= widget.markerList[selectedTileIndex]; + selectedTile ??= widget.markerList[0]; checkAndSetLastUpdate(); diff --git a/server/data_processing/__pycache__/process_lidar_data.cpython-311.pyc b/server/data_processing/__pycache__/process_lidar_data.cpython-311.pyc index 987adc32a54b4c008aebe4a29f2353d85a1bad1b..29a63e52c3216522dfbadd87d89f7e180e850df4 100644 GIT binary patch delta 20 bcmbPfG1G#3IWI340|NuYBG%s<x%p%OH;M%T delta 20 bcmbPfG1G#3IWI340|Ns??a5yox%p%OI~oO_ diff --git a/server/map/__pycache__/get_markers.cpython-311.pyc b/server/map/__pycache__/get_markers.cpython-311.pyc index 1bb8e31db7adc2d059fccce9adfa096f51b5fca6..9afbb6c07ee725a0171dfda4a7e56e20c3fe698a 100644 GIT binary patch delta 20 bcmZ1|yHJ*UIWI340|Ntt1MBaN+|&2~GeQLO delta 20 ccmZ1|yHJ*UIWI340|Ntt&52(dxu@{~05`J*u>b%7 diff --git a/server/map/__pycache__/get_relation.cpython-311.pyc b/server/map/__pycache__/get_relation.cpython-311.pyc index 5a5c3621fe61b4be57237662c8d3626118d5c51a..393bc9283c5d9d9d4e1daab160722e82c753fd7f 100644 GIT binary patch delta 989 zcmeA-nrP0qoR^o2fq{WxKkM(*8=@2WBp7E*RG-An*TN7bp28T+pvk{+-&;1um6O-7 z`!LFG{>lEDkxhYtfuTrx@+(efMx)7kT=|TFo9A(Hu$bzD#92Uu76Su=CQnfii0up_ zTtEa^-W|m901=)b!fWzvJ|i|w5L0urFux!ZW5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l|(CN{4WRApkUntWbZ+B=qkf#DWgYDH#oNpX=nh{KX!keXLy1!ks{ z<`!tO6oC{K#eww3gM=B=ib4KB7;6HOGTCe@62+vb3}UN*2vv|bSs?oCKmzt4!eR0T zF=fW=$ydbU`8CCFai*u{7bNDTBo-GbPhKOL83?ktC<Ua_2t)*c2yg&^+<uECB{R9C z2y9<ANQM_gh=B-@|9)}U<mRW8=A_ycl`t?cFoHrraC5d4C!+uZGh;C02QXO#QV#$_ CT4Brp diff --git a/server/map/get_relation.py b/server/map/get_relation.py index 60e61172..8f7df917 100644 --- a/server/map/get_relation.py +++ b/server/map/get_relation.py @@ -143,3 +143,21 @@ def get_divided_map(file_name): geo_data = gpd.read_file("server/map/" + file_name + ".geojson") polygon_data = geo_data[geo_data['geometry'].geom_type == 'Polygon'] polygons = [Polygon(polygon.exterior) for polygon in polygon_data['geometry']] + +# Returns a list of [(sub_div_id, sub_div_center)] +def get_id_and_center(file_name): + # Expected format: [(id, [x,y]), (id, [x,y])] + geo_data = gpd.read_file("server/lake_relations/" + file_name + "_div.json") + subdivisions = [] + for index, row in geo_data.iterrows(): + sub_div_id = row['sub_div_id'] + sub_div_center = row['sub_div_center'] + + print("sub_div_id: ", sub_div_id) + + subdivision = { + 'sub_div_id': sub_div_id, + 'sub_div_center': sub_div_center + } + subdivisions.append(subdivision) + return subdivisions -- GitLab