- Timestamp:
- 2013-12-07T13:51:13+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/command/SequenceCommand.java
r6397 r6450 116 116 117 117 protected final void setSequence(Command[] sequence) { 118 this.sequence = sequence;118 this.sequence = Arrays.copyOf(sequence, sequence.length); 119 119 } 120 120 -
trunk/src/org/openstreetmap/josm/gui/io/BasicUploadSettingsPanel.java
r6424 r6450 162 162 * Updates the changeset comment model upon changes in the input field. 163 163 */ 164 class CommentModelListener extends FocusAdapter implements ActionListener {164 static class CommentModelListener extends FocusAdapter implements ActionListener { 165 165 166 166 final HistoryComboBox source; … … 186 186 * in sync with the current changeset comment 187 187 */ 188 class ChangesetCommentObserver implements Observer {188 static class ChangesetCommentObserver implements Observer { 189 189 190 190 private final HistoryComboBox destination; -
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)); -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/GeoImageLayer.java
r6392 r6450 26 26 import java.util.Collection; 27 27 import java.util.Collections; 28 import java.util.Date;29 28 import java.util.GregorianCalendar; 30 29 import java.util.HashSet; … … 154 153 try { 155 154 e.setExifTime(ExifReader.readTime(f)); 156 } catch (ParseException e 1) {155 } catch (ParseException ex) { 157 156 e.setExifTime(null); 158 157 } … … 636 635 } 637 636 else { 638 // No GPS date stamp in EXIF data. 637 // No GPS date stamp in EXIF data. Copy it from EXIF time. 639 638 // Date is not set if EXIF time is not available. 640 Date exifTime = e.getExifTime(); 641 if (exifTime != null) { 639 if (e.hasExifTime()) { 642 640 // Time not set yet, so we can copy everything, not just date. 643 cal.setTime(e xifTime);641 cal.setTime(e.getExifTime()); 644 642 } 645 643 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageEntry.java
r6392 r6450 41 41 42 42 /** 43 * When the corr alation dialog is open, we like to show the image position43 * When the correlation dialog is open, we like to show the image position 44 44 * for the current time offset on the map in real time. 45 45 * On the other hand, when the user aborts this operation, the old values … … 68 68 return elevation; 69 69 } 70 70 71 public Date getGpsTime() { 71 72 if (tmp != null) 72 return tmp.gpsTime; 73 return gpsTime; 73 return getDefensiveDate(tmp.gpsTime); 74 return getDefensiveDate(gpsTime); 75 } 76 77 /** 78 * Convenient way to determine if this entry has a GPS time, without the cost of building a defensive copy. 79 * @return {@code true} if this entry has a GPS time 80 * @since 6450 81 */ 82 public final boolean hasGpsTime() { 83 return (tmp != null && tmp.gpsTime != null) || gpsTime != null; 74 84 } 75 85 … … 84 94 } 85 95 public Date getExifTime() { 86 return exifTime; 96 return getDefensiveDate(exifTime); 97 } 98 99 /** 100 * Convenient way to determine if this entry has a EXIF time, without the cost of building a defensive copy. 101 * @return {@code true} if this entry has a EXIF time 102 * @since 6450 103 */ 104 public final boolean hasExifTime() { 105 return exifTime != null; 87 106 } 88 107 … … 93 112 */ 94 113 public final Date getExifGpsTime() { 95 return exifGpsTime; 114 return getDefensiveDate(exifGpsTime); 115 } 116 117 /** 118 * Convenient way to determine if this entry has a EXIF GPS time, without the cost of building a defensive copy. 119 * @return {@code true} if this entry has a EXIF GPS time 120 * @since 6450 121 */ 122 public final boolean hasExifGpsTime() { 123 return exifGpsTime != null; 124 } 125 126 private static Date getDefensiveDate(Date date) { 127 if (date == null) 128 return null; 129 return new Date(date.getTime()); 96 130 } 97 131 … … 129 163 } 130 164 public void setExifTime(Date exifTime) { 131 this.exifTime = exifTime;165 this.exifTime = getDefensiveDate(exifTime); 132 166 } 133 167 … … 138 172 */ 139 173 public final void setExifGpsTime(Date exifGpsTime) { 140 this.exifGpsTime = exifGpsTime;174 this.exifGpsTime = getDefensiveDate(exifGpsTime); 141 175 } 142 176 143 177 public void setGpsTime(Date gpsTime) { 144 this.gpsTime = g psTime;178 this.gpsTime = getDefensiveDate(gpsTime); 145 179 } 146 180 public void setExifCoor(LatLon exifCoor) { … … 228 262 // This can be removed once isNewGpsData is used instead of the GPS time. 229 263 if (gpsTime == null) { 230 Date gpsTime = getExifGpsTime();231 if ( gpsTime == null) {232 gpsTime = getExifTime();233 if ( gpsTime == null) {264 Date time = getExifGpsTime(); 265 if (time == null) { 266 time = getExifTime(); 267 if (time == null) { 234 268 // Time still not set, take the current time. 235 gpsTime = new Date();269 time = new Date(); 236 270 } 237 271 } 238 setGpsTime(gpsTime);239 } 240 if (tmp != null && tmp.getGpsTime() == null) {272 gpsTime = time; 273 } 274 if (tmp != null && !tmp.hasGpsTime()) { 241 275 // tmp.gpsTime overrides gpsTime, so we set it too. 242 tmp. setGpsTime(getGpsTime());276 tmp.gpsTime = gpsTime; 243 277 } 244 278 } -
trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageViewerDialog.java
r6392 r6450 247 247 } 248 248 DateFormat dtf = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); 249 if (entry. getExifTime() != null) {249 if (entry.hasExifTime()) { 250 250 osd.append(tr("\nEXIF time: {0}", dtf.format(entry.getExifTime()))); 251 251 } 252 if (entry. getGpsTime() != null) {252 if (entry.hasGpsTime()) { 253 253 osd.append(tr("\nGPS time: {0}", dtf.format(entry.getGpsTime()))); 254 254 } -
trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionExporter.java
r6392 r6450 93 93 addAttr("elevation", entry.getElevation().toString(), imgElem, support); 94 94 } 95 if (entry. getGpsTime() != null) {95 if (entry.hasGpsTime()) { 96 96 addAttr("gps-time", Long.toString(entry.getGpsTime().getTime()), imgElem, support); 97 97 } … … 99 99 addAttr("exif-orientation", Integer.toString(entry.getExifOrientation()), imgElem, support); 100 100 } 101 if (entry. getExifTime() != null) {101 if (entry.hasExifTime()) { 102 102 addAttr("exif-time", Long.toString(entry.getExifTime().getTime()), imgElem, support); 103 103 } 104 if (entry. getExifGpsTime() != null) {104 if (entry.hasExifGpsTime()) { 105 105 addAttr("exif-gps-time", Long.toString(entry.getExifGpsTime().getTime()), imgElem, support); 106 106 } -
trunk/src/org/openstreetmap/josm/io/session/GeoImageSessionImporter.java
r6392 r6450 69 69 } else if (attrElem.getTagName().equals("exif-image-direction")) { 70 70 entry.setExifImgDir(Double.parseDouble(attrElem.getTextContent())); 71 } else if (attrElem.getTagName().equals("is-new-gps-data")) { 72 if (Boolean.parseBoolean(attrElem.getTextContent())) { 73 entry.flagNewGpsData(); 74 } 71 } else if (attrElem.getTagName().equals("is-new-gps-data") && Boolean.parseBoolean(attrElem.getTextContent())) { 72 entry.flagNewGpsData(); 75 73 } 76 74 // TODO: handle thumbnail loading
Note:
See TracChangeset
for help on using the changeset viewer.