Filter MaxValueWeights

This commit is contained in:
glax 2023-04-23 13:06:29 +02:00
parent 465d40a475
commit 68cb0ee3fd

View File

@ -136,13 +136,16 @@ public static class Renderer
public static ValueTuple<Image, Bounds> DrawGScores(Dictionary<OsmNode, double> gScoreDict, Image? renderOver = null,
Bounds? bounds = null)
{
float minLat = bounds?.minLat ?? gScoreDict.Min(kv => kv.Key.coordinates.latitude);
float minLon = bounds?.minLon ?? gScoreDict.Min(kv => kv.Key.coordinates.longitude);
float maxLat = bounds?.maxLat ?? gScoreDict.Max(kv => kv.Key.coordinates.latitude);
float maxLon = bounds?.maxLon ?? gScoreDict.Max(kv => kv.Key.coordinates.longitude);
Dictionary<OsmNode, double> gScore =
gScoreDict.Where(kv => kv.Value < double.MaxValue).ToDictionary(pair => pair.Key, pair => pair.Value);
float minLat = bounds?.minLat ?? gScore.Min(kv => kv.Key.coordinates.latitude);
float minLon = bounds?.minLon ?? gScore.Min(kv => kv.Key.coordinates.longitude);
float maxLat = bounds?.maxLat ?? gScore.Max(kv => kv.Key.coordinates.latitude);
float maxLon = bounds?.maxLon ?? gScore.Max(kv => kv.Key.coordinates.longitude);
double minWeight = gScoreDict.Min(kv => kv.Value);
double maxWeight = gScoreDict.Max(kv => kv.Value);
double minWeight = gScore.Min(kv => kv.Value);
double maxWeight = gScore.Max(kv => kv.Value);
float latDiff = maxLat - minLat;
float lonDiff = maxLon - minLon;
@ -159,7 +162,7 @@ public static class Renderer
float pointSize = PenThickness * 1.5f;
foreach (KeyValuePair<OsmNode, double> kv in gScoreDict)
foreach (KeyValuePair<OsmNode, double> kv in gScore)
{
double percentage = (kv.Value - minWeight) / (maxWeight - minWeight);
Brush b = new SolidBrush(GradientPick(percentage, WeightStartColor, WeightCenterColor, WeightEndColor));