diff --git a/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java b/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
index f00c865..30bfe20 100644
a
|
b
|
|
10 | 10 | import java.awt.Point; |
11 | 11 | import java.awt.RenderingHints; |
12 | 12 | import java.awt.Stroke; |
| 13 | import java.util.ArrayList; |
13 | 14 | import java.util.Collection; |
| 15 | import java.util.Collections; |
14 | 16 | import java.util.Date; |
15 | 17 | import java.util.List; |
16 | 18 | |
… |
… |
public void calculateColors() {
|
223 | 225 | |
224 | 226 | if (colorModeDynamic) { |
225 | 227 | if (colored == ColorMode.VELOCITY) { |
| 228 | final List<Double> velocities = new ArrayList<>(); |
226 | 229 | for (Collection<WayPoint> segment : data.getLinesIterable(null)) { |
227 | 230 | if (!forceLines) { |
228 | 231 | oldWp = null; |
… |
… |
public void calculateColors() {
|
235 | 238 | if (oldWp != null && trkPnt.time > oldWp.time) { |
236 | 239 | double vel = c.greatCircleDistance(oldWp.getCoor()) |
237 | 240 | / (trkPnt.time - oldWp.time); |
| 241 | velocities.add(vel); |
238 | 242 | if (vel > maxval) { |
239 | 243 | maxval = vel; |
240 | 244 | } |
… |
… |
public void calculateColors() {
|
245 | 249 | oldWp = trkPnt; |
246 | 250 | } |
247 | 251 | } |
| 252 | Collections.sort(velocities); |
| 253 | minval = velocities.get(velocities.size() / 20); // 5% percentile |
| 254 | maxval = velocities.get(velocities.size() * 19 / 20); // 95% percentile |
248 | 255 | if (minval >= maxval) { |
249 | 256 | velocityScale.setRange(0, 120/3.6); |
250 | 257 | } else { |
251 | | velocityScale.setRange(minval, maxval); |
| 258 | velocityScale.setRange(minval, maxval); |
252 | 259 | } |
253 | 260 | } else if (colored == ColorMode.HDOP) { |
254 | 261 | for (Collection<WayPoint> segment : data.getLinesIterable(null)) { |