javac.source=1.8
junit.selected.version=4
debug.classpath=${run.classpath}
-run.jvmargs=
+run.jvmargs=-Duser.language=en\n-Duser.country=US
build.generated.dir=${build.dir}/generated
jar.compress=false
javac.test.classpath=\
--- /dev/null
+dialog.quit=Quit
+dialog.cancel=Cancel
+dialog.msg1=Quit this program.
+dialog.select=Selection
+
+menu.quit=Quit?
+button.next=Next
+button.previous=Previous
+button.execute=Execute
+button.select=Selection...
+
+label.100=<html><p>1. Select image source folder.</p><ul><li>If you perform a copy operation, the file update time may be rewritten to the time the copy was executed. It is recommended to directly specify the folder in the camera SD card.</li></ul>
+label.110=Image Folder
+
+label.200=<html><p>2. Choose an image whose exact shooting time can be known.</p><ul><li>If the camera's clock is accurate, you can choose any image.</li></ul>
+label.210=Reference time image
+label.220=Based on EXIF date and time
+label.230=Based on FILE UPDATE time
+
+label.300=<html><p>3. enter the correct shooting time.</p><ul><li>If the camera clock is accurate, you do not need to change the setting.</li></ul>
+label.310=Reference time
+
+label.400=<html><p>4. Please select a GPX file to perform the matching.</p><ul><li>If you specify a folder, it will target all GPX files in the folder.</li></ul>
+label.410=GPX folder
+label.420=Ignore the first node of segment 'trkseg'
+label.430=Also make the generated GPX file (the one whose filename ends with '_.gpx') as the target of conversion
+
+label.500=Select whether to perform EXIF conversion
+label.501=When performing EXIF conversion, you also need to specify the folder to output the converted file.
+label.502=The output folder must have write permission and sufficient free space.
+label.510=Convert IMG
+label.520=Copy files outside the GPX file time
+label.530=Output folder
+label.540=Convert EXIF
+label.550=Output point marker <WPT> to GPX file
+label.560=Ignoring <MAGVAR> of source GPX
+label.570=Overwrite <SPEED> in output GPX
+
+msg.100=GPX file or directory does not exist.('%s')
+msg.110=The target GPX file can not be found.('%s')
+msg.120=When there are multiple GPX files, 'IMG.OUTPUT_ALL' option can not be specified.
+msg.130=Format of '%s' is wrong.(%s)
+msg.140=Not exists EXIF data in '%s'.
+
+msg.200=[error] Not exists <imgDir>.
+msg.210=[error] <imgDir> is not Folder.
+msg.220=[error] Not exists <baseFile1>.
+msg.230=[error] <baseFile1> is not a file.
+msg.240=[error] Not exists <baseFile2>.
+msg.250=[error] <baseFile2> is not a file.
--- /dev/null
+dialog.quit=\u7d42\u4e86
+dialog.cancel=\u30ad\u30e3\u30f3\u30bb\u30eb
+dialog.msg1=\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d42\u4e86\u3057\u307e\u3059\u3002
+dialog.select=\u9078\u629e
+
+menu.quit=\u7d42\u4e86...
+button.next=\u6b21\u3078
+button.previous=\u623b\u308b
+button.execute=\u51e6\u7406\u5b9f\u884c
+button.select=\u9078\u629e...
+
+label.100=<html><p>1. \u4f4d\u7f6e\u60c5\u5831\u3092\u4ed8\u52a0\u3057\u305f\u3044\u753b\u50cf\u30d5\u30a1\u30a4\u30eb\u304c\u683c\u7d0d\u3055\u308c\u3066\u3044\u308b\u30d5\u30a9\u30eb\u30c0\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002</p><ul><li>\u30b3\u30d4\u30fc\u52d5\u4f5c\u3092\u884c\u3046\u3068\u3001\u30d5\u30a1\u30a4\u30eb\u66f4\u65b0\u6642\u523b\u304c\u30b3\u30d4\u30fc\u3092\u5b9f\u884c\u3057\u305f\u6642\u523b\u306b\u66f8\u304d\u63db\u308f\u3063\u3066\u3057\u307e\u3046\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u30ab\u30e1\u30e9SD\u30ab\u30fc\u30c9\u5185\u306e\u30d5\u30a9\u30eb\u30c0\u3092\u76f4\u63a5\u6307\u5b9a\u3059\u308b\u3053\u3068\u3092\u304a\u3059\u3059\u3081\u3057\u307e\u3059\u3002</li></ul>
+label.110=\u5bfe\u8c61\u30d5\u30a9\u30eb\u30c0
+
+label.200=<html><p>2. \u6b63\u78ba\u306a\u64ae\u5f71\u6642\u523b\u304c\u5224\u660e\u3067\u304d\u308b\u753b\u50cf\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044\u3002</p><ul><li>\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306e\u6642\u8a08\u753b\u9762\uff08\u79d2\u304c\u5224\u5225\u3067\u304d\u308b\u3053\u3068\uff09\u3092\u64ae\u5f71\u3057\u305f\u753b\u50cf</li><li>\u30ab\u30e1\u30e9\u306e\u6642\u8a08\u304c\u6b63\u78ba\u306a\u3089\u3070\u3001\u3069\u306e\u753b\u50cf\u3092\u9078\u3093\u3067\u3082\u69cb\u3044\u307e\u305b\u3093\u3002</li></ul>
+label.210=\u57fa\u6e96\u6642\u523b\u753b\u50cf
+label.220=EXIF\u306e\u65e5\u6642\u3092\u57fa\u6e96\u306b\u3059\u308b
+label.230=\u30d5\u30a1\u30a4\u30eb\u66f4\u65b0\u65e5\u6642\u3092\u57fa\u6e96\u306b\u3059\u308b
+
+label.300=<html><p>3. \u6b63\u78ba\u306a\u64ae\u5f71\u6642\u523b\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002</p><ul><li>\u30ab\u30e1\u30e9\u306e\u6642\u8a08\u304c\u6b63\u78ba\u306a\u3089\u3070\u3001\u8a2d\u5b9a\u3092\u5909\u66f4\u3059\u308b\u5fc5\u8981\u306f\u3042\u308a\u307e\u305b\u3093\u3002</li></ul>
+label.310=\u57fa\u6e96\u6642\u523b
+
+label.400=<html><p>4. \u30d2\u30e2\u4ed8\u3092\u884c\u3046GPX\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044\u3002</p><ul><li>\u30d5\u30a9\u30eb\u30c0\u3092\u6307\u5b9a\u3059\u308b\u3068\u3001\u30d5\u30a9\u30eb\u30c0\u5185\u306b\u3042\u308b\u3059\u3079\u3066\u306eGPX\u30d5\u30a1\u30a4\u30eb\u3092\u5bfe\u8c61\u3068\u3057\u307e\u3059\u3002</li></ul>
+label.410=GPX\u30d5\u30a9\u30eb\u30c0
+label.420=\u30bb\u30b0\u30e1\u30f3\u30c8'trkseg'\u306e\u6700\u521d\u306e\uff11\u30ce\u30fc\u30c9\u306f\u7121\u8996\u3059\u308b
+label.430=\u751f\u6210\u3055\u308c\u305fGPX\u30d5\u30a1\u30a4\u30eb\uff08\u30d5\u30a1\u30a4\u30eb\u540d\u304c'_.gpx'\u3067\u7d42\u308f\u308b\u3082\u306e\uff09\u3082\u5909\u63db\u306e\u5bfe\u8c61\u306b\u3059\u308b
+
+label.500=EXIF\u5909\u63db\u3092\u884c\u3046\u304b\u3069\u3046\u304b\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044
+label.501=EXIF\u5909\u63db\u3092\u884c\u3046\u5834\u5408\u306b\u306f\u3001\u5909\u63db\u30d5\u30a1\u30a4\u30eb\u3092\u51fa\u529b\u3059\u308b\u30d5\u30a9\u30eb\u30c0\u3082\u6307\u5b9a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
+label.502=\u51fa\u529b\u30d5\u30a9\u30eb\u30c0\u306b\u306f\u3001\u66f8\u304d\u8fbc\u307f\u6a29\u9650\u3068\u3001\u5341\u5206\u306a\u7a7a\u304d\u5bb9\u91cf\u304c\u5fc5\u8981\u3067\u3059\u3002
+label.510=IMG\u306e\u5909\u63db\u3092\u3059\u308b
+label.520=GPX\u30d5\u30a1\u30a4\u30eb\u6642\u9593\u5916\u306e\u30d5\u30a1\u30a4\u30eb\u3082\u30b3\u30d4\u30fc\u3059\u308b
+label.530=\u51fa\u529b\u30d5\u30a9\u30eb\u30c0
+label.540=EXIF\u306e\u5909\u63db\u3092\u3059\u308b
+label.550=\u30dd\u30a4\u30f3\u30c8\u30de\u30fc\u30ab\u30fc<WPT>\u3092GPX\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3059\u308b
+label.560=\u30bd\u30fc\u30b9GPX\u306e<MAGVAR>\u3092\u7121\u8996\u3059\u308b
+label.570=\u51fa\u529bGPX\u306b<SPEED>\u3092\u4e0a\u66f8\u304d\u3059\u308b
+
+msg.100=GPX\u30d5\u30a1\u30a4\u30eb\u307e\u305f\u306f\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u5b58\u5728\u3057\u307e\u305b\u3093\u3002('%s')
+msg.110=\u5bfe\u8c61\u3068\u306a\u308bGPX\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093('%s')
+msg.120=\u8907\u6570\u306eGPX\u30d5\u30a1\u30a4\u30eb\u304c\u3042\u308b\u3068\u304d\u306b\u306f\u3001'IMG.OUTPUT_ALL'\u30aa\u30d7\u30b7\u30e7\u30f3\u306f\u6307\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002
+msg.130='%s'\u306e\u66f8\u5f0f\u304c\u9055\u3044\u307e\u3059(%s)
+msg.140='%s'\u306bEXIF\u60c5\u5831\u304c\u3042\u308a\u307e\u305b\u3093
+
+msg.200=[error] <imgDir>\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
+msg.210=[error] <imgDir>\u304c\u30d5\u30a9\u30eb\u30c0\u3058\u3083\u306a\u3044
+msg.220=[error] <baseFile1>\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
+msg.230=[error] <baseFile1>\u304c\u30d5\u30a1\u30a4\u30eb\u3058\u3083\u306a\u3044
+msg.240=[error] <baseFile1>\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
+msg.250=[error] <baseFile1>\u304c\u30d5\u30a1\u30a4\u30eb\u3058\u3083\u306a\u3044
@SuppressWarnings("serial")
public class AppParameters extends Properties {
- static final String FILE_PATH = "AdjustTime.ini";
-
- // GPX: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
- public static String GPX_GPXSPLIT = "GPX.gpxSplit";
-
- // GPX: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
- public static String GPX_NO_FIRST_NODE = "GPX.noFirstNode";
-
- // GPX: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
- public static String GPX_REUSE = "GPX.REUSE";
-
- // GPX: 基準時刻 {FILE_UPDATE | EXIF_TIME}
- public static String GPX_BASETIME = "GPX.BASETIME";
-
- // GPX: ファイル更新時刻 yyyy:MM:dd HH:mm:ss
- public static String IMG_TIME = "IMG.TIME";
-
- // 対象IMGフォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
- public static String IMG_SOURCE_FOLDER = "IMG.SOURCE_FOLDER";
-
- // 基準時刻画像(正確な撮影時刻が判明できる画像)
- public static String IMG_BASE_FILE = "IMG.BASE_FILE";
-
- // 対象GPXフォルダ:(GPXファイルが格納されているフォルダ)
- public static String GPX_SOURCE_FOLDER = "GPX.SOURCE_FOLDER";
-
- // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
- public static String IMG_OUTPUT_FOLDER = "IMG.OUTPUT_FOLDER";
-
- // 出力IMG: IMG出力をする {ON | OFF}
- public static String IMG_OUTPUT = "IMG.OUTPUT";
-
- // 出力IMG: 'out of time'も IMG出力の対象とする {ON | OFF}
- // この場合は、対象IMGフォルダ内のすべてのIMGファイルが出力フォルダに出力される
- public static String IMG_OUTPUT_ALL = "IMG.OUTPUT_ALL";
-
- // 出力IMG: EXIFを変換する
- public static String IMG_OUTPUT_EXIF = "IMG.OUTPUT_EXIF";
-
- // 出力GPX: <SPEED>を上書き出力する {ON | OFF}
- public static String GPX_OUTPUT_SPEED = "GPX.OUTPUT_SPEED";
-
- // 出力GPX: ソースGPXの<MAGVER>を無視する {ON | OFF}
- public static String GPX_OVERWRITE_MAGVAR = "GPX.OVERWRITE_MAGVAR";
-
- // 出力GPX: マーカー<wpt>を出力する {ON | OFF}
- public static String GPX_OUTPUT_WPT = "GPX.OUTPUT_WPT";
-
- File file;
-
- public AppParameters() throws FileNotFoundException, IOException {
- super();
- this.file = new File(FILE_PATH);
- syncFile();
- }
-
- public AppParameters(Properties defaults) throws FileNotFoundException, IOException {
- super(defaults);
- this.file = new File(FILE_PATH);
- syncFile();
- }
-
- public AppParameters(String iniFileName) throws FileNotFoundException, IOException {
- super();
- this.file = new File(iniFileName);
- syncFile();
- }
-
- void syncFile() throws FileNotFoundException, IOException {
- boolean update = false;
-
- if (this.file.exists()) {
- // ファイルが存在すれば、その内容をロードする。
- this.load(new FileInputStream(file));
- }
- else {
- update = true;
- }
-
- //------------------------------------------------
- // 対象フォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
- String valueStr = this.getProperty(IMG_SOURCE_FOLDER);
- if (valueStr == null) {
- update = true;
- this.setProperty(IMG_SOURCE_FOLDER, (new File(".")).getAbsolutePath());
- }
-
- //------------------------------------------------
- // 対象フォルダ:(GPXファイルが格納されているフォルダ)
- valueStr = this.getProperty(GPX_SOURCE_FOLDER);
- if (valueStr == null) {
- update = true;
- this.setProperty(GPX_SOURCE_FOLDER, (new File(".")).getAbsolutePath());
- }
-
- //------------------------------------------------
- // 基準時刻画像(正確な撮影時刻が判明できる画像)
- valueStr = this.getProperty(IMG_BASE_FILE);
- if (valueStr == null) {
- update = true;
- this.setProperty(IMG_BASE_FILE, "");
- }
-
- //------------------------------------------------
- // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
- valueStr = this.getProperty(IMG_OUTPUT_FOLDER);
- if (valueStr == null) {
- update = true;
- this.setProperty(IMG_OUTPUT_FOLDER, (new File(".")).getAbsolutePath());
- }
-
- //------------------------------------------------
- // IMG出力: IMGを出力する
- valueStr = this.getProperty(IMG_OUTPUT);
- if (valueStr == null) {
- update = true;
- valueStr = String.valueOf(true);
- }
- this.setProperty(IMG_OUTPUT, String.valueOf(valueStr));
-
- //------------------------------------------------
- // 出力IMG: 'out of time'も IMG出力の対象とする
- valueStr = this.getProperty(IMG_OUTPUT_ALL);
- if (valueStr == null) {
- update = true;
- valueStr = String.valueOf(false);
- }
- this.setProperty(IMG_OUTPUT_ALL, String.valueOf(valueStr));
-
- //------------------------------------------------
- // IMG出力: EXIFを変換する
- valueStr = this.getProperty(IMG_OUTPUT_EXIF);
- if (valueStr == null) {
- update = true;
- valueStr = String.valueOf(true);
- }
- this.setProperty(IMG_OUTPUT_EXIF, String.valueOf(valueStr));
-
- //------------------------------------------------
- // GPX出力: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
- valueStr = this.getProperty(GPX_GPXSPLIT);
- if (valueStr == null) {
- update = true;
- this.setProperty(GPX_GPXSPLIT, String.valueOf(true));
- }
-
- //------------------------------------------------
- // GPX出力: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
- valueStr = this.getProperty(GPX_NO_FIRST_NODE);
- if (valueStr == null) {
- update = true;
- this.setProperty(GPX_NO_FIRST_NODE, String.valueOf(true));
- }
-
- //------------------------------------------------
- // GPX出力: ポイントマーカー<WPT>を出力する {ON | OFF}
- valueStr = this.getProperty(GPX_OUTPUT_WPT);
- if (valueStr == null) {
- update = true;
- this.setProperty(GPX_OUTPUT_WPT, String.valueOf(false));
- }
-
- //------------------------------------------------
- // GPX出力: ソースGPXの<MAGVAR>を無視する {ON | OFF}
- valueStr = this.getProperty(GPX_OVERWRITE_MAGVAR);
- if (valueStr == null) {
- update = true;
- this.setProperty(GPX_OVERWRITE_MAGVAR, String.valueOf(false));
- }
-
- //------------------------------------------------
- // GPX出力: <SPEED>を上書き出力する {ON | OFF}
- valueStr = this.getProperty(GPX_OUTPUT_SPEED);
- if (valueStr == null) {
- update = true;
- this.setProperty(GPX_OUTPUT_SPEED, String.valueOf(false));
- }
-
- //------------------------------------------------
- // GPX出力: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
- valueStr = this.getProperty(GPX_REUSE);
- if (valueStr == null) {
- update = true;
- this.setProperty(GPX_REUSE, String.valueOf(false));
- }
-
- //------------------------------------------------
- // GPX: 基準時刻 {FILE_UPDATE | EXIF}
- valueStr = this.getProperty(GPX_BASETIME);
- if (valueStr == null) {
- update = true;
- this.setProperty(GPX_BASETIME, "FILE_UPDATE");
- }
-
- if (update) {
- // ・ファイルがなければ新たに作る
- // ・項目が足りない時は書き足す。
- this.store(new FileOutputStream(this.file), "defuilt settings");
- }
- }
-
- public void store() throws FileNotFoundException, IOException {
- this.store(new FileOutputStream(this.file), "by AdjustTime");
- }
+ static final String FILE_PATH = "AdjustTime.ini";
+
+ // GPX: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
+ public static String GPX_GPXSPLIT = "GPX.gpxSplit";
+
+ // GPX: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
+ public static String GPX_NO_FIRST_NODE = "GPX.noFirstNode";
+
+ // GPX: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
+ public static String GPX_REUSE = "GPX.REUSE";
+
+ // GPX: 基準時刻 {FILE_UPDATE | EXIF_TIME}
+ public static String GPX_BASETIME = "GPX.BASETIME";
+
+ // GPX: ファイル更新時刻 yyyy:MM:dd HH:mm:ss
+ public static String IMG_TIME = "IMG.TIME";
+
+ // 対象IMGフォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
+ public static String IMG_SOURCE_FOLDER = "IMG.SOURCE_FOLDER";
+
+ // 基準時刻画像(正確な撮影時刻が判明できる画像)
+ public static String IMG_BASE_FILE = "IMG.BASE_FILE";
+
+ // 対象GPXフォルダ:(GPXファイルが格納されているフォルダ)
+ public static String GPX_SOURCE_FOLDER = "GPX.SOURCE_FOLDER";
+
+ // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
+ public static String IMG_OUTPUT_FOLDER = "IMG.OUTPUT_FOLDER";
+
+ // 出力IMG: IMG出力をする {ON | OFF}
+ public static String IMG_OUTPUT = "IMG.OUTPUT";
+
+ // 出力IMG: 'out of time'も IMG出力の対象とする {ON | OFF}
+ // この場合は、対象IMGフォルダ内のすべてのIMGファイルが出力フォルダに出力される
+ public static String IMG_OUTPUT_ALL = "IMG.OUTPUT_ALL";
+
+ // 出力IMG: EXIFを変換する
+ public static String IMG_OUTPUT_EXIF = "IMG.OUTPUT_EXIF";
+
+ // 出力GPX: <SPEED>を上書き出力する {ON | OFF}
+ public static String GPX_OUTPUT_SPEED = "GPX.OUTPUT_SPEED";
+
+ // 出力GPX: ソースGPXの<MAGVER>を無視する {ON | OFF}
+ public static String GPX_OVERWRITE_MAGVAR = "GPX.OVERWRITE_MAGVAR";
+
+ // 出力GPX: マーカー<wpt>を出力する {ON | OFF}
+ public static String GPX_OUTPUT_WPT = "GPX.OUTPUT_WPT";
+
+ File file;
+
+ public AppParameters() throws FileNotFoundException, IOException {
+ super();
+ this.file = new File(FILE_PATH);
+ syncFile();
+ }
+
+ public AppParameters(Properties defaults) throws FileNotFoundException, IOException {
+ super(defaults);
+ this.file = new File(FILE_PATH);
+ syncFile();
+ }
+
+ public AppParameters(String iniFileName) throws FileNotFoundException, IOException {
+ super();
+ this.file = new File(iniFileName);
+ syncFile();
+ }
+
+ private void syncFile() throws FileNotFoundException, IOException {
+ boolean update = false;
+
+ if (this.file.exists()) {
+ // ファイルが存在すれば、その内容をロードする。
+ this.load(new FileInputStream(file));
+ }
+ else {
+ update = true;
+ }
+
+ //------------------------------------------------
+ // 対象フォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
+ String valueStr = this.getProperty(IMG_SOURCE_FOLDER);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(IMG_SOURCE_FOLDER, (new File(".")).getAbsolutePath());
+ }
+
+ //------------------------------------------------
+ // 対象フォルダ:(GPXファイルが格納されているフォルダ)
+ valueStr = this.getProperty(GPX_SOURCE_FOLDER);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(GPX_SOURCE_FOLDER, (new File(".")).getAbsolutePath());
+ }
+
+ //------------------------------------------------
+ // 基準時刻画像(正確な撮影時刻が判明できる画像)
+ valueStr = this.getProperty(IMG_BASE_FILE);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(IMG_BASE_FILE, "");
+ }
+
+ //------------------------------------------------
+ // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
+ valueStr = this.getProperty(IMG_OUTPUT_FOLDER);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(IMG_OUTPUT_FOLDER, (new File(".")).getAbsolutePath());
+ }
+
+ //------------------------------------------------
+ // IMG出力: IMGを出力する
+ valueStr = this.getProperty(IMG_OUTPUT);
+ if (valueStr == null) {
+ update = true;
+ valueStr = String.valueOf(true);
+ }
+ this.setProperty(IMG_OUTPUT, String.valueOf(valueStr));
+
+ //------------------------------------------------
+ // 出力IMG: 'out of time'も IMG出力の対象とする
+ valueStr = this.getProperty(IMG_OUTPUT_ALL);
+ if (valueStr == null) {
+ update = true;
+ valueStr = String.valueOf(false);
+ }
+ this.setProperty(IMG_OUTPUT_ALL, String.valueOf(valueStr));
+
+ //------------------------------------------------
+ // IMG出力: EXIFを変換する
+ valueStr = this.getProperty(IMG_OUTPUT_EXIF);
+ if (valueStr == null) {
+ update = true;
+ valueStr = String.valueOf(true);
+ }
+ this.setProperty(IMG_OUTPUT_EXIF, String.valueOf(valueStr));
+
+ //------------------------------------------------
+ // GPX出力: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
+ valueStr = this.getProperty(GPX_GPXSPLIT);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(GPX_GPXSPLIT, String.valueOf(true));
+ }
+
+ //------------------------------------------------
+ // GPX出力: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
+ valueStr = this.getProperty(GPX_NO_FIRST_NODE);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(GPX_NO_FIRST_NODE, String.valueOf(true));
+ }
+
+ //------------------------------------------------
+ // GPX出力: ポイントマーカー<WPT>を出力する {ON | OFF}
+ valueStr = this.getProperty(GPX_OUTPUT_WPT);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(GPX_OUTPUT_WPT, String.valueOf(false));
+ }
+
+ //------------------------------------------------
+ // GPX出力: ソースGPXの<MAGVAR>を無視する {ON | OFF}
+ valueStr = this.getProperty(GPX_OVERWRITE_MAGVAR);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(GPX_OVERWRITE_MAGVAR, String.valueOf(false));
+ }
+
+ //------------------------------------------------
+ // GPX出力: <SPEED>を上書き出力する {ON | OFF}
+ valueStr = this.getProperty(GPX_OUTPUT_SPEED);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(GPX_OUTPUT_SPEED, String.valueOf(false));
+ }
+
+ //------------------------------------------------
+ // GPX出力: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
+ valueStr = this.getProperty(GPX_REUSE);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(GPX_REUSE, String.valueOf(false));
+ }
+
+ //------------------------------------------------
+ // GPX: 基準時刻 {FILE_UPDATE | EXIF}
+ valueStr = this.getProperty(GPX_BASETIME);
+ if (valueStr == null) {
+ update = true;
+ this.setProperty(GPX_BASETIME, "FILE_UPDATE");
+ }
+
+ if (update) {
+ // ・ファイルがなければ新たに作る
+ // ・項目が足りない時は書き足す。
+ this.store(new FileOutputStream(this.file), "defuilt settings");
+ }
+ }
+
+ public void store() throws FileNotFoundException, IOException {
+ this.store(new FileOutputStream(this.file), "by AdjustTime");
+ }
}
public static boolean param_GpxOverwriteMagvar = false;
/**
- *
+ * @param imaE
+ * @param maeE
+ * @code{
* <trkpt lat="34.976635" lon="138.466228">
* <ele>267.291</ele>
* <magvar>359</magvar>
* <speed></speed>
* <time>2016-07-02T08:25:18Z</time>
* </trkpt>
- *
- * @param trkseg
- * @param map
+ * }
+ *
+ *
* @throws ParseException
*/
- public Complementation(TagTrkpt imaE, TagTrkpt maeE) throws ParseException {
- this.imaTag = new TagTrkpt(imaE.trkpt);
+ public Complementation(TagTrkpt imaE, TagTrkpt maeE) throws ParseException {
+ this.imaTag = new TagTrkpt(imaE.trkpt);
if (maeE != null) {
this.maeTag = new TagTrkpt(maeE.trkpt);
}
- }
+ }
/**
* 緯度・経度と時間差から速度(km/h)を求める
*/
public void complementationSpeed() {
if (imaTag.speedStr != null) {
- try {
+ try {
Double.parseDouble(imaTag.speedStr);
- }
- catch (NumberFormatException e) {
- // 数字以外なら<speed>エレメントを削除する
- imaTag.removeElement("speed");
- imaTag.speedStr = null;
- }
+ }
+ catch (NumberFormatException e) {
+ // 数字以外なら<speed>エレメントを削除する
+ imaTag.removeElement("speed");
+ imaTag.speedStr = null;
+ }
}
if (imaTag.speedStr == null) {
- double d = GeoDistance.calcDistHubeny(imaTag.lat, imaTag.lon, maeTag.lat, maeTag.lon);
+ double d = GeoDistance.calcDistHubeny(imaTag.lat, imaTag.lon, maeTag.lat, maeTag.lon);
String str = Double.toString((d * 3600) / (imaTag.time.getTime() - maeTag.time.getTime()));
int iDot = str.indexOf('.');
if (iDot > 0) {
str = str.substring(0, iDot+2);
}
imaTag.appendElement("speed", str);
- imaTag.speedStr = new String(str);
+ imaTag.speedStr = str;
}
}
/**
* 経度(longitude)と経度から進行方向を求める
- * @param imaE
- * @param imaLON
- * @param imaLAT
- * @param imaTIME
- * @param maeLON
- * @param maeLAT
- * @param maeTIME
* @throws ParseException
*/
public void complementationMagvar() throws ParseException {
if (imaTag.magvarStr != null) {
- try {
+ try {
Double.parseDouble(imaTag.magvarStr);
- }
- catch (NumberFormatException e) {
- // 数字以外なら<magvar>エレメントを削除する
- imaTag.removeElement("magvar");
- imaTag.magvarStr = null;
- }
+ }
+ catch (NumberFormatException e) {
+ // 数字以外なら<magvar>エレメントを削除する
+ imaTag.removeElement("magvar");
+ imaTag.magvarStr = null;
+ }
}
if (imaTag.magvarStr == null) {
str = str.substring(0, iDot);
}
imaTag.appendElement("magvar", str);
- imaTag.magvarStr = new String(str);
+ imaTag.magvarStr = str;
}
}
}
@SuppressWarnings("serial")
public class ElementMapTRKPT extends TreeMap<Date, TagTrkpt> {
- public static final long DIFF_MAE_TIME = 3000L; // before 3 secound
+ public static final long DIFF_MAE_TIME = 3000L; // before 3 secound
- public ElementMapTRKPT() {
- super(new TimeComparator());
- }
+ public ElementMapTRKPT() {
+ super(new TimeComparator());
+ }
- /**
- * 拡張put value:ElementをputするとElement内のtimeを読み取ってkeyとしてthis.put(key,value)する。
- * <trkpt lat="36.4260153752" lon="138.0117778201">
+ /**
+ * 拡張put value:ElementをputするとElement内のtimeを読み取ってkeyとしてthis.put(key,value)する。
+ * @param tag
+ * @code{
+ * <trkpt lat="36.4260153752" lon="138.0117778201">
* <ele>614.90</ele>
* <time>2017-05-21T23:02:16Z</time>
* <hdop>0.5</hdop>
* </trkpt>
- * @param value
- * @return keyとして登録したtime:Date
- * @throws ParseException
- * @throws DOMException
- */
- public Date put(TagTrkpt tag) throws DOMException, ParseException {
+ * }
+ * @return keyとして登録したtime:Date
+ * @throws ParseException
+ * @throws DOMException
+ */
+ public Date put(TagTrkpt tag) throws DOMException, ParseException {
this.put(tag.time, tag);
return tag.time;
- }
-
- /**
+ }
+
+ /**
* 指定時刻(jptime)のTRKPTエレメントを取り出す。
*
* @param jptime 指定する日時
public TagTrkpt getValue(Date jptime) throws ParseException {
TagTrkpt imaE = getTrkpt(jptime);
if (imaE != null) {
- TagTrkpt maeE = getMaeTrkpt(imaE.time);
+ TagTrkpt maeE = getMaeTrkpt(imaE.time);
if (maeE != null) {
Complementation comp = new Complementation(imaE, maeE);
// 直前の位置と、現在地から進行方向を求める
// 経度(longitude)と経度から進行方向を求める
if (Complementation.param_GpxOverwriteMagvar) {
- comp.complementationMagvar();
+ comp.complementationMagvar();
}
// 緯度・経度と時間差から速度(km/h)を求める
if (Complementation.param_GpxOutputSpeed) {
- comp.complementationSpeed();
+ comp.complementationSpeed();
}
//return (TagTrkpt)(comp.imaTag.trkpt.cloneNode(true));
return (TagTrkpt)(comp.imaTag);
private TagTrkpt getTrkpt(Date jptime) throws ParseException {
Date keyTime = null;
for (Date key : this.keySet()) {
- int flag = jptime.compareTo(key);
- if (flag < 0) {
- if (keyTime != null) {
- return this.get(keyTime);
- }
- return null;
- }
- else if (flag == 0) {
- return this.get(key);
- }
- else if (flag > 0) {
- keyTime = new Date(key.getTime());
- }
- }
- if (keyTime != null) {
- if (Math.abs(keyTime.getTime() - jptime.getTime()) <= OVER_TIME_LIMIT) {
- return this.get(keyTime);
- }
- }
- return null;
+ int flag = jptime.compareTo(key);
+ if (flag < 0) {
+ if (keyTime != null) {
+ return this.get(keyTime);
+ }
+ return null;
+ }
+ else if (flag == 0) {
+ return this.get(key);
+ }
+ else if (flag > 0) {
+ keyTime = new Date(key.getTime());
+ }
+ }
+ if (keyTime != null) {
+ if (Math.abs(keyTime.getTime() - jptime.getTime()) <= OVER_TIME_LIMIT) {
+ return this.get(keyTime);
+ }
+ }
+ return null;
}
/**
private TagTrkpt getMaeTrkpt(Date time) throws ParseException {
Date maeTime = null;
- for (Date key : this.keySet()) {
- int flag = time.compareTo(key);
- if (flag > 0) {
- maeTime = new Date(key.getTime());
- }
- else if (flag == 0) {
- if (maeTime == null) {
- return null;
- }
- return this.get(maeTime);
- }
- else {
- // time は key より古い
- if (maeTime == null) {
- return null;
- }
- if (Math.abs(maeTime.getTime() - time.getTime()) > OVER_TIME_LIMIT) {
- return null;
- }
- return this.get(maeTime);
- }
- }
+ for (Date key : this.keySet()) {
+ int flag = time.compareTo(key);
+ if (flag > 0) {
+ maeTime = new Date(key.getTime());
+ }
+ else if (flag == 0) {
+ if (maeTime == null) {
+ return null;
+ }
+ return this.get(maeTime);
+ }
+ else {
+ // time は key より古い
+ if (maeTime == null) {
+ return null;
+ }
+ if (Math.abs(maeTime.getTime() - time.getTime()) > OVER_TIME_LIMIT) {
+ return null;
+ }
+ return this.get(maeTime);
+ }
+ }
return null;
}
public void printinfo() {
Date firstTime = null;
Date lastTime = null;
- for (Date key : this.keySet()) {
- if (firstTime == null) {
- firstTime = new Date(key.getTime());
- }
- lastTime = new Date(key.getTime());
- }
- System.out.println(String.format("| <trkseg/> |%20s|%20s|", ImportPicture.toUTCString(firstTime), ImportPicture.toUTCString(lastTime)));
+ for (Date key : this.keySet()) {
+ if (firstTime == null) {
+ firstTime = new Date(key.getTime());
+ }
+ lastTime = new Date(key.getTime());
+ }
+ System.out.println(String.format("| <trkseg/> |%20s|%20s|", ImportPicture.toUTCString(firstTime), ImportPicture.toUTCString(lastTime)));
}
}
@SuppressWarnings("serial")
public class ElementMapTRKSEG extends TreeMap<Date, ElementMapTRKPT> {
- /**
- * TESTing
- * @throws ParseException
- * @throws ParserConfigurationException
- * @throws IOException
- * @throws SAXException
- * @throws DOMException
- */
- public static void main(String[] argv) throws DOMException, SAXException, IOException, ParserConfigurationException, ParseException {
- ElementMapTRKSEG mapTRKSEG = null;
- mapTRKSEG = new ElementMapTRKSEG();
+ /**
+ * TESTing
+ * @param argv
+ * @throws ParseException
+ * @throws ParserConfigurationException
+ * @throws IOException
+ * @throws SAXException
+ * @throws DOMException
+ */
+ public static void main(String[] argv) throws DOMException, SAXException, IOException, ParserConfigurationException, ParseException {
+ ElementMapTRKSEG mapTRKSEG = null;
+ mapTRKSEG = new ElementMapTRKSEG();
mapTRKSEG.parse(new File("testdata/cameradata/separate.gpx"));
mapTRKSEG.printinfo();
- }
-
- public ElementMapTRKSEG() {
- super(new TimeComparator());
- }
+ }
+ public ElementMapTRKSEG() {
+ super(new TimeComparator());
+ }
+
/**
* GPXファイルをパースする
- *
+ * @code{
* <gpx>
* <trk>
* <trkseg>
* </trkseg>
* </trk>
* </gpx>
- *
- * @param gpxFile
- * @return Document
- * @throws SAXException
- * @throws IOException
- * @throws ParserConfigurationException
- * @throws DOMException
- * @throws ParseException
- */
- public Document parse(File gpxFile) throws SAXException, IOException, ParserConfigurationException, DOMException, ParseException {
+ * }
+ *
+ * @param gpxFile
+ * @return Document
+ * @throws SAXException
+ * @throws IOException
+ * @throws ParserConfigurationException
+ * @throws DOMException
+ * @throws ParseException
+ */
+ public Document parse(File gpxFile) throws SAXException, IOException, ParserConfigurationException, DOMException, ParseException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
factory.setIgnoringElementContentWhitespace(true);
}
}
return document;
- }
-
- /**
- * 拡張put value:Node<TRKSEG>をputするとNode<TRKSEG>内のNode<TRKSPT>を put(key,value)する。
- * @param nodeTRKSEG
- * @return keyとして登録したtime:Date
- * @throws ParseException
- * @throws DOMException
- */
- public void put(Node nodeTRKSEG) throws DOMException, ParseException {
+ }
+
+ /**
+ * @code{
+ * 拡張put value:Node<TRKSEG>をputするとNode<TRKSEG>内のNode<TRKSPT>を put(key,value)する。
+ * }
+ * @param nodeTRKSEG
+ * @throws ParseException
+ * @throws DOMException
+ */
+ public void put(Node nodeTRKSEG) throws DOMException, ParseException {
if (nodeTRKSEG.getNodeName().equals("trkseg")) {
NodeList nodes2 = nodeTRKSEG.getChildNodes();
for (int i2 = 0; i2 < nodes2.getLength(); i2++) {
Node nodeTRKPT = nodes2.item(i2);
if (nodeTRKPT.getNodeName().equals("trkpt")) {
- if (ImportPicture.param_GpxNoFirstNode && (i2 == 0)) {
- continue;
- }
+ if (ImportPicture.param_GpxNoFirstNode && (i2 == 0)) {
+ continue;
+ }
mapTRKPT.put(new TagTrkpt((Element)nodeTRKPT));
}
}
this.put(mapTRKPT);
}
- }
+ }
- /**
- * 拡張put value:ElementMapTRKPTをputするとElementMapTRKPT内の最初のエントリのtimeを読み取ってkeyとしてthis.put(key,value)する。
- * @param value
- * @return keyとして登録したtime:Date
- * @throws ParseException
- * @throws DOMException
- */
- public void put(ElementMapTRKPT value) {
- for (Date key : value.keySet()) {
- this.put(key, value);
- return;
- }
- }
+ /**
+ * 拡張put value:ElementMapTRKPTをputするとElementMapTRKPT内の最初のエントリのtimeを読み取ってkeyとしてthis.put(key,value)する。
+ * @param value
+ * @throws DOMException
+ */
+ public void put(ElementMapTRKPT value) {
+ for (Date key : value.keySet()) {
+ this.put(key, value);
+ return;
+ }
+ }
- public void printinfo() {
- System.out.println(" +--------------------+--------------------|");
- System.out.println(" GPS logging time | First Time | Last Time |");
- System.out.println("|--------------------------------+--------------------+--------------------|");
-
- for (java.util.Map.Entry<Date, ElementMapTRKPT> map : this.entrySet()) {
- ElementMapTRKPT mapTRKPT = map.getValue();
- mapTRKPT.printinfo();
+ public void printinfo() {
+ System.out.println(" +--------------------+--------------------|");
+ System.out.println(" GPS logging time | First Time | Last Time |");
+ System.out.println("|--------------------------------+--------------------+--------------------|");
+ for (java.util.Map.Entry<Date, ElementMapTRKPT> map : this.entrySet()) {
+ ElementMapTRKPT mapTRKPT = map.getValue();
+ mapTRKPT.printinfo();
}
-
- System.out.println("|--------------------------------+--------------------+--------------------|");
- System.out.println();
- }
-
+ System.out.println("|--------------------------------+--------------------+--------------------|");
+ System.out.println();
+ }
}
* @return
*/
public static double deg2rad(double deg){
- return deg * Math.PI / 180.0;
+ return deg * Math.PI / 180.0;
}
/**
ElementMapTRKSEG mapTRKSEG = null;
Document document;
- public GpxFile(File file) throws ParserConfigurationException, DOMException, SAXException, IOException, ParseException {
- super(file.getParentFile(), file.getName());
+ @SuppressWarnings("LeakingThisInConstructor")
+ public GpxFile(File file) throws ParserConfigurationException, DOMException, SAXException, IOException, ParseException {
+ super(file.getParentFile(), file.getName());
DocumentBuilderFactory factory = null;
DocumentBuilder builder = null;
// GPX file --> Node root
gpx = builder.parse(this).getFirstChild();
- }
+ }
- /**
- * GPX 変換出力
- * @throws FileNotFoundException
- * @throws TransformerException
- */
- public void output(File outDir) throws FileNotFoundException, TransformerException {
+ /**
+ * GPX 変換出力
+ * @param outDir
+ * @throws FileNotFoundException
+ * @throws TransformerException
+ */
+ public void output(File outDir) throws FileNotFoundException, TransformerException {
String fileName = this.getName();
String iStr = fileName.substring(0, fileName.length() - 4);
File outputFile = new File(outDir, iStr +"_.gpx");
System.out.println(this.getAbsolutePath() + " => "+ outputFile.getAbsolutePath());
- outputFile.getParentFile().mkdirs();
+ outputFile.getParentFile().mkdirs();
DOMSource source = new DOMSource(this.gpx);
FileOutputStream os = new FileOutputStream(outputFile);
StreamResult result = new StreamResult(os);
os = new FileOutputStream(outputFile);
result = new StreamResult(os);
transformer.transform(source, result);
- }
+ }
/**
* <wpt lat="35.25714922" lon="139.15490497">
* <time>2012-06-15T03:00:29Z</time>
* </trkpt>
*
+ * @param imgDir
* @return
* @param iFile
* @param timestamp
import java.util.Comparator;\r
import java.util.Date;\r
import java.util.Map;\r
+import java.util.ResourceBundle;\r
import java.util.TimeZone;\r
import java.util.logging.LogManager;\r
import java.util.logging.Logger;\r
import org.xml.sax.SAXException;\r
\r
public class ImportPicture extends Thread {\r
- /**\r
- * 実行中に発生したExceptionを保持する場所\r
- */\r
- public Exception ex = null;\r
+ \r
+ /**\r
+ * 実行中に発生したExceptionを保持する場所\r
+ */\r
+ public Exception ex = null;\r
\r
/**\r
* ログ設定プロパティファイルのファイル内容\r
*/\r
protected static final String LOGGING_PROPERTIES_DATA\r
- = "handlers=java.util.logging.ConsoleHandler\n"\r
- + ".level=FINEST\n"\r
- + "java.util.logging.ConsoleHandler.level=INFO\n"\r
- + "java.util.logging.ConsoleHandler.formatter=osm.jp.gpx.YuuLogFormatter";\r
+ = "handlers=java.util.logging.ConsoleHandler\n"\r
+ + ".level=FINEST\n"\r
+ + "java.util.logging.ConsoleHandler.level=INFO\n"\r
+ + "java.util.logging.ConsoleHandler.formatter=osm.jp.gpx.YuuLogFormatter";\r
\r
/**\r
* static initializer によるログ設定の初期化\r
*/\r
- public static final Logger logger = Logger.getLogger("CommandLogging");\r
+ public static final Logger LOGGER = Logger.getLogger("CommandLogging");\r
static {\r
InputStream inStream = null;\r
try {\r
inStream = new ByteArrayInputStream(LOGGING_PROPERTIES_DATA.getBytes("UTF-8"));\r
try {\r
LogManager.getLogManager().readConfiguration(inStream);\r
- logger.config("ログ設定: LogManagerを設定しました。");\r
+ // "ログ設定: LogManagerを設定しました。"\r
+ LOGGER.config("LoggerSettings: LogManager setuped.");\r
}\r
catch (IOException e) {\r
- logger.warning("ログ設定: LogManager設定の際に例外が発生しました。:" + e.toString());\r
+ // LogManager設定の際に例外が発生しました.\r
+ String str = "LoggerSettings: Exception occered:" + e.toString();\r
+ LOGGER.warning(str);\r
}\r
}\r
catch (UnsupportedEncodingException e) {\r
- logger.severe("ログ設定: UTF-8エンコーディングがサポートされていません。:" + e.toString());\r
+ String str = "LoggerSettings: Not supported 'UTF-8' encoding: " + e.toString();\r
+ LOGGER.severe(str);\r
}\r
finally {\r
try {\r
inStream.close();\r
}\r
} catch (IOException e) {\r
- logger.warning("ログ設定: ログ設定プロパティファイルのストリームクローズ時に例外が発生しました。:"+ e.toString());\r
+ String str = "LoggerSettings: Exception occored: "+ e.toString();\r
+ LOGGER.warning(str);\r
}\r
}\r
}\r
\r
-\r
-\r
/** メイン\r
* 画像ファイルをGPXファイルに取り込みます。\r
* \r
public boolean exifBase = false;\r
public ArrayList<File> gpxFiles = new ArrayList<>();\r
public AppParameters params;\r
- public boolean param_GpxSplit = false;\r
- public static boolean param_GpxNoFirstNode = false;\r
- public boolean param_GpxReuse = false;\r
- public boolean param_GpxOutputWpt = true;\r
- public boolean param_ImgOutputAll = false;\r
- public String param_GpxSourceFolder = ".";\r
+ public boolean param_GpxSplit = false;\r
+ public static boolean param_GpxNoFirstNode = false;\r
+ public boolean param_GpxReuse = false;\r
+ public boolean param_GpxOutputWpt = true;\r
+ public boolean param_ImgOutputAll = false;\r
+ public String param_GpxSourceFolder = ".";\r
\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 ResourceBundle i18n = ResourceBundle.getBundle("i18n");\r
\r
public void setUp(String paramFilePath) throws Exception {\r
System.out.println("Param File = '"+ paramFilePath +"'");\r
this.imgDir = new File(this.params.getProperty(AppParameters.IMG_SOURCE_FOLDER));\r
\r
// 基準時刻(ファイル更新日時 | EXIF撮影日時)\r
- this.exifBase = (this.params.getProperty(AppParameters.GPX_BASETIME).equals("EXIF_TIME") ? true : false);\r
+ this.exifBase = (this.params.getProperty(AppParameters.GPX_BASETIME).equals("EXIF_TIME"));\r
\r
// 基準時刻ファイルの「更新日時」を使って時刻合わせを行う。\r
// argv[1] --> AppParameters.IMG_BASE_FILE に置き換え\r
// その他のパラメータを読み取る\r
String paramStr = this.params.getProperty(AppParameters.GPX_GPXSPLIT);\r
if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {\r
- this.param_GpxSplit = true;\r
+ this.param_GpxSplit = true;\r
}\r
\r
paramStr = this.params.getProperty(AppParameters.GPX_NO_FIRST_NODE);\r
if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {\r
- ImportPicture.param_GpxNoFirstNode = true;\r
+ ImportPicture.param_GpxNoFirstNode = true;\r
}\r
\r
paramStr = this.params.getProperty(AppParameters.GPX_REUSE);\r
if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {\r
- this.param_GpxReuse = true;\r
+ this.param_GpxReuse = true;\r
}\r
\r
paramStr = this.params.getProperty(AppParameters.IMG_OUTPUT_ALL);\r
if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {\r
- this.param_ImgOutputAll = true;\r
+ this.param_ImgOutputAll = true;\r
}\r
\r
paramStr = this.params.getProperty(AppParameters.GPX_OUTPUT_WPT);\r
if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {\r
- this.param_GpxOutputWpt = true;\r
+ this.param_GpxOutputWpt = true;\r
}\r
\r
paramStr = this.params.getProperty(AppParameters.GPX_OVERWRITE_MAGVAR);\r
if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {\r
- Complementation.param_GpxOverwriteMagvar = true;\r
+ Complementation.param_GpxOverwriteMagvar = true;\r
}\r
\r
paramStr = this.params.getProperty(AppParameters.GPX_OUTPUT_SPEED);\r
if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {\r
- Complementation.param_GpxOutputSpeed = true;\r
+ Complementation.param_GpxOutputSpeed = true;\r
}\r
\r
paramStr = this.params.getProperty(AppParameters.GPX_SOURCE_FOLDER);\r
if (paramStr != null) {\r
- this.param_GpxSourceFolder = new String(paramStr);\r
+ this.param_GpxSourceFolder = paramStr;\r
this.gpxDir = new File(this.param_GpxSourceFolder);\r
if (!this.gpxDir.exists()) {\r
- // GPXファイルまたはディレクトリが存在しません。\r
- System.out.println("GPXファイルまたはディレクトリが存在しません。('"+ paramStr +"')");\r
+ // GPXファイルまたはディレクトリが存在しません。('%s')\r
+ System.out.println(\r
+ String.format(i18n.getString("msg.100"), paramStr)\r
+ );\r
return;\r
}\r
}\r
if (this.gpxDir.isDirectory()) {\r
File[] files = this.gpxDir.listFiles();\r
if (files == null) {\r
- // 対象となるGPXファイルがありませんでした。\r
- System.out.println("対象となるGPXファイルがありませんでした。('"+ this.gpxDir.getAbsolutePath() +"')");\r
+ // 対象となるGPXファイルがありませんでした。('%s')\r
+ System.out.println(\r
+ String.format(i18n.getString("msg.110"), this.gpxDir.getAbsolutePath())\r
+ );\r
return;\r
}\r
if (this.param_ImgOutputAll && (files.length > 1)) {\r
- System.out.println("複数のGPXファイルがあるときには、'IMG.OUTPUT_ALL'オプションは指定できません。");\r
+ // "複数のGPXファイルがあるときには、'IMG.OUTPUT_ALL'オプションは指定できません。"\r
+ System.out.println(\r
+ i18n.getString("msg.120")\r
+ );\r
return;\r
}\r
\r
- java.util.Arrays.sort(files, new java.util.Comparator<File>() {\r
- @Override\r
- public int compare(File file1, File file2){\r
- return file1.getName().compareTo(file2.getName());\r
- }\r
- });\r
+ java.util.Arrays.sort(\r
+ files, new java.util.Comparator<File>() {\r
+ @Override\r
+ public int compare(File file1, File file2){\r
+ return file1.getName().compareTo(file2.getName());\r
+ }\r
+ }\r
+ );\r
for (File file : files) {\r
if (file.isFile()) {\r
String filename = file.getName().toUpperCase();\r
\r
paramStr = this.params.getProperty(AppParameters.IMG_OUTPUT_EXIF);\r
if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {\r
- this.exif = true;\r
+ this.exif = true;\r
}\r
\r
String timeStr = this.params.getProperty(AppParameters.IMG_TIME);\r
this.delta = t.getTime() - imgtime.getTime();\r
}\r
catch (ParseException e) {\r
- System.out.println("'"+ timeStr +"' の書式が違います("+ TIME_FORMAT_STRING +")");\r
+ // "'%s'の書式が違います(%s)"\r
+ System.out.println(\r
+ String.format(\r
+ i18n.getString("msg.130"),\r
+ timeStr,\r
+ TIME_FORMAT_STRING\r
+ )\r
+ );\r
return;\r
}\r
\r
this.join();\r
} catch(InterruptedException end) {}\r
if (this.ex != null) {\r
- throw this.ex;\r
+ throw this.ex;\r
}\r
- \r
}\r
\r
+ /**\r
+ * @code{\r
+ <wpt lat="35.25714922" lon="139.15490497">\r
+ <ele>62.099998474121094</ele>\r
+ <time>2012-06-11T00:44:38Z</time>\r
+ <hdop>0.75</hdop>\r
+ <name><![CDATA[写真]]></name>\r
+ <cmt><![CDATA[精度: 3.0m]]></cmt>\r
+ <link href="2012-06-11_09-44-38.jpg">\r
+ <text>2012-06-11_09-44-38.jpg</text>\r
+ </link>\r
+ <sat>9</sat>\r
+ </wpt>\r
+ * }\r
+ */\r
@Override\r
public void run() {\r
- /**\r
- *\r
- <wpt lat="35.25714922" lon="139.15490497">\r
- <ele>62.099998474121094</ele>\r
- <time>2012-06-11T00:44:38Z</time>\r
- <hdop>0.75</hdop>\r
- <name><![CDATA[写真]]></name>\r
- <cmt><![CDATA[精度: 3.0m]]></cmt>\r
- <link href="2012-06-11_09-44-38.jpg">\r
- <text>2012-06-11_09-44-38.jpg</text>\r
- </link>\r
- <sat>9</sat>\r
- </wpt>\r
- */\r
try {\r
- if (params.getProperty(AppParameters.IMG_OUTPUT).equals(Boolean.toString(true))) {\r
+ if (params.getProperty(AppParameters.IMG_OUTPUT).equals(Boolean.toString(true))) {\r
outDir = new File(outDir, imgDir.getName());\r
- }\r
- else {\r
+ }\r
+ else {\r
outDir = gpxDir;\r
- }\r
-\r
+ }\r
for (File gpxFile : this.gpxFiles) {\r
procGPXfile(new GpxFile(gpxFile));\r
}\r
}\r
catch(ParserConfigurationException | DOMException | SAXException | IOException | ParseException | ImageReadException | ImageWriteException | IllegalArgumentException | TransformerException e) {\r
- e.printStackTrace();\r
- this.ex = new Exception(e);\r
+ e.printStackTrace();\r
+ this.ex = new Exception(e);\r
}\r
}\r
\r
void procGPXfile(GpxFile gpxFile) throws ParserConfigurationException, SAXException, IOException, ParseException, ImageReadException, ImageWriteException, TransformerException {\r
System.gc();\r
\r
- System.out.println(" 時差: "+ (delta / 1000) +"(sec)");\r
- System.out.println(" Target GPX: ["+ gpxFile.getAbsolutePath() +"]");\r
- System.out.println(" EXIF: "+ (exif ? ("convert to '" + outDir.getAbsolutePath() +"'") : "off"));\r
+ System.out.println("time difference: "+ (delta / 1000) +"(sec)");\r
+ System.out.println(" Target GPX: ["+ gpxFile.getAbsolutePath() +"]");\r
+ System.out.println(" EXIF: "+ (exif ? ("convert to '" + outDir.getAbsolutePath() +"'") : "off"));\r
System.out.println();\r
\r
// imgDir内の画像ファイルを処理する\r
- System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");\r
- System.out.println("| name | Camera Time | GPStime | Latitude | Longitude | ele |magvar| km/h |");\r
- System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");\r
- proc(imgDir, delta, gpxFile.mapTRKSEG, exif, gpxFile);\r
- System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");\r
+ System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");\r
+ System.out.println("| name | Camera Time | GPStime | Latitude | Longitude | ele |magvar| km/h |");\r
+ System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");\r
+ proc(imgDir, delta, gpxFile.mapTRKSEG, exif, gpxFile);\r
+ System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");\r
\r
// GPX出力\r
- gpxFile.output(outDir);\r
+ gpxFile.output(outDir);\r
}\r
\r
\r
public boolean ret;\r
public int control;\r
public Discripter(boolean ret) {\r
- this.ret = ret;\r
- this.control = Discripter.NEXT;\r
+ this.ret = ret;\r
+ this.control = Discripter.NEXT;\r
}\r
}\r
\r
ImageMetadata meta = Imaging.getMetadata(imageFile);\r
JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;\r
if (jpegMetadata == null) {\r
- System.out.println("'"+ imageFile.getAbsolutePath() +"' にEXIF情報がありません");\r
+ // "'%s'にEXIF情報がありません"\r
+ System.out.println(\r
+ String.format(\r
+ i18n.getString("msg.140"), \r
+ imageFile.getAbsolutePath()\r
+ )\r
+ );\r
result.control = Discripter.CONTINUE;\r
return result;\r
}\r
+ @SuppressWarnings("LocalVariableHidesMemberVariable")\r
TiffImageMetadata exif = jpegMetadata.getExif();\r
if (exif == null) {\r
- System.out.println("'"+ imageFile.getAbsolutePath() +"' にEXIF情報がありません");\r
+ // "'%s'にEXIF情報がありません"\r
+ System.out.println(\r
+ String.format(\r
+ i18n.getString("msg.140"), \r
+ imageFile.getAbsolutePath()\r
+ )\r
+ );\r
result.control = Discripter.CONTINUE;\r
return result;\r
}\r
- String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];\r
- itime = ImportPicture.toEXIFDate(dateTimeOriginal);\r
+ String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];\r
+ itime = ImportPicture.toEXIFDate(dateTimeOriginal);\r
}\r
System.out.print(String.format("%20s|", toUTCString(itime)));\r
\r
Date correctedtime = new Date(itime.getTime() + delta);\r
System.out.print(String.format("%20s|", toUTCString(correctedtime)));\r
\r
- // 時刻uktimeにおける<magver>をtrkptに追加する\r
+ // 時刻uktimeにおける<magver>をtrkptに追加する\r
String eleStr = "-";\r
String magvarStr = "-";\r
String speedStr = "-";\r
TagTrkpt trkptT = null;\r
\r
for (Map.Entry<Date,ElementMapTRKPT> map : mapTRKSEG.entrySet()) {\r
- ElementMapTRKPT mapTRKPT = map.getValue();\r
- trkptT = mapTRKPT.getValue(correctedtime);\r
+ ElementMapTRKPT mapTRKPT = map.getValue();\r
+ trkptT = mapTRKPT.getValue(correctedtime);\r
if (trkptT != null) {\r
break;\r
}\r
longitude = trkptT.lon;\r
\r
if (trkptT.eleStr != null) {\r
- eleStr = new String(trkptT.eleStr);\r
+ eleStr = trkptT.eleStr;\r
}\r
\r
if (trkptT.magvarStr != null) {\r
- magvarStr = new String(trkptT.magvarStr);\r
+ magvarStr = trkptT.magvarStr;\r
}\r
\r
if (trkptT.speedStr != null) {\r
- speedStr = new String(trkptT.speedStr);\r
+ speedStr = trkptT.speedStr;\r
}\r
//System.out.print(String.format("%-14s|%-14s|", (new Double(latitude)).toString(), (new Double(longitude)).toString()));\r
System.out.print(String.format("%14.10f|%14.10f|", latitude, longitude));\r
outDir.mkdir();\r
\r
if (exifWrite) {\r
- exifWrite(imageFile, correctedtime, trkptT);\r
+ exifWrite(imageFile, correctedtime, trkptT);\r
\r
if (Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_WPT))) {\r
if (trkptT != null) {\r
}\r
}\r
else {\r
- if (this.param_ImgOutputAll) {\r
- // EXIFの変換を伴わない単純なファイルコピー\r
- FileInputStream sStream = new FileInputStream(imageFile);\r
- FileInputStream dStream = new FileInputStream(new File(outDir, imageFile.getName()));\r
+ if (this.param_ImgOutputAll) {\r
+ // EXIFの変換を伴わない単純なファイルコピー\r
+ FileInputStream sStream = new FileInputStream(imageFile);\r
+ FileInputStream dStream = new FileInputStream(new File(outDir, imageFile.getName()));\r
FileChannel srcChannel = sStream.getChannel();\r
FileChannel destChannel = dStream.getChannel();\r
try {\r
sStream.close();\r
dStream.close();\r
}\r
- }\r
+ }\r
}\r
result.control = Discripter.NEXT;\r
return result;\r
ImageMetadata meta = Imaging.getMetadata(imageFile);\r
JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;\r
if (jpegMetadata != null) {\r
+ @SuppressWarnings("LocalVariableHidesMemberVariable")\r
TiffImageMetadata exif = jpegMetadata.getExif();\r
if (exif != null) {\r
outputSet = exif.getOutputSet();\r
final String dateStamp = yearStr +":"+ monthStr +":"+ dayStr;\r
\r
gpsDir.removeField(GpsTagConstants.GPS_TAG_GPS_TIME_STAMP);\r
- gpsDir.add(GpsTagConstants.GPS_TAG_GPS_TIME_STAMP,\r
- RationalNumber.valueOf(cal.get(Calendar.HOUR_OF_DAY)),\r
- RationalNumber.valueOf(cal.get(Calendar.MINUTE)),\r
- RationalNumber.valueOf(cal.get(Calendar.SECOND)));\r
+ gpsDir.add(\r
+ GpsTagConstants.GPS_TAG_GPS_TIME_STAMP,\r
+ RationalNumber.valueOf(cal.get(Calendar.HOUR_OF_DAY)),\r
+ RationalNumber.valueOf(cal.get(Calendar.MINUTE)),\r
+ RationalNumber.valueOf(cal.get(Calendar.SECOND))\r
+ );\r
gpsDir.removeField(GpsTagConstants.GPS_TAG_GPS_DATE_STAMP);\r
gpsDir.add(GpsTagConstants.GPS_TAG_GPS_DATE_STAMP, dateStamp);\r
}\r
}\r
\r
//---- EXIF GPS_ ----\r
- outputSet.setGPSInDegrees(trkptT.lon.doubleValue(), trkptT.lat.doubleValue());\r
+ outputSet.setGPSInDegrees(trkptT.lon, trkptT.lat);\r
}\r
\r
ExifRewriter rewriter = new ExifRewriter();\r
try (FileOutputStream fos = new FileOutputStream(new File(outDir, imageFile.getName()))) {\r
rewriter.updateExifMetadataLossy(imageFile, fos, outputSet);\r
}\r
-\r
}\r
\r
// 基準時刻ファイルの「更新日時」を使って時刻合わせを行う。\r
ImageMetadata meta = Imaging.getMetadata(baseFile);\r
JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;\r
if (jpegMetadata == null) {\r
- System.out.println("'"+ baseFile.getAbsolutePath() +"' にEXIF情報がありません");\r
+ // "'%s'にEXIF情報がありません"\r
+ System.out.println(\r
+ String.format(\r
+ i18n.getString("msg.140"), \r
+ baseFile.getAbsolutePath()\r
+ )\r
+ );\r
return null;\r
}\r
+ @SuppressWarnings("LocalVariableHidesMemberVariable")\r
TiffImageMetadata exif = jpegMetadata.getExif();\r
if (exif == null) {\r
- System.out.println("'"+ baseFile.getAbsolutePath() +"' にEXIF情報がありません");\r
+ // "'%s'にEXIF情報がありません"\r
+ System.out.println(\r
+ String.format(\r
+ i18n.getString("msg.140"), \r
+ baseFile.getAbsolutePath()\r
+ )\r
+ );\r
return null;\r
}\r
- String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];\r
- return new Date(ImportPicture.toEXIFDate(dateTimeOriginal).getTime());\r
+ String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];\r
+ return new Date(ImportPicture.toEXIFDate(dateTimeOriginal).getTime());\r
}\r
else {\r
return new Date(baseFile.lastModified());\r
}\r
}\r
\r
- \r
/**\r
* 対象は '*.JPG' のみ対象とする\r
* @return \r
return ((name != null) && name.toUpperCase().endsWith(".JPG"));\r
}\r
\r
-\r
/**\r
* DateをEXIFの文字列に変換する。\r
* 注意:EXiFの撮影時刻はUTC時間ではない\r
* JPEGファイルフィルター\r
* @author yuu\r
*/\r
- class JpegFileFilter implements FilenameFilter {\r
+ class JpegFileFilter implements FilenameFilter {\r
@Override\r
- public boolean accept(File dir, String name) {\r
- if (name.toUpperCase().matches(".*\\.JPG$")) {\r
- return true;\r
- }\r
- return false;\r
+ public boolean accept(File dir, String name) {\r
+ return name.toUpperCase().matches(".*\\.JPG$");\r
}\r
- }\r
+ }\r
}
\ No newline at end of file
import java.util.Calendar;\r
import java.util.Comparator;\r
import java.util.Date;\r
+import java.util.ResourceBundle;\r
import java.util.logging.LogManager;\r
import java.util.logging.Logger;\r
import org.apache.commons.imaging.ImageReadException;\r
/**\r
* static initializer によるログ設定の初期化\r
*/\r
- public static final Logger logger = Logger.getLogger("CommandLogging");\r
+ public static final Logger LOGGER = Logger.getLogger("CommandLogging");\r
static {\r
InputStream inStream = null;\r
try {\r
inStream = new ByteArrayInputStream(LOGGING_PROPERTIES_DATA.getBytes("UTF-8"));\r
try {\r
LogManager.getLogManager().readConfiguration(inStream);\r
- logger.config("ログ設定: LogManagerを設定しました。");\r
+ // "ログ設定: LogManagerを設定しました。"\r
+ LOGGER.config("LoggerSettings: LogManager setuped.");\r
}\r
catch (IOException e) {\r
- logger.warning("ログ設定: LogManager設定の際に例外が発生しました。:" + e.toString());\r
+ // LogManager設定の際に例外が発生しました.\r
+ String str = "LoggerSettings: Exception occered:" + e.toString();\r
+ LOGGER.warning(str);\r
}\r
}\r
catch (UnsupportedEncodingException e) {\r
- logger.severe("ログ設定: UTF-8エンコーディングがサポートされていません。:" + e.toString());\r
+ String str = "LoggerSettings: Not supported 'UTF-8' encoding: " + e.toString();\r
+ LOGGER.severe(str);\r
}\r
finally {\r
try {\r
inStream.close();\r
}\r
} catch (IOException e) {\r
- logger.warning("ログ設定: ログ設定プロパティファイルのストリームクローズ時に例外が発生しました。:"+ e.toString());\r
+ String str = "LoggerSettings: Exception occored: "+ e.toString();\r
+ LOGGER.warning(str);\r
}\r
}\r
}\r
* ・基準画像の正しい日時\r
* ・画像ファイルの間隔(秒)\r
* \r
- * exp) $ java -cp .:AdjustTime.jar:commons-imaging-1.0-SNAPSHOT.jar [AdjustTime.ini]\r
+ * exp) $ java -cp .:AdjustTime.jar:commons-imaging-1.0-SNAPSHOT.jar [AdjustTime.ini]\r
* exp) > java -cp .;AdjustTime.jar;commons-imaging-1.0-SNAPSHOT.jar [AdjustTime.ini]\r
* \r
* 1. 予め、動画から画像を切り出す\r
\r
File imgDir = new File(argv[0]);\r
if (!imgDir.exists()) {\r
- System.out.println("[error] <imgDir>が存在しません。");\r
+ // "[error] <imgDir>が存在しません。"\r
+ System.out.println(i18n.getString("msg.200"));\r
return;\r
}\r
if (!imgDir.isDirectory()) {\r
- System.out.println("[error] <imgDir>がフォルダじゃない");\r
+ // "[error] <imgDir>がフォルダじゃない"\r
+ System.out.println(i18n.getString("msg.210"));\r
return;\r
}\r
\r
File baseFile1 = new File(imgDir, argv[1]);\r
if (!baseFile1.exists()) {\r
- System.out.println("[error] <baseFile1>が存在しません。");\r
+ // "[error] <baseFile1>が存在しません。"\r
+ System.out.println(i18n.getString("msg.220"));\r
return;\r
}\r
if (!baseFile1.isFile()) {\r
- System.out.println("[error] <baseFile1>がファイルじゃない");\r
+ // "[error] <baseFile1>がファイルじゃない"\r
+ System.out.println(i18n.getString("msg.230"));\r
return;\r
}\r
\r
\r
File baseFile2 = new File(imgDir, argv[3]);\r
if (!baseFile2.exists()) {\r
- System.out.println("[error] <baseFile2>が存在しません。");\r
+ // "[error] <baseFile2>が存在しません。"\r
+ System.out.println(i18n.getString("msg.240"));\r
return;\r
}\r
if (!baseFile2.isFile()) {\r
- System.out.println("[error] <baseFile2>がファイルじゃない");\r
+ // "[error] <baseFile2>がファイルじゃない"\r
+ System.out.println(i18n.getString("msg.250"));\r
return;\r
}\r
\r
public int bCount2 = 0;\r
public long span = 0;\r
public ArrayList<File> jpgFiles = new ArrayList<>();\r
+ public static ResourceBundle i18n = ResourceBundle.getBundle("i18n");\r
\r
@SuppressWarnings("Convert2Lambda")\r
public void setUp(File imgDir, File baseFile1, Date baseTime1, File baseFile2, Date baseTime2) throws Exception {\r
\r
try {\r
// imgDir内の画像ファイルを処理する\r
+ @SuppressWarnings("LocalVariableHidesMemberVariable")\r
long span = baseTime2.getTime() - baseTime1.getTime();\r
span = span / (bCount2 - bCount1);\r
int i = 0;\r
class JpegFileFilter implements FilenameFilter {\r
@Override\r
public boolean accept(File dir, String name) {\r
- if (name.toUpperCase().matches(".*\\.JPG$")) {\r
- return true;\r
- }\r
- return false;\r
+ return name.toUpperCase().matches(".*\\.JPG$");\r
}\r
}\r
}
\ No newline at end of file
import org.w3c.dom.NodeList;
/**
- *
+ * @code{
* <trkpt lat="35.32123832" lon="139.56965631">
* <ele>47.20000076293945</ele>
* <time>2012-06-15T03:00:29Z</time>
* <magvar></magvar>
* <speed></speed>
* </trkpt>
- *
- * @author yuu
+ * }
*
*/
public class TagTrkpt {
- public Element trkpt = null;
- public Double lat = null;
- public Double lon = null;
- public String eleStr = null;
- public Date time = null;
- public String magvarStr = null;
- public String speedStr = null;
+ public Element trkpt = null;
+ public Double lat = null;
+ public Double lon = null;
+ public String eleStr = null;
+ public Date time = null;
+ public String magvarStr = null;
+ public String speedStr = null;
- public TagTrkpt(Element trkpt) {
- this.trkpt = (Element) trkpt.cloneNode(true);
+ public TagTrkpt(Element trkpt) {
+ this.trkpt = (Element) trkpt.cloneNode(true);
NamedNodeMap nodeMap = trkpt.getAttributes();
for (int j=0; j < nodeMap.getLength(); j++ ) {
if (node2 != null) {
if (node2.getNodeType() == Node.TEXT_NODE) {
try {
- this.time = ImportPicture.toUTCDate(node2.getNodeValue());
- } catch (ParseException e) {
- this.time = null;
- }
+ this.time = ImportPicture.toUTCDate(node2.getNodeValue());
+ } catch (ParseException e) {
+ this.time = null;
+ }
}
}
}
break;
}
}
- }
+ }
public void removeElement(String eleName) {
- Node child;
- for (child = trkpt.getFirstChild(); child != null; child = child.getNextSibling()) {
- NodeList nodeList = child.getChildNodes();
- for(int i = 0; i < nodeList.getLength(); i++) {
- Node grandChild = child.getChildNodes().item(i);
- if (grandChild.getNodeName().equals(eleName)) {
- child.removeChild(grandChild);
- }
- }
- }
+ Node child;
+ for (child = trkpt.getFirstChild(); child != null; child = child.getNextSibling()) {
+ NodeList nodeList = child.getChildNodes();
+ for(int i = 0; i < nodeList.getLength(); i++) {
+ Node grandChild = child.getChildNodes().item(i);
+ if (grandChild.getNodeName().equals(eleName)) {
+ child.removeChild(grandChild);
+ }
+ }
+ }
}
public void appendElement(String eleName, String valueStr) {
/**
* java.util.Date型をコレクションのKEYにした時に、時間順に並べ替える
*
- * @author yuu
*/
public class TimeComparator implements Comparator<Date>
{
- /**
- * 日付順にソート
- */
- @Override
- public int compare(Date arg0, Date arg1) {
- return arg0.compareTo(arg1);
- }
-
+ /**
+ * 日付順にソート
+ * @param arg0
+ * @param arg1
+ */
+ @Override
+ public int compare(Date arg0, Date arg1) {
+ return arg0.compareTo(arg1);
+ }
}
public class YuuLogFormatter extends Formatter {\r
private final SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");\r
\r
+ @Override\r
public String format(final LogRecord argLogRecord) {\r
final StringBuffer buf = new StringBuffer();\r
\r
class SymWindow extends java.awt.event.WindowAdapter
{
- public void windowClosing(java.awt.event.WindowEvent event)
- {
+ @Override
+ public void windowClosing(java.awt.event.WindowEvent event) {
Object object = event.getSource();
- if (object == AboutDialog.this)
+ if (object == AboutDialog.this) {
AboutDialog_WindowClosing(event);
+ }
}
}
class SymAction implements java.awt.event.ActionListener
{
- public void actionPerformed(java.awt.event.ActionEvent event)
- {
+ @Override
+ public void actionPerformed(java.awt.event.ActionEvent event) {
Object object = event.getSource();
- if (object == okButton)
+ if (object == okButton) {
okButton_Clicked(event);
+ }
}
}
- public AboutDialog(Frame parent, boolean modal)
- {
+ @SuppressWarnings("OverridableMethodCallInConstructor")
+ public AboutDialog(Frame parent, boolean modal) {
super(parent, modal);
// This code is automatically generated by Visual Cafe when you add
okButton.setLabel("OK");
okButton.setBounds(145,65,66,27);
add(okButton);
- label2 = new java.awt.Label("Copyright(C) 2014,2017, yuuhayashi \n The MIT License (MIT).",Label.RIGHT);
+ label2 = new java.awt.Label("Copyright(C) 2014,2018, yuuhayashi \n The MIT License (MIT).",Label.RIGHT);
label2.setBounds(10,40,340,20);
add(label2);
setTitle("About... "+ AdjustTime.PROGRAM_NAME);
SymAction lSymAction = new SymAction();
okButton.addActionListener(lSymAction);
//}}
-
}
- public AboutDialog(Frame parent, String title, boolean modal)
- {
+ @SuppressWarnings("OverridableMethodCallInConstructor")
+ public AboutDialog(Frame parent, String title, boolean modal) {
this(parent, modal);
setTitle(title);
}
- public void addNotify()
- {
+ @Override
+ public void addNotify() {
// Record the size of the window prior to calling parents addNotify.
super.addNotify();
// Only do this once.
- if (fComponentsAdjusted)
+ if (fComponentsAdjusted) {
return;
+ }
// Adjust components according to the insets
setSize(getInsets().left + getInsets().right + getSize().width, getInsets().top + getInsets().bottom + getSize().height);
Component components[] = getComponents();
- for (int i = 0; i < components.length; i++)
- {
- Point p = components[i].getLocation();
+ for (Component component : components) {
+ Point p = component.getLocation();
p.translate(getInsets().left, getInsets().top);
- components[i].setLocation(p);
+ component.setLocation(p);
}
// Used for addNotify check.
* @param b if true, show the component; otherwise, hide the component.
* @see java.awt.Component#isVisible
*/
- public void setVisible(boolean b)
- {
- if(b)
- {
+ @Override
+ public void setVisible(boolean b) {
+ if(b) {
Rectangle bounds = getParent().getBounds();
Rectangle abounds = getBounds();
setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
super.setVisible(b);
}
- void AboutDialog_WindowClosing(java.awt.event.WindowEvent event)
- {
+ void AboutDialog_WindowClosing(java.awt.event.WindowEvent event) {
dispose();
}
- void okButton_Clicked(java.awt.event.ActionEvent event)
- {
+ void okButton_Clicked(java.awt.event.ActionEvent event) {
//{{CONNECTION
// Clicked from okButton Hide the Dialog
dispose();
package osm.jp.gpx.matchtime.gui;
+
import java.awt.*;
import java.awt.event.ActionEvent;
import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
+import java.util.ResourceBundle;
import java.util.TimeZone;
-
import javax.swing.*;
-
import osm.jp.gpx.*;
-import org.apache.commons.imaging.ImageReadException;
-import org.apache.commons.imaging.ImageWriteException;
import org.apache.commons.imaging.Imaging;
import org.apache.commons.imaging.common.ImageMetadata;
import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
public class AdjustTime extends JFrame
{
public static final String PROGRAM_NAME = "AdjustTime for JOSM";
- public static final String PROGRAM_VARSION = "3.2";
- public static final String PROGRAM_UPDATE = "2017/06/28";
-
+ public static final String PROGRAM_VARSION = "8.01";
+ public static final String PROGRAM_UPDATE = "2018/09/17";
+
AppParameters params;
SimpleDateFormat dfjp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
// Used for addNotify check.
boolean fComponentsAdjusted = false;
+ public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
//{{DECLARE_CONTROLS
JPanel cardPanel; // ウィザード形式パネル(カード型)
}
}
- /**
- * データベース内のテーブルを一覧で表示するFrame
- * @throws IOException
- */
+ /**
+ * データベース内のテーブルを一覧で表示するFrame
+ * @throws IOException
+ */
+ @SuppressWarnings("OverridableMethodCallInConstructor")
public AdjustTime() throws IOException
{
dfjp.setTimeZone(TimeZone.getTimeZone("JST"));
cardPanel.setLayout(new CardLayout());
container.add(cardPanel, BorderLayout.CENTER);
- nextButton = new JButton("次へ");
+ nextButton = new JButton(i18n.getString("button.next"));
container.add(nextButton, BorderLayout.EAST);
- backButton = new JButton("戻る");
+ backButton = new JButton(i18n.getString("button.previous"));
container.add(backButton, BorderLayout.WEST);
cards = new JPanel[5];
int cardNo = 0;
cards[cardNo].setLayout(new BorderLayout());
JLabel label1 = new JLabel();
- label1.setText("<html><p>1. 位置情報を付加したい画像ファイルが格納されているフォルダを選択してください。</p><ul><li>コピー動作を行うと、ファイル更新時刻がコピーを実行した時刻に書き換わってしまうことがあります。オリジナルのカメラUSB内のフォルダを直接指定することをおすすめします。</li></ul>");
+ label1.setText(i18n.getString("label.100"));
cards[cardNo].add(label1, BorderLayout.NORTH);
argsPanel = new JPanel();
argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
- arg1_srcFolder = new ParameterPanelFolder("対象フォルダ: ", params.getProperty(AppParameters.IMG_SOURCE_FOLDER));
+ arg1_srcFolder = new ParameterPanelFolder(i18n.getString("label.110") +": ", params.getProperty(AppParameters.IMG_SOURCE_FOLDER));
argsPanel.add(arg1_srcFolder);
cards[cardNo].add(argsPanel, BorderLayout.CENTER);
cardNo++;
cards[cardNo].setLayout(new BorderLayout());
JLabel label2 = new JLabel();
- label2.setText("<html><p>2. 正確な撮影時刻が判明できる画像を選んでください。</p><ul><li>スマートフォンの時計画面(秒が判別できること)を撮影した画像</li><li>カメラの時計が正確ならば、どの画像を選んでも構いません。</li></ul>");
+ label2.setText(i18n.getString("label.200"));
cards[cardNo].add(label2, BorderLayout.NORTH);
argsPanel = new JPanel();
+
+ // 基準時刻画像
argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
- arg2_baseTimeImg = new ParameterPanelImageFile("基準時刻画像: ", params.getProperty(AppParameters.IMG_BASE_FILE), arg1_srcFolder);
+ arg2_baseTimeImg = new ParameterPanelImageFile(i18n.getString("label.210") +": ", params.getProperty(AppParameters.IMG_BASE_FILE), arg1_srcFolder);
argsPanel.add(arg2_baseTimeImg);
baseTimeGroup = new ButtonGroup();
- exifBase = new JRadioButton("EXIFの日時を基準にする");
- fupdateBase = new JRadioButton("File更新日時を基準にする");
+
+ // EXIFの日時を基準にする
+ exifBase = new JRadioButton(i18n.getString("label.220"));
+
+ // ファイル更新日時を基準にする
+ fupdateBase = new JRadioButton(i18n.getString("label.230"));
baseTimeGroup.add(exifBase);
baseTimeGroup.add(fupdateBase);
argsPanel.add(exifBase);
argsPanel = new JPanel();
argsPanel.setLayout(new GridLayout(2, 1));
+ // 3. 正確な撮影時刻を入力してください。
+ // カメラの時計が正確ならば、設定を変更する必要はありません。
JLabel label3 = new JLabel();
- label3.setText("<html><p>3. 正確な撮影時刻を入力してください。</p><ul><li>カメラの時計が正確ならば、設定を変更する必要はありません。</li></ul>");
+ label3.setText(i18n.getString("label.300"));
argsPanel.add(label3);
- arg3_basetime = new ParameterPanel(" 基準時刻: ", ImportPicture.TIME_FORMAT_STRING);
+
+ // 基準時刻:
+ String str310 = String.format(" %s: ", i18n.getString("label.310"));
+ arg3_basetime = new ParameterPanel(str310, ImportPicture.TIME_FORMAT_STRING);
argsPanel.add(arg3_basetime);
cards[cardNo].add(argsPanel, BorderLayout.NORTH);
// 4.GPXファイル設定画面
cardNo++;
cards[cardNo].setLayout(new BorderLayout());
+
+ // 4. ヒモ付を行うGPXファイルを選択してください。
+ // - フォルダを指定すると、フォルダ内のすべてのGPXファイルを対象とします。
JLabel label4 = new JLabel();
- label4.setText("<html><p>4. ヒモ付を行うGPXファイルを選択してください。</p><ul><li>フォルダを指定すると、フォルダ内にあるすべてのGPXファイルを対象とします。</li><li>カメラの時計が正確ならば、どの画像を選んでも構いません。</li></ul>");
+ label4.setText(i18n.getString("label.400"));
cards[cardNo].add(label4, BorderLayout.NORTH);
JPanel tmpPanel4a = new JPanel();
tmpPanel4a.setLayout(new BoxLayout(tmpPanel4a, BoxLayout.Y_AXIS));
- arg4_gpxFolder = new ParameterPanelGpx("GPXフォルダ: ", params.getProperty(AppParameters.GPX_SOURCE_FOLDER));
+
+ // "GPXフォルダ: "
+ arg4_gpxFolder = new ParameterPanelGpx(
+ i18n.getString("label.410") + ": ",
+ params.getProperty(AppParameters.GPX_SOURCE_FOLDER)
+ );
tmpPanel4a.add(arg4_gpxFolder);
- noFirstNode = new JCheckBox("<trkseg>セグメントの最初の1ノードは無視する。", params.getProperty(AppParameters.GPX_NO_FIRST_NODE).equals("ON"));
+
+ // "セグメント'trkseg'の最初の1ノードは無視する。"
+ noFirstNode = new JCheckBox(
+ i18n.getString("label.420"),
+ params.getProperty(AppParameters.GPX_NO_FIRST_NODE).equals("ON")
+ );
tmpPanel4a.add(noFirstNode);
- gpxReuse = new JCheckBox("生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。", params.getProperty(AppParameters.GPX_REUSE).equals("ON"));
+
+ // "生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も変換の対象にする"
+ gpxReuse = new JCheckBox(
+ i18n.getString("label.430"),
+ params.getProperty(AppParameters.GPX_REUSE).equals("ON")
+ );
gpxReuse.setEnabled(true);
tmpPanel4a.add(gpxReuse);
cards[cardNo].add(tmpPanel4a, BorderLayout.CENTER);
// 5.EXIF更新設定画面
cardNo++;
cards[cardNo].setLayout(new BorderLayout());
+
+ // 5. EXIF変換を行うかどうかを選択してください。
+ // - EXIF変換を行う場合には、変換ファイルを出力するフォルダも指定する必要があります。
+ // - 出力フォルダには、書き込み権限と、十分な空き容量が必要です。
JLabel label5 = new JLabel();
- label5.setText("<html><p>5. EXIF変換を行うかどうかを選択してください。</p><ul><li>EXIF変換を行う場合には、変換ファイルを出力するフォルダも指定する必要があります。</li><li>出力フォルダには、書き込み権限と、十分な空き容量が必要です。</li></ul>");
+ label5.setText(
+ String.format(
+ "<html><p>5. %s</p><ul><li>%s</li><li>%s</li></ul>",
+ i18n.getString("label.500"),
+ i18n.getString("label.501"),
+ i18n.getString("label.502")
+ )
+ );
cards[cardNo].add(label5, BorderLayout.NORTH);
JPanel tmpPanel5 = new JPanel();
tmpPanel5.setLayout(new BoxLayout(tmpPanel5, BoxLayout.Y_AXIS));
- outputIMG = new JCheckBox("IMGの変換をする", Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT)));
+ // "IMGの変換をする"
+ outputIMG = new JCheckBox(
+ i18n.getString("label.510"),
+ Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT))
+ );
tmpPanel5.add(outputIMG);
- outputIMG_all = new JCheckBox("GPXファイル時間外のファイルもコピーする", Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_ALL)));
+ // "GPXファイル時間外のファイルもコピーする"
+ outputIMG_all = new JCheckBox(
+ i18n.getString("label.520"),
+ Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_ALL))
+ );
tmpPanel5.add(outputIMG_all);
- arg5_outputFolder = new ParameterPanelFolder("出力フォルダ: ", params.getProperty(AppParameters.IMG_OUTPUT_FOLDER));
+ // "出力フォルダ: "
+ arg5_outputFolder = new ParameterPanelFolder(
+ i18n.getString("label.530") + ": ",
+ params.getProperty(AppParameters.IMG_OUTPUT_FOLDER)
+ );
tmpPanel5.add(arg5_outputFolder);
- exifON = new JCheckBox("EXIFの変換をする", Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_EXIF)));
+ // "EXIFの変換をする"
+ exifON = new JCheckBox(
+ i18n.getString("label.540"),
+ Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_EXIF))
+ );
tmpPanel5.add(exifON);
- gpxOutputWpt = new JCheckBox("出力GPXにポイントマーカー<WPT>を書き出す", Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_WPT)));
+ // "ポイントマーカー<WPT>をGPXファイルに出力する"
+ gpxOutputWpt = new JCheckBox(
+ i18n.getString("label.550"),
+ Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_WPT))
+ );
gpxOutputWpt.setEnabled(true);
tmpPanel5.add(gpxOutputWpt);
- gpxOverwriteMagvar = new JCheckBox("ソースGPXの<MAGVAR>を無視する", Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OVERWRITE_MAGVAR)));
+ // "ソースGPXの<MAGVAR>を無視する"
+ gpxOverwriteMagvar = new JCheckBox(
+ i18n.getString("label.560"),
+ Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OVERWRITE_MAGVAR))
+ );
gpxOverwriteMagvar.setEnabled(true);
tmpPanel5.add(gpxOverwriteMagvar);
- gpxOutputSpeed = new JCheckBox("出力GPXに<SPEED>を上書きする", Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_SPEED)));
+ // "出力GPXに<SPEED>を上書きする"
+ gpxOutputSpeed = new JCheckBox(
+ i18n.getString("label.570"),
+ Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_SPEED))
+ );
gpxOutputSpeed.setEnabled(true);
tmpPanel5.add(gpxOutputSpeed);
cards[cardNo].add(tmpPanel5, BorderLayout.CENTER);
- doButton = new JButton("処理実行", AdjustTime.createImageIcon("images/media_playback_start.png"));
+ // "処理実行"
+ doButton = new JButton(
+ i18n.getString("button.execute"),
+ AdjustTime.createImageIcon("images/media_playback_start.png")
+ );
cards[cardNo].add(doButton, BorderLayout.SOUTH);
//---------------------------------------------------------------------
// INIT_MENUS
menu1 = new java.awt.Menu("File");
- miExit = new java.awt.MenuItem(QuitDialog.TITLE);
+ miExit = new java.awt.MenuItem(i18n.getString("menu.quit"));
miExit.setFont(new Font("Dialog", Font.PLAIN, 12));
menu1.add(miExit);
mainMenuBar.add(menu1);
mainMenuBar.add(menu3);
setMenuBar(mainMenuBar);
-
//{{REGISTER_LISTENERS
SymWindow aSymWindow = new SymWindow();
* コマンドラインの引数はありません。
* @param args
*/
+ @SuppressWarnings("UseSpecificCatch")
static public void main(String args[]) {
SwingUtilities.invokeLater(() -> {
try {
- createAndShowGUI();
- } catch (Exception e) {
- e.printStackTrace();
- }
+ createAndShowGUI();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
});
}
private static void createAndShowGUI() throws IOException {
/**
* 選択された画像ファイルを表示する
* 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
- * @param ev
- * @throws ImageReadException
- * @throws ImageWriteException
+ * @param ev
*/
+ @SuppressWarnings("UseSpecificCatch")
public void imageView_Action(ActionEvent ev) {
String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
File timeFile = new File(path);
if (exifBase.isSelected()) {
- try {
+ try {
ImageMetadata meta = Imaging.getMetadata(timeFile);
JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
if (jpegMetadata != null) {
arg3_basetime.argField.setText("exif == null");
}
}
- }
- catch (Exception e) {}
+ }
+ catch (Exception e) {}
}
else {
- long lastModifyTime = timeFile.lastModified();
- arg3_basetime.argField.setText(dfjp.format(new Date(lastModifyTime)));
+ long lastModifyTime = timeFile.lastModified();
+ arg3_basetime.argField.setText(dfjp.format(new Date(lastModifyTime)));
}
int size_x = imageSPane.getWidth() - 8;
public void zoomin_Action(ActionEvent ev) {
if (refImage != null) {
- int size_x = imageLabel.getWidth();
- String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
- ImageIcon tmpIcon = new ImageIcon(path);
- refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT));
- imageLabel.setIcon(refImage);
+ int size_x = imageLabel.getWidth();
+ String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
+ ImageIcon tmpIcon = new ImageIcon(path);
+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT));
+ imageLabel.setIcon(refImage);
repaint();
}
}
public void zoomout_Action(ActionEvent ev) {
if (refImage != null) {
- int size_x = imageLabel.getWidth();
- ImageIcon tmpIcon = refImage;
- refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT));
- imageLabel.setIcon(refImage);
+ int size_x = imageLabel.getWidth();
+ ImageIcon tmpIcon = refImage;
+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT));
+ imageLabel.setIcon(refImage);
repaint();
}
}
JFileChooser fc;
//Set up the file chooser.
- File sdir = new File(arg1_srcFolder.getText());
- System.out.println(sdir.getPath());
- if (sdir.isDirectory()) {
- fc = new JFileChooser(sdir);
- }
- else {
- fc = new JFileChooser();
- }
-
- //Add a custom file filter and disable the default
- //(Accept All) file filter.
+ File sdir = new File(arg1_srcFolder.getText());
+ System.out.println(sdir.getPath());
+ if (sdir.isDirectory()) {
+ fc = new JFileChooser(sdir);
+ }
+ else {
+ fc = new JFileChooser();
+ }
+
+ //Add a custom file filter and disable the default
+ //(Accept All) file filter.
fc.addChoosableFileFilter(new ImageFilter());
fc.setAcceptAllFileFilterUsed(false);
//Add the preview pane.
fc.setAccessory(new ImagePreview(fc));
- //Show it.
- int returnVal = fc.showDialog(this, "選択");
+ //Show it. "選択"
+ int returnVal = fc.showDialog(this, i18n.getString("dialog.select"));
//Process the results.
if (returnVal == JFileChooser.APPROVE_OPTION) {
* @param event
*/
void outputIMG_Action (ActionEvent event) {
- arg5_outputFolder.setEnabled(outputIMG.isEnabled());
+ arg5_outputFolder.setEnabled(outputIMG.isEnabled());
}
/**
* [実行]ボタンをクリックしたときの動作
* @param event
*/
+ @SuppressWarnings("UseSpecificCatch")
void doButton_Action(java.awt.event.ActionEvent event) {
doButton.setEnabled(false);
this.params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
}
try {
- this.params.setProperty(AppParameters.IMG_SOURCE_FOLDER, arg1_srcFolder.getText());
- this.params.setProperty(AppParameters.IMG_BASE_FILE, arg2_baseTimeImg.getText());
- this.params.setProperty(AppParameters.IMG_TIME, ImportPicture.toUTCString(dfjp.parse(arg3_basetime.getText())));
- this.params.setProperty(AppParameters.IMG_OUTPUT, String.valueOf(outputIMG.isSelected()));
- this.params.setProperty(AppParameters.IMG_OUTPUT_FOLDER, arg5_outputFolder.getText());
- this.params.setProperty(AppParameters.IMG_OUTPUT_ALL, String.valueOf(outputIMG_all.isSelected()));
- this.params.setProperty(AppParameters.IMG_OUTPUT_EXIF, String.valueOf(exifON.isSelected()));
- this.params.setProperty(AppParameters.GPX_OVERWRITE_MAGVAR, String.valueOf(gpxOverwriteMagvar.isSelected()));
- this.params.setProperty(AppParameters.GPX_OUTPUT_SPEED, String.valueOf(gpxOutputSpeed.isSelected()));
- this.params.setProperty(AppParameters.GPX_OUTPUT_WPT, String.valueOf(gpxOutputWpt.isSelected()));
+ this.params.setProperty(AppParameters.IMG_SOURCE_FOLDER, arg1_srcFolder.getText());
+ this.params.setProperty(AppParameters.IMG_BASE_FILE, arg2_baseTimeImg.getText());
+ this.params.setProperty(AppParameters.IMG_TIME, ImportPicture.toUTCString(dfjp.parse(arg3_basetime.getText())));
+ this.params.setProperty(AppParameters.IMG_OUTPUT, String.valueOf(outputIMG.isSelected()));
+ this.params.setProperty(AppParameters.IMG_OUTPUT_FOLDER, arg5_outputFolder.getText());
+ this.params.setProperty(AppParameters.IMG_OUTPUT_ALL, String.valueOf(outputIMG_all.isSelected()));
+ this.params.setProperty(AppParameters.IMG_OUTPUT_EXIF, String.valueOf(exifON.isSelected()));
+ this.params.setProperty(AppParameters.GPX_OVERWRITE_MAGVAR, String.valueOf(gpxOverwriteMagvar.isSelected()));
+ this.params.setProperty(AppParameters.GPX_OUTPUT_SPEED, String.valueOf(gpxOutputSpeed.isSelected()));
+ this.params.setProperty(AppParameters.GPX_OUTPUT_WPT, String.valueOf(gpxOutputWpt.isSelected()));
this.params.store();
}
catch(Exception e) {
- e.printStackTrace();
+ e.printStackTrace();
}
(new DoDialog(this, argv)).setVisible(true);
package osm.jp.gpx.matchtime.gui;
+
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
String[] args; // コマンドパラメータ
private String commandName = ""; // コマンド名
@SuppressWarnings({ "rawtypes" })
- private Class cmd; // 実行対象インスタンス
+ private final Class cmd; // 実行対象インスタンス
/**
* コンストラクタ:実行対象のインスタンスを得る
JTextArea textArea; // 実行結果を表示するJTextArea (中央)
//}}
+ @SuppressWarnings("OverridableMethodCallInConstructor")
public DoDialog(JFrame parentFrame, String[] args) {
super(parentFrame, true); // モーダルダイアログを基盤にする
this.parentFrame = parentFrame;
this.args = args;
// INIT_CONTROLS
+ @SuppressWarnings("OverridableMethodCallInConstructor")
Container container = getContentPane();
container.setLayout(new BorderLayout());
parentFrame.setVisible(false);
super.addNotify();
- if (fComponentsAdjusted)
+ if (fComponentsAdjusted) {
return;
+ }
// Adjust components according to the insets
setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
* JTextAreaに書き出すOutputStream
*/
public static class JTextAreaOutputStream extends OutputStream {
- private ByteArrayOutputStream os;
+ private final ByteArrayOutputStream os;
/** 書き出し対象 */
- private JTextArea textArea;
- private String encode;
+ private final JTextArea textArea;
+ private final String encode;
public JTextAreaOutputStream(JTextArea textArea, String encode) {
this.textArea = textArea;
/**
* OutputStream#write(byte[])のオーバーライド
* @param arg
+ * @throws java.io.IOException
*/
@Override
public void write(int arg) throws IOException {
/**
* flush()でJTextAreaに書き出す
+ * @throws java.io.IOException
*/
@Override
public void flush() throws IOException {
// 文字列のエンコード
final String str = new String(this.os.toByteArray(), this.encode);
// 実際の書き出し処理
- SwingUtilities.invokeLater(new Runnable(){
- @Override
- public void run() {
- JTextAreaOutputStream.this.textArea.append(str);
+ SwingUtilities.invokeLater(
+ new Runnable(){
+ @Override
+ public void run() {
+ JTextAreaOutputStream.this.textArea.append(str);
+ }
}
- });
+ );
// 書き出した内容はクリアする
this.os.reset();
}
// 非同期に行う処理を記述するためのクラス
class LongTaskWorker extends SwingWorker<Object, Object> {
- private JButton button;
+ private final JButton button;
public LongTaskWorker(JButton button) {
this.button = button;
// 非同期に行われる処理
@Override
+ @SuppressWarnings("SleepWhileInLoop")
public Object doInBackground() {
// ながーい処理
PrintStream defOut = System.out;
public class GpxAndFolderFilter extends FileFilter {
+ @Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
String extension = Utils.getExtension(f);
if (extension != null) {
- if (extension.equals("gpx")) {
- return true;
- }
- else {
- return false;
- }
+ return extension.equals("gpx");
}
return false;
}
+ @Override
public String getDescription() {
return "Just GPXs";
}
ImageIcon tiffIcon = Utils.createImageIcon("images/tiffIcon.gif");
ImageIcon pngIcon = Utils.createImageIcon("images/pngIcon.png");
+ @Override
public String getName(File f) {
return null; //let the L&F FileView figure this out
}
+ @Override
public String getDescription(File f) {
return null; //let the L&F FileView figure this out
}
+ @Override
public Boolean isTraversable(File f) {
return null; //let the L&F FileView figure this out
}
+ @Override
public String getTypeDescription(File f) {
String extension = Utils.getExtension(f);
String type = null;
if (extension != null) {
- if (extension.equals(Utils.jpeg) ||
- extension.equals(Utils.jpg)) {
- type = "JPEG Image";
- } else if (extension.equals(Utils.gif)){
- type = "GIF Image";
- } else if (extension.equals(Utils.tiff) ||
- extension.equals(Utils.tif)) {
- type = "TIFF Image";
- } else if (extension.equals(Utils.png)){
- type = "PNG Image";
+ switch (extension) {
+ case Utils.jpeg:
+ case Utils.jpg:
+ type = "JPEG Image";
+ break;
+ case Utils.gif:
+ type = "GIF Image";
+ break;
+ case Utils.tiff:
+ case Utils.tif:
+ type = "TIFF Image";
+ break;
+ case Utils.png:
+ type = "PNG Image";
+ break;
+ default:
+ break;
}
}
return type;
}
+ @Override
public Icon getIcon(File f) {
String extension = Utils.getExtension(f);
Icon icon = null;
if (extension != null) {
- if (extension.equals(Utils.jpeg) ||
- extension.equals(Utils.jpg)) {
- icon = jpgIcon;
- } else if (extension.equals(Utils.gif)) {
- icon = gifIcon;
- } else if (extension.equals(Utils.tiff) ||
- extension.equals(Utils.tif)) {
- icon = tiffIcon;
- } else if (extension.equals(Utils.png)) {
- icon = pngIcon;
+ switch (extension) {
+ case Utils.jpeg:
+ case Utils.jpg:
+ icon = jpgIcon;
+ break;
+ case Utils.gif:
+ icon = gifIcon;
+ break;
+ case Utils.tiff:
+ case Utils.tif:
+ icon = tiffIcon;
+ break;
+ case Utils.png:
+ icon = pngIcon;
+ break;
+ default:
+ break;
}
}
return icon;
public class ImageFilter extends FileFilter {
//Accept all directories and all gif, jpg, tiff, or png files.
+ @Override
public boolean accept(File f) {
if (f.isDirectory()) {
return true;
String extension = Utils.getExtension(f);
if (extension != null) {
- if (extension.equals(Utils.tiff) ||
+ return extension.equals(Utils.tiff) ||
extension.equals(Utils.tif) ||
extension.equals(Utils.gif) ||
extension.equals(Utils.jpeg) ||
extension.equals(Utils.jpg) ||
- extension.equals(Utils.png)) {
- return true;
- } else {
- return false;
- }
+ extension.equals(Utils.png);
}
-
return false;
}
//The description of this filter
+ @Override
public String getDescription() {
return "Just Images";
}
static int IMAGE_SIZE_X = 320;
static int IMAGE_SIZE_Y = 240;
+ @SuppressWarnings({"LeakingThisInConstructor", "OverridableMethodCallInConstructor"})
public ImagePreview(JFileChooser fc) {
setPreferredSize(new Dimension(IMAGE_SIZE_X + 10, IMAGE_SIZE_Y + 10));
fc.addPropertyChangeListener(this);
}
}
+ @Override
public void propertyChange(PropertyChangeEvent e) {
boolean update = false;
String prop = e.getPropertyName();
- //If the directory changed, don't show an image.
if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
file = null;
update = true;
-
- //If a file became selected, find out which one.
- } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
+ }
+ else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
file = (File) e.getNewValue();
update = true;
}
-
- //Update the preview accordingly.
if (update) {
thumbnail = null;
if (isShowing()) {
}
}
+ @Override
protected void paintComponent(Graphics g) {
if (thumbnail == null) {
loadImage();
package osm.jp.gpx.matchtime.gui;
+
import java.awt.Dimension;
import java.awt.LayoutManager;
+import java.util.ResourceBundle;
import javax.swing.BoxLayout;
import javax.swing.JLabel;
* この1インスタンスで、1パラメータをあらわす。
*/
public class ParameterPanel extends JPanel {
- /**
- *
- */
- private static final long serialVersionUID = 4629824800747170556L;
- public JTextField argField;
+ private static final long serialVersionUID = 4629824800747170556L;
+ public JTextField argField;
public JLabel argLabel;
+ public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
- public ParameterPanel(String label, String text) {
- super();
-
- argLabel = new JLabel(label);
- argField = new JTextField(text);
+ @SuppressWarnings("OverridableMethodCallInConstructor")
+ public ParameterPanel(String label, String text) {
+ super();
+
+ argLabel = new JLabel(label);
+ argField = new JTextField(text);
this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
this.setMaximumSize(new Dimension(1920, 40));
this.add(argLabel);
this.add(argField);
- }
-
- public String getText() {
- return this.argField.getText();
- }
-
- public ParameterPanel(boolean isDoubleBuffered) {
- super(isDoubleBuffered);
- // TODO 自動生成されたコンストラクター・スタブ
- }
-
- public ParameterPanel(LayoutManager layout) {
- super(layout);
- // TODO 自動生成されたコンストラクター・スタブ
- }
-
- public ParameterPanel(LayoutManager layout, boolean isDoubleBuffered) {
- super(layout, isDoubleBuffered);
- // TODO 自動生成されたコンストラクター・スタブ
- }
+ }
+
+ public String getText() {
+ return this.argField.getText();
+ }
+
+ public ParameterPanel(boolean isDoubleBuffered) {
+ super(isDoubleBuffered);
+ // TODO 自動生成されたコンストラクター・スタブ
+ }
+
+ public ParameterPanel(LayoutManager layout) {
+ super(layout);
+ // TODO 自動生成されたコンストラクター・スタブ
+ }
+
+ public ParameterPanel(LayoutManager layout, boolean isDoubleBuffered) {
+ super(layout, isDoubleBuffered);
+ // TODO 自動生成されたコンストラクター・スタブ
+ }
}
import javax.swing.JFileChooser;
@SuppressWarnings("serial")
-public class ParameterPanelFolder extends ParameterPanel implements ActionListener {
- JFileChooser fc;
- JButton openButton;
- int chooser;
+public class ParameterPanelFolder extends ParameterPanel implements ActionListener
+{
+ JFileChooser fc;
+ JButton openButton;
+ int chooser;
- public ParameterPanelFolder(String label, String text, int chooser) {
- super(label, text);
+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
+ public ParameterPanelFolder(String label, String text, int chooser) {
+ super(label, text);
- //Create a file chooser
- this.chooser = chooser;
+ // Create a file chooser
+ this.chooser = chooser;
- openButton = new JButton("選択...", AdjustTime.createImageIcon("images/Open16.gif"));
+ // "選択..."
+ openButton = new JButton(
+ i18n.getString("button.select"),
+ AdjustTime.createImageIcon("images/Open16.gif")
+ );
openButton.addActionListener(this);
this.add(openButton);
- }
-
- public ParameterPanelFolder(String label, String text) {
- this(label, text, JFileChooser.DIRECTORIES_ONLY);
- }
-
- public void setEnable(boolean f) {
- super.setEnabled(f);
- openButton.setEnabled(f);
- }
+ }
+
+ public ParameterPanelFolder(String label, String text) {
+ this(label, text, JFileChooser.DIRECTORIES_ONLY);
+ }
+
+ public void setEnable(boolean f) {
+ super.setEnabled(f);
+ openButton.setEnabled(f);
+ }
+ @Override
public void actionPerformed(ActionEvent e) {
- if (e.getSource() == openButton){
- System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
- File sdir = new File(this.argField.getText());
- if (sdir.exists()) {
- this.fc = new JFileChooser(sdir);
- }
- else {
- this.fc = new JFileChooser();
- }
- this.fc.setFileSelectionMode(this.chooser);
-
- int returnVal = this.fc.showOpenDialog(ParameterPanelFolder.this);
-
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = this.fc.getSelectedFile();
- this.argField.setText(file.getAbsolutePath());
- }
- }
+ if (e.getSource() == openButton){
+ System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
+ File sdir = new File(this.argField.getText());
+ if (sdir.exists()) {
+ this.fc = new JFileChooser(sdir);
+ }
+ else {
+ this.fc = new JFileChooser();
+ }
+ this.fc.setFileSelectionMode(this.chooser);
+
+ int returnVal = this.fc.showOpenDialog(ParameterPanelFolder.this);
+
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = this.fc.getSelectedFile();
+ this.argField.setText(file.getAbsolutePath());
+ }
+ }
}
}
\ No newline at end of file
import javax.swing.JFileChooser;
@SuppressWarnings("serial")
-public class ParameterPanelGpx extends ParameterPanel implements ActionListener {
- JFileChooser fc;
- JButton openButton;
+public class ParameterPanelGpx extends ParameterPanel implements ActionListener
+{
+ JFileChooser fc;
+ JButton openButton;
- public ParameterPanelGpx(String label, String text) {
- super(label, text);
+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
+ public ParameterPanelGpx(String label, String text) {
+ super(label, text);
- openButton = new JButton("選択...", AdjustTime.createImageIcon("images/Open16.gif"));
+ // "選択..."
+ openButton = new JButton(
+ i18n.getString("button.select"),
+ AdjustTime.createImageIcon("images/Open16.gif")
+ );
openButton.addActionListener(this);
this.add(openButton);
- }
+ }
- public void setEnable(boolean f) {
- super.setEnabled(f);
- openButton.setEnabled(f);
- }
+ public void setEnable(boolean f) {
+ super.setEnabled(f);
+ openButton.setEnabled(f);
+ }
+ @Override
public void actionPerformed(ActionEvent e) {
- if (e.getSource() == openButton){
- System.out.println("ParameterPanelGpx.actionPerformed(openButton)");
- File sdir = new File(this.argField.getText());
- if (sdir.exists()) {
- this.fc = new JFileChooser(sdir);
- }
- else {
- this.fc = new JFileChooser();
- }
- this.fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
- this.fc.addChoosableFileFilter(new GpxAndFolderFilter());
- this.fc.setAcceptAllFileFilterUsed(false);
-
- int returnVal = this.fc.showOpenDialog(ParameterPanelGpx.this);
-
- if (returnVal == JFileChooser.APPROVE_OPTION) {
- File file = this.fc.getSelectedFile();
- this.argField.setText(file.getAbsolutePath());
- }
- }
+ if (e.getSource() == openButton){
+ System.out.println("ParameterPanelGpx.actionPerformed(openButton)");
+ File sdir = new File(this.argField.getText());
+ if (sdir.exists()) {
+ this.fc = new JFileChooser(sdir);
+ }
+ else {
+ this.fc = new JFileChooser();
+ }
+ this.fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
+ this.fc.addChoosableFileFilter(new GpxAndFolderFilter());
+ this.fc.setAcceptAllFileFilterUsed(false);
+
+ int returnVal = this.fc.showOpenDialog(ParameterPanelGpx.this);
+
+ if (returnVal == JFileChooser.APPROVE_OPTION) {
+ File file = this.fc.getSelectedFile();
+ this.argField.setText(file.getAbsolutePath());
+ }
+ }
}
}
@SuppressWarnings("serial")
public class ParameterPanelImageFile extends ParameterPanel implements ActionListener {
- JFileChooser fc;
- JButton openButton;
- ParameterPanelFolder paramDir;
+ JFileChooser fc;
+ JButton openButton;
+ ParameterPanelFolder paramDir;
- public ParameterPanelImageFile(String label, String text, ParameterPanelFolder paramDir) {
- super(label, text);
+ @SuppressWarnings("OverridableMethodCallInConstructor")
+ public ParameterPanelImageFile(String label, String text, ParameterPanelFolder paramDir) {
+ super(label, text);
- //Create the open button. We use the image from the JLF
- //Graphics Repository (but we extracted it from the jar).
- openButton = new JButton("選択...");
+ // "選択..."
+ openButton = new JButton(i18n.getString("button.select"));
/*
openButton.addActionListener(this);
//Create a file chooser
this.paramDir = paramDir;
- }
+ }
- public void actionPerformed(ActionEvent e) {
- /*
+ @SuppressWarnings("override")
+ public void actionPerformed(ActionEvent e) {
+ /*
//Set up the file chooser.
File sdir = new File(paramDir.getText());
System.out.println(sdir.toPath());
@SuppressWarnings("serial")
public class ParameterPanelSelecter extends JPanel implements ActionListener {
- public static final int ITEM_WIDTH_1 = 160;
- public static final int ITEM_WIDTH_2 = 240;
+ public static final int ITEM_WIDTH_1 = 160;
+ public static final int ITEM_WIDTH_2 = 240;
public static final int LINE_WIDTH = ITEM_WIDTH_1 + ITEM_WIDTH_2;
public static final int LINE_HEIGHT = 18;
- public JLabel label;
- public JComboBox<String> field;
- public String value;
+ public JLabel label;
+ public JComboBox<String> field;
+ public String value;
- public ParameterPanelSelecter(String title, String[] items) {
- super(null);
- this.value = items[0];
+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
+ public ParameterPanelSelecter(String title, String[] items) {
+ super(null);
+ this.value = items[0];
- this.label = new JLabel(title, JLabel.RIGHT);
- this.label.setBounds(0, 0, ITEM_WIDTH_1 - 6, LINE_HEIGHT);
- add(this.label);
+ this.label = new JLabel(title, JLabel.RIGHT);
+ this.label.setBounds(0, 0, ITEM_WIDTH_1 - 6, LINE_HEIGHT);
+ add(this.label);
- this.field = new JComboBox<String>();
- this.field.addActionListener(this);
- for (int i=0; i < items.length; i++) {
- this.field.addItem(items[i]);
- }
- this.field.setBounds(ITEM_WIDTH_1, 0, ITEM_WIDTH_2, LINE_HEIGHT);
- add(this.field);
-
- setPreferredSize(new Dimension(ITEM_WIDTH_1, LINE_HEIGHT));
- }
+ this.field = new JComboBox<>();
+ this.field.addActionListener(this);
+ for (String item : items) {
+ this.field.addItem(item);
+ }
+ this.field.setBounds(ITEM_WIDTH_1, 0, ITEM_WIDTH_2, LINE_HEIGHT);
+ add(this.field);
+
+ setPreferredSize(new Dimension(ITEM_WIDTH_1, LINE_HEIGHT));
+ }
- @Override
- public void actionPerformed(ActionEvent e) {
- this.value = (String)this.field.getSelectedItem();
- }
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ this.value = (String)this.field.getSelectedItem();
+ }
}
\ No newline at end of file
@SuppressWarnings("serial")
public class ParameterPanelTime extends ParameterPanel implements ActionListener {
- JFileChooser fc;
- public JButton doButton;
+ JFileChooser fc;
+ public JButton doButton;
- public ParameterPanelTime(String label, String text) {
- super(label, text);
+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
+ public ParameterPanelTime(String label, String text) {
+ super(label, text);
doButton = new JButton("処理実行", AdjustTime.createImageIcon("images/media_playback_start.png"));
doButton.addActionListener(this);
this.add(doButton);
- }
+ }
+ @Override
public void actionPerformed(ActionEvent e) {
}
}
\ No newline at end of file
import java.awt.Window;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
+import java.util.ResourceBundle;
import javax.swing.JButton;
import javax.swing.JDialog;
@SuppressWarnings("serial")
public class QuitDialog extends JDialog implements WindowListener
{
- public static final String TITLE = "終了?";
JButton yesButton;
JButton noButton;
JLabel label1;
+ @SuppressWarnings("OverridableMethodCallInConstructor")
public QuitDialog(JFrame parent, boolean modal) {
super(parent, modal);
+
+ ResourceBundle i18n = ResourceBundle.getBundle("i18n");
+
addWindowListener((WindowListener) this);
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setLayout(null);
setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135);
- yesButton = new JButton(" 終了 ");
+ yesButton = new JButton(String.format(" %s ", i18n.getString("dialog.quit")));
yesButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
+ @Override
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((Window)getParent(), 201));
System.exit(0);
- }
+ }
});
yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22);
yesButton.setFont(new Font("Dialog", 1, 12));
add(yesButton);
- noButton = new JButton("キャンセル");
+ noButton = new JButton(i18n.getString("dialog.cancel"));
noButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
- setVisible(false);
- }
+ @Override
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
+ setVisible(false);
+ }
});
noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22);
noButton.setFont(new Font("Dialog", 1, 12));
add(noButton);
- label1 = new JLabel("プログラムを終了します。", JLabel.CENTER);
+ label1 = new JLabel(i18n.getString("dialog.msg1"), JLabel.CENTER);
label1.setBounds(78, 33, 180, 23);
add(label1);
- setTitle("プログラムの終了");
+ setTitle(i18n.getString("dialog.msg1"));
setResizable(false);
setVisible(true);
}
+ @Override
public void setVisible(boolean b) {
if(b) {
Rectangle bounds = getParent().getBounds();
}
- public void windowActivated(WindowEvent e) {
- }
+ @Override
+ public void windowActivated(WindowEvent e) {
+ }
- public void windowClosed(WindowEvent e) {
- setVisible(false);
- }
+ @Override
+ public void windowClosed(WindowEvent e) {
+ setVisible(false);
+ }
- public void windowClosing(WindowEvent e) {
- setVisible(false);
- }
+ @Override
+ public void windowClosing(WindowEvent e) {
+ setVisible(false);
+ }
- public void windowDeactivated(WindowEvent e) {
- }
+ @Override
+ public void windowDeactivated(WindowEvent e) {
+ }
- public void windowDeiconified(WindowEvent e) {
- }
+ @Override
+ public void windowDeiconified(WindowEvent e) {
+ }
- public void windowIconified(WindowEvent e) {
- }
+ @Override
+ public void windowIconified(WindowEvent e) {
+ }
- public void windowOpened(WindowEvent e) {
- }
+ @Override
+ public void windowOpened(WindowEvent e) {
+ }
}
return ext;
}
- /** Returns an ImageIcon, or null if the path was invalid. */
+ /** Returns an ImageIcon, or null if the path was invalid.
+ * @param path
+ * @return
+ */
protected static ImageIcon createImageIcon(String path) {
java.net.URL imgURL = Utils.class.getResource(path);
if (imgURL != null) {
package osm.jp.gpx.utils;
-
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
else {
File dir = new File(destPath.getParent());
if (!dir.exists()) {
- dir.mkdirs();
+ dir.mkdirs();
}
destPath.createNewFile();
byte[] btoRead = new byte[1024];
- BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath));
- int len = 0;
-
- while ((len = tarIn.read(btoRead)) != -1) {
- bout.write(btoRead, 0, len);
+ try (BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath))) {
+ int len = 0;
+ while ((len = tarIn.read(btoRead)) != -1) {
+ bout.write(btoRead, 0, len);
+ }
}
-
- bout.close();
destPath.setLastModified(tarEntry.getLastModifiedDate().getTime());
btoRead = null;
}
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.nio.channels.FileChannel;
import org.junit.After;
@RunWith(Enclosed.class)
public class AppParametersTest {
-
- public static class 定義ファイルが存在しない場合 {
- AppParameters params;
-
- @Before
- public void setUp() throws Exception {
- File iniFile = new File("AdjustTime.ini");
- File orgFile = new File("AdjustTime.ini.org");
-
- if (orgFile.exists()) {
- orgFile.delete();
- }
- if (iniFile.exists()) {
- iniFile.renameTo(orgFile);
- }
- }
-
- @After
- public void tearDown() throws Exception {
- File iniFile = new File("AdjustTime.ini");
- File orgFile = new File("AdjustTime.ini.org");
- if (iniFile.exists()) {
- iniFile.delete();
- }
- if (orgFile.exists()) {
- orgFile.renameTo(iniFile);
- }
- }
-
- @Test
- public void IMG_OUTPUT_ALLが定義されていない時() {
- try {
- params = new AppParameters("testdata/AdjustTime.off.ini");
- String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
- assertThat(valueStr, is("false"));
- }
- catch (Exception e) {
- fail("Exceptionが発生した。");
- }
- }
- }
-
- public static class 定義ファイルがtureに定義されているとき {
-
- @Before
- public void setUp() throws Exception {
- File iniFile = new File("AdjustTime.ini");
- File orgFile = new File("AdjustTime.ini.org");
- File testFile = new File("testdata", "AdjustTime.on.ini");
-
- if (orgFile.exists()) {
- orgFile.delete();
- }
- if (iniFile.exists()) {
- iniFile.renameTo(orgFile);
- }
-
- FileInputStream inStream = new FileInputStream(testFile);
- FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
- FileChannel inChannel = inStream.getChannel();
- FileChannel outChannel = outStream.getChannel();
- try {
- inChannel.transferTo(0, inChannel.size(),outChannel);
- }
- finally {
- if (inChannel != null) inChannel.close();
- if (outChannel != null) outChannel.close();
- inStream.close();
- outStream.close();
- }
- }
-
- @After
- public void tearDown() throws Exception {
- File iniFile = new File("AdjustTime.ini");
- File orgFile = new File("AdjustTime.ini.org");
- if (iniFile.exists()) {
- iniFile.delete();
- }
- if (orgFile.exists()) {
- orgFile.renameTo(iniFile);
- }
- }
-
- @Test
- public void IMG_OUTPUT_ALLがtureに定義されているとき() {
- try {
- AppParameters params;
- params = new AppParameters();
- String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
- assertThat(valueStr, is("true"));
- }
- catch (Exception e) {
- fail("Exceptionが発生した。");
- }
- }
-
- @Test
- public void IMG_OUTPUT_ALLをfalseに書き換える() {
- try {
- AppParameters params = new AppParameters();
- params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
- params.store();
- params = null;
- AppParameters newParams = new AppParameters();
- String valueStr = newParams.getProperty(AppParameters.IMG_OUTPUT_ALL);
- assertThat(valueStr, is("false"));
- }
- catch (Exception e) {
- fail("Exceptionが発生した。");
- }
- }
- }
-
- public static class 定義ファイルがfalseに定義されているとき {
-
- @Before
- public void setUp() throws Exception {
- File iniFile = new File("AdjustTime.ini");
- File orgFile = new File("AdjustTime.ini.org");
- File testFile = new File("testdata", "AdjustTime.off.ini");
-
- if (orgFile.exists()) {
- orgFile.delete();
- }
- if (iniFile.exists()) {
- iniFile.renameTo(orgFile);
- }
-
- FileInputStream inStream = new FileInputStream(testFile);
- FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
- FileChannel inChannel = inStream.getChannel();
- FileChannel outChannel = outStream.getChannel();
- try {
- inChannel.transferTo(0, inChannel.size(),outChannel);
- }
- finally {
- if (inChannel != null) inChannel.close();
- if (outChannel != null) outChannel.close();
- inStream.close();
- outStream.close();
- }
- }
-
- @After
- public void tearDown() throws Exception {
- File iniFile = new File("AdjustTime.ini");
- File orgFile = new File("AdjustTime.ini.org");
- if (iniFile.exists()) {
- iniFile.delete();
- }
- if (orgFile.exists()) {
- orgFile.renameTo(iniFile);
- }
- }
-
- @Test
- public void IMG_OUTPUT_ALLがfalseに定義されているとき() {
- try {
- AppParameters params = new AppParameters();
- String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
- assertThat(valueStr, is("false"));
- }
- catch (Exception e) {
- fail("Exceptionが発生した。");
- }
- }
-
- @Test
- public void IMG_OUTPUT_ALLをtrueに書き換える() {
- try {
- AppParameters params = new AppParameters();
- params.setProperty(AppParameters.IMG_OUTPUT_ALL, "true");
- params.store();
- params = null;
- AppParameters newParams = new AppParameters();
- String valueStr = newParams.getProperty(AppParameters.IMG_OUTPUT_ALL);
- assertThat(valueStr, is("true"));
- }
- catch (Exception e) {
- fail("Exceptionが発生した。");
- }
- }
- }
+
+ public static class 定義ファイルが存在しない場合 {
+ AppParameters params;
+
+ @Before
+ public void setUp() throws Exception {
+ File iniFile = new File("AdjustTime.ini");
+ File orgFile = new File("AdjustTime.ini.org");
+
+ if (orgFile.exists()) {
+ orgFile.delete();
+ }
+ if (iniFile.exists()) {
+ iniFile.renameTo(orgFile);
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ File iniFile = new File("AdjustTime.ini");
+ File orgFile = new File("AdjustTime.ini.org");
+ if (iniFile.exists()) {
+ iniFile.delete();
+ }
+ if (orgFile.exists()) {
+ orgFile.renameTo(iniFile);
+ }
+ }
+
+ @Test
+ public void IMG_OUTPUT_ALLが定義されていない時() {
+ try {
+ params = new AppParameters("testdata/AdjustTime.off.ini");
+ String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
+ assertThat(valueStr, is("false"));
+ }
+ catch (IOException e) {
+ fail("Exceptionが発生した。");
+ }
+ }
+ }
+
+ public static class 定義ファイルがtureに定義されているとき {
+
+ @Before
+ public void setUp() throws Exception {
+ File iniFile = new File("AdjustTime.ini");
+ File orgFile = new File("AdjustTime.ini.org");
+ File testFile = new File("testdata", "AdjustTime.on.ini");
+
+ if (orgFile.exists()) {
+ orgFile.delete();
+ }
+ if (iniFile.exists()) {
+ iniFile.renameTo(orgFile);
+ }
+
+ FileInputStream inStream = new FileInputStream(testFile);
+ FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
+ FileChannel inChannel = inStream.getChannel();
+ FileChannel outChannel = outStream.getChannel();
+ try {
+ inChannel.transferTo(0, inChannel.size(),outChannel);
+ }
+ finally {
+ if (inChannel != null) inChannel.close();
+ if (outChannel != null) outChannel.close();
+ inStream.close();
+ outStream.close();
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ File iniFile = new File("AdjustTime.ini");
+ File orgFile = new File("AdjustTime.ini.org");
+ if (iniFile.exists()) {
+ iniFile.delete();
+ }
+ if (orgFile.exists()) {
+ orgFile.renameTo(iniFile);
+ }
+ }
+
+ @Test
+ public void IMG_OUTPUT_ALLがtureに定義されているとき() {
+ try {
+ AppParameters params;
+ params = new AppParameters();
+ String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
+ assertThat(valueStr, is("true"));
+ }
+ catch (IOException e) {
+ fail("Exceptionが発生した。");
+ }
+ }
+
+ @Test
+ public void IMG_OUTPUT_ALLをfalseに書き換える() {
+ try {
+ AppParameters params = new AppParameters();
+ params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
+ params.store();
+ params = null;
+ AppParameters newParams = new AppParameters();
+ String valueStr = newParams.getProperty(AppParameters.IMG_OUTPUT_ALL);
+ assertThat(valueStr, is("false"));
+ }
+ catch (IOException e) {
+ fail("Exceptionが発生した。");
+ }
+ }
+ }
+
+ public static class 定義ファイルがfalseに定義されているとき {
+
+ @Before
+ public void setUp() throws Exception {
+ File iniFile = new File("AdjustTime.ini");
+ File orgFile = new File("AdjustTime.ini.org");
+ File testFile = new File("testdata", "AdjustTime.off.ini");
+
+ if (orgFile.exists()) {
+ orgFile.delete();
+ }
+ if (iniFile.exists()) {
+ iniFile.renameTo(orgFile);
+ }
+
+ FileInputStream inStream = new FileInputStream(testFile);
+ FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
+ FileChannel inChannel = inStream.getChannel();
+ FileChannel outChannel = outStream.getChannel();
+ try {
+ inChannel.transferTo(0, inChannel.size(),outChannel);
+ }
+ finally {
+ if (inChannel != null) inChannel.close();
+ if (outChannel != null) outChannel.close();
+ inStream.close();
+ outStream.close();
+ }
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ File iniFile = new File("AdjustTime.ini");
+ File orgFile = new File("AdjustTime.ini.org");
+ if (iniFile.exists()) {
+ iniFile.delete();
+ }
+ if (orgFile.exists()) {
+ orgFile.renameTo(iniFile);
+ }
+ }
+
+ @Test
+ public void IMG_OUTPUT_ALLがfalseに定義されているとき() {
+ try {
+ AppParameters params = new AppParameters();
+ String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
+ assertThat(valueStr, is("false"));
+ }
+ catch (IOException e) {
+ fail("Exceptionが発生した。");
+ }
+ }
+
+ @Test
+ public void IMG_OUTPUT_ALLをtrueに書き換える() {
+ try {
+ AppParameters params = new AppParameters();
+ params.setProperty(AppParameters.IMG_OUTPUT_ALL, "true");
+ params.store();
+ params = null;
+ AppParameters newParams = new AppParameters();
+ String valueStr = newParams.getProperty(AppParameters.IMG_OUTPUT_ALL);
+ assertThat(valueStr, is("true"));
+ }
+ catch (IOException e) {
+ fail("Exceptionが発生した。");
+ }
+ }
+ }
}
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.CoreMatchers.nullValue;
import static org.junit.Assert.*;
-
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
-import java.util.Iterator;
-
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
-
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.runners.Enclosed;
@RunWith(Enclosed.class)
public class ElementMapTRKPTTest {
-
- public static class Keyのみ {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
- ElementMapTRKPT map = null;
- long timeL;
- static String[] values = {
- "1970-01-01 08:59:59.999",
- "1970-01-01 09:00:00.000",
- "1970-01-01 09:00:00.001",
- "2018-10-25 07:59:59.999",
- "2018-10-25 08:00:00.000",
- "2018-10-25 08:00:00.001"
- };
-
- @Before
- public void setUp() throws Exception {
- timeL = (sdf.parse("2018-10-25 08:00:00.000")).getTime();
- map = new ElementMapTRKPT();
- map.put(new Date(timeL), null); // 5-6: 2018-10-25 08:00:00.000
- map.put(new Date(timeL + 1L), null); // 7: 2018-10-25 08:00:00.001
- map.put(new Date(timeL - 1L), null); // 4: 2018-10-25 07:59:59.999
- map.put(new Date(1L), null); // 3: 1970-01-01 09:00:00.001
- map.put(new Date(0L), null); // 2: 1970-01-01 09:00:00.000
- map.put(new Date(-1L), null); // 1: 1970-01-01 08:59:59.999
- map.put(new Date(timeL), null); // 5-6: 2018-10-25 08:00:00.000
- }
-
- @Test
- public void 同一キーをPUTした場合() {
- assertThat(map.size(), is(6));
- }
-
- @Test
- public void イテレータを使って読みだす() {
- assertThat(map.size(), is(6));
-
- int i = 0;
- for (Iterator<Date> itr = map.keySet().iterator(); itr.hasNext(); ) {
- Date key = itr.next();
- assertThat(sdf.format(key), is(values[i++]));
- }
- }
-
- @Test
- public void 拡張FOR文を使って読みだす() {
- assertThat(map.size(), is(6));
-
- int i = 0;
- for (Date key : map.keySet()) {
- assertThat(sdf.format(key), is(values[i++]));
- }
- }
- }
-
- public static class Keyとvalueのセット {
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
- ElementMapTRKPT map = null;
- long timeL;
-
- /*
- * <trkpt lat="35.8812697884" lon="137.9952202085"><time>2017-05-29T01:23:18Z</time></trkpt>
- * <trkpt lat="35.8811769169" lon="137.9951928835"><time>2017-05-29T01:23:21Z</time><ele>614.90</ele></trkpt>
- * <trkpt lat="35.881112963" lon="137.9951796401"><time>2017-05-29T01:23:24Z</time><ele>615.00</ele></trkpt>
- * <trkpt lat="35.881072646" lon="137.9951728508"><time>2017-05-29T01:23:27Z</time><ele>615.03</ele></trkpt>
- */
- static String[][] values = {
- {"2017-05-29T01:23:18Z", "35.8812697884", "137.9952202085", null},
- {"2017-05-29T01:23:21Z", "35.8811769169", "137.9951928835", "614.90"},
- {"2017-05-29T01:23:24Z", "35.881112963", "137.9951796401", "615.00"},
- {"2017-05-29T01:23:27Z", "35.881072646", "137.9951728508", "615.03"}
- };
-
- Element createElement(Document document, String[] values) {
- Element trkpt = document.createElement("trkpt");
- trkpt.setAttribute("lat", values[1]);
- trkpt.setAttribute("lon", values[2]);
- Element timeE = document.createElement("time");
- timeE.appendChild(document.createTextNode(values[0]));
- trkpt.appendChild(timeE);
- if (values[3] != null) {
- Element eleE = document.createElement("ele");
- eleE.appendChild(document.createTextNode(values[3]));
- trkpt.appendChild(eleE);
- }
- return trkpt;
- }
-
- @Before
- public void setUp() throws Exception {
- Complementation.param_GpxOverwriteMagvar = true;
-
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder builder = factory.newDocumentBuilder();
- DOMImplementation domImpl=builder.getDOMImplementation();
- Document document = domImpl.createDocument("","trkpt",null);
-
- map = new ElementMapTRKPT();
- for (int cnt = 4; cnt > 0; cnt--) {
- map.put(new TagTrkpt(createElement(document, values[cnt - 1])));
- }
- }
-
- @Test
- public void コンテンツの数をチェック() {
- assertThat(map.size(), is(4));
- }
-
- @Test
- public void KEYが時間順に取り出せるか() {
- int i = 0;
- for (Date key : map.keySet()) {
- try {
- String s = sdf.format(ImportPicture.toUTCDate(values[i++][0]));
- assertThat(sdf.format(key), is(s));
- } catch (ParseException e) {
- e.printStackTrace();
- }
- }
- }
-
- @Test
- public void get_17() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:17Z"));
- assertThat(tag, is(nullValue()));
- }
-
- @Test
- public void get_18() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:18Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
- assertThat(tag.eleStr, is(nullValue()));
- assertThat(tag.lat, is((new Double(values[0][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[0][2])).doubleValue()));
- assertThat(tag.magvarStr, is(nullValue()));
- }
-
- @Test
- public void get_19() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:19Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
- assertThat(tag.eleStr, is(nullValue()));
- assertThat(tag.lat, is((new Double(values[0][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[0][2])).doubleValue()));
- assertThat(tag.magvarStr, is(nullValue()));
- }
-
- @Test
- public void get_20() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:20Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
- assertThat(tag.eleStr, is(nullValue()));
- assertThat(tag.lat, is((new Double(values[0][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[0][2])).doubleValue()));
- assertThat(tag.magvarStr, is(nullValue()));
- }
-
- @Test
- public void get_21() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:21Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
- assertThat(tag.eleStr, is("614.90"));
- assertThat(tag.lat, is((new Double(values[1][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[1][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_22() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:22Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
- assertThat(tag.eleStr, is("614.90"));
- assertThat(tag.lat, is((new Double(values[1][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[1][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_23() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:23Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
- assertThat(tag.eleStr, is("614.90"));
- assertThat(tag.lat, is((new Double(values[1][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[1][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_24() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:24Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
- assertThat(tag.eleStr, is("615.00"));
- assertThat(tag.lat, is((new Double(values[2][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[2][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_25() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:25Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
- assertThat(tag.eleStr, is("615.00"));
- assertThat(tag.lat, is((new Double(values[2][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[2][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_26() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:26Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
- assertThat(tag.eleStr, is("615.00"));
- assertThat(tag.lat, is((new Double(values[2][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[2][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_27() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:27Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
- assertThat(tag.eleStr, is("615.03"));
- assertThat(tag.lat, is((new Double(values[3][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[3][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_28() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:28Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
- assertThat(tag.eleStr, is("615.03"));
- assertThat(tag.lat, is((new Double(values[3][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[3][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_30() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:30Z"));
- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
- assertThat(tag.eleStr, is("615.03"));
- assertThat(tag.lat, is((new Double(values[3][1])).doubleValue()));
- assertThat(tag.lon, is((new Double(values[3][2])).doubleValue()));
- assertThat(tag.magvarStr, is(notNullValue()));
- }
-
- @Test
- public void get_31() throws ParseException {
- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:31Z"));
- assertThat(tag, is(nullValue()));
- }
- }
-
- public static class タイムスタンプの書式 {
- @Test
- public void EXIF時刻書式テスト() throws Exception {
- String dateTimeOriginal = "2017:06:30 09:59:59";
- Date time = ImportPicture.toEXIFDate(dateTimeOriginal);
- assertThat(ImportPicture.toEXIFString(time), is("2017:06:30 09:59:59"));
- assertThat(ImportPicture.toUTCString(time), is("2017-06-30T00:59:59Z"));
- DateFormat dfUTC = new SimpleDateFormat(ImportPicture.TIME_FORMAT_STRING);
- assertThat(dfUTC.format(time), is("2017-06-30T09:59:59Z"));
- }
-
- }
+
+ public static class Keyのみ {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
+ ElementMapTRKPT map = null;
+ long timeL;
+ static String[] values = {
+ "1970-01-01 08:59:59.999",
+ "1970-01-01 09:00:00.000",
+ "1970-01-01 09:00:00.001",
+ "2018-10-25 07:59:59.999",
+ "2018-10-25 08:00:00.000",
+ "2018-10-25 08:00:00.001"
+ };
+
+ @Before
+ public void setUp() throws Exception {
+ timeL = (sdf.parse("2018-10-25 08:00:00.000")).getTime();
+ map = new ElementMapTRKPT();
+ map.put(new Date(timeL), null); // 5-6: 2018-10-25 08:00:00.000
+ map.put(new Date(timeL + 1L), null); // 7: 2018-10-25 08:00:00.001
+ map.put(new Date(timeL - 1L), null); // 4: 2018-10-25 07:59:59.999
+ map.put(new Date(1L), null); // 3: 1970-01-01 09:00:00.001
+ map.put(new Date(0L), null); // 2: 1970-01-01 09:00:00.000
+ map.put(new Date(-1L), null); // 1: 1970-01-01 08:59:59.999
+ map.put(new Date(timeL), null); // 5-6: 2018-10-25 08:00:00.000
+ }
+
+ @Test
+ public void 同一キーをPUTした場合() {
+ assertThat(map.size(), is(6));
+ }
+
+ @Test
+ public void イテレータを使って読みだす() {
+ assertThat(map.size(), is(6));
+
+ int i = 0;
+ for (Date key : map.keySet()) {
+ assertThat(sdf.format(key), is(values[i++]));
+ }
+ }
+
+ @Test
+ public void 拡張FOR文を使って読みだす() {
+ assertThat(map.size(), is(6));
+
+ int i = 0;
+ for (Date key : map.keySet()) {
+ assertThat(sdf.format(key), is(values[i++]));
+ }
+ }
+ }
+
+ public static class Keyとvalueのセット {
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
+ ElementMapTRKPT map = null;
+ long timeL;
+
+ /*
+ * <trkpt lat="35.8812697884" lon="137.9952202085"><time>2017-05-29T01:23:18Z</time></trkpt>
+ * <trkpt lat="35.8811769169" lon="137.9951928835"><time>2017-05-29T01:23:21Z</time><ele>614.90</ele></trkpt>
+ * <trkpt lat="35.881112963" lon="137.9951796401"><time>2017-05-29T01:23:24Z</time><ele>615.00</ele></trkpt>
+ * <trkpt lat="35.881072646" lon="137.9951728508"><time>2017-05-29T01:23:27Z</time><ele>615.03</ele></trkpt>
+ */
+ static String[][] values = {
+ {"2017-05-29T01:23:18Z", "35.8812697884", "137.9952202085", null},
+ {"2017-05-29T01:23:21Z", "35.8811769169", "137.9951928835", "614.90"},
+ {"2017-05-29T01:23:24Z", "35.881112963", "137.9951796401", "615.00"},
+ {"2017-05-29T01:23:27Z", "35.881072646", "137.9951728508", "615.03"}
+ };
+
+ Element createElement(Document document, String[] values) {
+ Element trkpt = document.createElement("trkpt");
+ trkpt.setAttribute("lat", values[1]);
+ trkpt.setAttribute("lon", values[2]);
+ Element timeE = document.createElement("time");
+ timeE.appendChild(document.createTextNode(values[0]));
+ trkpt.appendChild(timeE);
+ if (values[3] != null) {
+ Element eleE = document.createElement("ele");
+ eleE.appendChild(document.createTextNode(values[3]));
+ trkpt.appendChild(eleE);
+ }
+ return trkpt;
+ }
+
+ @Before
+ public void setUp() throws Exception {
+ Complementation.param_GpxOverwriteMagvar = true;
+
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ DOMImplementation domImpl=builder.getDOMImplementation();
+ Document document = domImpl.createDocument("","trkpt",null);
+
+ map = new ElementMapTRKPT();
+ for (int cnt = 4; cnt > 0; cnt--) {
+ map.put(new TagTrkpt(createElement(document, values[cnt - 1])));
+ }
+ }
+
+ @Test
+ public void コンテンツの数をチェック() {
+ assertThat(map.size(), is(4));
+ }
+
+ @Test
+ public void KEYが時間順に取り出せるか() {
+ int i = 0;
+ for (Date key : map.keySet()) {
+ try {
+ String s = sdf.format(ImportPicture.toUTCDate(values[i++][0]));
+ assertThat(sdf.format(key), is(s));
+ } catch (ParseException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Test
+ public void get_17() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:17Z"));
+ assertThat(tag, is(nullValue()));
+ }
+
+ @Test
+ public void get_18() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:18Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
+ assertThat(tag.eleStr, is(nullValue()));
+ assertThat(tag.lat, is(new Double(values[0][1])));
+ assertThat(tag.lon, is(new Double(values[0][2])));
+ assertThat(tag.magvarStr, is(nullValue()));
+ }
+
+ @Test
+ public void get_19() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:19Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
+ assertThat(tag.eleStr, is(nullValue()));
+ assertThat(tag.lat, is(new Double(values[0][1])));
+ assertThat(tag.lon, is(new Double(values[0][2])));
+ assertThat(tag.magvarStr, is(nullValue()));
+ }
+
+ @Test
+ public void get_20() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:20Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
+ assertThat(tag.eleStr, is(nullValue()));
+ assertThat(tag.lat, is(new Double(values[0][1])));
+ assertThat(tag.lon, is(new Double(values[0][2])));
+ assertThat(tag.magvarStr, is(nullValue()));
+ }
+
+ @Test
+ public void get_21() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:21Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
+ assertThat(tag.eleStr, is("614.90"));
+ assertThat(tag.lat, is(new Double(values[1][1])));
+ assertThat(tag.lon, is(new Double(values[1][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_22() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:22Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
+ assertThat(tag.eleStr, is("614.90"));
+ assertThat(tag.lat, is(new Double(values[1][1])));
+ assertThat(tag.lon, is(new Double(values[1][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_23() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:23Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
+ assertThat(tag.eleStr, is("614.90"));
+ assertThat(tag.lat, is(new Double(values[1][1])));
+ assertThat(tag.lon, is(new Double(values[1][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_24() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:24Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
+ assertThat(tag.eleStr, is("615.00"));
+ assertThat(tag.lat, is(new Double(values[2][1])));
+ assertThat(tag.lon, is(new Double(values[2][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_25() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:25Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
+ assertThat(tag.eleStr, is("615.00"));
+ assertThat(tag.lat, is(new Double(values[2][1])));
+ assertThat(tag.lon, is(new Double(values[2][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_26() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:26Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
+ assertThat(tag.eleStr, is("615.00"));
+ assertThat(tag.lat, is(new Double(values[2][1])));
+ assertThat(tag.lon, is(new Double(values[2][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_27() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:27Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
+ assertThat(tag.eleStr, is("615.03"));
+ assertThat(tag.lat, is(new Double(values[3][1])));
+ assertThat(tag.lon, is(new Double(values[3][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_28() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:28Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
+ assertThat(tag.eleStr, is("615.03"));
+ assertThat(tag.lat, is(new Double(values[3][1])));
+ assertThat(tag.lon, is(new Double(values[3][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_30() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:30Z"));
+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
+ assertThat(tag.eleStr, is("615.03"));
+ assertThat(tag.lat, is(new Double(values[3][1])));
+ assertThat(tag.lon, is(new Double(values[3][2])));
+ assertThat(tag.magvarStr, is(notNullValue()));
+ }
+
+ @Test
+ public void get_31() throws ParseException {
+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:31Z"));
+ assertThat(tag, is(nullValue()));
+ }
+ }
+
+ public static class タイムスタンプの書式 {
+ @Test
+ public void EXIF時刻書式テスト() throws Exception {
+ String dateTimeOriginal = "2017:06:30 09:59:59";
+ Date time = ImportPicture.toEXIFDate(dateTimeOriginal);
+ assertThat(ImportPicture.toEXIFString(time), is("2017:06:30 09:59:59"));
+ assertThat(ImportPicture.toUTCString(time), is("2017-06-30T00:59:59Z"));
+ DateFormat dfUTC = new SimpleDateFormat(ImportPicture.TIME_FORMAT_STRING);
+ assertThat(dfUTC.format(time), is("2017-06-30T09:59:59Z"));
+ }
+ }
}
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.fail;
-
import java.io.File;
+import java.io.IOException;
+import java.text.ParseException;
import java.util.Date;
-
+import javax.xml.parsers.ParserConfigurationException;
import org.junit.experimental.theories.DataPoints;
import org.junit.experimental.theories.Theories;
import org.junit.experimental.theories.Theory;
import org.junit.runner.RunWith;
+import org.w3c.dom.DOMException;
+import org.xml.sax.SAXException;
public class ElementMapTRKSEGTest {
-
- @RunWith(Theories.class)
- public static class 各種GPXファイルを食わせる {
- static class Fixture {
- String gpxSourcePath; // GPXファイル(オリジナル)
- int segCount; // GPXファイルに含まれるTRKSEGノードの数
-
- public Fixture(
- String gpxSourcePath,
- int segCount
- ) {
- this.gpxSourcePath = gpxSourcePath;
- this.segCount = segCount;
- }
-
- public String toString() {
- String msg = "テストパターン : \n";
- msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
- msg += "\tsegCount = "+ segCount;
- return msg;
- }
- }
- @DataPoints
- public static Fixture[] datas = {
- new Fixture("testdata/20170517.gpx", 1),
- new Fixture("testdata/20170518.gpx", 1),
- new Fixture("testdata/muiltiTRK.GarminColorado.gpx.xml", 3),
- new Fixture("testdata/muiltiTRKSEG.GarminColorado.gpx.xml", 3),
- new Fixture("testdata/muiltiTRKSEG.noNameSpace.gpx.xml", 3),
- new Fixture("testdata/multiTRKSEG.eTrex_20J.gpx.xml", 3),
- new Fixture("testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml", 3),
- };
+ @RunWith(Theories.class)
+ public static class 各種GPXファイルを食わせる {
+ static class Fixture {
+ String gpxSourcePath; // GPXファイル(オリジナル)
+ int segCount; // GPXファイルに含まれるTRKSEGノードの数
+
+ public Fixture(String gpxSourcePath, int segCount) {
+ this.gpxSourcePath = gpxSourcePath;
+ this.segCount = segCount;
+ }
+
+ @Override
+ public String toString() {
+ String msg = "テストパターン : \n";
+ msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
+ msg += "\tsegCount = "+ segCount;
+ return msg;
+ }
+ }
+
+ @DataPoints
+ public static Fixture[] datas = {
+ new Fixture("testdata/20170517.gpx", 1),
+ new Fixture("testdata/20170518.gpx", 1),
+ new Fixture("testdata/muiltiTRK.GarminColorado.gpx.xml", 3),
+ new Fixture("testdata/muiltiTRKSEG.GarminColorado.gpx.xml", 3),
+ new Fixture("testdata/muiltiTRKSEG.noNameSpace.gpx.xml", 3),
+ new Fixture("testdata/multiTRKSEG.eTrex_20J.gpx.xml", 3),
+ new Fixture("testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml", 3),
+ };
- @Theory
- public void TRKSEGを読み込む(Fixture dataset) {
- try {
- ElementMapTRKSEG mapTRKSEG = new ElementMapTRKSEG();
- mapTRKSEG.parse(new File(dataset.gpxSourcePath));
- mapTRKSEG.printinfo();
- System.out.println("GPX file: "+ dataset.gpxSourcePath);
- assertThat(mapTRKSEG.size(), is(dataset.segCount));
- for (Date key : mapTRKSEG.keySet()) {
- assertThat(key, is(notNullValue()));
- }
- }
- catch (Exception e) {
- fail();
- }
- }
-
- }
+ @Theory
+ public void TRKSEGを読み込む(Fixture dataset) {
+ try {
+ ElementMapTRKSEG mapTRKSEG = new ElementMapTRKSEG();
+ mapTRKSEG.parse(new File(dataset.gpxSourcePath));
+ mapTRKSEG.printinfo();
+ System.out.println("GPX file: "+ dataset.gpxSourcePath);
+ assertThat(mapTRKSEG.size(), is(dataset.segCount));
+ for (Date key : mapTRKSEG.keySet()) {
+ assertThat(key, is(notNullValue()));
+ }
+ }
+ catch (IOException | ParseException | ParserConfigurationException | DOMException | SAXException e) {
+ fail();
+ }
+ }
+ }
}
import org.junit.experimental.theories.Theory;
public class ImportPictureTest {
- static class Expecter {
- String value;
- boolean expect;
- String timeStr;
- double latD;
- double lonD;
- boolean magvar;
-
- public Expecter(String value, boolean expect, String timeStr, double latD, double lonD, boolean magvar) {
- this.value = value;
- this.expect = expect;
- this.timeStr = timeStr;
- this.latD = latD;
- this.lonD = lonD;
- this.magvar = magvar;
- }
- }
-
- static class Fixture {
- String comment; // テスト概要(コメント)
- String tarFilePath; // TARデータ
- String gpxSourcePath; // GPXファイル(オリジナル)
- String gpxDestinationPath; // GPXファイル(配置先)
- String iniFilePath; // iniファイル
- Expecter[] expecters;
-
- public Fixture(
- String comment,
- String tarFilePath,
- String gpxSourcePath,
- String gpxDestinationPath,
- String iniFilePath,
- Expecter[] expecters
- ) {
- this.comment = comment;
- this.tarFilePath = tarFilePath;
- this.gpxSourcePath = gpxSourcePath;
- this.gpxDestinationPath = gpxDestinationPath;
- this.iniFilePath = iniFilePath;
- this.expecters = expecters;
- }
-
- public String toString() {
- String msg = "テストパターン : "+ comment + "\n";
- msg += "\ttarFilePath = "+ tarFilePath +"\n";
- msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
- msg += "\tgpxDestinationPath = "+ gpxDestinationPath +"\n";
- msg += "\tiniFilePath = "+ iniFilePath;
- return msg;
- }
- }
-
-
- @RunWith(Theories.class)
- public static class 各種カメラGPXファイル {
-
- @DataPoints
- public static Fixture[] datas = {
- // 1
- new Fixture(
- "[A1].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時",
- "testdata/Sony20170518.tar.gz",
- "testdata/20170518.gpx",
- "testdata/cameradata/20170518.gpx",
- "testdata/AdjustTime.20170518.A1.ini",
- new Expecter[] {
- new Expecter("10170518/20170518_.gpx", true, null, 90.0D, 180.0D, false),
- new Expecter("10170518/DSC05183.JPG", false, null, 90.0D, 180.0D, false),
- new Expecter("10170518/DSC05184.JPG", true, "2017:05:18 09:34:44", 35.4367520000D, 139.4082730000D, true),
- new Expecter("10170518/DSC05196.JPG", true, "2017:05:18 09:37:32", 35.4376820000D, 139.4085150000D, true),
- new Expecter("10170518/DSC05204.JPG", true, "2017:05:18 09:46:48", 35.4368560000D, 139.4082190000D, true),
- new Expecter("10170518/DSC05205.JPG", false, null, 90.0D, 180.0D, false),
- }),
- // 2
- new Fixture(
- "[A2].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時",
- "testdata/Sony20170518.tar.gz",
- "testdata/20170518.gpx",
- "testdata/cameradata/20170518.gpx",
- "testdata/AdjustTime.20170518.A2.ini",
- new Expecter[] {
- new Expecter("10170518/20170518_.gpx", true, null, 90.0D, 180.0D, false),
- new Expecter("10170518/DSC05183.JPG", true, "2017:05:18 09:16:48", 90.0D, 180.0D, true),
- new Expecter("10170518/DSC05184.JPG", true, "2017:05:18 09:34:44", 35.4367520000D, 139.4082730000D, true),
- new Expecter("10170518/DSC05196.JPG", true, "2017:05:18 09:37:32", 35.4376820000D, 139.4085150000D, true),
- new Expecter("10170518/DSC05204.JPG", true, "2017:05:18 09:46:48", 35.4368560000D, 139.4082190000D, true),
- new Expecter("10170518/DSC05205.JPG", true, "2017:05:18 09:48:04", 90.0D, 180.0D, true),
- }),
- // 3.
- new Fixture(
- "[B1].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時",
- "testdata/WiMiUS20170518.tar.gz",
- "testdata/20170518.gpx",
- "testdata/cameradata/20170518.gpx",
- "testdata/AdjustTime.20170518.B1.ini",
- new Expecter[] {
- new Expecter("cameradata/20170518_.gpx", true, null, 90.0D, 180.0D, false),
- new Expecter("cameradata/20170518_092031A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("cameradata/20170518_094226A_snap.jpg", true, "2017:05:18 09:42:26", 35.4366860000D, 139.4082650000D, true),
- new Expecter("cameradata/20170518_094737A.jpg", true, "2017:05:18 09:47:36", 35.4368200000D, 139.4082810000D, true),
- new Expecter("cameradata/20170518_094827A.jpg", false, null, 90.0D, 180.0D, false),
- }),
- // 4.
- new Fixture(
- "[B2].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時",
- "testdata/WiMiUS20170518.tar.gz",
- "testdata/20170518.gpx",
- "testdata/cameradata/20170518.gpx",
- "testdata/AdjustTime.20170518.B2.ini",
- new Expecter[] {
- new Expecter("cameradata/20170518_.gpx", true, null, 90.0D, 180.0D, false),
- new Expecter("cameradata/20170518_092031A.jpg", true, "2017:05:18 09:20:30", 90.0D, 180.0D, true),
- new Expecter("cameradata/20170518_094226A_snap.jpg", true, "2017:05:18 09:42:26", 35.4366860000D, 139.4082650000D, true),
- new Expecter("cameradata/20170518_094737A.jpg", true, "2017:05:18 09:47:36", 35.4368200000D, 139.4082810000D, true),
- new Expecter("cameradata/20170518_094827A.jpg", true, "2017:05:18 09:48:26", 90.0D, 180.0D, true),
- }),
- // 5.
- new Fixture(
- "[M1a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.GarminColorado",
- "testdata/separate.tar.gz",
- "testdata/muiltiTRK.GarminColorado.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M1a.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
- }),
-
- new Fixture(
- "[M1b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.GarminColorado",
- "testdata/separate.tar.gz",
- "testdata/muiltiTRK.GarminColorado.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M1b.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
- }),
-
- new Fixture(
- "[M1c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.GarminColorado",
- "testdata/separate.tar.gz",
- "testdata/muiltiTRK.GarminColorado.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M1c.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339846227D, 138.0625408050D, true),
- }),
-
- new Fixture(
- "[M1d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.GarminColorado",
- "testdata/separate.tar.gz",
- "testdata/muiltiTRK.GarminColorado.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M1d.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339846227D, 138.0625408050D, true),
- }),
-
-
- new Fixture(
- "[M2a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20J",
- "testdata/separate.tar.gz",
- "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M2a.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
- }),
-
- new Fixture(
- "[M2b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20J",
- "testdata/separate.tar.gz",
- "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M2b.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
- }),
-
- new Fixture(
- "[M2c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20J",
- "testdata/separate.tar.gz",
- "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M2c.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
- }),
-
- new Fixture(
- "[M2d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20J",
- "testdata/separate.tar.gz",
- "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M2d.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
- }),
-
- new Fixture(
- "[M3a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20Jreverse",
- "testdata/separate.tar.gz",
- "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M2a.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
- }),
-
- new Fixture(
- "[M3b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20Jreverse",
- "testdata/separate.tar.gz",
- "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M2b.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
- }),
-
- new Fixture(
- "[M3c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20Jreverse",
- "testdata/separate.tar.gz",
- "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M2c.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
- }),
-
- new Fixture(
- "[M3d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20Jreverse",
- "testdata/separate.tar.gz",
- "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
- "testdata/cameradata/separate.gpx",
- "testdata/AdjustTime.M2d.separate.ini",
- new Expecter[] {
- // GPX file
- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
-
- // out of time ( - 2017-05-29T01:23:18)
- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
-
- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
-
- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
-
- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
-
- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
-
- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
- }),
- };
-
- @Theory
- public void パラメータテスト(Fixture dataset) throws Exception {
- ImportPictureTest.setup(dataset);
- ImportPictureTest.testdo(dataset.iniFilePath);
- //SimpleDateFormat format = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.UK);
-
- Expecter[] es = dataset.expecters;
- AppParameters params = new AppParameters(dataset.iniFilePath);
- File outDir = new File(params.getProperty(AppParameters.IMG_OUTPUT_FOLDER));
- for (int i = 0; i < es.length; i++) {
- File file = new File(outDir, es[i].value);
- System.out.println("[JUnit.debug] assert file='"+ file.getAbsolutePath() +"'");
- assertThat(file.exists(), is(es[i].expect));
- if (es[i].timeStr != null) {
- // JPEG メタデータが存在すること
- ImageMetadata meta = Imaging.getMetadata(file);
-
- // メタデータは インスタンスJpegImageMetadata であること
- assertThat((meta instanceof JpegImageMetadata), is(true));
-
- JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
- assertNotNull(jpegMetadata);
-
- // EXIFデータが存在すること
- TiffImageMetadata exif = jpegMetadata.getExif();
- assertNotNull(exif);
-
- // EXIF-TIME が正しく設定されていること
- String exifTime = ImportPicture.toEXIFString(ImportPicture.toEXIFDate(exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0]));
- System.out.println("[debug] exifTime = '"+ exifTime +"' <--> '"+ es[i].timeStr +"'");
- assertThat(exifTime, is(es[i].timeStr));
-
- // LAT,LON
- GPSInfo gpsInfo = exif.getGPS();
- if (es[i].latD != 90.0D) {
- assertThat(comparePosition(gpsInfo.getLatitudeAsDegreesNorth()), is(comparePosition(es[i].latD)));
- }
- if (es[i].lonD != 180.0D) {
- assertThat(comparePosition(gpsInfo.getLongitudeAsDegreesEast()), is(comparePosition(es[i].lonD)));
- }
- }
- }
- }
-
- static String comparePosition(double b) {
- return String.format("%.4f", b);
- }
- }
-
- static void setup(Fixture dataset) throws IOException {
- System.out.println(dataset.toString());
-
- // カメラディレクトリを削除する
- File dir = new File("testdata/cameradata");
- if (dir.exists()) {
- ImportPictureTest.delete(dir);
- }
- File outDir = new File("testdata/output");
- if (outDir.exists()) {
- ImportPictureTest.delete(outDir);
- }
- outDir.mkdir();
-
- // カメラディレクトリを作成する
- ImportPictureTest.uncompress(new File(dataset.tarFilePath), new File("testdata/cameradata"));
-
- // GPXファイルをセット
- try ( FileInputStream inStream = new FileInputStream(new File(dataset.gpxSourcePath));
- FileOutputStream outStream = new FileOutputStream(new File(dataset.gpxDestinationPath));
- FileChannel inChannel = inStream.getChannel();
- FileChannel outChannel = outStream.getChannel(); )
+ static class Expecter {
+ String value;
+ boolean expect;
+ String timeStr;
+ double latD;
+ double lonD;
+ boolean magvar;
+
+ public Expecter(String value, boolean expect, String timeStr, double latD, double lonD, boolean magvar) {
+ this.value = value;
+ this.expect = expect;
+ this.timeStr = timeStr;
+ this.latD = latD;
+ this.lonD = lonD;
+ this.magvar = magvar;
+ }
+ }
+
+ static class Fixture {
+ String comment; // テスト概要(コメント)
+ String tarFilePath; // TARデータ
+ String gpxSourcePath; // GPXファイル(オリジナル)
+ String gpxDestinationPath; // GPXファイル(配置先)
+ String iniFilePath; // iniファイル
+ Expecter[] expecters;
+
+ public Fixture(
+ String comment,
+ String tarFilePath,
+ String gpxSourcePath,
+ String gpxDestinationPath,
+ String iniFilePath,
+ Expecter[] expecters
+ ) {
+ this.comment = comment;
+ this.tarFilePath = tarFilePath;
+ this.gpxSourcePath = gpxSourcePath;
+ this.gpxDestinationPath = gpxDestinationPath;
+ this.iniFilePath = iniFilePath;
+ this.expecters = expecters;
+ }
+
+ @Override
+ public String toString() {
+ String msg = "テストパターン : "+ comment + "\n";
+ msg += "\ttarFilePath = "+ tarFilePath +"\n";
+ msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
+ msg += "\tgpxDestinationPath = "+ gpxDestinationPath +"\n";
+ msg += "\tiniFilePath = "+ iniFilePath;
+ return msg;
+ }
+ }
+
+
+ @RunWith(Theories.class)
+ public static class 各種カメラGPXファイル {
+
+ @DataPoints
+ public static Fixture[] datas = {
+ // 1
+ new Fixture(
+ "[A1].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時",
+ "testdata/Sony20170518.tar.gz",
+ "testdata/20170518.gpx",
+ "testdata/cameradata/20170518.gpx",
+ "testdata/AdjustTime.20170518.A1.ini",
+ new Expecter[] {
+ new Expecter("10170518/20170518_.gpx", true, null, 90.0D, 180.0D, false),
+ new Expecter("10170518/DSC05183.JPG", false, null, 90.0D, 180.0D, false),
+ new Expecter("10170518/DSC05184.JPG", true, "2017:05:18 09:34:44", 35.4367520000D, 139.4082730000D, true),
+ new Expecter("10170518/DSC05196.JPG", true, "2017:05:18 09:37:32", 35.4376820000D, 139.4085150000D, true),
+ new Expecter("10170518/DSC05204.JPG", true, "2017:05:18 09:46:48", 35.4368560000D, 139.4082190000D, true),
+ new Expecter("10170518/DSC05205.JPG", false, null, 90.0D, 180.0D, false),
+ }
+ ),
+ // 2
+ new Fixture(
+ "[A2].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時",
+ "testdata/Sony20170518.tar.gz",
+ "testdata/20170518.gpx",
+ "testdata/cameradata/20170518.gpx",
+ "testdata/AdjustTime.20170518.A2.ini",
+ new Expecter[] {
+ new Expecter("10170518/20170518_.gpx", true, null, 90.0D, 180.0D, false),
+ new Expecter("10170518/DSC05183.JPG", true, "2017:05:18 09:16:48", 90.0D, 180.0D, true),
+ new Expecter("10170518/DSC05184.JPG", true, "2017:05:18 09:34:44", 35.4367520000D, 139.4082730000D, true),
+ new Expecter("10170518/DSC05196.JPG", true, "2017:05:18 09:37:32", 35.4376820000D, 139.4085150000D, true),
+ new Expecter("10170518/DSC05204.JPG", true, "2017:05:18 09:46:48", 35.4368560000D, 139.4082190000D, true),
+ new Expecter("10170518/DSC05205.JPG", true, "2017:05:18 09:48:04", 90.0D, 180.0D, true),
+ }
+ ),
+ // 3.
+ new Fixture(
+ "[B1].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時",
+ "testdata/WiMiUS20170518.tar.gz",
+ "testdata/20170518.gpx",
+ "testdata/cameradata/20170518.gpx",
+ "testdata/AdjustTime.20170518.B1.ini",
+ new Expecter[] {
+ new Expecter("cameradata/20170518_.gpx", true, null, 90.0D, 180.0D, false),
+ new Expecter("cameradata/20170518_092031A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("cameradata/20170518_094226A_snap.jpg", true, "2017:05:18 09:42:26", 35.4366860000D, 139.4082650000D, true),
+ new Expecter("cameradata/20170518_094737A.jpg", true, "2017:05:18 09:47:36", 35.4368200000D, 139.4082810000D, true),
+ new Expecter("cameradata/20170518_094827A.jpg", false, null, 90.0D, 180.0D, false),
+ }
+ ),
+ // 4.
+ new Fixture(
+ "[B2].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時",
+ "testdata/WiMiUS20170518.tar.gz",
+ "testdata/20170518.gpx",
+ "testdata/cameradata/20170518.gpx",
+ "testdata/AdjustTime.20170518.B2.ini",
+ new Expecter[] {
+ new Expecter("cameradata/20170518_.gpx", true, null, 90.0D, 180.0D, false),
+ new Expecter("cameradata/20170518_092031A.jpg", true, "2017:05:18 09:20:30", 90.0D, 180.0D, true),
+ new Expecter("cameradata/20170518_094226A_snap.jpg", true, "2017:05:18 09:42:26", 35.4366860000D, 139.4082650000D, true),
+ new Expecter("cameradata/20170518_094737A.jpg", true, "2017:05:18 09:47:36", 35.4368200000D, 139.4082810000D, true),
+ new Expecter("cameradata/20170518_094827A.jpg", true, "2017:05:18 09:48:26", 90.0D, 180.0D, true),
+ }
+ ),
+ // 5.
+ new Fixture(
+ "[M1a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.GarminColorado",
+ "testdata/separate.tar.gz",
+ "testdata/muiltiTRK.GarminColorado.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M1a.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M1b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.GarminColorado",
+ "testdata/separate.tar.gz",
+ "testdata/muiltiTRK.GarminColorado.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M1b.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M1c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.GarminColorado",
+ "testdata/separate.tar.gz",
+ "testdata/muiltiTRK.GarminColorado.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M1c.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339846227D, 138.0625408050D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M1d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.GarminColorado",
+ "testdata/separate.tar.gz",
+ "testdata/muiltiTRK.GarminColorado.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M1d.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339846227D, 138.0625408050D, true),
+ }
+ ),
+
+
+ new Fixture(
+ "[M2a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20J",
+ "testdata/separate.tar.gz",
+ "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M2a.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M2b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20J",
+ "testdata/separate.tar.gz",
+ "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M2b.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M2c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20J",
+ "testdata/separate.tar.gz",
+ "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M2c.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M2d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20J",
+ "testdata/separate.tar.gz",
+ "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M2d.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M3a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20Jreverse",
+ "testdata/separate.tar.gz",
+ "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M2a.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M3b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20Jreverse",
+ "testdata/separate.tar.gz",
+ "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M2b.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M3c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20Jreverse",
+ "testdata/separate.tar.gz",
+ "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M2c.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
+ }
+ ),
+
+ new Fixture(
+ "[M3d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20Jreverse",
+ "testdata/separate.tar.gz",
+ "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
+ "testdata/cameradata/separate.gpx",
+ "testdata/AdjustTime.M2d.separate.ini",
+ new Expecter[] {
+ // GPX file
+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
+
+ // out of time ( - 2017-05-29T01:23:18)
+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
+
+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
+
+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
+
+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
+
+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
+
+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
+ }
+ ),
+ };
+
+ @Theory
+ public void パラメータテスト(Fixture dataset) throws Exception {
+ ImportPictureTest.setup(dataset);
+ ImportPictureTest.testdo(dataset.iniFilePath);
+ //SimpleDateFormat format = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.UK);
+
+ Expecter[] es = dataset.expecters;
+ AppParameters params = new AppParameters(dataset.iniFilePath);
+ File outDir = new File(params.getProperty(AppParameters.IMG_OUTPUT_FOLDER));
+ for (Expecter e : es) {
+ File file = new File(outDir, e.value);
+ System.out.println("[JUnit.debug] assert file='"+ file.getAbsolutePath() +"'");
+ assertThat(file.exists(), is(e.expect));
+ if (e.timeStr != null) {
+ // JPEG メタデータが存在すること
+ ImageMetadata meta = Imaging.getMetadata(file);
+ // メタデータは インスタンスJpegImageMetadata であること
+ assertThat((meta instanceof JpegImageMetadata), is(true));
+ JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
+ assertNotNull(jpegMetadata);
+ // EXIFデータが存在すること
+ TiffImageMetadata exif = jpegMetadata.getExif();
+ assertNotNull(exif);
+ // EXIF-TIME が正しく設定されていること
+ String exifTime = ImportPicture.toEXIFString(ImportPicture.toEXIFDate(exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0]));
+ System.out.println("[debug] exifTime = '"+ exifTime +"' <--> '" + e.timeStr + "'");
+ assertThat(exifTime, is(e.timeStr));
+ // LAT,LON
+ GPSInfo gpsInfo = exif.getGPS();
+ if (e.latD != 90.0D) {
+ assertThat(comparePosition(gpsInfo.getLatitudeAsDegreesNorth()), is(comparePosition(e.latD)));
+ }
+ if (e.lonD != 180.0D) {
+ assertThat(comparePosition(gpsInfo.getLongitudeAsDegreesEast()), is(comparePosition(e.lonD)));
+ }
+ }
+ }
+ }
+
+ static String comparePosition(double b) {
+ return String.format("%.4f", b);
+ }
+ }
+
+ static void setup(Fixture dataset) throws IOException {
+ System.out.println(dataset.toString());
+
+ // カメラディレクトリを削除する
+ File dir = new File("testdata/cameradata");
+ if (dir.exists()) {
+ ImportPictureTest.delete(dir);
+ }
+ File outDir = new File("testdata/output");
+ if (outDir.exists()) {
+ ImportPictureTest.delete(outDir);
+ }
+ outDir.mkdir();
+
+ // カメラディレクトリを作成する
+ ImportPictureTest.uncompress(new File(dataset.tarFilePath), new File("testdata/cameradata"));
+
+ // GPXファイルをセット
+ try (FileInputStream inStream = new FileInputStream(new File(dataset.gpxSourcePath));
+ FileOutputStream outStream = new FileOutputStream(new File(dataset.gpxDestinationPath));
+ FileChannel inChannel = inStream.getChannel();
+ FileChannel outChannel = outStream.getChannel())
{
inChannel.transferTo(0, inChannel.size(), outChannel);
}
- }
-
- /**
- * 実行する
- * @throws Exception
- */
- static void testdo(String iniFilePath) {
+ }
+
+ /**
+ * 実行する
+ * @throws Exception
+ */
+ static void testdo(String iniFilePath) {
try {
- String[] argv = new String[1];
- argv[0] = new String(iniFilePath);
- ImportPicture.main(argv);
- }
- catch (Exception e) {
- e.printStackTrace();
- fail("Exceptionが発生した。");
- }
- }
-
- /**
+ String[] argv = {iniFilePath};
+ ImportPicture.main(argv);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ fail("Exceptionが発生した。");
+ }
+ }
+
+ /**
* *.tar.gz解凍
* ファイル更新日時をオリジナルと同じにします。
* @param tazFile 解凍する*.tar.gzファイル
public static void uncompress(File tazFile, File dest) throws IOException {
dest.mkdir();
- TarArchiveInputStream tarIn = null;
- tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(new BufferedInputStream(new FileInputStream(tazFile))));
-
- TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
- while (tarEntry != null) {
- File destPath = new File(dest, tarEntry.getName());
- //System.out.println("uncompress: " + destPath.getCanonicalPath());
- if (tarEntry.isDirectory()) {
- destPath.mkdirs();
- }
- else {
- File dir = new File(destPath.getParent());
- if (!dir.exists()) {
- dir.mkdirs();
- }
- destPath.createNewFile();
- byte[] btoRead = new byte[1024];
- BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath));
- int len = 0;
-
- while ((len = tarIn.read(btoRead)) != -1) {
- bout.write(btoRead, 0, len);
+ try (TarArchiveInputStream tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(new BufferedInputStream(new FileInputStream(tazFile))))) {
+ TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
+ while (tarEntry != null) {
+ File destPath = new File(dest, tarEntry.getName());
+ //System.out.println("uncompress: " + destPath.getCanonicalPath());
+ if (tarEntry.isDirectory()) {
+ destPath.mkdirs();
}
-
- bout.close();
- destPath.setLastModified(tarEntry.getLastModifiedDate().getTime());
- btoRead = null;
+ else {
+ File dir = new File(destPath.getParent());
+ if (!dir.exists()) {
+ dir.mkdirs();
+ }
+ destPath.createNewFile();
+ byte[] btoRead = new byte[1024];
+ try (BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath))) {
+ int len = 0;
+ while ((len = tarIn.read(btoRead)) != -1) {
+ bout.write(btoRead, 0, len);
+ }
+ }
+ destPath.setLastModified(tarEntry.getLastModifiedDate().getTime());
+ btoRead = null;
+ }
+ tarEntry = tarIn.getNextTarEntry();
}
- tarEntry = tarIn.getNextTarEntry();
}
- tarIn.close();
}
public static void delete(File file) throws IOException {
if (file.isDirectory()) {
File files[] = file.listFiles();
if (files != null) {
- for (int i=0; i < files.length; i++) {
- delete(files[i]); // 再帰呼び出し
+ for (File file1 : files) {
+ delete(file1); // 再帰呼び出し
}
}
}
if (!file.delete()) {
- System.out.println("ERROR: ファイルは削除できませんでした。 '" + file.getAbsolutePath() +"'");
+ System.out.println("ERROR: ファイルは削除できませんでした。 '" + file.getAbsolutePath() +"'");
}
- return;
}
}
\ No newline at end of file
* Zipファイルを展開します
* @param aZipFile zipファイル
* @param aOutDir 出力先ディレクトリ
+ * @throws java.io.IOException
*/
public static void decode(File aZipFile, String aOutDir) throws IOException {
FileInputStream fileIn = null;
zipIn.closeEntry();
}
}
- catch (Exception e) {
+ catch (IOException e) {
e.printStackTrace();
}
finally {
try {
fileIn.close();
}
- catch (Exception e) {}
+ catch (IOException e) {}
}
if (fileOut != null) {
try {
fileOut.close();
}
- catch(Exception e) {}
+ catch(IOException e) {}
}
zipIn.close();
}