Changeset 16294 in osm for applications/editors/josm/plugins/agpifoj/src/org
- Timestamp:
- 2009-07-03T23:35:00+02:00 (16 years ago)
- 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
r14916 r16294 29 29 import org.openstreetmap.josm.Main; 30 30 import org.openstreetmap.josm.actions.RenameLayerAction; 31 import org.openstreetmap.josm.data.coor.CachedLatLon; 31 32 import org.openstreetmap.josm.data.coor.EastNorth; 32 33 import org.openstreetmap.josm.data.coor.LatLon; … … 53 54 54 55 private int currentPhoto = -1; 55 56 56 57 // These are used by the auto-guess function to store the result, 57 58 // so when the dialig is re-opened the users modifications don't … … 68 69 Date time; 69 70 LatLon exifCoor; 70 LatLon coor; 71 EastNorth pos; 71 CachedLatLon pos; 72 72 /** Speed in kilometer per second */ 73 73 Double speed; … … 75 75 Double elevation; 76 76 77 public void setCoor(LatLon latlon) 78 { 79 pos = new CachedLatLon(latlon); 80 } 77 81 public int compareTo(ImageEntry image) { 78 82 if (time != null && image.time != null) { … … 362 366 public void visitBoundingBox(BoundingXYVisitor v) { 363 367 for (ImageEntry e : data) 364 v.visit(e.pos );368 v.visit(e.pos.getEastNorth()); 365 369 } 366 370 … … 411 415 // Store values 412 416 413 e.coor = new LatLon(lat, lon); 414 e.exifCoor = e.coor; 415 e.pos = Main.proj.latlon2eastNorth(e.coor); 417 e.setCoor(new LatLon(lat, lon)); 418 e.exifCoor = e.pos; 416 419 417 420 } catch (Exception p) { 418 e.coor = null;419 421 e.pos = null; 420 422 } -
applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/CorrelateGpxWithImages.java
r16290 r16294 765 765 // Reset previous position 766 766 for(ImageEntry x : autoImgs) { 767 x.coor = null;768 767 x.pos = null; 769 768 } … … 893 892 if (e.time != null) { 894 893 // Reset previous position 895 e.coor = null;896 894 e.pos = null; 897 895 dateImgLst.add(e); … … 908 906 } else { 909 907 for (ImageEntry e : yLayer.data) { 910 if (e.time != null && e. coor== null) {908 if (e.time != null && e.pos == null) { 911 909 dateImgLst.add(e); 912 910 } … … 999 997 while(i >= 0 && (dateImgLst.get(i).time.getTime()/1000) <= curDateWp 1000 998 && (dateImgLst.get(i).time.getTime()/1000) >= (curDateWp - interval)) { 1001 if(dateImgLst.get(i).coor == null) { 1002 dateImgLst.get(i).pos = curWp.eastNorth; 1003 dateImgLst.get(i).coor = Main.proj.eastNorth2latlon(dateImgLst.get(i).pos); 999 if(dateImgLst.get(i).pos == null) { 1000 dateImgLst.get(i).setCoor(curWp.getCoor()); 1004 1001 dateImgLst.get(i).speed = speed; 1005 1002 dateImgLst.get(i).elevation = curElevation; … … 1016 1013 while(i >= 0 && (imgDate = dateImgLst.get(i).time.getTime()/1000) >= prevDateWp) { 1017 1014 1018 if(dateImgLst.get(i). coor== null) {1015 if(dateImgLst.get(i).pos == null) { 1019 1016 // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless 1020 1017 // variable 1021 1018 double timeDiff = (double)(imgDate - prevDateWp) / interval; 1022 dateImgLst.get(i).pos = new EastNorth( 1023 interpolate(prevWp.eastNorth.east(), curWp.eastNorth.east(), timeDiff), 1024 interpolate(prevWp.eastNorth.north(), curWp.eastNorth.north(), timeDiff)); 1025 dateImgLst.get(i).coor = Main.proj.eastNorth2latlon(dateImgLst.get(i).pos); 1019 dateImgLst.get(i).setCoor(prevWp.getCoor().interpolate(curWp.getCoor(), timeDiff)); 1026 1020 dateImgLst.get(i).speed = speed; 1027 1021 1028 1022 if (curElevation != null && prevElevation != null) 1029 dateImgLst.get(i).elevation = interpolate(prevElevation, curElevation, timeDiff);1023 dateImgLst.get(i).elevation = prevElevation + (curElevation - prevElevation) * timeDiff; 1030 1024 1031 1025 ret++; … … 1034 1028 } 1035 1029 return ret; 1036 }1037 1038 private double interpolate(double val1, double val2, double time) {1039 return val1 + (val2 - val1) * time;1040 1030 } 1041 1031 … … 1168 1158 * Formula and earth radius from : http://en.wikipedia.org/wiki/Great-circle_distance */ 1169 1159 public double getDistance(WayPoint p1, WayPoint p2) { 1170 double p1Lat = p1. latlon.lat() * Math.PI / 180;1171 double p1Lon = p1. latlon.lon() * Math.PI / 180;1172 double p2Lat = p2. latlon.lat() * Math.PI / 180;1173 double p2Lon = p2. latlon.lon() * Math.PI / 180;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; 1174 1164 double ret = Math.atan2(Math.sqrt(Math.pow(Math.cos(p2Lat) * Math.sin(p2Lon - p1Lon), 2) 1175 1165 + Math.pow(Math.cos(p1Lat) * Math.sin(p2Lat)
Note:
See TracChangeset
for help on using the changeset viewer.