Changeset 622 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2008-05-03T17:44:05+02:00 (17 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r608 r622 287 287 } 288 288 289 private static Color[] colors = new Color[256]; 290 static { 291 for (int i = 0; i < colors.length; i++) { 292 colors[i] = Color.getHSBColor(i/300.0f, 1, 1); 293 } 294 } 295 289 296 @Override public void paint(Graphics g, MapView mv) { 290 297 String gpsCol = Main.pref.get("color.gps point"); … … 306 313 lines = Main.pref.getBoolean(linesKey); 307 314 boolean large = Main.pref.getBoolean("draw.rawgps.large"); 315 boolean colored = Main.pref.getBoolean("draw.rawgps.colors"); 308 316 309 317 Point old = null; … … 319 327 Point screen = mv.getPoint(trkPnt.eastNorth); 320 328 if (lines && old != null) { 329 double dist = trkPnt.latlon.greatCircleDistance(oldWp.latlon); 330 double dtime = trkPnt.time - oldWp.time; 331 double vel = dist/dtime; 332 333 if (colored && dtime > 0) { 334 // scale linearly until 130km/h = 36.1m/s 335 if (vel < 0 || vel > 36) { 336 g.setColor(colors[255]); 337 } else { 338 g.setColor(colors[(int) (7*vel)]); 339 } 340 } 321 341 322 342 // draw line, if no maxLineLength is set or the line is shorter. 323 if (maxLineLength == -1 || trkPnt.latlon.greatCircleDistance(oldWp.latlon)<= maxLineLength){343 if (maxLineLength == -1 || dist <= maxLineLength){ 324 344 g.drawLine(old.x, old.y, screen.x, screen.y); 325 345 -
trunk/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
r604 r622 17 17 private JCheckBox forceRawGpsLines = new JCheckBox(tr("Force lines if no segments imported.")); 18 18 private JCheckBox largeGpsPoints = new JCheckBox(tr("Draw large GPS points.")); 19 private JCheckBox colorTracks = new JCheckBox(tr("Color tracks by velocity.")); 19 20 private JCheckBox directionHint = new JCheckBox(tr("Draw Direction Arrows")); 20 21 private JCheckBox drawGpsArrows = new JCheckBox(tr("Draw Direction Arrows")); … … 34 35 forceRawGpsLines.setEnabled(drawRawGpsLines.isSelected()); 35 36 drawGpsArrows.setEnabled(drawRawGpsLines.isSelected()); 37 colorTracks.setEnabled(drawRawGpsLines.isSelected()); 36 38 } 37 39 }); … … 51 53 drawGpsArrows.setEnabled(drawRawGpsLines.isSelected()); 52 54 gui.display.add(drawGpsArrows, GBC.eop().insets(40,0,0,0)); 55 56 // colorTracks 57 colorTracks.setSelected(Main.pref.getBoolean("draw.rawgps.colors")); 58 colorTracks.setToolTipText(tr("Choose the hue for the track color by the velocity at that point.")); 59 colorTracks.setEnabled(drawRawGpsLines.isSelected()); 60 gui.display.add(colorTracks, GBC.eop().insets(40,0,0,0)); 53 61 54 62 // largeGpsPoints … … 98 106 Main.pref.put("draw.rawgps.lines.force", forceRawGpsLines.isSelected()); 99 107 Main.pref.put("draw.rawgps.direction", drawGpsArrows.isSelected()); 108 Main.pref.put("draw.rawgps.colors", colorTracks.isSelected()); 100 109 Main.pref.put("draw.rawgps.large", largeGpsPoints.isSelected()); 101 110 Main.pref.put("draw.segment.direction", directionHint.isSelected());
Note:
See TracChangeset
for help on using the changeset viewer.