--- orig/src/org/openstreetmap/josm/gui/layer/GpxLayer.java	2009-01-11 11:16:42.000000000 +0100
+++ trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java	2009-01-16 21:49:01.875000000 +0100
@@ -86,6 +86,7 @@
     private int computeCacheMaxLineLengthUsed;
     private Color computeCacheColorUsed;
     private boolean computeCacheColored;
+    private int computeCacheColorTracksTune;
 
     public GpxLayer(GpxData d) {
         super((String) d.attr.get("name"));
@@ -396,18 +397,20 @@
         } catch (java.lang.NumberFormatException e) {
             Main.pref.put("draw.rawgps.min-arrow-distance", "0");
         }
-
+        int colorTracksTune = Main.pref.getInteger("draw.rawgps.colorTracksTune", 45); // allows to tweak line coloring for different speed levels. foot: 10, bike: 20, car: 45         
         /****************************************************************
          ********** STEP 2a - CHECK CACHE VALIDITY **********************
          ****************************************************************/
         if (computeCacheInSync && ((computeCacheMaxLineLengthUsed != maxLineLength) ||
                                    (!neutralColor.equals(computeCacheColorUsed)) ||
-                                   (computeCacheColored != colored))) {
+                                   (computeCacheColored != colored) ||
+                                   (computeCacheColorTracksTune != colorTracksTune))) {
 //          System.out.println("(re-)computing gpx line styles, reason: CCIS=" + computeCacheInSync + " CCMLLU=" + (computeCacheMaxLineLengthUsed != maxLineLength) + " CCCU=" +  (!neutralColor.equals(computeCacheColorUsed)) + " CCC=" + (computeCacheColored != colored));
             computeCacheMaxLineLengthUsed = maxLineLength;
             computeCacheInSync = false;
             computeCacheColorUsed = neutralColor;
             computeCacheColored = colored;
+            computeCacheColorTracksTune = colorTracksTune;
         }
 
         /****************************************************************
@@ -428,13 +431,14 @@
                             double dist = trkPnt.latlon.greatCircleDistance(oldWp.latlon);
                             double dtime = trkPnt.time - oldWp.time;
                             double vel = dist/dtime;
+                            double velColor = vel/colorTracksTune*255;
 
                             if (!colored) {
                                 trkPnt.speedLineColor = neutralColor;
-                            } else if (dtime <= 0 || vel < 0 || vel > 36) { // attn: bad case first
+                            } else if (dtime <= 0 || vel < 0 || velColor > 255) { // attn: bad case first
                                 trkPnt.speedLineColor = colors[255];
                             } else {
-                                trkPnt.speedLineColor = colors[(int) (7*vel)];
+                                trkPnt.speedLineColor = colors[(int) (velColor)];
                             }
                             if (maxLineLength == -1 || dist <= maxLineLength) {
                                 trkPnt.drawLine = true;
