Disable cost gradients and simplification (#693)

This commit is contained in:
Norbert Renner 2023-02-20 12:48:42 +01:00
parent c2ef8e83ec
commit 89ecdcd84f

View file

@ -221,7 +221,12 @@ BR.RoutingPathQuality = L.Control.extend({
icon: 'fa-usd', icon: 'fa-usd',
provider: new HotLineQualityProvider({ provider: new HotLineQualityProvider({
hotlineOptions: { hotlineOptions: {
pct: 0.95, // skip (1 - pct) percent of largest values when calculating maximum // skip (1 - pct) percent of largest values when calculating maximum
pct: 0.95,
// turns off gradients as they wash out colors of shorter segments
discreteStrokes: true,
// disables line simplification, so short segments won't disappear on some zoom levels
smoothFactor: 0,
outlineColor: 'dimgray', outlineColor: 'dimgray',
renderer: renderer, renderer: renderer,
}, },
@ -432,7 +437,9 @@ var HotLineQualityProvider = L.Class.extend({
}, },
_calcMinMaxValues: function (lines, pct) { _calcMinMaxValues: function (lines, pct) {
lines.sort(function(a, b){return a[2] - b[2]}); lines.sort(function (a, b) {
return a[2] - b[2];
});
var min = lines[0][2]; var min = lines[0][2];
var max = lines[Math.ceil(pct * lines.length) - 1][2]; var max = lines[Math.ceil(pct * lines.length) - 1][2];
if (min === max) { if (min === max) {