From afc801aefc0e936ae5a6b4f9dcc1a5bd4fa9b9e8 Mon Sep 17 00:00:00 2001 From: gluap Date: Fri, 24 Jun 2022 18:52:59 +0200 Subject: [PATCH] save current state. --- frontend/src/mapstyles/index.js | 4 ++-- frontend/src/pages/MapPage/LayerSidebar.tsx | 14 +++++++++++--- frontend/src/pages/MapPage/RoadInfo.tsx | 2 +- frontend/src/pages/MapPage/index.tsx | 4 ++-- frontend/src/reducers/mapConfig.ts | 3 ++- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/frontend/src/mapstyles/index.js b/frontend/src/mapstyles/index.js index 5d90dc0..e82106b 100644 --- a/frontend/src/mapstyles/index.js +++ b/frontend/src/mapstyles/index.js @@ -52,8 +52,8 @@ var steps = {'rural': [1.6,1.8,2.0,2.2], export function borderByZone() { return ["match", ['get', 'zone'], - "rural", "brown", - "urban", "olive", + "rural", "cyan", + "urban", "blue", "purple" ] } diff --git a/frontend/src/pages/MapPage/LayerSidebar.tsx b/frontend/src/pages/MapPage/LayerSidebar.tsx index d0f7a4d..b3ccc91 100644 --- a/frontend/src/pages/MapPage/LayerSidebar.tsx +++ b/frontend/src/pages/MapPage/LayerSidebar.tsx @@ -1,7 +1,7 @@ import React from 'react' import _ from 'lodash' import {connect} from 'react-redux' -import {List, Select, Input, Divider, Checkbox, Header} from 'semantic-ui-react' +import {List, Select, Input, Divider, Label, Checkbox, Header} from 'semantic-ui-react' import { MapConfig, @@ -23,6 +23,7 @@ const ROAD_ATTRIBUTE_OPTIONS = [ {value: 'distance_overtaker_median', key: 'distance_overtaker_median', text: 'Overtaker distance median'}, {value: 'overtaking_event_count', key: 'overtaking_event_count', text: 'Event count'}, {value: 'usage_count', key: 'usage_count', text: 'Usage count'}, + {value: 'zone', key: 'zone', text: 'Overtaking distance zone'} ] function LayerSidebar({ @@ -96,6 +97,13 @@ function LayerSidebar({ ) : + attribute.endsWith('zone') ? ( + <> + + + + + ) : ( Urban @@ -123,9 +131,9 @@ function LayerSidebar({ {showEvents && ( <> - Urban + Urban - Rural + Rural diff --git a/frontend/src/pages/MapPage/RoadInfo.tsx b/frontend/src/pages/MapPage/RoadInfo.tsx index 35fdc0e..871279a 100644 --- a/frontend/src/pages/MapPage/RoadInfo.tsx +++ b/frontend/src/pages/MapPage/RoadInfo.tsx @@ -34,7 +34,7 @@ const LABELS = { max: 'Maximum', mean: 'Average', } -const ZONE_COLORS = {urban: 'olive', rural: 'brown', motorway: 'purple'} +const ZONE_COLORS = {urban: 'blue', rural: 'cyan', motorway: 'purple'} const CARDINAL_DIRECTIONS = ['north', 'north-east', 'east', 'south-east', 'south', 'south-west', 'west', 'north-west'] const getCardinalDirection = (bearing) => bearing == null diff --git a/frontend/src/pages/MapPage/index.tsx b/frontend/src/pages/MapPage/index.tsx index 3579afa..bf597e0 100644 --- a/frontend/src/pages/MapPage/index.tsx +++ b/frontend/src/pages/MapPage/index.tsx @@ -54,6 +54,8 @@ const getRoadsLayer = (colorAttribute, maxCount) => ? colorByDistance(colorAttribute) : colorAttribute.endsWith('_count') ? colorByCount(colorAttribute, maxCount) + : colorAttribute.endsWith('zone') + ? borderByZone() : '#DDD' draft.paint['line-opacity'][3] = 12 draft.paint['line-opacity'][5] = 13 @@ -67,8 +69,6 @@ const getEventsLayer = () => ({ paint: { 'circle-radius': ['interpolate', ['linear'], ['zoom'], 14, 3, 17, 8], 'circle-color': colorByDistance('distance_overtaker'), - 'circle-stroke-color': borderByZone(), - 'circle-stroke-width':['interpolate', ['linear'], ['zoom'], 14, 1, 17, 4], }, minzoom: 11, }) diff --git a/frontend/src/reducers/mapConfig.ts b/frontend/src/reducers/mapConfig.ts index f0140cb..e7c14cf 100644 --- a/frontend/src/reducers/mapConfig.ts +++ b/frontend/src/reducers/mapConfig.ts @@ -11,7 +11,8 @@ type RoadAttribute = | "distance_overtaker_max" | "distance_overtaker_median" | "overtaking_event_count" - | "usage_count"; + | "usage_count" + | "zone"; export type MapConfig = { baseMap: {