package osm.jp.gpx;\r
\r
import java.io.*;\r
-import java.math.BigDecimal;\r
-import java.math.RoundingMode;\r
import java.nio.channels.FileChannel;\r
import java.text.DateFormat;\r
import java.text.DecimalFormat;\r
\r
public static final String TIME_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss'Z'";\r
private static final String EXIF_DATE_TIME_FORMAT_STRING = "yyyy:MM:dd HH:mm:ss";\r
- //public static final SimpleDateFormat DATE_PARSE = new SimpleDateFormat(TIME_FORMAT_STRING +" Z");\r
- //public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat(TIME_FORMAT_STRING);\r
- //public static final SimpleDateFormat EXIF_DATE_TIME_PARSE = new SimpleDateFormat(EXIF_DATE_TIME_FORMAT_STRING + " Z");\r
- //public static final SimpleDateFormat EXIF_DATE_TIME_FORMAT = new SimpleDateFormat(EXIF_DATE_TIME_FORMAT_STRING);\r
\r
@Override\r
public void run() {\r
//---- EXIF GPS_ ----\r
longitude = Math.abs(longitude);\r
latitude = Math.abs(latitude);\r
-\r
- /*\r
- final String longitudeRef = (longitude < 0 ? "W" : "E");\r
- final String latitudeRef = (latitude < 0 ? "S" : "N");\r
- gpsDir.removeField(GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF);\r
- gpsDir.add(GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF, longitudeRef);\r
- gpsDir.removeField(GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF);\r
- gpsDir.add(GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF, latitudeRef);\r
- {\r
- BigDecimal value = BigDecimal.valueOf(longitude);\r
- \r
- final double longitudeDegrees = (value.setScale(0, RoundingMode.DOWN)).doubleValue();\r
- value = value.subtract(BigDecimal.valueOf(longitudeDegrees));\r
- value = value.multiply(BigDecimal.valueOf(60));\r
- final double longitudeMinutes = (value.setScale(0, RoundingMode.DOWN)).doubleValue();\r
- value = value.subtract(BigDecimal.valueOf(longitudeMinutes));\r
- value = value.multiply(BigDecimal.valueOf(60));\r
- final double longitudeSeconds = (value.setScale(3, BigDecimal.ROUND_HALF_UP)).doubleValue();\r
- gpsDir.removeField(GpsTagConstants.GPS_TAG_GPS_LONGITUDE);\r
- gpsDir.add(GpsTagConstants.GPS_TAG_GPS_LONGITUDE,\r
- RationalNumber.valueOf(longitudeDegrees),\r
- RationalNumber.valueOf(longitudeMinutes),\r
- RationalNumber.valueOf(longitudeSeconds));\r
- }\r
- {\r
- BigDecimal value = BigDecimal.valueOf(latitude);\r
- final double latitudeDegrees = (value.setScale(0, RoundingMode.DOWN)).doubleValue();\r
- value = value.subtract(BigDecimal.valueOf(latitudeDegrees));\r
- value = value.multiply(BigDecimal.valueOf(60));\r
- final double latitudeMinutes = (value.setScale(0, RoundingMode.DOWN)).doubleValue();\r
- value = value.subtract(BigDecimal.valueOf(latitudeMinutes));\r
- value = value.multiply(BigDecimal.valueOf(60));\r
- final double latitudeSeconds = (value.setScale(3, BigDecimal.ROUND_HALF_UP)).doubleValue();\r
- gpsDir.removeField(GpsTagConstants.GPS_TAG_GPS_LATITUDE);\r
- gpsDir.add(GpsTagConstants.GPS_TAG_GPS_LATITUDE,\r
- RationalNumber.valueOf(latitudeDegrees),\r
- RationalNumber.valueOf(latitudeMinutes),\r
- RationalNumber.valueOf(latitudeSeconds));\r
- }\r
- */\r
outputSet.setGPSInDegrees(longitude, latitude);\r
}\r
\r
*/\r
public static String toEXIFString(Date localdate) {\r
DateFormat dfUTC = new SimpleDateFormat(EXIF_DATE_TIME_FORMAT_STRING);\r
- //dfUTC.setTimeZone(TimeZone.getTimeZone("UTC"));\r
return dfUTC.format(localdate);\r
}\r
\r