Changeset 9234 in josm for trunk/src/org


Ignore:
Timestamp:
2016-01-01T14:05:12+01:00 (8 years ago)
Author:
simon04
Message:

fix #11338 - Gpx tracks: speed outliers and coloring

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java

    r9078 r9234  
    1111import java.awt.RenderingHints;
    1212import java.awt.Stroke;
     13import java.util.ArrayList;
    1314import java.util.Collection;
     15import java.util.Collections;
    1416import java.util.Date;
    1517import java.util.List;
     
    224226        if (colorModeDynamic) {
    225227            if (colored == ColorMode.VELOCITY) {
     228                final List<Double> velocities = new ArrayList<>();
    226229                for (Collection<WayPoint> segment : data.getLinesIterable(null)) {
    227230                    if (!forceLines) {
     
    236239                            double vel = c.greatCircleDistance(oldWp.getCoor())
    237240                                    / (trkPnt.time - oldWp.time);
     241                            velocities.add(vel);
    238242                            if (vel > maxval) {
    239243                                maxval = vel;
     
    246250                    }
    247251                }
     252                Collections.sort(velocities);
     253                minval = velocities.get(velocities.size() / 20); // 5% percentile to remove outliers
     254                maxval = velocities.get(velocities.size() * 19 / 20); // 95% percentile to remove outliers
    248255                if (minval >= maxval) {
    249256                    velocityScale.setRange(0, 120/3.6);
Note: See TracChangeset for help on using the changeset viewer.