Changeset 6775 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2014-01-29T22:26:53+01:00 (10 years ago)
Author:
simon04
Message:

fix #9600 - GpxLayer: use neutral track color if speed is zero (velocity mode) or time extent is very short (time mode)

File:
1 edited

Legend:

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

    r6717 r6775  
    575575                                int velColor =(int) Math.round(colorModeDynamic ? ((vel-minval)*255/(maxval-minval))
    576576                                        : (vel <= 0 ? 0 : vel / colorTracksTune * 255));
    577                                 trkPnt.customColoring = colors[Math.max(0, Math.min(velColor, 255))];
     577                                final int vIndex = Math.max(0, Math.min(velColor, 255));
     578                                trkPnt.customColoring = vIndex == 255 ? neutralColor : colors[vIndex];
    578579                            } else {
    579                                 trkPnt.customColoring = colors[255];
     580                                trkPnt.customColoring = neutralColor;
    580581                            }
    581582                            break;
     
    591592                        case time:
    592593                            double t=trkPnt.time;
    593                             if (t>0 && t<=now){ // skip bad timestamps
     594                            if (t > 0 && t <= now && maxval - minval > 1000) { // skip bad timestamps and very short tracks
    594595                                int tColor = (int) Math.round((t-minval)*255/(maxval-minval));
    595596                                trkPnt.customColoring = colors[tColor];
Note: See TracChangeset for help on using the changeset viewer.