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

update: tile selection

parent c42c2916
No related branches found
No related tags found
1 merge request!10Clhp map
......@@ -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,
),
......
......@@ -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();
......
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -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
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