Changeset 18738 in josm for trunk/src/org
- Timestamp:
- 2023-05-30T15:39:05+02:00 (18 months ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/gpx/GpxDrawHelper.java
r18494 r18738 134 134 private ColorScale qualityScale; 135 135 private ColorScale fixScale; 136 private ColorScale refScale; 136 137 private ColorScale dateScale; 137 138 private ColorScale directionScale; … … 243 244 qualityScale = ColorScale.createFixedScale(rtkLibQualityColors).addTitle(tr("Quality")).addColorBarTitles(rtkLibQualityNames); 244 245 fixScale = ColorScale.createFixedScale(gpsFixQualityColors).addTitle(tr("GPS fix")).addColorBarTitles(gpsFixQualityNames); 246 refScale = ColorScale.createCyclicScale(1).addTitle(tr("GPS ref")); 245 247 dateScale = ColorScale.createHSBScale(256).addTitle(tr("Time")); 246 248 directionScale = ColorScale.createCyclicScale(256).setIntervalCount(4).addTitle(tr("Direction")); … … 291 293 * Color by GPS fix 292 294 */ 293 FIX; 295 FIX, 296 /** 297 * Color by differential ID 298 */ 299 REF; 294 300 295 301 static ColorMode fromIndex(final int index) { … … 393 399 qualityScale.setNoDataColor(neutralColor); 394 400 fixScale.setNoDataColor(neutralColor); 401 refScale.setNoDataColor(neutralColor); 395 402 directionScale.setNoDataColor(neutralColor); 396 403 … … 609 616 qualityScale.setRange(1, rtkLibQualityColors.length); 610 617 fixScale.setRange(0, gpsFixQualityColors.length); 618 refScale.setRange(0, gpsFixQualityColors.length); 611 619 } 612 620 double now = System.currentTimeMillis()/1000.0; … … 618 626 } 619 627 628 ArrayList<String> refs = new ArrayList<String>(); 629 if(colored == ColorMode.REF) { 630 for (Line segment : getLinesIterable(null)) { 631 for (WayPoint trkPnt : segment) { 632 if (trkPnt.get(GpxConstants.PT_DGPSID) != null) { 633 String refval = trkPnt.get(GpxConstants.PT_DGPSID).toString(); 634 int i = refs.indexOf(refval); 635 if(i < 0) { 636 refs.add(refval); 637 } 638 } 639 } 640 } 641 if(refs.size() > 0) { 642 Collections.sort(refs); 643 String[] a = {}; 644 refScale = ColorScale.createCyclicScale(refs.size()).addTitle(tr("GPS ref")).addColorBarTitles(refs.toArray(a)); 645 refScale.setRange(0, refs.size()); 646 } 647 } 620 648 // Now the colors for all the points will be assigned 621 649 for (Line segment : getLinesIterable(null)) { … … 641 669 if (fix >= 0) { 642 670 color = fixScale.getColor(fix); 671 } 672 } 673 } else if (colored == ColorMode.REF) { 674 if (trkPnt.get(GpxConstants.PT_DGPSID) != null) { 675 String refval = trkPnt.get(GpxConstants.PT_DGPSID).toString(); 676 int i = refs.indexOf(refval); 677 if (i >= 0) { 678 color = refScale.getColor(i); 643 679 } 644 680 } … … 1572 1608 } else if (colored == ColorMode.FIX) { 1573 1609 fixScale.drawColorBar(g, w-30, 50, 20, 175, 1.0); 1610 } else if (colored == ColorMode.REF) { 1611 refScale.drawColorBar(g, w-30, 50, 20, 175, 1.0); 1574 1612 } else if (colored == ColorMode.VELOCITY) { 1575 1613 SystemOfMeasurement som = SystemOfMeasurement.getSystemOfMeasurement(); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/GPXSettingsPanel.java
r18396 r18738 72 72 private final JRadioButton colorTypeQuality = new JRadioButton(tr("Quality (RTKLib only, if available)")); 73 73 private final JRadioButton colorTypeFix = new JRadioButton(tr("GPS fix value")); 74 private final JRadioButton colorTypeRef = new JRadioButton(tr("GPS reference ID")); 74 75 private final JRadioButton colorTypeTime = new JRadioButton(tr("Track date")); 75 76 private final JRadioButton colorTypeHeatMap = new JRadioButton(tr("Heat Map (dark = few, bright = many)")); … … 455 456 colorGroup.add(colorTypeQuality); 456 457 colorGroup.add(colorTypeFix); 458 colorGroup.add(colorTypeRef); 457 459 colorGroup.add(colorTypeTime); 458 460 colorGroup.add(colorTypeHeatMap); … … 466 468 tr("Colors points and track segments by RTKLib quality flag (Q). Your capture device needs to log that information.")); 467 469 colorTypeFix.setToolTipText(tr("Colors points and track segments by GPS fix value.")); 470 colorTypeRef.setToolTipText(tr("Colors points and track segments by GPS reference ID.")); 468 471 colorTypeTime.setToolTipText(tr("Colors points and track segments by its timestamp.")); 469 472 colorTypeHeatMap.setToolTipText(tr("Collected points and track segments for a position and displayed as heat map.")); … … 488 491 add(colorTypeQuality, GBC.eol().insets(40, 0, 0, 0)); 489 492 add(colorTypeFix, GBC.eol().insets(40, 0, 0, 0)); 493 add(colorTypeRef, GBC.eol().insets(40, 0, 0, 0)); 490 494 add(colorTypeTime, GBC.eol().insets(40, 0, 0, 0)); 491 495 add(colorTypeHeatMap, GBC.std().insets(40, 0, 0, 0)); … … 642 646 case 6: colorTypeQuality.setSelected(true); break; 643 647 case 7: colorTypeFix.setSelected(true); break; 648 case 8: colorTypeRef.setSelected(true); break; 644 649 default: Logging.warn("Unknown color type: " + colorType); 645 650 } … … 720 725 } else if (colorTypeFix.isSelected()) { 721 726 putPref("colormode", 7); 727 } else if (colorTypeRef.isSelected()) { 728 putPref("colormode", 8); 722 729 } else { 723 730 putPref("colormode", 0); -
trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java
r18179 r18738 432 432 } 433 433 } 434 // h-dilution 435 accu = e[GGA.REF.position]; 436 if (!accu.isEmpty()) { 437 currentwp.put(GpxConstants.PT_DGPSID, accu); 438 } 434 439 } else if (isSentence(e[0], Sentence.VTG)) { 435 440 // COURSE -
trunk/src/org/openstreetmap/josm/tools/ColorScale.java
r18396 r18738 73 73 for (int i = 0; i < sc.colors.length; i++) { 74 74 75 float angle = i / 256f * 4;75 float angle = i * 4f / count; 76 76 int quadrant = (int) angle; 77 77 angle -= quadrant; … … 236 236 public void drawColorBar(Graphics2D g, int x, int y, int w, int h, double valueScale) { 237 237 int n = colors.length; 238 239 238 for (int i = 0; i < n; i++) { 240 239 g.setColor(colors[i]); … … 269 268 txt = String.format("%.3f", val*valueScale); 270 269 } 271 if (w < h) { 270 if (intervalCount == 0) { 271 g.drawString(txt, x-fw-3, y+h/2+fh/2); 272 } else if (w < h) { 272 273 g.drawString(txt, x-fw-3, y+i*h/intervalCount+fh/2); 273 274 } else {
Note:
See TracChangeset
for help on using the changeset viewer.