Changeset 6895 in josm for trunk/src/org/openstreetmap/josm/gui/layer
- Timestamp:
- 2014-03-02T15:38:21+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r6889 r6895 367 367 for (int i = 0; i < colors.length; i++) { 368 368 colors[i] = Color.getHSBColor(i / 300.0f, 1, 1); 369 } 370 } 371 /** Colors (with custom alpha channel, if given) for HDOP painting. */ 372 private final Color[] hdopColors; 373 private final int hdopAlpha = Main.pref.getInteger("hdop.color.alpha", -1); 374 { 375 if (hdopAlpha >= 0) { 376 hdopColors = new Color[256]; 377 for (int i = 0; i < hdopColors.length; i++) { 378 hdopColors[i] = new Color((colors[i].getRGB() & 0xFFFFFF) | ((hdopAlpha & 0xFF) << 24), true); 379 } 380 } else { 381 hdopColors = colors; 369 382 } 370 383 } … … 556 569 } 557 570 trkPnt.customColoring = neutralColor; 558 if(colored == colorModes.dilution && trkPnt.attr.get("hdop") != null) { 559 float hdop = ((Float) trkPnt.attr.get("hdop")).floatValue(); 560 int hdoplvl =(int) Math.round(colorModeDynamic ? ((hdop-minval)*255/(maxval-minval)) 561 : (hdop <= 0 ? 0 : hdop * hdopfactor)); 562 // High hdop is bad, but high values in colors are green. 563 // Therefore inverse the logic 564 int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl); 565 trkPnt.customColoring = colors[hdopcolor]; 571 if (trkPnt.attr.get("hdop") != null) { 572 if (colored == colorModes.dilution) { 573 float hdop = ((Float) trkPnt.attr.get("hdop")).floatValue(); 574 int hdoplvl =(int) Math.round(colorModeDynamic ? ((hdop-minval)*255/(maxval-minval)) 575 : (hdop <= 0 ? 0 : hdop * hdopfactor)); 576 // High hdop is bad, but high values in colors are green. 577 // Therefore inverse the logic 578 int hdopcolor = 255 - (hdoplvl > 255 ? 255 : hdoplvl); 579 trkPnt.customColoring = colors[hdopcolor]; 580 trkPnt.customColoringTransparent = hdopColors[hdopcolor]; 581 } else { 582 trkPnt.customColoringTransparent = new Color( 583 neutralColor.getRed(), neutralColor.getGreen(), neutralColor.getBlue(), hdopAlpha & 0xFF); 584 } 566 585 } 567 586 if (oldWp != null) { … … 740 759 } 741 760 Point screen = mv.getPoint(trkPnt.getEastNorth()); 742 g.setColor(trkPnt.customColoring );761 g.setColor(trkPnt.customColoringTransparent); 743 762 if (hdopcircle && trkPnt.attr.get("hdop") != null) { 744 763 // hdop value
Note:
See TracChangeset
for help on using the changeset viewer.