Changeset 16315 in osm for applications


Ignore:
Timestamp:
2009-07-05T10:41:52+02:00 (16 years ago)
Author:
stoecker
Message:

minor cleanups reusing JOSM code

Location:
applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/AgpifojLayer.java

    r16294 r16315  
    366366    public void visitBoundingBox(BoundingXYVisitor v) {
    367367        for (ImageEntry e : data)
    368             v.visit(e.pos.getEastNorth());
     368            v.visit(e.pos);
    369369    }
    370370
  • applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java

    r16294 r16315  
    979979
    980980        if (prevWp != null) {
    981             double distance = getDistance(prevWp, curWp);
     981            double distance = prevWp.getCoor().greatCircleDistance(curWp.getCoor());
    982982            // This is in km/h, 3.6 * m/s
    983983            if (curDateWp > prevDateWp)
     
    11541154        }
    11551155    }
    1156 
    1157     /** Return the distance in meters between 2 points
    1158      * Formula and earth radius from : http://en.wikipedia.org/wiki/Great-circle_distance */
    1159     public double getDistance(WayPoint p1, WayPoint p2) {
    1160         double p1Lat = p1.getCoor().lat() * Math.PI / 180;
    1161         double p1Lon = p1.getCoor().lon() * Math.PI / 180;
    1162         double p2Lat = p2.getCoor().lat() * Math.PI / 180;
    1163         double p2Lon = p2.getCoor().lon() * Math.PI / 180;
    1164         double ret = Math.atan2(Math.sqrt(Math.pow(Math.cos(p2Lat) * Math.sin(p2Lon - p1Lon), 2)
    1165                                           + Math.pow(Math.cos(p1Lat) * Math.sin(p2Lat)
    1166                                                      - Math.sin(p1Lat) * Math.cos(p2Lat) * Math.cos(p2Lon - p1Lon), 2)),
    1167                                 Math.sin(p1Lat) * Math.sin(p2Lat)
    1168                                 + Math.cos(p1Lat) * Math.cos(p2Lat) * Math.cos(p2Lon - p1Lon))
    1169                      * 6372795; // Earth radius, in meters
    1170         return ret;
    1171     }
    11721156}
Note: See TracChangeset for help on using the changeset viewer.