Index: /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 18737)
+++ /trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java	(revision 18738)
@@ -134,4 +134,5 @@
     private ColorScale qualityScale;
     private ColorScale fixScale;
+    private ColorScale refScale;
     private ColorScale dateScale;
     private ColorScale directionScale;
@@ -243,4 +244,5 @@
         qualityScale = ColorScale.createFixedScale(rtkLibQualityColors).addTitle(tr("Quality")).addColorBarTitles(rtkLibQualityNames);
         fixScale = ColorScale.createFixedScale(gpsFixQualityColors).addTitle(tr("GPS fix")).addColorBarTitles(gpsFixQualityNames);
+        refScale = ColorScale.createCyclicScale(1).addTitle(tr("GPS ref"));
         dateScale = ColorScale.createHSBScale(256).addTitle(tr("Time"));
         directionScale = ColorScale.createCyclicScale(256).setIntervalCount(4).addTitle(tr("Direction"));
@@ -291,5 +293,9 @@
          * Color by GPS fix
          */
-        FIX;
+        FIX,
+        /**
+         * Color by differential ID
+         */
+        REF;
 
         static ColorMode fromIndex(final int index) {
@@ -393,4 +399,5 @@
         qualityScale.setNoDataColor(neutralColor);
         fixScale.setNoDataColor(neutralColor);
+        refScale.setNoDataColor(neutralColor);
         directionScale.setNoDataColor(neutralColor);
 
@@ -609,4 +616,5 @@
             qualityScale.setRange(1, rtkLibQualityColors.length);
             fixScale.setRange(0, gpsFixQualityColors.length);
+            refScale.setRange(0, gpsFixQualityColors.length);
         }
         double now = System.currentTimeMillis()/1000.0;
@@ -618,4 +626,24 @@
         }
 
+        ArrayList<String> refs = new ArrayList<String>();
+        if(colored == ColorMode.REF) {
+            for (Line segment : getLinesIterable(null)) {
+                for (WayPoint trkPnt : segment) {
+                    if (trkPnt.get(GpxConstants.PT_DGPSID) != null) {
+                        String refval = trkPnt.get(GpxConstants.PT_DGPSID).toString();
+                        int i = refs.indexOf(refval);
+                        if(i < 0) {
+                            refs.add(refval);
+                        }
+                    }
+                }
+            }
+            if(refs.size() > 0) {
+                Collections.sort(refs);
+                String[] a = {};
+                refScale = ColorScale.createCyclicScale(refs.size()).addTitle(tr("GPS ref")).addColorBarTitles(refs.toArray(a));
+                refScale.setRange(0, refs.size());
+            }
+        }
         // Now the colors for all the points will be assigned
         for (Line segment : getLinesIterable(null)) {
@@ -641,4 +669,12 @@
                         if (fix >= 0) {
                             color = fixScale.getColor(fix);
+                        }
+                    }
+                } else if (colored == ColorMode.REF) {
+                    if (trkPnt.get(GpxConstants.PT_DGPSID) != null) {
+                        String refval = trkPnt.get(GpxConstants.PT_DGPSID).toString();
+                        int i = refs.indexOf(refval);
+                        if (i >= 0) {
+                            color = refScale.getColor(i);
                         }
                     }
@@ -1572,4 +1608,6 @@
         } else if (colored == ColorMode.FIX) {
             fixScale.drawColorBar(g, w-30, 50, 20, 175, 1.0);
+        } else if (colored == ColorMode.REF) {
+            refScale.drawColorBar(g, w-30, 50, 20, 175, 1.0);
         } else if (colored == ColorMode.VELOCITY) {
             SystemOfMeasurement som = SystemOfMeasurement.getSystemOfMeasurement();
Index: /trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java	(revision 18737)
+++ /trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java	(revision 18738)
@@ -72,4 +72,5 @@
     private final JRadioButton colorTypeQuality = new JRadioButton(tr("Quality (RTKLib only, if available)"));
     private final JRadioButton colorTypeFix = new JRadioButton(tr("GPS fix value"));
+    private final JRadioButton colorTypeRef = new JRadioButton(tr("GPS reference ID"));
     private final JRadioButton colorTypeTime = new JRadioButton(tr("Track date"));
     private final JRadioButton colorTypeHeatMap = new JRadioButton(tr("Heat Map (dark = few, bright = many)"));
@@ -455,4 +456,5 @@
         colorGroup.add(colorTypeQuality);
         colorGroup.add(colorTypeFix);
+        colorGroup.add(colorTypeRef);
         colorGroup.add(colorTypeTime);
         colorGroup.add(colorTypeHeatMap);
@@ -466,4 +468,5 @@
                 tr("Colors points and track segments by RTKLib quality flag (Q). Your capture device needs to log that information."));
         colorTypeFix.setToolTipText(tr("Colors points and track segments by GPS fix value."));
+        colorTypeRef.setToolTipText(tr("Colors points and track segments by GPS reference ID."));
         colorTypeTime.setToolTipText(tr("Colors points and track segments by its timestamp."));
         colorTypeHeatMap.setToolTipText(tr("Collected points and track segments for a position and displayed as heat map."));
@@ -488,4 +491,5 @@
         add(colorTypeQuality, GBC.eol().insets(40, 0, 0, 0));
         add(colorTypeFix, GBC.eol().insets(40, 0, 0, 0));
+        add(colorTypeRef, GBC.eol().insets(40, 0, 0, 0));
         add(colorTypeTime, GBC.eol().insets(40, 0, 0, 0));
         add(colorTypeHeatMap, GBC.std().insets(40, 0, 0, 0));
@@ -642,4 +646,5 @@
             case 6: colorTypeQuality.setSelected(true); break;
             case 7: colorTypeFix.setSelected(true); break;
+            case 8: colorTypeRef.setSelected(true); break;
             default: Logging.warn("Unknown color type: " + colorType);
             }
@@ -720,4 +725,6 @@
         } else if (colorTypeFix.isSelected()) {
             putPref("colormode", 7);
+        } else if (colorTypeRef.isSelected()) {
+            putPref("colormode", 8);
         } else {
             putPref("colormode", 0);
Index: /trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java	(revision 18737)
+++ /trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java	(revision 18738)
@@ -432,4 +432,9 @@
                     }
                 }
+                // h-dilution
+                accu = e[GGA.REF.position];
+                if (!accu.isEmpty()) {
+                    currentwp.put(GpxConstants.PT_DGPSID, accu);
+                }
             } else if (isSentence(e[0], Sentence.VTG)) {
                 // COURSE
Index: /trunk/src/org/openstreetmap/josm/tools/ColorScale.java
===================================================================
--- /trunk/src/org/openstreetmap/josm/tools/ColorScale.java	(revision 18737)
+++ /trunk/src/org/openstreetmap/josm/tools/ColorScale.java	(revision 18738)
@@ -73,5 +73,5 @@
         for (int i = 0; i < sc.colors.length; i++) {
 
-            float angle = i / 256f * 4;
+            float angle = i * 4f / count;
             int quadrant = (int) angle;
             angle -= quadrant;
@@ -236,5 +236,4 @@
     public void drawColorBar(Graphics2D g, int x, int y, int w, int h, double valueScale) {
         int n = colors.length;
-
         for (int i = 0; i < n; i++) {
             g.setColor(colors[i]);
@@ -269,5 +268,7 @@
                 txt = String.format("%.3f", val*valueScale);
             }
-            if (w < h) {
+            if (intervalCount == 0) {
+                g.drawString(txt, x-fw-3, y+h/2+fh/2);
+            } else if (w < h) {
                 g.drawString(txt, x-fw-3, y+i*h/intervalCount+fh/2);
             } else {
