Ticket #4157: josm-ehpe.diff-3208

File josm-ehpe.diff-3208, 3.1 KB (added by hopet@…, 16 years ago)

Patch against rev. 3208

Line 
1Index: src/org/openstreetmap/josm/gui/layer/GpxLayer.java
2===================================================================
3--- src/org/openstreetmap/josm/gui/layer/GpxLayer.java (revision 3208)
4+++ src/org/openstreetmap/josm/gui/layer/GpxLayer.java (working copy)
5@@ -534,6 +534,13 @@
6 // paint large dots for points
7 boolean large = Main.pref.getBoolean("draw.rawgps.large");
8 boolean hdopcircle = Main.pref.getBoolean("draw.rawgps.hdopcircle", true);
9+ boolean ehpecircle = Main.pref.getBoolean("draw.rawgps.ehpecircle", true);
10+ double ehpefactor;
11+ try {
12+ ehpefactor = Main.pref.getDouble("draw.rawgps.ehpefactor", 1.0d);
13+ } catch (Exception e) {
14+ ehpefactor = 1.0d;
15+ }
16 // color the lines
17 colorModes colored = colorModes.none;
18 try {
19@@ -730,7 +737,7 @@
20 /****************************************************************
21 ********** STEP 3d - DRAW LARGE POINTS AND HDOP CIRCLE *********
22 ****************************************************************/
23- if (large || hdopcircle) {
24+ if (large || hdopcircle || ehpecircle) {
25 g.setColor(neutralColor);
26 for (Collection<WayPoint> segment : visibleSegments) {
27 for (WayPoint trkPnt : segment) {
28@@ -750,6 +757,17 @@
29 int hdopp = mv.getPoint(new LatLon(trkPnt.getCoor().lat(), trkPnt.getCoor().lon() + 2*6*hdop*360/40000000)).x - screen.x;
30 g.drawArc(screen.x-hdopp/2, screen.y-hdopp/2, hdopp, hdopp, 0, 360);
31 }
32+ if (ehpecircle && trkPnt.attr.get("ehpe") != null) {
33+ // ehpe value
34+ float ehpe = ((Float) trkPnt.attr.get("ehpe")).floatValue();
35+ if (ehpe < 0) {
36+ ehpe = 0;
37+ }
38+ // ehpe pixels; 1 arcdeg of latitude is about 111,000m
39+ int ehpep = Math.abs(mv.getPoint(new LatLon(trkPnt.getCoor().lat() + ehpefactor*ehpe/111000, trkPnt.getCoor().lon())).y - screen.y);
40+ g.drawArc(screen.x - ehpep / 2, screen.y - ehpep / 2, ehpep, ehpep, 0, 360);
41+ }
42+
43 if (large) {
44 g.fillRect(screen.x-1, screen.y-1, 3, 3);
45 }
46Index: src/org/openstreetmap/josm/io/GpxReader.java
47===================================================================
48--- src/org/openstreetmap/josm/io/GpxReader.java (revision 3208)
49+++ src/org/openstreetmap/josm/io/GpxReader.java (working copy)
50@@ -322,6 +322,12 @@
51 case ext:
52 if (qName.equals("extensions")) {
53 currentState = states.pop();
54+ } else if (qName.equals("ehpe")) {
55+ try {
56+ currentWayPoint.attr.put(qName, Float.parseFloat(accumulator.toString()));
57+ } catch (Exception e) {
58+ currentWayPoint.attr.put(qName, new Float(0));
59+ }
60 }
61 break;
62 default: