Changeset 31842 in osm
- Timestamp:
- 2015-12-17T16:48:19+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java
r31799 r31842 59 59 this.file = file; 60 60 try { 61 this.capturedAt = MapillaryUtils.getEpoch(datetimeOriginal, 62 "yyyy:MM:dd hh:mm:ss"); 61 this.capturedAt = MapillaryUtils.getEpoch(datetimeOriginal, "yyyy:MM:dd HH:mm:ss"); 63 62 } catch (ParseException e) { 64 63 try { 65 this.capturedAt = MapillaryUtils.getEpoch(datetimeOriginal, 66 "yyyy/MM/dd hh:mm:ss"); 64 this.capturedAt = MapillaryUtils.getEpoch(datetimeOriginal, "yyyy/MM/dd HH:mm:ss"); 67 65 } catch (ParseException e1) { 68 66 this.capturedAt = MapillaryUtils.currentTime(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java
r31840 r31842 129 129 if (mimg instanceof MapillaryImportedImage) 130 130 exifDirectory.add(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL, 131 ((MapillaryImportedImage) mimg).getDate("yyyy/MM/dd hh:mm:ss"));131 ((MapillaryImportedImage) mimg).getDate("yyyy/MM/dd HH:mm:ss")); 132 132 else if (mimg instanceof MapillaryImage) 133 133 exifDirectory.add(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL, 134 ((MapillaryImage) mimg).getDate("yyyy/MM/dd hh/mm/ss"));134 ((MapillaryImage) mimg).getDate("yyyy/MM/dd HH/mm/ss")); 135 135 outputSet.setGPSInDegrees(mimg.getLatLon().lon(), mimg.getLatLon().lat()); 136 136 OutputStream os = new BufferedOutputStream(new FileOutputStream(finalPath + ".jpg")); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
r31841 r31842 175 175 exifDirectory.removeField(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); 176 176 exifDirectory.add(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL, 177 ((MapillaryImportedImage) image).getDate("yyyy/MM/dd hh:mm:ss"));177 ((MapillaryImportedImage) image).getDate("yyyy/MM/dd HH:mm:ss")); 178 178 179 179 // Removes the ImageDescription tag, that causes problems in the upload. -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
r31838 r31842 74 74 75 75 /** 76 * Returns the current date. 76 * Returns the current date formatted as EXIF timestamp. 77 * As timezone the default timezone of the JVM is used ({@link java.util.TimeZone#getDefault()}). 77 78 * 78 79 * @return A {@code String} object containing the current date. 79 80 */ 80 81 public static String currentDate() { 81 Calendar cal = Calendar.getInstance(); 82 SimpleDateFormat formatter = new SimpleDateFormat("yyyy:MM:dd hh:mm:ss"); 83 return formatter.format(cal.getTime()); 84 } 85 86 /** 87 * Returns current time in Epoch format 82 return new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.UK).format(Calendar.getInstance().getTime()); 83 } 84 85 /** 86 * Returns current time in Epoch format (milliseconds since 1970-01-01T00:00:00+0000) 88 87 * 89 88 * @return The current date in Epoch format. 90 89 */ 91 90 public static long currentTime() { 92 Calendar cal = Calendar.getInstance(); 93 return cal.getTimeInMillis(); 91 return Calendar.getInstance().getTimeInMillis(); 92 } 93 94 /** 95 * Parses a string with a given format and returns the Epoch time. 96 * If no timezone information is given, the default timezone of the JVM is used 97 * ({@link java.util.TimeZone#getDefault()}). 98 * 99 * @param date The string containing the date. 100 * @param format The format of the date. 101 * @return The date in Epoch format. 102 * @throws ParseException 103 */ 104 public static long getEpoch(String date, String format) throws ParseException { 105 return new SimpleDateFormat(format, Locale.UK).parse(date).getTime(); 94 106 } 95 107 … … 149 161 } 150 162 151 result = 360 * ((result + 180) / 360 - Math.floor((result + 180) / 360)) 152 - 180; 163 result = 360 * ((result + 180) / 360 - Math.floor((result + 180) / 360)) - 180; 153 164 return result; 154 }155 156 /**157 * Parses a string with a given format and returns the Epoch time.158 *159 * @param date160 * The string containing the date.161 * @param format162 * The format of the date.163 * @return The date in Epoch format.164 * @throws ParseException165 */166 public static long getEpoch(String date, String format) throws ParseException {167 SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.UK);168 Date dateTime = formatter.parse(date);169 return dateTime.getTime();170 165 } 171 166
Note:
See TracChangeset
for help on using the changeset viewer.