Commit 1ad2b255 authored by alain's avatar alain 🐙
Browse files

handle cuckoo sensors color

parent 0b9b3496
......@@ -12,6 +12,7 @@ import { mapControlSettings, mapItemSettings } from "../../../config/map"
const hexagonOffset = 0.86603
const cuckooThreshold = 2
const radiusScale = scaleLinear([mapControlSettings.zoomMax, mapControlSettings.zoomMin], [mapItemSettings.sizeMin, mapItemSettings.sizeMax])
const heightMaxScale = scaleLinear([mapControlSettings.zoomMax, mapControlSettings.zoomMin], [mapItemSettings.elevationMaxMin, mapItemSettings.elevationMaxMax])
......@@ -60,7 +61,7 @@ class StationLayer extends CompositeLayer {
const factor = range[1] / 96
renderValue = factor + factor * Math.random()
} else {
renderValue = value > range[1] * 2 ? range[1] / 12 : Math.min(value, range[1])
renderValue = value > range[1] * cuckooThreshold ? range[1] / 6 : Math.min(value, range[1])
}
const elevationScale = (scale === 'log' ? scaleLog(range, [0, heightMaxScale(zoom)]) : scaleLinear(range, [0, heightMaxScale(zoom)]))
......@@ -79,14 +80,13 @@ class StationLayer extends CompositeLayer {
getElevation: d => getHeight(d.mean, zoom),
getPosition: d => this.getCoordinates(d, count, radius),
getFillColor: d => {
if(d.mean === null || d.mean > range[1]*2) {
if(d.mean === null || d.mean > range[1]*cuckooThreshold) {
let color = getColorArray(mapItemSettings.colorOffline)
color[3] = color[3] * 0.5
return color
} else {
let color = getColorArray(getColor(d.mean, legend, (scale === 'log')))
let color = getColorArray(getColor(Math.min(d.mean, range[1]), legend, (scale === 'log')))
color[3] = color[3] * (1 - 0.1 * d.dataAge)
return color
}
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment