diff --git a/src/org/openstreetmap/josm/gui/layer/GpxLayer.java b/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
index 1443089..bc632a1 100644
a
|
b
|
public class GpxLayer extends Layer {
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
| 313 | private static Color[] colors_cyclic = new Color[256]; |
| 314 | static { |
| 315 | for (int i = 0; i < colors_cyclic.length; i++) { |
| 316 | colors_cyclic[i] = Color.getHSBColor(i / 256.0f, 1, 1); |
| 317 | } |
| 318 | } |
| 319 | |
313 | 320 | // lookup array to draw arrows without doing any math |
314 | 321 | private static int ll0 = 9; |
315 | 322 | private static int sl4 = 5; |
… |
… |
public class GpxLayer extends Layer {
|
321 | 328 | |
322 | 329 | // the different color modes |
323 | 330 | enum colorModes { |
324 | | none, velocity, dilution |
| 331 | none, velocity, direction, dilution |
325 | 332 | } |
326 | 333 | |
327 | 334 | @Override |
… |
… |
public class GpxLayer extends Layer {
|
429 | 436 | } |
430 | 437 | break; |
431 | 438 | |
| 439 | case direction: |
| 440 | // unfortunately "heading" misses a cos-factor in the |
| 441 | // longitudes to account for the convergence of meridians |
| 442 | double dirColor = oldWp.getCoor().heading(trkPnt.getCoor()) / (2.0 * Math.PI) * 255; |
| 443 | // Bad case first |
| 444 | if (dirColor != dirColor || dirColor < 0.0 || dirColor >= 256.0) { |
| 445 | trkPnt.customColoring = colors_cyclic[0]; |
| 446 | } else { |
| 447 | trkPnt.customColoring = colors_cyclic[(int) (dirColor)]; |
| 448 | } |
| 449 | break; |
| 450 | |
432 | 451 | case dilution: |
433 | 452 | if (trkPnt.attr.get("hdop") != null) { |
434 | 453 | float hdop = ((Float) trkPnt.attr.get("hdop")).floatValue(); |
diff --git a/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java b/src/org/openstreetmap/josm/gui/preferences/DrawingPreference.java
index 785026d..9801ced 100644
a
|
b
|
public class DrawingPreference implements PreferenceSetting {
|
44 | 44 | private JCheckBox hdopCircleGpsPoints = new JCheckBox(tr("Draw a circle form HDOP value.")); |
45 | 45 | private ButtonGroup colorGroup; |
46 | 46 | private JRadioButton colorTypeVelocity = new JRadioButton(tr("Velocity (red = slow, green = fast)")); |
| 47 | private JRadioButton colorTypeDirection = new JRadioButton(tr("Direction (red = north, purple = west)")); |
47 | 48 | private JRadioButton colorTypeDilution = new JRadioButton(tr("Dilution of Position (red = high, green = low, if available)")); |
48 | 49 | private JRadioButton colorTypeNone = new JRadioButton(tr("Single Color (can be customized for named layers)")); |
49 | 50 | private JComboBox colorTypeVelocityTune = new JComboBox(new String[] {tr("Car"), tr("Bicycle"), tr("Foot")}); |
… |
… |
public class DrawingPreference implements PreferenceSetting {
|
169 | 170 | colorGroup = new ButtonGroup(); |
170 | 171 | colorGroup.add(colorTypeNone); |
171 | 172 | colorGroup.add(colorTypeVelocity); |
| 173 | colorGroup.add(colorTypeDirection); |
172 | 174 | colorGroup.add(colorTypeDilution); |
173 | 175 | |
174 | 176 | colorTypeVelocity.addChangeListener(new ChangeListener(){ |
… |
… |
public class DrawingPreference implements PreferenceSetting {
|
185 | 187 | colorTypeVelocity.setSelected(true); |
186 | 188 | break; |
187 | 189 | case 2: |
| 190 | colorTypeDirection.setSelected(true); |
| 191 | break; |
| 192 | case 3: |
188 | 193 | colorTypeDilution.setSelected(true); |
189 | 194 | break; |
190 | 195 | } |
191 | 196 | |
192 | 197 | colorTypeNone.setToolTipText(tr("All points and track segments will have the same color. Can be customized in Layer Manager.")); |
193 | 198 | colorTypeVelocity.setToolTipText(tr("Colors points and track segments by velocity.")); |
| 199 | colorTypeDirection.setToolTipText(tr("Colors points and track segments by direction.")); |
194 | 200 | colorTypeDilution.setToolTipText(tr("Colors points and track segments by dilution of position (HDOP). Your capture device needs to log that information.")); |
195 | 201 | |
196 | 202 | // color Tracks by Velocity Tune |
… |
… |
public class DrawingPreference implements PreferenceSetting {
|
205 | 211 | panel.add(colorTypeNone, GBC.eol().insets(40,0,0,0)); |
206 | 212 | panel.add(colorTypeVelocity, GBC.std().insets(40,0,0,0)); |
207 | 213 | panel.add(colorTypeVelocityTune, GBC.eop().insets(5,0,0,5)); |
| 214 | panel.add(colorTypeDirection, GBC.eol().insets(40,0,0,0)); |
208 | 215 | panel.add(colorTypeDilution, GBC.eol().insets(40,0,0,0)); |
209 | 216 | |
210 | 217 | // waypointLabel |
… |
… |
public class DrawingPreference implements PreferenceSetting {
|
297 | 304 | Main.pref.put("draw.rawgps.min-arrow-distance", drawGpsArrowsMinDist.getText()); |
298 | 305 | if(colorTypeVelocity.isSelected()) { |
299 | 306 | Main.pref.putInteger("draw.rawgps.colors", 1); |
300 | | } else if(colorTypeDilution.isSelected()) { |
| 307 | } else if(colorTypeDirection.isSelected()) { |
301 | 308 | Main.pref.putInteger("draw.rawgps.colors", 2); |
| 309 | } else if(colorTypeDilution.isSelected()) { |
| 310 | Main.pref.putInteger("draw.rawgps.colors", 3); |
302 | 311 | } else { |
303 | 312 | Main.pref.putInteger("draw.rawgps.colors", 0); |
304 | 313 | } |