Ticket #4157: josm-ehpe.diff

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

JOSM patch

  • src/org/openstreetmap/josm/gui/layer/GpxLayer.java

     
    513513        // paint large dots for points
    514514        boolean large = Main.pref.getBoolean("draw.rawgps.large");
    515515        boolean hdopcircle = Main.pref.getBoolean("draw.rawgps.hdopcircle", true);
     516        boolean ehpecircle = Main.pref.getBoolean("draw.rawgps.ehpecircle", true);
     517        double ehpefactor;
     518        try {
     519            ehpefactor = Main.pref.getDouble("draw.rawgps.ehpefactor", 1.0d);
     520        } catch (Exception e) {
     521            ehpefactor = 1.0d;
     522        }
    516523        // color the lines
    517524        colorModes colored = colorModes.none;
    518525        try {
     
    707714        /****************************************************************
    708715         ********** STEP 3d - DRAW LARGE POINTS AND HDOP CIRCLE *********
    709716         ****************************************************************/
    710         if (large || hdopcircle) {
     717        if (large || hdopcircle || ehpecircle) {
    711718            g.setColor(neutralColor);
    712719            for (GpxTrack trk : data.tracks) {
    713720                for (Collection<WayPoint> segment : trk.trackSegs) {
     
    728735                            int hdopp = mv.getPoint(new LatLon(trkPnt.getCoor().lat(), trkPnt.getCoor().lon() + 2*6*hdop*360/40000000)).x - screen.x;
    729736                            g.drawArc(screen.x-hdopp/2, screen.y-hdopp/2, hdopp, hdopp, 0, 360);
    730737                        }
     738                        if (ehpecircle && trkPnt.attr.get("ehpe") != null) {
     739                            // ehpe value
     740                            float ehpe = ((Float) trkPnt.attr.get("ehpe")).floatValue();
     741                            if (ehpe < 0) {
     742                                ehpe = 0;
     743                            }
     744                            // ehpe pixels; 1 arcdeg of latitude is about 111,000m
     745                            int ehpep = Math.abs(mv.getPoint(new LatLon(trkPnt.getCoor().lat() + ehpefactor*ehpe/111000, trkPnt.getCoor().lon())).y - screen.y);
     746                            g.drawArc(screen.x - ehpep / 2, screen.y - ehpep / 2, ehpep, ehpep, 0, 360);
     747                        }
    731748                        if (large) {
    732749                            g.fillRect(screen.x-1, screen.y-1, 3, 3);
    733750                        }
  • src/org/openstreetmap/josm/io/GpxReader.java

     
    314314                case ext:
    315315                    if (qName.equals("extensions")) {
    316316                        currentState = states.pop();
     317                    } else if (qName.equals("ehpe")) {
     318                        try {
     319                            currentWayPoint.attr.put(qName, Float.parseFloat(accumulator.toString()));
     320                        } catch (Exception e) {
     321                            currentWayPoint.attr.put(qName, new Float(0));
    317322                    }
     323                    }                   
    318324                    break;
    319325                default:
    320326                    if (qName.equals("wpt")) {