Changeset 9338 in josm


Ignore:
Timestamp:
2016-01-07T16:54:19+01:00 (9 years ago)
Author:
simon04
Message:

fix #12312 - Error when loading GPX file with single point and track dynamic track coloring

Regression of r9234.

File:
1 edited

Legend:

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

    r9248 r9338  
    241241                                    / (trkPnt.time - oldWp.time);
    242242                            velocities.add(vel);
    243                             if (vel > maxval) {
    244                                 maxval = vel;
    245                             }
    246                             if (vel < minval) {
    247                                 minval = vel;
    248                             }
    249243                        }
    250244                        oldWp = trkPnt;
     
    252246                }
    253247                Collections.sort(velocities);
    254                 minval = velocities.get(velocities.size() / 20); // 5% percentile to remove outliers
    255                 maxval = velocities.get(velocities.size() * 19 / 20); // 95% percentile to remove outliers
    256                 if (minval >= maxval) {
     248                if (velocities.isEmpty()) {
    257249                    velocityScale.setRange(0, 120/3.6);
    258250                } else {
     251                    minval = velocities.get(velocities.size() / 20); // 5% percentile to remove outliers
     252                    maxval = velocities.get(velocities.size() * 19 / 20); // 95% percentile to remove outliers
    259253                    velocityScale.setRange(minval, maxval);
    260254                }
Note: See TracChangeset for help on using the changeset viewer.