From ada6d814ed78e5415adb148dc9c92abcd77f55fd Mon Sep 17 00:00:00 2001 From: Nate-Wessel Date: Mon, 30 Dec 2024 15:51:08 +0000 Subject: [PATCH] style by corridor completeness as before --- frontend/src/Map/index.jsx | 9 ++++++--- frontend/src/corridor.js | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/Map/index.jsx b/frontend/src/Map/index.jsx index 11cabef..97f7be9 100644 --- a/frontend/src/Map/index.jsx +++ b/frontend/src/Map/index.jsx @@ -104,16 +104,19 @@ const styles = { type:'circle', paint:{ 'circle-radius': 8, - 'circle-color': 'red', + 'circle-color': ['get','color'], 'circle-opacity': 0.2, 'circle-stroke-width': 2, - 'circle-stroke-color': 'red' + 'circle-stroke-color': ['get','color'] } }, lines: { id:'corridor-links', type:'line', - paint:{'line-width': 3, 'line-color': 'black'}, + paint:{ + 'line-width': 3, + 'line-color': ['get','color'] + }, layout: {'line-cap': 'round'} } }, diff --git a/frontend/src/corridor.js b/frontend/src/corridor.js index 3e7faf9..29ab9ed 100644 --- a/frontend/src/corridor.js +++ b/frontend/src/corridor.js @@ -27,11 +27,15 @@ export class Corridor extends Factor { type: 'MultiLineString', coordinates: this.links.map(link=>link.geometry.coordinates) }, - properties: {} + properties: { 'color': this.isComplete ? 'green' : 'red' } } } get geojsonFeaturesPoint(){ - return this.intersections.map(i=>i.geojson) + return this.intersections.map( i => { + let feature = i.geojson + feature.properties.color = this.isComplete ? 'green' : 'red' + return feature + } ) } addIntersection(intersection,logActivity){ console.assert(intersection instanceof Intersection)