Changeset 6450 in josm for trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
- Timestamp:
- 2013-12-07T13:51:13+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImages.java
r6392 r6450 1074 1074 List<ImageEntry> dateImgLst = new ArrayList<ImageEntry>(yLayer.data.size()); 1075 1075 for (ImageEntry e : yLayer.data) { 1076 if ( e.getExifTime() == null) {1076 if (!e.hasExifTime()) { 1077 1077 continue; 1078 1078 } … … 1159 1159 } 1160 1160 1161 private static Double getElevation(WayPoint wp) { 1162 String value = (String) wp.attr.get("ele"); 1163 if (value != null) { 1164 try { 1165 return new Double(value); 1166 } catch (NumberFormatException e) { 1167 Main.warn(e); 1168 } 1169 } 1170 return null; 1171 } 1172 1161 1173 private int matchPoints(List<ImageEntry> images, WayPoint prevWp, long prevWpTime, 1162 1174 WayPoint curWp, long curWpTime, long offset) { … … 1175 1187 Double speed = null; 1176 1188 Double prevElevation = null; 1177 Double curElevation = null;1178 1189 1179 1190 if (prevWp != null) { … … 1183 1194 speed = 3600 * distance / (curWpTime - prevWpTime); 1184 1195 } 1185 try { 1186 prevElevation = new Double((String) prevWp.attr.get("ele")); 1187 } catch(Exception e) {} 1188 } 1189 1190 try { 1191 curElevation = new Double((String) curWp.attr.get("ele")); 1192 } catch (Exception e) {} 1196 prevElevation = getElevation(prevWp); 1197 } 1198 1199 Double curElevation = getElevation(curWp); 1193 1200 1194 1201 // First trackpoint, then interval is set to five seconds, i.e. photos up to five seconds 1195 1202 // before the first point will be geotagged with the starting point 1196 if (prevWpTime == 0 || curWpTime <= prevWpTime) {1203 if (prevWpTime == 0 || curWpTime <= prevWpTime) { 1197 1204 while (true) { 1198 1205 if (i < 0) { … … 1200 1207 } 1201 1208 final ImageEntry curImg = images.get(i); 1202 if (curImg.getExifTime().getTime() > curWpTime1203 || curImg.getExifTime().getTime()< curWpTime - interval) {1209 long time = curImg.getExifTime().getTime(); 1210 if (time > curWpTime || time < curWpTime - interval) { 1204 1211 break; 1205 1212 } 1206 if (curImg.tmp.getPos() == null) {1213 if (curImg.tmp.getPos() == null) { 1207 1214 curImg.tmp.setPos(curWp.getCoor()); 1208 1215 curImg.tmp.setSpeed(speed); … … 1229 1236 } 1230 1237 1231 if(curImg.tmp.getPos() == null) { 1232 // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless 1233 // variable 1238 if (curImg.tmp.getPos() == null) { 1239 // The values of timeDiff are between 0 and 1, it is not seconds but a dimensionless variable 1234 1240 double timeDiff = (double)(imgTime - prevWpTime) / interval; 1235 1241 curImg.tmp.setPos(prevWp.getCoor().interpolate(curWp.getCoor(), timeDiff));
Note:
See TracChangeset
for help on using the changeset viewer.