• R/O
  • HTTP
  • SSH
  • HTTPS

importpicture: Commit


Commit MetaInfo

Revision867f73a3f85d6fbe9e85cf3500d38be13119c642 (tree)
Time2018-09-17 12:23:03
Authorhayashi <hayashi.yuu@gmai...>
Commiterhayashi

Log Message

i18n, reformat, Java8

Change Summary

Incremental Difference

--- a/importPicture/nbproject/project.properties
+++ b/importPicture/nbproject/project.properties
@@ -47,7 +47,7 @@ javadoc.encoding=${source.encoding}
4747 javac.source=1.8
4848 junit.selected.version=4
4949 debug.classpath=${run.classpath}
50-run.jvmargs=
50+run.jvmargs=-Duser.language=en\n-Duser.country=US
5151 build.generated.dir=${build.dir}/generated
5252 jar.compress=false
5353 javac.test.classpath=\
--- /dev/null
+++ b/importPicture/src/i18n.properties
@@ -0,0 +1,50 @@
1+dialog.quit=Quit
2+dialog.cancel=Cancel
3+dialog.msg1=Quit this program.
4+dialog.select=Selection
5+
6+menu.quit=Quit?
7+button.next=Next
8+button.previous=Previous
9+button.execute=Execute
10+button.select=Selection...
11+
12+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>
13+label.110=Image Folder
14+
15+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>
16+label.210=Reference time image
17+label.220=Based on EXIF date and time
18+label.230=Based on FILE UPDATE time
19+
20+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>
21+label.310=Reference time
22+
23+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>
24+label.410=GPX folder
25+label.420=Ignore the first node of segment 'trkseg'
26+label.430=Also make the generated GPX file (the one whose filename ends with '_.gpx') as the target of conversion
27+
28+label.500=Select whether to perform EXIF conversion
29+label.501=When performing EXIF conversion, you also need to specify the folder to output the converted file.
30+label.502=The output folder must have write permission and sufficient free space.
31+label.510=Convert IMG
32+label.520=Copy files outside the GPX file time
33+label.530=Output folder
34+label.540=Convert EXIF
35+label.550=Output point marker <WPT> to GPX file
36+label.560=Ignoring <MAGVAR> of source GPX
37+label.570=Overwrite <SPEED> in output GPX
38+
39+msg.100=GPX file or directory does not exist.('%s')
40+msg.110=The target GPX file can not be found.('%s')
41+msg.120=When there are multiple GPX files, 'IMG.OUTPUT_ALL' option can not be specified.
42+msg.130=Format of '%s' is wrong.(%s)
43+msg.140=Not exists EXIF data in '%s'.
44+
45+msg.200=[error] Not exists <imgDir>.
46+msg.210=[error] <imgDir> is not Folder.
47+msg.220=[error] Not exists <baseFile1>.
48+msg.230=[error] <baseFile1> is not a file.
49+msg.240=[error] Not exists <baseFile2>.
50+msg.250=[error] <baseFile2> is not a file.
--- /dev/null
+++ b/importPicture/src/i18n_ja_JP.properties
@@ -0,0 +1,50 @@
1+dialog.quit=\u7d42\u4e86
2+dialog.cancel=\u30ad\u30e3\u30f3\u30bb\u30eb
3+dialog.msg1=\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u7d42\u4e86\u3057\u307e\u3059\u3002
4+dialog.select=\u9078\u629e
5+
6+menu.quit=\u7d42\u4e86...
7+button.next=\u6b21\u3078
8+button.previous=\u623b\u308b
9+button.execute=\u51e6\u7406\u5b9f\u884c
10+button.select=\u9078\u629e...
11+
12+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>
13+label.110=\u5bfe\u8c61\u30d5\u30a9\u30eb\u30c0
14+
15+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>
16+label.210=\u57fa\u6e96\u6642\u523b\u753b\u50cf
17+label.220=EXIF\u306e\u65e5\u6642\u3092\u57fa\u6e96\u306b\u3059\u308b
18+label.230=\u30d5\u30a1\u30a4\u30eb\u66f4\u65b0\u65e5\u6642\u3092\u57fa\u6e96\u306b\u3059\u308b
19+
20+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>
21+label.310=\u57fa\u6e96\u6642\u523b
22+
23+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>
24+label.410=GPX\u30d5\u30a9\u30eb\u30c0
25+label.420=\u30bb\u30b0\u30e1\u30f3\u30c8'trkseg'\u306e\u6700\u521d\u306e\uff11\u30ce\u30fc\u30c9\u306f\u7121\u8996\u3059\u308b
26+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
27+
28+label.500=EXIF\u5909\u63db\u3092\u884c\u3046\u304b\u3069\u3046\u304b\u3092\u9078\u629e\u3057\u3066\u304f\u3060\u3055\u3044
29+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
30+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
31+label.510=IMG\u306e\u5909\u63db\u3092\u3059\u308b
32+label.520=GPX\u30d5\u30a1\u30a4\u30eb\u6642\u9593\u5916\u306e\u30d5\u30a1\u30a4\u30eb\u3082\u30b3\u30d4\u30fc\u3059\u308b
33+label.530=\u51fa\u529b\u30d5\u30a9\u30eb\u30c0
34+label.540=EXIF\u306e\u5909\u63db\u3092\u3059\u308b
35+label.550=\u30dd\u30a4\u30f3\u30c8\u30de\u30fc\u30ab\u30fc<WPT>\u3092GPX\u30d5\u30a1\u30a4\u30eb\u306b\u51fa\u529b\u3059\u308b
36+label.560=\u30bd\u30fc\u30b9GPX\u306e<MAGVAR>\u3092\u7121\u8996\u3059\u308b
37+label.570=\u51fa\u529bGPX\u306b<SPEED>\u3092\u4e0a\u66f8\u304d\u3059\u308b
38+
39+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')
40+msg.110=\u5bfe\u8c61\u3068\u306a\u308bGPX\u30d5\u30a1\u30a4\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093('%s')
41+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
42+msg.130='%s'\u306e\u66f8\u5f0f\u304c\u9055\u3044\u307e\u3059(%s)
43+msg.140='%s'\u306bEXIF\u60c5\u5831\u304c\u3042\u308a\u307e\u305b\u3093
44+
45+msg.200=[error] <imgDir>\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
46+msg.210=[error] <imgDir>\u304c\u30d5\u30a9\u30eb\u30c0\u3058\u3083\u306a\u3044
47+msg.220=[error] <baseFile1>\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
48+msg.230=[error] <baseFile1>\u304c\u30d5\u30a1\u30a4\u30eb\u3058\u3083\u306a\u3044
49+msg.240=[error] <baseFile1>\u304c\u5b58\u5728\u3057\u307e\u305b\u3093
50+msg.250=[error] <baseFile1>\u304c\u30d5\u30a1\u30a4\u30eb\u3058\u3083\u306a\u3044
--- a/importPicture/src/osm/jp/gpx/AppParameters.java
+++ b/importPicture/src/osm/jp/gpx/AppParameters.java
@@ -9,208 +9,208 @@ import java.util.Properties;
99
1010 @SuppressWarnings("serial")
1111 public class AppParameters extends Properties {
12- static final String FILE_PATH = "AdjustTime.ini";
13-
14- // GPX: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
15- public static String GPX_GPXSPLIT = "GPX.gpxSplit";
16-
17- // GPX: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
18- public static String GPX_NO_FIRST_NODE = "GPX.noFirstNode";
19-
20- // GPX: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
21- public static String GPX_REUSE = "GPX.REUSE";
22-
23- // GPX: 基準時刻 {FILE_UPDATE | EXIF_TIME}
24- public static String GPX_BASETIME = "GPX.BASETIME";
25-
26- // GPX: ファイル更新時刻 yyyy:MM:dd HH:mm:ss
27- public static String IMG_TIME = "IMG.TIME";
28-
29- // 対象IMGフォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
30- public static String IMG_SOURCE_FOLDER = "IMG.SOURCE_FOLDER";
31-
32- // 基準時刻画像(正確な撮影時刻が判明できる画像)
33- public static String IMG_BASE_FILE = "IMG.BASE_FILE";
34-
35- // 対象GPXフォルダ:(GPXファイルが格納されているフォルダ)
36- public static String GPX_SOURCE_FOLDER = "GPX.SOURCE_FOLDER";
37-
38- // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
39- public static String IMG_OUTPUT_FOLDER = "IMG.OUTPUT_FOLDER";
40-
41- // 出力IMG: IMG出力をする {ON | OFF}
42- public static String IMG_OUTPUT = "IMG.OUTPUT";
43-
44- // 出力IMG: 'out of time'も IMG出力の対象とする {ON | OFF}
45- //   この場合は、対象IMGフォルダ内のすべてのIMGファイルが出力フォルダに出力される
46- public static String IMG_OUTPUT_ALL = "IMG.OUTPUT_ALL";
47-
48- // 出力IMG: EXIFを変換する
49- public static String IMG_OUTPUT_EXIF = "IMG.OUTPUT_EXIF";
50-
51- // 出力GPX: <SPEED>を上書き出力する {ON | OFF}
52- public static String GPX_OUTPUT_SPEED = "GPX.OUTPUT_SPEED";
53-
54- // 出力GPX: ソースGPXの<MAGVER>を無視する {ON | OFF}
55- public static String GPX_OVERWRITE_MAGVAR = "GPX.OVERWRITE_MAGVAR";
56-
57- // 出力GPX: マーカー<wpt>を出力する {ON | OFF}
58- public static String GPX_OUTPUT_WPT = "GPX.OUTPUT_WPT";
59-
60- File file;
61-
62- public AppParameters() throws FileNotFoundException, IOException {
63- super();
64- this.file = new File(FILE_PATH);
65- syncFile();
66- }
67-
68- public AppParameters(Properties defaults) throws FileNotFoundException, IOException {
69- super(defaults);
70- this.file = new File(FILE_PATH);
71- syncFile();
72- }
73-
74- public AppParameters(String iniFileName) throws FileNotFoundException, IOException {
75- super();
76- this.file = new File(iniFileName);
77- syncFile();
78- }
79-
80- void syncFile() throws FileNotFoundException, IOException {
81- boolean update = false;
82-
83- if (this.file.exists()) {
84- // ファイルが存在すれば、その内容をロードする。
85- this.load(new FileInputStream(file));
86- }
87- else {
88- update = true;
89- }
90-
91- //------------------------------------------------
92- // 対象フォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
93- String valueStr = this.getProperty(IMG_SOURCE_FOLDER);
94- if (valueStr == null) {
95- update = true;
96- this.setProperty(IMG_SOURCE_FOLDER, (new File(".")).getAbsolutePath());
97- }
98-
99- //------------------------------------------------
100- // 対象フォルダ:(GPXファイルが格納されているフォルダ)
101- valueStr = this.getProperty(GPX_SOURCE_FOLDER);
102- if (valueStr == null) {
103- update = true;
104- this.setProperty(GPX_SOURCE_FOLDER, (new File(".")).getAbsolutePath());
105- }
106-
107- //------------------------------------------------
108- // 基準時刻画像(正確な撮影時刻が判明できる画像)
109- valueStr = this.getProperty(IMG_BASE_FILE);
110- if (valueStr == null) {
111- update = true;
112- this.setProperty(IMG_BASE_FILE, "");
113- }
114-
115- //------------------------------------------------
116- // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
117- valueStr = this.getProperty(IMG_OUTPUT_FOLDER);
118- if (valueStr == null) {
119- update = true;
120- this.setProperty(IMG_OUTPUT_FOLDER, (new File(".")).getAbsolutePath());
121- }
122-
123- //------------------------------------------------
124- // IMG出力: IMGを出力する
125- valueStr = this.getProperty(IMG_OUTPUT);
126- if (valueStr == null) {
127- update = true;
128- valueStr = String.valueOf(true);
129- }
130- this.setProperty(IMG_OUTPUT, String.valueOf(valueStr));
131-
132- //------------------------------------------------
133- // 出力IMG: 'out of time'も IMG出力の対象とする
134- valueStr = this.getProperty(IMG_OUTPUT_ALL);
135- if (valueStr == null) {
136- update = true;
137- valueStr = String.valueOf(false);
138- }
139- this.setProperty(IMG_OUTPUT_ALL, String.valueOf(valueStr));
140-
141- //------------------------------------------------
142- // IMG出力: EXIFを変換する
143- valueStr = this.getProperty(IMG_OUTPUT_EXIF);
144- if (valueStr == null) {
145- update = true;
146- valueStr = String.valueOf(true);
147- }
148- this.setProperty(IMG_OUTPUT_EXIF, String.valueOf(valueStr));
149-
150- //------------------------------------------------
151- // GPX出力: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
152- valueStr = this.getProperty(GPX_GPXSPLIT);
153- if (valueStr == null) {
154- update = true;
155- this.setProperty(GPX_GPXSPLIT, String.valueOf(true));
156- }
157-
158- //------------------------------------------------
159- // GPX出力: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
160- valueStr = this.getProperty(GPX_NO_FIRST_NODE);
161- if (valueStr == null) {
162- update = true;
163- this.setProperty(GPX_NO_FIRST_NODE, String.valueOf(true));
164- }
165-
166- //------------------------------------------------
167- // GPX出力: ポイントマーカー<WPT>を出力する {ON | OFF}
168- valueStr = this.getProperty(GPX_OUTPUT_WPT);
169- if (valueStr == null) {
170- update = true;
171- this.setProperty(GPX_OUTPUT_WPT, String.valueOf(false));
172- }
173-
174- //------------------------------------------------
175- // GPX出力: ソースGPXの<MAGVAR>を無視する {ON | OFF}
176- valueStr = this.getProperty(GPX_OVERWRITE_MAGVAR);
177- if (valueStr == null) {
178- update = true;
179- this.setProperty(GPX_OVERWRITE_MAGVAR, String.valueOf(false));
180- }
181-
182- //------------------------------------------------
183- // GPX出力: <SPEED>を上書き出力する {ON | OFF}
184- valueStr = this.getProperty(GPX_OUTPUT_SPEED);
185- if (valueStr == null) {
186- update = true;
187- this.setProperty(GPX_OUTPUT_SPEED, String.valueOf(false));
188- }
189-
190- //------------------------------------------------
191- // GPX出力: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
192- valueStr = this.getProperty(GPX_REUSE);
193- if (valueStr == null) {
194- update = true;
195- this.setProperty(GPX_REUSE, String.valueOf(false));
196- }
197-
198- //------------------------------------------------
199- // GPX: 基準時刻 {FILE_UPDATE | EXIF}
200- valueStr = this.getProperty(GPX_BASETIME);
201- if (valueStr == null) {
202- update = true;
203- this.setProperty(GPX_BASETIME, "FILE_UPDATE");
204- }
205-
206- if (update) {
207- // ・ファイルがなければ新たに作る
208- // ・項目が足りない時は書き足す。
209- this.store(new FileOutputStream(this.file), "defuilt settings");
210- }
211- }
212-
213- public void store() throws FileNotFoundException, IOException {
214- this.store(new FileOutputStream(this.file), "by AdjustTime");
215- }
12+ static final String FILE_PATH = "AdjustTime.ini";
13+
14+ // GPX: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
15+ public static String GPX_GPXSPLIT = "GPX.gpxSplit";
16+
17+ // GPX: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
18+ public static String GPX_NO_FIRST_NODE = "GPX.noFirstNode";
19+
20+ // GPX: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
21+ public static String GPX_REUSE = "GPX.REUSE";
22+
23+ // GPX: 基準時刻 {FILE_UPDATE | EXIF_TIME}
24+ public static String GPX_BASETIME = "GPX.BASETIME";
25+
26+ // GPX: ファイル更新時刻 yyyy:MM:dd HH:mm:ss
27+ public static String IMG_TIME = "IMG.TIME";
28+
29+ // 対象IMGフォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
30+ public static String IMG_SOURCE_FOLDER = "IMG.SOURCE_FOLDER";
31+
32+ // 基準時刻画像(正確な撮影時刻が判明できる画像)
33+ public static String IMG_BASE_FILE = "IMG.BASE_FILE";
34+
35+ // 対象GPXフォルダ:(GPXファイルが格納されているフォルダ)
36+ public static String GPX_SOURCE_FOLDER = "GPX.SOURCE_FOLDER";
37+
38+ // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
39+ public static String IMG_OUTPUT_FOLDER = "IMG.OUTPUT_FOLDER";
40+
41+ // 出力IMG: IMG出力をする {ON | OFF}
42+ public static String IMG_OUTPUT = "IMG.OUTPUT";
43+
44+ // 出力IMG: 'out of time'も IMG出力の対象とする {ON | OFF}
45+ //   この場合は、対象IMGフォルダ内のすべてのIMGファイルが出力フォルダに出力される
46+ public static String IMG_OUTPUT_ALL = "IMG.OUTPUT_ALL";
47+
48+ // 出力IMG: EXIFを変換する
49+ public static String IMG_OUTPUT_EXIF = "IMG.OUTPUT_EXIF";
50+
51+ // 出力GPX: <SPEED>を上書き出力する {ON | OFF}
52+ public static String GPX_OUTPUT_SPEED = "GPX.OUTPUT_SPEED";
53+
54+ // 出力GPX: ソースGPXの<MAGVER>を無視する {ON | OFF}
55+ public static String GPX_OVERWRITE_MAGVAR = "GPX.OVERWRITE_MAGVAR";
56+
57+ // 出力GPX: マーカー<wpt>を出力する {ON | OFF}
58+ public static String GPX_OUTPUT_WPT = "GPX.OUTPUT_WPT";
59+
60+ File file;
61+
62+ public AppParameters() throws FileNotFoundException, IOException {
63+ super();
64+ this.file = new File(FILE_PATH);
65+ syncFile();
66+ }
67+
68+ public AppParameters(Properties defaults) throws FileNotFoundException, IOException {
69+ super(defaults);
70+ this.file = new File(FILE_PATH);
71+ syncFile();
72+ }
73+
74+ public AppParameters(String iniFileName) throws FileNotFoundException, IOException {
75+ super();
76+ this.file = new File(iniFileName);
77+ syncFile();
78+ }
79+
80+ private void syncFile() throws FileNotFoundException, IOException {
81+ boolean update = false;
82+
83+ if (this.file.exists()) {
84+ // ファイルが存在すれば、その内容をロードする。
85+ this.load(new FileInputStream(file));
86+ }
87+ else {
88+ update = true;
89+ }
90+
91+ //------------------------------------------------
92+ // 対象フォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
93+ String valueStr = this.getProperty(IMG_SOURCE_FOLDER);
94+ if (valueStr == null) {
95+ update = true;
96+ this.setProperty(IMG_SOURCE_FOLDER, (new File(".")).getAbsolutePath());
97+ }
98+
99+ //------------------------------------------------
100+ // 対象フォルダ:(GPXファイルが格納されているフォルダ)
101+ valueStr = this.getProperty(GPX_SOURCE_FOLDER);
102+ if (valueStr == null) {
103+ update = true;
104+ this.setProperty(GPX_SOURCE_FOLDER, (new File(".")).getAbsolutePath());
105+ }
106+
107+ //------------------------------------------------
108+ // 基準時刻画像(正確な撮影時刻が判明できる画像)
109+ valueStr = this.getProperty(IMG_BASE_FILE);
110+ if (valueStr == null) {
111+ update = true;
112+ this.setProperty(IMG_BASE_FILE, "");
113+ }
114+
115+ //------------------------------------------------
116+ // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
117+ valueStr = this.getProperty(IMG_OUTPUT_FOLDER);
118+ if (valueStr == null) {
119+ update = true;
120+ this.setProperty(IMG_OUTPUT_FOLDER, (new File(".")).getAbsolutePath());
121+ }
122+
123+ //------------------------------------------------
124+ // IMG出力: IMGを出力する
125+ valueStr = this.getProperty(IMG_OUTPUT);
126+ if (valueStr == null) {
127+ update = true;
128+ valueStr = String.valueOf(true);
129+ }
130+ this.setProperty(IMG_OUTPUT, String.valueOf(valueStr));
131+
132+ //------------------------------------------------
133+ // 出力IMG: 'out of time'も IMG出力の対象とする
134+ valueStr = this.getProperty(IMG_OUTPUT_ALL);
135+ if (valueStr == null) {
136+ update = true;
137+ valueStr = String.valueOf(false);
138+ }
139+ this.setProperty(IMG_OUTPUT_ALL, String.valueOf(valueStr));
140+
141+ //------------------------------------------------
142+ // IMG出力: EXIFを変換する
143+ valueStr = this.getProperty(IMG_OUTPUT_EXIF);
144+ if (valueStr == null) {
145+ update = true;
146+ valueStr = String.valueOf(true);
147+ }
148+ this.setProperty(IMG_OUTPUT_EXIF, String.valueOf(valueStr));
149+
150+ //------------------------------------------------
151+ // GPX出力: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
152+ valueStr = this.getProperty(GPX_GPXSPLIT);
153+ if (valueStr == null) {
154+ update = true;
155+ this.setProperty(GPX_GPXSPLIT, String.valueOf(true));
156+ }
157+
158+ //------------------------------------------------
159+ // GPX出力: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
160+ valueStr = this.getProperty(GPX_NO_FIRST_NODE);
161+ if (valueStr == null) {
162+ update = true;
163+ this.setProperty(GPX_NO_FIRST_NODE, String.valueOf(true));
164+ }
165+
166+ //------------------------------------------------
167+ // GPX出力: ポイントマーカー<WPT>を出力する {ON | OFF}
168+ valueStr = this.getProperty(GPX_OUTPUT_WPT);
169+ if (valueStr == null) {
170+ update = true;
171+ this.setProperty(GPX_OUTPUT_WPT, String.valueOf(false));
172+ }
173+
174+ //------------------------------------------------
175+ // GPX出力: ソースGPXの<MAGVAR>を無視する {ON | OFF}
176+ valueStr = this.getProperty(GPX_OVERWRITE_MAGVAR);
177+ if (valueStr == null) {
178+ update = true;
179+ this.setProperty(GPX_OVERWRITE_MAGVAR, String.valueOf(false));
180+ }
181+
182+ //------------------------------------------------
183+ // GPX出力: <SPEED>を上書き出力する {ON | OFF}
184+ valueStr = this.getProperty(GPX_OUTPUT_SPEED);
185+ if (valueStr == null) {
186+ update = true;
187+ this.setProperty(GPX_OUTPUT_SPEED, String.valueOf(false));
188+ }
189+
190+ //------------------------------------------------
191+ // GPX出力: 生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。 {ON | OFF}
192+ valueStr = this.getProperty(GPX_REUSE);
193+ if (valueStr == null) {
194+ update = true;
195+ this.setProperty(GPX_REUSE, String.valueOf(false));
196+ }
197+
198+ //------------------------------------------------
199+ // GPX: 基準時刻 {FILE_UPDATE | EXIF}
200+ valueStr = this.getProperty(GPX_BASETIME);
201+ if (valueStr == null) {
202+ update = true;
203+ this.setProperty(GPX_BASETIME, "FILE_UPDATE");
204+ }
205+
206+ if (update) {
207+ // ・ファイルがなければ新たに作る
208+ // ・項目が足りない時は書き足す。
209+ this.store(new FileOutputStream(this.file), "defuilt settings");
210+ }
211+ }
212+
213+ public void store() throws FileNotFoundException, IOException {
214+ this.store(new FileOutputStream(this.file), "by AdjustTime");
215+ }
216216 }
--- a/importPicture/src/osm/jp/gpx/Complementation.java
+++ b/importPicture/src/osm/jp/gpx/Complementation.java
@@ -13,24 +13,26 @@ public class Complementation {
1313 public static boolean param_GpxOverwriteMagvar = false;
1414
1515 /**
16- *
16+ * @param imaE
17+ * @param maeE
18+ * @code{
1719 * <trkpt lat="34.976635" lon="138.466228">
1820 * <ele>267.291</ele>
1921 * <magvar>359</magvar>
2022 * <speed></speed>
2123 * <time>2016-07-02T08:25:18Z</time>
2224 * </trkpt>
23- *
24- * @param trkseg
25- * @param map
25+ * }
26+ *
27+ *
2628 * @throws ParseException
2729 */
28- public Complementation(TagTrkpt imaE, TagTrkpt maeE) throws ParseException {
29- this.imaTag = new TagTrkpt(imaE.trkpt);
30+ public Complementation(TagTrkpt imaE, TagTrkpt maeE) throws ParseException {
31+ this.imaTag = new TagTrkpt(imaE.trkpt);
3032 if (maeE != null) {
3133 this.maeTag = new TagTrkpt(maeE.trkpt);
3234 }
33- }
35+ }
3436
3537 /**
3638 * 緯度・経度と時間差から速度(km/h)を求める
@@ -38,49 +40,42 @@ public class Complementation {
3840 */
3941 public void complementationSpeed() {
4042 if (imaTag.speedStr != null) {
41- try {
43+ try {
4244 Double.parseDouble(imaTag.speedStr);
43- }
44- catch (NumberFormatException e) {
45- // 数字以外なら<speed>エレメントを削除する
46- imaTag.removeElement("speed");
47- imaTag.speedStr = null;
48- }
45+ }
46+ catch (NumberFormatException e) {
47+ // 数字以外なら<speed>エレメントを削除する
48+ imaTag.removeElement("speed");
49+ imaTag.speedStr = null;
50+ }
4951 }
5052
5153 if (imaTag.speedStr == null) {
52- double d = GeoDistance.calcDistHubeny(imaTag.lat, imaTag.lon, maeTag.lat, maeTag.lon);
54+ double d = GeoDistance.calcDistHubeny(imaTag.lat, imaTag.lon, maeTag.lat, maeTag.lon);
5355 String str = Double.toString((d * 3600) / (imaTag.time.getTime() - maeTag.time.getTime()));
5456 int iDot = str.indexOf('.');
5557 if (iDot > 0) {
5658 str = str.substring(0, iDot+2);
5759 }
5860 imaTag.appendElement("speed", str);
59- imaTag.speedStr = new String(str);
61+ imaTag.speedStr = str;
6062 }
6163 }
6264
6365 /**
6466 * 経度(longitude)と経度から進行方向を求める
65- * @param imaE
66- * @param imaLON
67- * @param imaLAT
68- * @param imaTIME
69- * @param maeLON
70- * @param maeLAT
71- * @param maeTIME
7267 * @throws ParseException
7368 */
7469 public void complementationMagvar() throws ParseException {
7570 if (imaTag.magvarStr != null) {
76- try {
71+ try {
7772 Double.parseDouble(imaTag.magvarStr);
78- }
79- catch (NumberFormatException e) {
80- // 数字以外なら<magvar>エレメントを削除する
81- imaTag.removeElement("magvar");
82- imaTag.magvarStr = null;
83- }
73+ }
74+ catch (NumberFormatException e) {
75+ // 数字以外なら<magvar>エレメントを削除する
76+ imaTag.removeElement("magvar");
77+ imaTag.magvarStr = null;
78+ }
8479 }
8580
8681 if (imaTag.magvarStr == null) {
@@ -112,7 +107,7 @@ public class Complementation {
112107 str = str.substring(0, iDot);
113108 }
114109 imaTag.appendElement("magvar", str);
115- imaTag.magvarStr = new String(str);
110+ imaTag.magvarStr = str;
116111 }
117112 }
118113 }
--- a/importPicture/src/osm/jp/gpx/ElementMapTRKPT.java
+++ b/importPicture/src/osm/jp/gpx/ElementMapTRKPT.java
@@ -8,30 +8,32 @@ import org.w3c.dom.DOMException;
88
99 @SuppressWarnings("serial")
1010 public class ElementMapTRKPT extends TreeMap<Date, TagTrkpt> {
11- public static final long DIFF_MAE_TIME = 3000L; // before 3 secound
11+ public static final long DIFF_MAE_TIME = 3000L; // before 3 secound
1212
13- public ElementMapTRKPT() {
14- super(new TimeComparator());
15- }
13+ public ElementMapTRKPT() {
14+ super(new TimeComparator());
15+ }
1616
17- /**
18- * 拡張put value:ElementをputするとElement内のtimeを読み取ってkeyとしてthis.put(key,value)する。
19- * <trkpt lat="36.4260153752" lon="138.0117778201">
17+ /**
18+ * 拡張put value:ElementをputするとElement内のtimeを読み取ってkeyとしてthis.put(key,value)する。
19+ * @param tag
20+ * @code{
21+ * <trkpt lat="36.4260153752" lon="138.0117778201">
2022 * <ele>614.90</ele>
2123 * <time>2017-05-21T23:02:16Z</time>
2224 * <hdop>0.5</hdop>
2325 * </trkpt>
24- * @param value
25- * @return keyとして登録したtime:Date
26- * @throws ParseException
27- * @throws DOMException
28- */
29- public Date put(TagTrkpt tag) throws DOMException, ParseException {
26+ * }
27+ * @return keyとして登録したtime:Date
28+ * @throws ParseException
29+ * @throws DOMException
30+ */
31+ public Date put(TagTrkpt tag) throws DOMException, ParseException {
3032 this.put(tag.time, tag);
3133 return tag.time;
32- }
33-
34- /**
34+ }
35+
36+ /**
3537 * 指定時刻(jptime)のTRKPTエレメントを取り出す。
3638 *
3739 * @param jptime 指定する日時
@@ -41,7 +43,7 @@ public class ElementMapTRKPT extends TreeMap<Date, TagTrkpt> {
4143 public TagTrkpt getValue(Date jptime) throws ParseException {
4244 TagTrkpt imaE = getTrkpt(jptime);
4345 if (imaE != null) {
44- TagTrkpt maeE = getMaeTrkpt(imaE.time);
46+ TagTrkpt maeE = getMaeTrkpt(imaE.time);
4547 if (maeE != null) {
4648 Complementation comp = new Complementation(imaE, maeE);
4749
@@ -49,12 +51,12 @@ public class ElementMapTRKPT extends TreeMap<Date, TagTrkpt> {
4951 // 直前の位置と、現在地から進行方向を求める
5052 // 経度(longitude)と経度から進行方向を求める
5153 if (Complementation.param_GpxOverwriteMagvar) {
52- comp.complementationMagvar();
54+ comp.complementationMagvar();
5355 }
5456
5557 // 緯度・経度と時間差から速度(km/h)を求める
5658 if (Complementation.param_GpxOutputSpeed) {
57- comp.complementationSpeed();
59+ comp.complementationSpeed();
5860 }
5961 //return (TagTrkpt)(comp.imaTag.trkpt.cloneNode(true));
6062 return (TagTrkpt)(comp.imaTag);
@@ -77,26 +79,26 @@ public class ElementMapTRKPT extends TreeMap<Date, TagTrkpt> {
7779 private TagTrkpt getTrkpt(Date jptime) throws ParseException {
7880 Date keyTime = null;
7981 for (Date key : this.keySet()) {
80- int flag = jptime.compareTo(key);
81- if (flag < 0) {
82- if (keyTime != null) {
83- return this.get(keyTime);
84- }
85- return null;
86- }
87- else if (flag == 0) {
88- return this.get(key);
89- }
90- else if (flag > 0) {
91- keyTime = new Date(key.getTime());
92- }
93- }
94- if (keyTime != null) {
95- if (Math.abs(keyTime.getTime() - jptime.getTime()) <= OVER_TIME_LIMIT) {
96- return this.get(keyTime);
97- }
98- }
99- return null;
82+ int flag = jptime.compareTo(key);
83+ if (flag < 0) {
84+ if (keyTime != null) {
85+ return this.get(keyTime);
86+ }
87+ return null;
88+ }
89+ else if (flag == 0) {
90+ return this.get(key);
91+ }
92+ else if (flag > 0) {
93+ keyTime = new Date(key.getTime());
94+ }
95+ }
96+ if (keyTime != null) {
97+ if (Math.abs(keyTime.getTime() - jptime.getTime()) <= OVER_TIME_LIMIT) {
98+ return this.get(keyTime);
99+ }
100+ }
101+ return null;
100102 }
101103
102104 /**
@@ -108,40 +110,40 @@ public class ElementMapTRKPT extends TreeMap<Date, TagTrkpt> {
108110
109111 private TagTrkpt getMaeTrkpt(Date time) throws ParseException {
110112 Date maeTime = null;
111- for (Date key : this.keySet()) {
112- int flag = time.compareTo(key);
113- if (flag > 0) {
114- maeTime = new Date(key.getTime());
115- }
116- else if (flag == 0) {
117- if (maeTime == null) {
118- return null;
119- }
120- return this.get(maeTime);
121- }
122- else {
123- // time は key より古い
124- if (maeTime == null) {
125- return null;
126- }
127- if (Math.abs(maeTime.getTime() - time.getTime()) > OVER_TIME_LIMIT) {
128- return null;
129- }
130- return this.get(maeTime);
131- }
132- }
113+ for (Date key : this.keySet()) {
114+ int flag = time.compareTo(key);
115+ if (flag > 0) {
116+ maeTime = new Date(key.getTime());
117+ }
118+ else if (flag == 0) {
119+ if (maeTime == null) {
120+ return null;
121+ }
122+ return this.get(maeTime);
123+ }
124+ else {
125+ // time は key より古い
126+ if (maeTime == null) {
127+ return null;
128+ }
129+ if (Math.abs(maeTime.getTime() - time.getTime()) > OVER_TIME_LIMIT) {
130+ return null;
131+ }
132+ return this.get(maeTime);
133+ }
134+ }
133135 return null;
134136 }
135137
136138 public void printinfo() {
137139 Date firstTime = null;
138140 Date lastTime = null;
139- for (Date key : this.keySet()) {
140- if (firstTime == null) {
141- firstTime = new Date(key.getTime());
142- }
143- lastTime = new Date(key.getTime());
144- }
145- System.out.println(String.format("| <trkseg/> |%20s|%20s|", ImportPicture.toUTCString(firstTime), ImportPicture.toUTCString(lastTime)));
141+ for (Date key : this.keySet()) {
142+ if (firstTime == null) {
143+ firstTime = new Date(key.getTime());
144+ }
145+ lastTime = new Date(key.getTime());
146+ }
147+ System.out.println(String.format("| <trkseg/> |%20s|%20s|", ImportPicture.toUTCString(firstTime), ImportPicture.toUTCString(lastTime)));
146148 }
147149 }
--- a/importPicture/src/osm/jp/gpx/ElementMapTRKSEG.java
+++ b/importPicture/src/osm/jp/gpx/ElementMapTRKSEG.java
@@ -15,28 +15,29 @@ import org.xml.sax.SAXException;
1515
1616 @SuppressWarnings("serial")
1717 public class ElementMapTRKSEG extends TreeMap<Date, ElementMapTRKPT> {
18- /**
19- * TESTing
20- * @throws ParseException
21- * @throws ParserConfigurationException
22- * @throws IOException
23- * @throws SAXException
24- * @throws DOMException
25- */
26- public static void main(String[] argv) throws DOMException, SAXException, IOException, ParserConfigurationException, ParseException {
27- ElementMapTRKSEG mapTRKSEG = null;
28- mapTRKSEG = new ElementMapTRKSEG();
18+ /**
19+ * TESTing
20+ * @param argv
21+ * @throws ParseException
22+ * @throws ParserConfigurationException
23+ * @throws IOException
24+ * @throws SAXException
25+ * @throws DOMException
26+ */
27+ public static void main(String[] argv) throws DOMException, SAXException, IOException, ParserConfigurationException, ParseException {
28+ ElementMapTRKSEG mapTRKSEG = null;
29+ mapTRKSEG = new ElementMapTRKSEG();
2930 mapTRKSEG.parse(new File("testdata/cameradata/separate.gpx"));
3031 mapTRKSEG.printinfo();
31- }
32-
33- public ElementMapTRKSEG() {
34- super(new TimeComparator());
35- }
32+ }
3633
34+ public ElementMapTRKSEG() {
35+ super(new TimeComparator());
36+ }
37+
3738 /**
3839 * GPXファイルをパースする
39- *
40+ * @code{
4041 * <gpx>
4142 * <trk>
4243 * <trkseg>
@@ -48,16 +49,17 @@ public class ElementMapTRKSEG extends TreeMap<Date, ElementMapTRKPT> {
4849 * </trkseg>
4950 * </trk>
5051 * </gpx>
51- *
52- * @param gpxFile
53- * @return Document
54- * @throws SAXException
55- * @throws IOException
56- * @throws ParserConfigurationException
57- * @throws DOMException
58- * @throws ParseException
59- */
60- public Document parse(File gpxFile) throws SAXException, IOException, ParserConfigurationException, DOMException, ParseException {
52+ * }
53+ *
54+ * @param gpxFile
55+ * @return Document
56+ * @throws SAXException
57+ * @throws IOException
58+ * @throws ParserConfigurationException
59+ * @throws DOMException
60+ * @throws ParseException
61+ */
62+ public Document parse(File gpxFile) throws SAXException, IOException, ParserConfigurationException, DOMException, ParseException {
6163 DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
6264 DocumentBuilder builder = factory.newDocumentBuilder();
6365 factory.setIgnoringElementContentWhitespace(true);
@@ -82,16 +84,17 @@ public class ElementMapTRKSEG extends TreeMap<Date, ElementMapTRKPT> {
8284 }
8385 }
8486 return document;
85- }
86-
87- /**
88- * 拡張put value:Node<TRKSEG>をputするとNode<TRKSEG>内のNode<TRKSPT>を put(key,value)する。
89- * @param nodeTRKSEG
90- * @return keyとして登録したtime:Date
91- * @throws ParseException
92- * @throws DOMException
93- */
94- public void put(Node nodeTRKSEG) throws DOMException, ParseException {
87+ }
88+
89+ /**
90+ * @code{
91+ * 拡張put value:Node<TRKSEG>をputするとNode<TRKSEG>内のNode<TRKSPT>を put(key,value)する。
92+ * }
93+ * @param nodeTRKSEG
94+ * @throws ParseException
95+ * @throws DOMException
96+ */
97+ public void put(Node nodeTRKSEG) throws DOMException, ParseException {
9598 if (nodeTRKSEG.getNodeName().equals("trkseg")) {
9699 NodeList nodes2 = nodeTRKSEG.getChildNodes();
97100
@@ -99,42 +102,37 @@ public class ElementMapTRKSEG extends TreeMap<Date, ElementMapTRKPT> {
99102 for (int i2 = 0; i2 < nodes2.getLength(); i2++) {
100103 Node nodeTRKPT = nodes2.item(i2);
101104 if (nodeTRKPT.getNodeName().equals("trkpt")) {
102- if (ImportPicture.param_GpxNoFirstNode && (i2 == 0)) {
103- continue;
104- }
105+ if (ImportPicture.param_GpxNoFirstNode && (i2 == 0)) {
106+ continue;
107+ }
105108 mapTRKPT.put(new TagTrkpt((Element)nodeTRKPT));
106109 }
107110 }
108111 this.put(mapTRKPT);
109112 }
110- }
113+ }
111114
112- /**
113- * 拡張put value:ElementMapTRKPTをputするとElementMapTRKPT内の最初のエントリのtimeを読み取ってkeyとしてthis.put(key,value)する。
114- * @param value
115- * @return keyとして登録したtime:Date
116- * @throws ParseException
117- * @throws DOMException
118- */
119- public void put(ElementMapTRKPT value) {
120- for (Date key : value.keySet()) {
121- this.put(key, value);
122- return;
123- }
124- }
115+ /**
116+ * 拡張put value:ElementMapTRKPTをputするとElementMapTRKPT内の最初のエントリのtimeを読み取ってkeyとしてthis.put(key,value)する。
117+ * @param value
118+ * @throws DOMException
119+ */
120+ public void put(ElementMapTRKPT value) {
121+ for (Date key : value.keySet()) {
122+ this.put(key, value);
123+ return;
124+ }
125+ }
125126
126- public void printinfo() {
127- System.out.println(" +--------------------+--------------------|");
128- System.out.println(" GPS logging time | First Time | Last Time |");
129- System.out.println("|--------------------------------+--------------------+--------------------|");
130-
131- for (java.util.Map.Entry<Date, ElementMapTRKPT> map : this.entrySet()) {
132- ElementMapTRKPT mapTRKPT = map.getValue();
133- mapTRKPT.printinfo();
127+ public void printinfo() {
128+ System.out.println(" +--------------------+--------------------|");
129+ System.out.println(" GPS logging time | First Time | Last Time |");
130+ System.out.println("|--------------------------------+--------------------+--------------------|");
131+ for (java.util.Map.Entry<Date, ElementMapTRKPT> map : this.entrySet()) {
132+ ElementMapTRKPT mapTRKPT = map.getValue();
133+ mapTRKPT.printinfo();
134134 }
135-
136- System.out.println("|--------------------------------+--------------------+--------------------|");
137- System.out.println();
138- }
139-
135+ System.out.println("|--------------------------------+--------------------+--------------------|");
136+ System.out.println();
137+ }
140138 }
--- a/importPicture/src/osm/jp/gpx/GeoDistance.java
+++ b/importPicture/src/osm/jp/gpx/GeoDistance.java
@@ -26,7 +26,7 @@ public class GeoDistance {
2626 * @return
2727 */
2828 public static double deg2rad(double deg){
29- return deg * Math.PI / 180.0;
29+ return deg * Math.PI / 180.0;
3030 }
3131
3232 /**
--- a/importPicture/src/osm/jp/gpx/GpxFile.java
+++ b/importPicture/src/osm/jp/gpx/GpxFile.java
@@ -30,8 +30,9 @@ public class GpxFile extends File {
3030 ElementMapTRKSEG mapTRKSEG = null;
3131 Document document;
3232
33- public GpxFile(File file) throws ParserConfigurationException, DOMException, SAXException, IOException, ParseException {
34- super(file.getParentFile(), file.getName());
33+ @SuppressWarnings("LeakingThisInConstructor")
34+ public GpxFile(File file) throws ParserConfigurationException, DOMException, SAXException, IOException, ParseException {
35+ super(file.getParentFile(), file.getName());
3536
3637 DocumentBuilderFactory factory = null;
3738 DocumentBuilder builder = null;
@@ -51,20 +52,21 @@ public class GpxFile extends File {
5152
5253 // GPX file --> Node root
5354 gpx = builder.parse(this).getFirstChild();
54- }
55+ }
5556
56- /**
57- * GPX 変換出力
58- * @throws FileNotFoundException
59- * @throws TransformerException
60- */
61- public void output(File outDir) throws FileNotFoundException, TransformerException {
57+ /**
58+ * GPX 変換出力
59+ * @param outDir
60+ * @throws FileNotFoundException
61+ * @throws TransformerException
62+ */
63+ public void output(File outDir) throws FileNotFoundException, TransformerException {
6264 String fileName = this.getName();
6365 String iStr = fileName.substring(0, fileName.length() - 4);
6466 File outputFile = new File(outDir, iStr +"_.gpx");
6567 System.out.println(this.getAbsolutePath() + " => "+ outputFile.getAbsolutePath());
6668
67- outputFile.getParentFile().mkdirs();
69+ outputFile.getParentFile().mkdirs();
6870 DOMSource source = new DOMSource(this.gpx);
6971 FileOutputStream os = new FileOutputStream(outputFile);
7072 StreamResult result = new StreamResult(os);
@@ -77,7 +79,7 @@ public class GpxFile extends File {
7779 os = new FileOutputStream(outputFile);
7880 result = new StreamResult(os);
7981 transformer.transform(source, result);
80- }
82+ }
8183
8284 /**
8385 * <wpt lat="35.25714922" lon="139.15490497">
@@ -94,6 +96,7 @@ public class GpxFile extends File {
9496 * <time>2012-06-15T03:00:29Z</time>
9597 * </trkpt>
9698 *
99+ * @param imgDir
97100 * @return
98101 * @param iFile
99102 * @param timestamp
--- a/importPicture/src/osm/jp/gpx/ImportPicture.java
+++ b/importPicture/src/osm/jp/gpx/ImportPicture.java
@@ -12,6 +12,7 @@ import java.util.Calendar;
1212 import java.util.Comparator;
1313 import java.util.Date;
1414 import java.util.Map;
15+import java.util.ResourceBundle;
1516 import java.util.TimeZone;
1617 import java.util.logging.LogManager;
1718 import java.util.logging.Logger;
@@ -35,38 +36,43 @@ import org.w3c.dom.*;
3536 import org.xml.sax.SAXException;
3637
3738 public class ImportPicture extends Thread {
38- /**
39- * 実行中に発生したExceptionを保持する場所
40- */
41- public Exception ex = null;
39+
40+ /**
41+ * 実行中に発生したExceptionを保持する場所
42+ */
43+ public Exception ex = null;
4244
4345 /**
4446 * ログ設定プロパティファイルのファイル内容
4547 */
4648 protected static final String LOGGING_PROPERTIES_DATA
47- = "handlers=java.util.logging.ConsoleHandler\n"
48- + ".level=FINEST\n"
49- + "java.util.logging.ConsoleHandler.level=INFO\n"
50- + "java.util.logging.ConsoleHandler.formatter=osm.jp.gpx.YuuLogFormatter";
49+ = "handlers=java.util.logging.ConsoleHandler\n"
50+ + ".level=FINEST\n"
51+ + "java.util.logging.ConsoleHandler.level=INFO\n"
52+ + "java.util.logging.ConsoleHandler.formatter=osm.jp.gpx.YuuLogFormatter";
5153
5254 /**
5355 * static initializer によるログ設定の初期化
5456 */
55- public static final Logger logger = Logger.getLogger("CommandLogging");
57+ public static final Logger LOGGER = Logger.getLogger("CommandLogging");
5658 static {
5759 InputStream inStream = null;
5860 try {
5961 inStream = new ByteArrayInputStream(LOGGING_PROPERTIES_DATA.getBytes("UTF-8"));
6062 try {
6163 LogManager.getLogManager().readConfiguration(inStream);
62- logger.config("ログ設定: LogManagerを設定しました。");
64+ // "ログ設定: LogManagerを設定しました。"
65+ LOGGER.config("LoggerSettings: LogManager setuped.");
6366 }
6467 catch (IOException e) {
65- logger.warning("ログ設定: LogManager設定の際に例外が発生しました。:" + e.toString());
68+ // LogManager設定の際に例外が発生しました.
69+ String str = "LoggerSettings: Exception occered:" + e.toString();
70+ LOGGER.warning(str);
6671 }
6772 }
6873 catch (UnsupportedEncodingException e) {
69- logger.severe("ログ設定: UTF-8エンコーディングがサポートされていません。:" + e.toString());
74+ String str = "LoggerSettings: Not supported 'UTF-8' encoding: " + e.toString();
75+ LOGGER.severe(str);
7076 }
7177 finally {
7278 try {
@@ -74,13 +80,12 @@ public class ImportPicture extends Thread {
7480 inStream.close();
7581 }
7682 } catch (IOException e) {
77- logger.warning("ログ設定: ログ設定プロパティファイルのストリームクローズ時に例外が発生しました。:"+ e.toString());
83+ String str = "LoggerSettings: Exception occored: "+ e.toString();
84+ LOGGER.warning(str);
7885 }
7986 }
8087 }
8188
82-
83-
8489 /** メイン
8590 * 画像ファイルをGPXファイルに取り込みます。
8691 *
@@ -120,16 +125,16 @@ public class ImportPicture extends Thread {
120125 public boolean exifBase = false;
121126 public ArrayList<File> gpxFiles = new ArrayList<>();
122127 public AppParameters params;
123- public boolean param_GpxSplit = false;
124- public static boolean param_GpxNoFirstNode = false;
125- public boolean param_GpxReuse = false;
126- public boolean param_GpxOutputWpt = true;
127- public boolean param_ImgOutputAll = false;
128- public String param_GpxSourceFolder = ".";
128+ public boolean param_GpxSplit = false;
129+ public static boolean param_GpxNoFirstNode = false;
130+ public boolean param_GpxReuse = false;
131+ public boolean param_GpxOutputWpt = true;
132+ public boolean param_ImgOutputAll = false;
133+ public String param_GpxSourceFolder = ".";
129134
130-
131135 public static final String TIME_FORMAT_STRING = "yyyy-MM-dd'T'HH:mm:ss'Z'";
132136 private static final String EXIF_DATE_TIME_FORMAT_STRING = "yyyy:MM:dd HH:mm:ss";
137+ public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
133138
134139 public void setUp(String paramFilePath) throws Exception {
135140 System.out.println("Param File = '"+ paramFilePath +"'");
@@ -158,7 +163,7 @@ public class ImportPicture extends Thread {
158163 this.imgDir = new File(this.params.getProperty(AppParameters.IMG_SOURCE_FOLDER));
159164
160165 // 基準時刻(ファイル更新日時 | EXIF撮影日時)
161- this.exifBase = (this.params.getProperty(AppParameters.GPX_BASETIME).equals("EXIF_TIME") ? true : false);
166+ this.exifBase = (this.params.getProperty(AppParameters.GPX_BASETIME).equals("EXIF_TIME"));
162167
163168 // 基準時刻ファイルの「更新日時」を使って時刻合わせを行う。
164169 // argv[1] --> AppParameters.IMG_BASE_FILE に置き換え
@@ -171,46 +176,48 @@ public class ImportPicture extends Thread {
171176 // その他のパラメータを読み取る
172177 String paramStr = this.params.getProperty(AppParameters.GPX_GPXSPLIT);
173178 if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {
174- this.param_GpxSplit = true;
179+ this.param_GpxSplit = true;
175180 }
176181
177182 paramStr = this.params.getProperty(AppParameters.GPX_NO_FIRST_NODE);
178183 if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {
179- ImportPicture.param_GpxNoFirstNode = true;
184+ ImportPicture.param_GpxNoFirstNode = true;
180185 }
181186
182187 paramStr = this.params.getProperty(AppParameters.GPX_REUSE);
183188 if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {
184- this.param_GpxReuse = true;
189+ this.param_GpxReuse = true;
185190 }
186191
187192 paramStr = this.params.getProperty(AppParameters.IMG_OUTPUT_ALL);
188193 if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {
189- this.param_ImgOutputAll = true;
194+ this.param_ImgOutputAll = true;
190195 }
191196
192197 paramStr = this.params.getProperty(AppParameters.GPX_OUTPUT_WPT);
193198 if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {
194- this.param_GpxOutputWpt = true;
199+ this.param_GpxOutputWpt = true;
195200 }
196201
197202 paramStr = this.params.getProperty(AppParameters.GPX_OVERWRITE_MAGVAR);
198203 if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {
199- Complementation.param_GpxOverwriteMagvar = true;
204+ Complementation.param_GpxOverwriteMagvar = true;
200205 }
201206
202207 paramStr = this.params.getProperty(AppParameters.GPX_OUTPUT_SPEED);
203208 if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {
204- Complementation.param_GpxOutputSpeed = true;
209+ Complementation.param_GpxOutputSpeed = true;
205210 }
206211
207212 paramStr = this.params.getProperty(AppParameters.GPX_SOURCE_FOLDER);
208213 if (paramStr != null) {
209- this.param_GpxSourceFolder = new String(paramStr);
214+ this.param_GpxSourceFolder = paramStr;
210215 this.gpxDir = new File(this.param_GpxSourceFolder);
211216 if (!this.gpxDir.exists()) {
212- // GPXファイルまたはディレクトリが存在しません。
213- System.out.println("GPXファイルまたはディレクトリが存在しません。('"+ paramStr +"')");
217+ // GPXファイルまたはディレクトリが存在しません。('%s')
218+ System.out.println(
219+ String.format(i18n.getString("msg.100"), paramStr)
220+ );
214221 return;
215222 }
216223 }
@@ -222,21 +229,28 @@ public class ImportPicture extends Thread {
222229 if (this.gpxDir.isDirectory()) {
223230 File[] files = this.gpxDir.listFiles();
224231 if (files == null) {
225- // 対象となるGPXファイルがありませんでした。
226- System.out.println("対象となるGPXファイルがありませんでした。('"+ this.gpxDir.getAbsolutePath() +"')");
232+ // 対象となるGPXファイルがありませんでした。('%s')
233+ System.out.println(
234+ String.format(i18n.getString("msg.110"), this.gpxDir.getAbsolutePath())
235+ );
227236 return;
228237 }
229238 if (this.param_ImgOutputAll && (files.length > 1)) {
230- System.out.println("複数のGPXファイルがあるときには、'IMG.OUTPUT_ALL'オプションは指定できません。");
239+ // "複数のGPXファイルがあるときには、'IMG.OUTPUT_ALL'オプションは指定できません。"
240+ System.out.println(
241+ i18n.getString("msg.120")
242+ );
231243 return;
232244 }
233245
234- java.util.Arrays.sort(files, new java.util.Comparator<File>() {
235- @Override
236- public int compare(File file1, File file2){
237- return file1.getName().compareTo(file2.getName());
238- }
239- });
246+ java.util.Arrays.sort(
247+ files, new java.util.Comparator<File>() {
248+ @Override
249+ public int compare(File file1, File file2){
250+ return file1.getName().compareTo(file2.getName());
251+ }
252+ }
253+ );
240254 for (File file : files) {
241255 if (file.isFile()) {
242256 String filename = file.getName().toUpperCase();
@@ -254,7 +268,7 @@ public class ImportPicture extends Thread {
254268
255269 paramStr = this.params.getProperty(AppParameters.IMG_OUTPUT_EXIF);
256270 if ((paramStr != null) && (paramStr.equals(Boolean.toString(true)))) {
257- this.exif = true;
271+ this.exif = true;
258272 }
259273
260274 String timeStr = this.params.getProperty(AppParameters.IMG_TIME);
@@ -263,7 +277,14 @@ public class ImportPicture extends Thread {
263277 this.delta = t.getTime() - imgtime.getTime();
264278 }
265279 catch (ParseException e) {
266- System.out.println("'"+ timeStr +"' の書式が違います("+ TIME_FORMAT_STRING +")");
280+ // "'%s'の書式が違います(%s)"
281+ System.out.println(
282+ String.format(
283+ i18n.getString("msg.130"),
284+ timeStr,
285+ TIME_FORMAT_STRING
286+ )
287+ );
267288 return;
268289 }
269290
@@ -272,42 +293,41 @@ public class ImportPicture extends Thread {
272293 this.join();
273294 } catch(InterruptedException end) {}
274295 if (this.ex != null) {
275- throw this.ex;
296+ throw this.ex;
276297 }
277-
278298 }
279299
300+ /**
301+ * @code{
302+ <wpt lat="35.25714922" lon="139.15490497">
303+ <ele>62.099998474121094</ele>
304+ <time>2012-06-11T00:44:38Z</time>
305+ <hdop>0.75</hdop>
306+ <name><![CDATA[写真]]></name>
307+ <cmt><![CDATA[精度: 3.0m]]></cmt>
308+ <link href="2012-06-11_09-44-38.jpg">
309+ <text>2012-06-11_09-44-38.jpg</text>
310+ </link>
311+ <sat>9</sat>
312+ </wpt>
313+ * }
314+ */
280315 @Override
281316 public void run() {
282- /**
283- *
284- <wpt lat="35.25714922" lon="139.15490497">
285- <ele>62.099998474121094</ele>
286- <time>2012-06-11T00:44:38Z</time>
287- <hdop>0.75</hdop>
288- <name><![CDATA[写真]]></name>
289- <cmt><![CDATA[精度: 3.0m]]></cmt>
290- <link href="2012-06-11_09-44-38.jpg">
291- <text>2012-06-11_09-44-38.jpg</text>
292- </link>
293- <sat>9</sat>
294- </wpt>
295- */
296317 try {
297- if (params.getProperty(AppParameters.IMG_OUTPUT).equals(Boolean.toString(true))) {
318+ if (params.getProperty(AppParameters.IMG_OUTPUT).equals(Boolean.toString(true))) {
298319 outDir = new File(outDir, imgDir.getName());
299- }
300- else {
320+ }
321+ else {
301322 outDir = gpxDir;
302- }
303-
323+ }
304324 for (File gpxFile : this.gpxFiles) {
305325 procGPXfile(new GpxFile(gpxFile));
306326 }
307327 }
308328 catch(ParserConfigurationException | DOMException | SAXException | IOException | ParseException | ImageReadException | ImageWriteException | IllegalArgumentException | TransformerException e) {
309- e.printStackTrace();
310- this.ex = new Exception(e);
329+ e.printStackTrace();
330+ this.ex = new Exception(e);
311331 }
312332 }
313333
@@ -325,20 +345,20 @@ public class ImportPicture extends Thread {
325345 void procGPXfile(GpxFile gpxFile) throws ParserConfigurationException, SAXException, IOException, ParseException, ImageReadException, ImageWriteException, TransformerException {
326346 System.gc();
327347
328- System.out.println(" 時差: "+ (delta / 1000) +"(sec)");
329- System.out.println(" Target GPX: ["+ gpxFile.getAbsolutePath() +"]");
330- System.out.println(" EXIF: "+ (exif ? ("convert to '" + outDir.getAbsolutePath() +"'") : "off"));
348+ System.out.println("time difference: "+ (delta / 1000) +"(sec)");
349+ System.out.println(" Target GPX: ["+ gpxFile.getAbsolutePath() +"]");
350+ System.out.println(" EXIF: "+ (exif ? ("convert to '" + outDir.getAbsolutePath() +"'") : "off"));
331351 System.out.println();
332352
333353 // imgDir内の画像ファイルを処理する
334- System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");
335- System.out.println("| name | Camera Time | GPStime | Latitude | Longitude | ele |magvar| km/h |");
336- System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");
337- proc(imgDir, delta, gpxFile.mapTRKSEG, exif, gpxFile);
338- System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");
354+ System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");
355+ System.out.println("| name | Camera Time | GPStime | Latitude | Longitude | ele |magvar| km/h |");
356+ System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");
357+ proc(imgDir, delta, gpxFile.mapTRKSEG, exif, gpxFile);
358+ System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|");
339359
340360 // GPX出力
341- gpxFile.output(outDir);
361+ gpxFile.output(outDir);
342362 }
343363
344364
@@ -386,8 +406,8 @@ public class ImportPicture extends Thread {
386406 public boolean ret;
387407 public int control;
388408 public Discripter(boolean ret) {
389- this.ret = ret;
390- this.control = Discripter.NEXT;
409+ this.ret = ret;
410+ this.control = Discripter.NEXT;
391411 }
392412 }
393413
@@ -401,18 +421,31 @@ public class ImportPicture extends Thread {
401421 ImageMetadata meta = Imaging.getMetadata(imageFile);
402422 JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
403423 if (jpegMetadata == null) {
404- System.out.println("'"+ imageFile.getAbsolutePath() +"' にEXIF情報がありません");
424+ // "'%s'にEXIF情報がありません"
425+ System.out.println(
426+ String.format(
427+ i18n.getString("msg.140"),
428+ imageFile.getAbsolutePath()
429+ )
430+ );
405431 result.control = Discripter.CONTINUE;
406432 return result;
407433 }
434+ @SuppressWarnings("LocalVariableHidesMemberVariable")
408435 TiffImageMetadata exif = jpegMetadata.getExif();
409436 if (exif == null) {
410- System.out.println("'"+ imageFile.getAbsolutePath() +"' にEXIF情報がありません");
437+ // "'%s'にEXIF情報がありません"
438+ System.out.println(
439+ String.format(
440+ i18n.getString("msg.140"),
441+ imageFile.getAbsolutePath()
442+ )
443+ );
411444 result.control = Discripter.CONTINUE;
412445 return result;
413446 }
414- String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];
415- itime = ImportPicture.toEXIFDate(dateTimeOriginal);
447+ String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];
448+ itime = ImportPicture.toEXIFDate(dateTimeOriginal);
416449 }
417450 System.out.print(String.format("%20s|", toUTCString(itime)));
418451
@@ -420,7 +453,7 @@ public class ImportPicture extends Thread {
420453 Date correctedtime = new Date(itime.getTime() + delta);
421454 System.out.print(String.format("%20s|", toUTCString(correctedtime)));
422455
423- // 時刻uktimeにおける<magver>をtrkptに追加する
456+ // 時刻uktimeにおける<magver>をtrkptに追加する
424457 String eleStr = "-";
425458 String magvarStr = "-";
426459 String speedStr = "-";
@@ -429,8 +462,8 @@ public class ImportPicture extends Thread {
429462 TagTrkpt trkptT = null;
430463
431464 for (Map.Entry<Date,ElementMapTRKPT> map : mapTRKSEG.entrySet()) {
432- ElementMapTRKPT mapTRKPT = map.getValue();
433- trkptT = mapTRKPT.getValue(correctedtime);
465+ ElementMapTRKPT mapTRKPT = map.getValue();
466+ trkptT = mapTRKPT.getValue(correctedtime);
434467 if (trkptT != null) {
435468 break;
436469 }
@@ -449,15 +482,15 @@ public class ImportPicture extends Thread {
449482 longitude = trkptT.lon;
450483
451484 if (trkptT.eleStr != null) {
452- eleStr = new String(trkptT.eleStr);
485+ eleStr = trkptT.eleStr;
453486 }
454487
455488 if (trkptT.magvarStr != null) {
456- magvarStr = new String(trkptT.magvarStr);
489+ magvarStr = trkptT.magvarStr;
457490 }
458491
459492 if (trkptT.speedStr != null) {
460- speedStr = new String(trkptT.speedStr);
493+ speedStr = trkptT.speedStr;
461494 }
462495 //System.out.print(String.format("%-14s|%-14s|", (new Double(latitude)).toString(), (new Double(longitude)).toString()));
463496 System.out.print(String.format("%14.10f|%14.10f|", latitude, longitude));
@@ -468,7 +501,7 @@ public class ImportPicture extends Thread {
468501 outDir.mkdir();
469502
470503 if (exifWrite) {
471- exifWrite(imageFile, correctedtime, trkptT);
504+ exifWrite(imageFile, correctedtime, trkptT);
472505
473506 if (Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_WPT))) {
474507 if (trkptT != null) {
@@ -478,10 +511,10 @@ public class ImportPicture extends Thread {
478511 }
479512 }
480513 else {
481- if (this.param_ImgOutputAll) {
482- // EXIFの変換を伴わない単純なファイルコピー
483- FileInputStream sStream = new FileInputStream(imageFile);
484- FileInputStream dStream = new FileInputStream(new File(outDir, imageFile.getName()));
514+ if (this.param_ImgOutputAll) {
515+ // EXIFの変換を伴わない単純なファイルコピー
516+ FileInputStream sStream = new FileInputStream(imageFile);
517+ FileInputStream dStream = new FileInputStream(new File(outDir, imageFile.getName()));
485518 FileChannel srcChannel = sStream.getChannel();
486519 FileChannel destChannel = dStream.getChannel();
487520 try {
@@ -493,7 +526,7 @@ public class ImportPicture extends Thread {
493526 sStream.close();
494527 dStream.close();
495528 }
496- }
529+ }
497530 }
498531 result.control = Discripter.NEXT;
499532 return result;
@@ -509,6 +542,7 @@ public class ImportPicture extends Thread {
509542 ImageMetadata meta = Imaging.getMetadata(imageFile);
510543 JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
511544 if (jpegMetadata != null) {
545+ @SuppressWarnings("LocalVariableHidesMemberVariable")
512546 TiffImageMetadata exif = jpegMetadata.getExif();
513547 if (exif != null) {
514548 outputSet = exif.getOutputSet();
@@ -541,10 +575,12 @@ public class ImportPicture extends Thread {
541575 final String dateStamp = yearStr +":"+ monthStr +":"+ dayStr;
542576
543577 gpsDir.removeField(GpsTagConstants.GPS_TAG_GPS_TIME_STAMP);
544- gpsDir.add(GpsTagConstants.GPS_TAG_GPS_TIME_STAMP,
545- RationalNumber.valueOf(cal.get(Calendar.HOUR_OF_DAY)),
546- RationalNumber.valueOf(cal.get(Calendar.MINUTE)),
547- RationalNumber.valueOf(cal.get(Calendar.SECOND)));
578+ gpsDir.add(
579+ GpsTagConstants.GPS_TAG_GPS_TIME_STAMP,
580+ RationalNumber.valueOf(cal.get(Calendar.HOUR_OF_DAY)),
581+ RationalNumber.valueOf(cal.get(Calendar.MINUTE)),
582+ RationalNumber.valueOf(cal.get(Calendar.SECOND))
583+ );
548584 gpsDir.removeField(GpsTagConstants.GPS_TAG_GPS_DATE_STAMP);
549585 gpsDir.add(GpsTagConstants.GPS_TAG_GPS_DATE_STAMP, dateStamp);
550586 }
@@ -565,14 +601,13 @@ public class ImportPicture extends Thread {
565601 }
566602
567603 //---- EXIF GPS_ ----
568- outputSet.setGPSInDegrees(trkptT.lon.doubleValue(), trkptT.lat.doubleValue());
604+ outputSet.setGPSInDegrees(trkptT.lon, trkptT.lat);
569605 }
570606
571607 ExifRewriter rewriter = new ExifRewriter();
572608 try (FileOutputStream fos = new FileOutputStream(new File(outDir, imageFile.getName()))) {
573609 rewriter.updateExifMetadataLossy(imageFile, fos, outputSet);
574610 }
575-
576611 }
577612
578613 // 基準時刻ファイルの「更新日時」を使って時刻合わせを行う。
@@ -583,23 +618,35 @@ public class ImportPicture extends Thread {
583618 ImageMetadata meta = Imaging.getMetadata(baseFile);
584619 JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
585620 if (jpegMetadata == null) {
586- System.out.println("'"+ baseFile.getAbsolutePath() +"' にEXIF情報がありません");
621+ // "'%s'にEXIF情報がありません"
622+ System.out.println(
623+ String.format(
624+ i18n.getString("msg.140"),
625+ baseFile.getAbsolutePath()
626+ )
627+ );
587628 return null;
588629 }
630+ @SuppressWarnings("LocalVariableHidesMemberVariable")
589631 TiffImageMetadata exif = jpegMetadata.getExif();
590632 if (exif == null) {
591- System.out.println("'"+ baseFile.getAbsolutePath() +"' にEXIF情報がありません");
633+ // "'%s'にEXIF情報がありません"
634+ System.out.println(
635+ String.format(
636+ i18n.getString("msg.140"),
637+ baseFile.getAbsolutePath()
638+ )
639+ );
592640 return null;
593641 }
594- String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];
595- return new Date(ImportPicture.toEXIFDate(dateTimeOriginal).getTime());
642+ String dateTimeOriginal = exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0];
643+ return new Date(ImportPicture.toEXIFDate(dateTimeOriginal).getTime());
596644 }
597645 else {
598646 return new Date(baseFile.lastModified());
599647 }
600648 }
601649
602-
603650 /**
604651 * 対象は '*.JPG' のみ対象とする
605652 * @return
@@ -609,7 +656,6 @@ public class ImportPicture extends Thread {
609656 return ((name != null) && name.toUpperCase().endsWith(".JPG"));
610657 }
611658
612-
613659 /**
614660 * DateをEXIFの文字列に変換する。
615661 * 注意:EXiFの撮影時刻はUTC時間ではない
@@ -674,13 +720,10 @@ public class ImportPicture extends Thread {
674720 * JPEGファイルフィルター
675721 * @author yuu
676722 */
677- class JpegFileFilter implements FilenameFilter {
723+ class JpegFileFilter implements FilenameFilter {
678724 @Override
679- public boolean accept(File dir, String name) {
680- if (name.toUpperCase().matches(".*\\.JPG$")) {
681- return true;
682- }
683- return false;
725+ public boolean accept(File dir, String name) {
726+ return name.toUpperCase().matches(".*\\.JPG$");
684727 }
685- }
728+ }
686729 }
\ No newline at end of file
--- a/importPicture/src/osm/jp/gpx/Restamp.java
+++ b/importPicture/src/osm/jp/gpx/Restamp.java
@@ -7,6 +7,7 @@ import java.util.ArrayList;
77 import java.util.Calendar;
88 import java.util.Comparator;
99 import java.util.Date;
10+import java.util.ResourceBundle;
1011 import java.util.logging.LogManager;
1112 import java.util.logging.Logger;
1213 import org.apache.commons.imaging.ImageReadException;
@@ -34,21 +35,25 @@ public class Restamp extends Thread {
3435 /**
3536 * static initializer によるログ設定の初期化
3637 */
37- public static final Logger logger = Logger.getLogger("CommandLogging");
38+ public static final Logger LOGGER = Logger.getLogger("CommandLogging");
3839 static {
3940 InputStream inStream = null;
4041 try {
4142 inStream = new ByteArrayInputStream(LOGGING_PROPERTIES_DATA.getBytes("UTF-8"));
4243 try {
4344 LogManager.getLogManager().readConfiguration(inStream);
44- logger.config("ログ設定: LogManagerを設定しました。");
45+ // "ログ設定: LogManagerを設定しました。"
46+ LOGGER.config("LoggerSettings: LogManager setuped.");
4547 }
4648 catch (IOException e) {
47- logger.warning("ログ設定: LogManager設定の際に例外が発生しました。:" + e.toString());
49+ // LogManager設定の際に例外が発生しました.
50+ String str = "LoggerSettings: Exception occered:" + e.toString();
51+ LOGGER.warning(str);
4852 }
4953 }
5054 catch (UnsupportedEncodingException e) {
51- logger.severe("ログ設定: UTF-8エンコーディングがサポートされていません。:" + e.toString());
55+ String str = "LoggerSettings: Not supported 'UTF-8' encoding: " + e.toString();
56+ LOGGER.severe(str);
5257 }
5358 finally {
5459 try {
@@ -56,7 +61,8 @@ public class Restamp extends Thread {
5661 inStream.close();
5762 }
5863 } catch (IOException e) {
59- logger.warning("ログ設定: ログ設定プロパティファイルのストリームクローズ時に例外が発生しました。:"+ e.toString());
64+ String str = "LoggerSettings: Exception occored: "+ e.toString();
65+ LOGGER.warning(str);
6066 }
6167 }
6268 }
@@ -75,7 +81,7 @@ public class Restamp extends Thread {
7581 * ・基準画像の正しい日時
7682 * ・画像ファイルの間隔(秒)
7783 *
78- * exp) $ java -cp .:AdjustTime.jar:commons-imaging-1.0-SNAPSHOT.jar [AdjustTime.ini]
84+ * exp) $ java -cp .:AdjustTime.jar:commons-imaging-1.0-SNAPSHOT.jar [AdjustTime.ini]
7985 * exp) > java -cp .;AdjustTime.jar;commons-imaging-1.0-SNAPSHOT.jar [AdjustTime.ini]
8086 *
8187 * 1. 予め、動画から画像を切り出す
@@ -113,21 +119,25 @@ public class Restamp extends Thread {
113119
114120 File imgDir = new File(argv[0]);
115121 if (!imgDir.exists()) {
116- System.out.println("[error] <imgDir>が存在しません。");
122+ // "[error] <imgDir>が存在しません。"
123+ System.out.println(i18n.getString("msg.200"));
117124 return;
118125 }
119126 if (!imgDir.isDirectory()) {
120- System.out.println("[error] <imgDir>がフォルダじゃない");
127+ // "[error] <imgDir>がフォルダじゃない"
128+ System.out.println(i18n.getString("msg.210"));
121129 return;
122130 }
123131
124132 File baseFile1 = new File(imgDir, argv[1]);
125133 if (!baseFile1.exists()) {
126- System.out.println("[error] <baseFile1>が存在しません。");
134+ // "[error] <baseFile1>が存在しません。"
135+ System.out.println(i18n.getString("msg.220"));
127136 return;
128137 }
129138 if (!baseFile1.isFile()) {
130- System.out.println("[error] <baseFile1>がファイルじゃない");
139+ // "[error] <baseFile1>がファイルじゃない"
140+ System.out.println(i18n.getString("msg.230"));
131141 return;
132142 }
133143
@@ -136,11 +146,13 @@ public class Restamp extends Thread {
136146
137147 File baseFile2 = new File(imgDir, argv[3]);
138148 if (!baseFile2.exists()) {
139- System.out.println("[error] <baseFile2>が存在しません。");
149+ // "[error] <baseFile2>が存在しません。"
150+ System.out.println(i18n.getString("msg.240"));
140151 return;
141152 }
142153 if (!baseFile2.isFile()) {
143- System.out.println("[error] <baseFile2>がファイルじゃない");
154+ // "[error] <baseFile2>がファイルじゃない"
155+ System.out.println(i18n.getString("msg.250"));
144156 return;
145157 }
146158
@@ -158,6 +170,7 @@ public class Restamp extends Thread {
158170 public int bCount2 = 0;
159171 public long span = 0;
160172 public ArrayList<File> jpgFiles = new ArrayList<>();
173+ public static ResourceBundle i18n = ResourceBundle.getBundle("i18n");
161174
162175 @SuppressWarnings("Convert2Lambda")
163176 public void setUp(File imgDir, File baseFile1, Date baseTime1, File baseFile2, Date baseTime2) throws Exception {
@@ -192,6 +205,7 @@ public class Restamp extends Thread {
192205
193206 try {
194207 // imgDir内の画像ファイルを処理する
208+ @SuppressWarnings("LocalVariableHidesMemberVariable")
195209 long span = baseTime2.getTime() - baseTime1.getTime();
196210 span = span / (bCount2 - bCount1);
197211 int i = 0;
@@ -239,10 +253,7 @@ public class Restamp extends Thread {
239253 class JpegFileFilter implements FilenameFilter {
240254 @Override
241255 public boolean accept(File dir, String name) {
242- if (name.toUpperCase().matches(".*\\.JPG$")) {
243- return true;
244- }
245- return false;
256+ return name.toUpperCase().matches(".*\\.JPG$");
246257 }
247258 }
248259 }
\ No newline at end of file
--- a/importPicture/src/osm/jp/gpx/TagTrkpt.java
+++ b/importPicture/src/osm/jp/gpx/TagTrkpt.java
@@ -10,28 +10,27 @@ import org.w3c.dom.Node;
1010 import org.w3c.dom.NodeList;
1111
1212 /**
13- *
13+ * @code{
1414 * <trkpt lat="35.32123832" lon="139.56965631">
1515 * <ele>47.20000076293945</ele>
1616 * <time>2012-06-15T03:00:29Z</time>
1717 * <magvar></magvar>
1818 * <speed></speed>
1919 * </trkpt>
20- *
21- * @author yuu
20+ * }
2221 *
2322 */
2423 public class TagTrkpt {
25- public Element trkpt = null;
26- public Double lat = null;
27- public Double lon = null;
28- public String eleStr = null;
29- public Date time = null;
30- public String magvarStr = null;
31- public String speedStr = null;
24+ public Element trkpt = null;
25+ public Double lat = null;
26+ public Double lon = null;
27+ public String eleStr = null;
28+ public Date time = null;
29+ public String magvarStr = null;
30+ public String speedStr = null;
3231
33- public TagTrkpt(Element trkpt) {
34- this.trkpt = (Element) trkpt.cloneNode(true);
32+ public TagTrkpt(Element trkpt) {
33+ this.trkpt = (Element) trkpt.cloneNode(true);
3534
3635 NamedNodeMap nodeMap = trkpt.getAttributes();
3736 for (int j=0; j < nodeMap.getLength(); j++ ) {
@@ -68,10 +67,10 @@ public class TagTrkpt {
6867 if (node2 != null) {
6968 if (node2.getNodeType() == Node.TEXT_NODE) {
7069 try {
71- this.time = ImportPicture.toUTCDate(node2.getNodeValue());
72- } catch (ParseException e) {
73- this.time = null;
74- }
70+ this.time = ImportPicture.toUTCDate(node2.getNodeValue());
71+ } catch (ParseException e) {
72+ this.time = null;
73+ }
7574 }
7675 }
7776 }
@@ -98,19 +97,19 @@ public class TagTrkpt {
9897 break;
9998 }
10099 }
101- }
100+ }
102101
103102 public void removeElement(String eleName) {
104- Node child;
105- for (child = trkpt.getFirstChild(); child != null; child = child.getNextSibling()) {
106- NodeList nodeList = child.getChildNodes();
107- for(int i = 0; i < nodeList.getLength(); i++) {
108- Node grandChild = child.getChildNodes().item(i);
109- if (grandChild.getNodeName().equals(eleName)) {
110- child.removeChild(grandChild);
111- }
112- }
113- }
103+ Node child;
104+ for (child = trkpt.getFirstChild(); child != null; child = child.getNextSibling()) {
105+ NodeList nodeList = child.getChildNodes();
106+ for(int i = 0; i < nodeList.getLength(); i++) {
107+ Node grandChild = child.getChildNodes().item(i);
108+ if (grandChild.getNodeName().equals(eleName)) {
109+ child.removeChild(grandChild);
110+ }
111+ }
112+ }
114113 }
115114
116115 public void appendElement(String eleName, String valueStr) {
--- a/importPicture/src/osm/jp/gpx/TimeComparator.java
+++ b/importPicture/src/osm/jp/gpx/TimeComparator.java
@@ -6,16 +6,16 @@ import java.util.Date;
66 /**
77 * java.util.Date型をコレクションのKEYにした時に、時間順に並べ替える
88 *
9- * @author yuu
109 */
1110 public class TimeComparator implements Comparator<Date>
1211 {
13- /**
14- * 日付順にソート
15- */
16- @Override
17- public int compare(Date arg0, Date arg1) {
18- return arg0.compareTo(arg1);
19- }
20-
12+ /**
13+ * 日付順にソート
14+ * @param arg0
15+ * @param arg1
16+ */
17+ @Override
18+ public int compare(Date arg0, Date arg1) {
19+ return arg0.compareTo(arg1);
20+ }
2121 }
--- a/importPicture/src/osm/jp/gpx/YuuLogFormatter.java
+++ b/importPicture/src/osm/jp/gpx/YuuLogFormatter.java
@@ -12,6 +12,7 @@ import java.util.logging.LogRecord;
1212 public class YuuLogFormatter extends Formatter {
1313 private final SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
1414
15+ @Override
1516 public String format(final LogRecord argLogRecord) {
1617 final StringBuffer buf = new StringBuffer();
1718
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/AboutDialog.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/AboutDialog.java
@@ -15,26 +15,28 @@ public class AboutDialog extends Dialog
1515
1616 class SymWindow extends java.awt.event.WindowAdapter
1717 {
18- public void windowClosing(java.awt.event.WindowEvent event)
19- {
18+ @Override
19+ public void windowClosing(java.awt.event.WindowEvent event) {
2020 Object object = event.getSource();
21- if (object == AboutDialog.this)
21+ if (object == AboutDialog.this) {
2222 AboutDialog_WindowClosing(event);
23+ }
2324 }
2425 }
2526
2627 class SymAction implements java.awt.event.ActionListener
2728 {
28- public void actionPerformed(java.awt.event.ActionEvent event)
29- {
29+ @Override
30+ public void actionPerformed(java.awt.event.ActionEvent event) {
3031 Object object = event.getSource();
31- if (object == okButton)
32+ if (object == okButton) {
3233 okButton_Clicked(event);
34+ }
3335 }
3436 }
3537
36- public AboutDialog(Frame parent, boolean modal)
37- {
38+ @SuppressWarnings("OverridableMethodCallInConstructor")
39+ public AboutDialog(Frame parent, boolean modal) {
3840 super(parent, modal);
3941
4042 // This code is automatically generated by Visual Cafe when you add
@@ -55,7 +57,7 @@ public class AboutDialog extends Dialog
5557 okButton.setLabel("OK");
5658 okButton.setBounds(145,65,66,27);
5759 add(okButton);
58- label2 = new java.awt.Label("Copyright(C) 2014,2017, yuuhayashi \n The MIT License (MIT).",Label.RIGHT);
60+ label2 = new java.awt.Label("Copyright(C) 2014,2018, yuuhayashi \n The MIT License (MIT).",Label.RIGHT);
5961 label2.setBounds(10,40,340,20);
6062 add(label2);
6163 setTitle("About... "+ AdjustTime.PROGRAM_NAME);
@@ -67,33 +69,32 @@ public class AboutDialog extends Dialog
6769 SymAction lSymAction = new SymAction();
6870 okButton.addActionListener(lSymAction);
6971 //}}
70-
7172 }
7273
73- public AboutDialog(Frame parent, String title, boolean modal)
74- {
74+ @SuppressWarnings("OverridableMethodCallInConstructor")
75+ public AboutDialog(Frame parent, String title, boolean modal) {
7576 this(parent, modal);
7677 setTitle(title);
7778 }
7879
79- public void addNotify()
80- {
80+ @Override
81+ public void addNotify() {
8182 // Record the size of the window prior to calling parents addNotify.
8283
8384 super.addNotify();
8485
8586 // Only do this once.
86- if (fComponentsAdjusted)
87+ if (fComponentsAdjusted) {
8788 return;
89+ }
8890
8991 // Adjust components according to the insets
9092 setSize(getInsets().left + getInsets().right + getSize().width, getInsets().top + getInsets().bottom + getSize().height);
9193 Component components[] = getComponents();
92- for (int i = 0; i < components.length; i++)
93- {
94- Point p = components[i].getLocation();
94+ for (Component component : components) {
95+ Point p = component.getLocation();
9596 p.translate(getInsets().left, getInsets().top);
96- components[i].setLocation(p);
97+ component.setLocation(p);
9798 }
9899
99100 // Used for addNotify check.
@@ -105,10 +106,9 @@ public class AboutDialog extends Dialog
105106 * @param b if true, show the component; otherwise, hide the component.
106107 * @see java.awt.Component#isVisible
107108 */
108- public void setVisible(boolean b)
109- {
110- if(b)
111- {
109+ @Override
110+ public void setVisible(boolean b) {
111+ if(b) {
112112 Rectangle bounds = getParent().getBounds();
113113 Rectangle abounds = getBounds();
114114 setLocation(bounds.x + (bounds.width - abounds.width)/ 2,
@@ -117,13 +117,11 @@ public class AboutDialog extends Dialog
117117 super.setVisible(b);
118118 }
119119
120- void AboutDialog_WindowClosing(java.awt.event.WindowEvent event)
121- {
120+ void AboutDialog_WindowClosing(java.awt.event.WindowEvent event) {
122121 dispose();
123122 }
124123
125- void okButton_Clicked(java.awt.event.ActionEvent event)
126- {
124+ void okButton_Clicked(java.awt.event.ActionEvent event) {
127125 //{{CONNECTION
128126 // Clicked from okButton Hide the Dialog
129127 dispose();
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java
@@ -1,17 +1,15 @@
11 package osm.jp.gpx.matchtime.gui;
2+
23 import java.awt.*;
34 import java.awt.event.ActionEvent;
45 import java.io.File;
56 import java.io.IOException;
67 import java.text.SimpleDateFormat;
78 import java.util.Date;
9+import java.util.ResourceBundle;
810 import java.util.TimeZone;
9-
1011 import javax.swing.*;
11-
1212 import osm.jp.gpx.*;
13-import org.apache.commons.imaging.ImageReadException;
14-import org.apache.commons.imaging.ImageWriteException;
1513 import org.apache.commons.imaging.Imaging;
1614 import org.apache.commons.imaging.common.ImageMetadata;
1715 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
@@ -25,14 +23,15 @@ import org.apache.commons.imaging.formats.tiff.constants.ExifTagConstants;
2523 public class AdjustTime extends JFrame
2624 {
2725 public static final String PROGRAM_NAME = "AdjustTime for JOSM";
28- public static final String PROGRAM_VARSION = "3.2";
29- public static final String PROGRAM_UPDATE = "2017/06/28";
30-
26+ public static final String PROGRAM_VARSION = "8.01";
27+ public static final String PROGRAM_UPDATE = "2018/09/17";
28+
3129 AppParameters params;
3230 SimpleDateFormat dfjp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z");
3331
3432 // Used for addNotify check.
3533 boolean fComponentsAdjusted = false;
34+ public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
3635
3736 //{{DECLARE_CONTROLS
3837 JPanel cardPanel; // ウィザード形式パネル(カード型)
@@ -147,10 +146,11 @@ public class AdjustTime extends JFrame
147146 }
148147 }
149148
150- /**
151- * データベース内のテーブルを一覧で表示するFrame
152- * @throws IOException
153- */
149+ /**
150+ * データベース内のテーブルを一覧で表示するFrame
151+ * @throws IOException
152+ */
153+ @SuppressWarnings("OverridableMethodCallInConstructor")
154154 public AdjustTime() throws IOException
155155 {
156156 dfjp.setTimeZone(TimeZone.getTimeZone("JST"));
@@ -168,10 +168,10 @@ public class AdjustTime extends JFrame
168168 cardPanel.setLayout(new CardLayout());
169169 container.add(cardPanel, BorderLayout.CENTER);
170170
171- nextButton = new JButton("次へ");
171+ nextButton = new JButton(i18n.getString("button.next"));
172172 container.add(nextButton, BorderLayout.EAST);
173173
174- backButton = new JButton("戻る");
174+ backButton = new JButton(i18n.getString("button.previous"));
175175 container.add(backButton, BorderLayout.WEST);
176176
177177 cards = new JPanel[5];
@@ -186,12 +186,12 @@ public class AdjustTime extends JFrame
186186 int cardNo = 0;
187187 cards[cardNo].setLayout(new BorderLayout());
188188 JLabel label1 = new JLabel();
189- label1.setText("<html><p>1. 位置情報を付加したい画像ファイルが格納されているフォルダを選択してください。</p><ul><li>コピー動作を行うと、ファイル更新時刻がコピーを実行した時刻に書き換わってしまうことがあります。オリジナルのカメラUSB内のフォルダを直接指定することをおすすめします。</li></ul>");
189+ label1.setText(i18n.getString("label.100"));
190190 cards[cardNo].add(label1, BorderLayout.NORTH);
191191
192192 argsPanel = new JPanel();
193193 argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
194- arg1_srcFolder = new ParameterPanelFolder("対象フォルダ: ", params.getProperty(AppParameters.IMG_SOURCE_FOLDER));
194+ arg1_srcFolder = new ParameterPanelFolder(i18n.getString("label.110") +": ", params.getProperty(AppParameters.IMG_SOURCE_FOLDER));
195195 argsPanel.add(arg1_srcFolder);
196196 cards[cardNo].add(argsPanel, BorderLayout.CENTER);
197197
@@ -200,17 +200,23 @@ public class AdjustTime extends JFrame
200200 cardNo++;
201201 cards[cardNo].setLayout(new BorderLayout());
202202 JLabel label2 = new JLabel();
203- label2.setText("<html><p>2. 正確な撮影時刻が判明できる画像を選んでください。</p><ul><li>スマートフォンの時計画面(秒が判別できること)を撮影した画像</li><li>カメラの時計が正確ならば、どの画像を選んでも構いません。</li></ul>");
203+ label2.setText(i18n.getString("label.200"));
204204 cards[cardNo].add(label2, BorderLayout.NORTH);
205205
206206 argsPanel = new JPanel();
207+
208+ // 基準時刻画像
207209 argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
208- arg2_baseTimeImg = new ParameterPanelImageFile("基準時刻画像: ", params.getProperty(AppParameters.IMG_BASE_FILE), arg1_srcFolder);
210+ arg2_baseTimeImg = new ParameterPanelImageFile(i18n.getString("label.210") +": ", params.getProperty(AppParameters.IMG_BASE_FILE), arg1_srcFolder);
209211 argsPanel.add(arg2_baseTimeImg);
210212
211213 baseTimeGroup = new ButtonGroup();
212- exifBase = new JRadioButton("EXIFの日時を基準にする");
213- fupdateBase = new JRadioButton("File更新日時を基準にする");
214+
215+ // EXIFの日時を基準にする
216+ exifBase = new JRadioButton(i18n.getString("label.220"));
217+
218+ // ファイル更新日時を基準にする
219+ fupdateBase = new JRadioButton(i18n.getString("label.230"));
214220 baseTimeGroup.add(exifBase);
215221 baseTimeGroup.add(fupdateBase);
216222 argsPanel.add(exifBase);
@@ -232,10 +238,15 @@ public class AdjustTime extends JFrame
232238 argsPanel = new JPanel();
233239 argsPanel.setLayout(new GridLayout(2, 1));
234240
241+ // 3. 正確な撮影時刻を入力してください。
242+ // カメラの時計が正確ならば、設定を変更する必要はありません。
235243 JLabel label3 = new JLabel();
236- label3.setText("<html><p>3. 正確な撮影時刻を入力してください。</p><ul><li>カメラの時計が正確ならば、設定を変更する必要はありません。</li></ul>");
244+ label3.setText(i18n.getString("label.300"));
237245 argsPanel.add(label3);
238- arg3_basetime = new ParameterPanel("  基準時刻: ", ImportPicture.TIME_FORMAT_STRING);
246+
247+ // 基準時刻:
248+ String str310 = String.format("  %s: ", i18n.getString("label.310"));
249+ arg3_basetime = new ParameterPanel(str310, ImportPicture.TIME_FORMAT_STRING);
239250 argsPanel.add(arg3_basetime);
240251 cards[cardNo].add(argsPanel, BorderLayout.NORTH);
241252
@@ -259,17 +270,35 @@ public class AdjustTime extends JFrame
259270 // 4.GPXファイル設定画面
260271 cardNo++;
261272 cards[cardNo].setLayout(new BorderLayout());
273+
274+ // 4. ヒモ付を行うGPXファイルを選択してください。
275+ // - フォルダを指定すると、フォルダ内のすべてのGPXファイルを対象とします。
262276 JLabel label4 = new JLabel();
263- label4.setText("<html><p>4. ヒモ付を行うGPXファイルを選択してください。</p><ul><li>フォルダを指定すると、フォルダ内にあるすべてのGPXファイルを対象とします。</li><li>カメラの時計が正確ならば、どの画像を選んでも構いません。</li></ul>");
277+ label4.setText(i18n.getString("label.400"));
264278 cards[cardNo].add(label4, BorderLayout.NORTH);
265279
266280 JPanel tmpPanel4a = new JPanel();
267281 tmpPanel4a.setLayout(new BoxLayout(tmpPanel4a, BoxLayout.Y_AXIS));
268- arg4_gpxFolder = new ParameterPanelGpx("GPXフォルダ: ", params.getProperty(AppParameters.GPX_SOURCE_FOLDER));
282+
283+ // "GPXフォルダ: "
284+ arg4_gpxFolder = new ParameterPanelGpx(
285+ i18n.getString("label.410") + ": ",
286+ params.getProperty(AppParameters.GPX_SOURCE_FOLDER)
287+ );
269288 tmpPanel4a.add(arg4_gpxFolder);
270- noFirstNode = new JCheckBox("<trkseg>セグメントの最初の1ノードは無視する。", params.getProperty(AppParameters.GPX_NO_FIRST_NODE).equals("ON"));
289+
290+ // "セグメント'trkseg'の最初の1ノードは無視する。"
291+ noFirstNode = new JCheckBox(
292+ i18n.getString("label.420"),
293+ params.getProperty(AppParameters.GPX_NO_FIRST_NODE).equals("ON")
294+ );
271295 tmpPanel4a.add(noFirstNode);
272- gpxReuse = new JCheckBox("生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も対象にする。", params.getProperty(AppParameters.GPX_REUSE).equals("ON"));
296+
297+ // "生成されたGPXファイル(ファイル名が'_.gpx'で終わるもの)も変換の対象にする"
298+ gpxReuse = new JCheckBox(
299+ i18n.getString("label.430"),
300+ params.getProperty(AppParameters.GPX_REUSE).equals("ON")
301+ );
273302 gpxReuse.setEnabled(true);
274303 tmpPanel4a.add(gpxReuse);
275304 cards[cardNo].add(tmpPanel4a, BorderLayout.CENTER);
@@ -278,47 +307,90 @@ public class AdjustTime extends JFrame
278307 // 5.EXIF更新設定画面
279308 cardNo++;
280309 cards[cardNo].setLayout(new BorderLayout());
310+
311+ // 5. EXIF変換を行うかどうかを選択してください。
312+ // - EXIF変換を行う場合には、変換ファイルを出力するフォルダも指定する必要があります。
313+ // - 出力フォルダには、書き込み権限と、十分な空き容量が必要です。
281314 JLabel label5 = new JLabel();
282- label5.setText("<html><p>5. EXIF変換を行うかどうかを選択してください。</p><ul><li>EXIF変換を行う場合には、変換ファイルを出力するフォルダも指定する必要があります。</li><li>出力フォルダには、書き込み権限と、十分な空き容量が必要です。</li></ul>");
315+ label5.setText(
316+ String.format(
317+ "<html><p>5. %s</p><ul><li>%s</li><li>%s</li></ul>",
318+ i18n.getString("label.500"),
319+ i18n.getString("label.501"),
320+ i18n.getString("label.502")
321+ )
322+ );
283323 cards[cardNo].add(label5, BorderLayout.NORTH);
284324
285325 JPanel tmpPanel5 = new JPanel();
286326 tmpPanel5.setLayout(new BoxLayout(tmpPanel5, BoxLayout.Y_AXIS));
287327
288- outputIMG = new JCheckBox("IMGの変換をする", Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT)));
328+ // "IMGの変換をする"
329+ outputIMG = new JCheckBox(
330+ i18n.getString("label.510"),
331+ Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT))
332+ );
289333 tmpPanel5.add(outputIMG);
290334
291- outputIMG_all = new JCheckBox("GPXファイル時間外のファイルもコピーする", Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_ALL)));
335+ // "GPXファイル時間外のファイルもコピーする"
336+ outputIMG_all = new JCheckBox(
337+ i18n.getString("label.520"),
338+ Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_ALL))
339+ );
292340 tmpPanel5.add(outputIMG_all);
293341
294- arg5_outputFolder = new ParameterPanelFolder("出力フォルダ: ", params.getProperty(AppParameters.IMG_OUTPUT_FOLDER));
342+ // "出力フォルダ: "
343+ arg5_outputFolder = new ParameterPanelFolder(
344+ i18n.getString("label.530") + ": ",
345+ params.getProperty(AppParameters.IMG_OUTPUT_FOLDER)
346+ );
295347 tmpPanel5.add(arg5_outputFolder);
296348
297- exifON = new JCheckBox("EXIFの変換をする", Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_EXIF)));
349+ // "EXIFの変換をする"
350+ exifON = new JCheckBox(
351+ i18n.getString("label.540"),
352+ Boolean.parseBoolean(params.getProperty(AppParameters.IMG_OUTPUT_EXIF))
353+ );
298354 tmpPanel5.add(exifON);
299355
300- gpxOutputWpt = new JCheckBox("出力GPXにポイントマーカー<WPT>を書き出す", Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_WPT)));
356+ // "ポイントマーカー<WPT>をGPXファイルに出力する"
357+ gpxOutputWpt = new JCheckBox(
358+ i18n.getString("label.550"),
359+ Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_WPT))
360+ );
301361 gpxOutputWpt.setEnabled(true);
302362 tmpPanel5.add(gpxOutputWpt);
303363
304- gpxOverwriteMagvar = new JCheckBox("ソースGPXの<MAGVAR>を無視する", Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OVERWRITE_MAGVAR)));
364+ // "ソースGPXの<MAGVAR>を無視する"
365+ gpxOverwriteMagvar = new JCheckBox(
366+ i18n.getString("label.560"),
367+ Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OVERWRITE_MAGVAR))
368+ );
305369 gpxOverwriteMagvar.setEnabled(true);
306370 tmpPanel5.add(gpxOverwriteMagvar);
307371
308- gpxOutputSpeed = new JCheckBox("出力GPXに<SPEED>を上書きする", Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_SPEED)));
372+ // "出力GPXに<SPEED>を上書きする"
373+ gpxOutputSpeed = new JCheckBox(
374+ i18n.getString("label.570"),
375+ Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_SPEED))
376+ );
309377 gpxOutputSpeed.setEnabled(true);
310378 tmpPanel5.add(gpxOutputSpeed);
311379
312380 cards[cardNo].add(tmpPanel5, BorderLayout.CENTER);
313381
314- doButton = new JButton("処理実行", AdjustTime.createImageIcon("images/media_playback_start.png"));
382+ // "処理実行"
383+ doButton = new JButton(
384+ i18n.getString("button.execute"),
385+ AdjustTime.createImageIcon("images/media_playback_start.png")
386+ );
315387 cards[cardNo].add(doButton, BorderLayout.SOUTH);
316388
317389
318390 //---------------------------------------------------------------------
319391 // INIT_MENUS
320392 menu1 = new java.awt.Menu("File");
321- miExit = new java.awt.MenuItem(QuitDialog.TITLE);
393+ miExit = new java.awt.MenuItem(i18n.getString("menu.quit"));
322394 miExit.setFont(new Font("Dialog", Font.PLAIN, 12));
323395 menu1.add(miExit);
324396
@@ -334,7 +406,6 @@ public class AdjustTime extends JFrame
334406 mainMenuBar.add(menu1);
335407 mainMenuBar.add(menu3);
336408 setMenuBar(mainMenuBar);
337-
338409
339410 //{{REGISTER_LISTENERS
340411 SymWindow aSymWindow = new SymWindow();
@@ -377,13 +448,14 @@ public class AdjustTime extends JFrame
377448 * コマンドラインの引数はありません。
378449 * @param args
379450 */
451+ @SuppressWarnings("UseSpecificCatch")
380452 static public void main(String args[]) {
381453 SwingUtilities.invokeLater(() -> {
382454 try {
383- createAndShowGUI();
384- } catch (Exception e) {
385- e.printStackTrace();
386- }
455+ createAndShowGUI();
456+ } catch (Exception e) {
457+ e.printStackTrace();
458+ }
387459 });
388460 }
389461 private static void createAndShowGUI() throws IOException {
@@ -433,16 +505,15 @@ public class AdjustTime extends JFrame
433505 /**
434506 * 選択された画像ファイルを表示する
435507 * 基準画像ボタンがクリックされた時に、基準時刻フィールドに基準画像の作成日時を設定する。
436- * @param ev
437- * @throws ImageReadException
438- * @throws ImageWriteException
508+ * @param ev
439509 */
510+ @SuppressWarnings("UseSpecificCatch")
440511 public void imageView_Action(ActionEvent ev) {
441512 String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
442513
443514 File timeFile = new File(path);
444515 if (exifBase.isSelected()) {
445- try {
516+ try {
446517 ImageMetadata meta = Imaging.getMetadata(timeFile);
447518 JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
448519 if (jpegMetadata != null) {
@@ -456,12 +527,12 @@ public class AdjustTime extends JFrame
456527 arg3_basetime.argField.setText("exif == null");
457528 }
458529 }
459- }
460- catch (Exception e) {}
530+ }
531+ catch (Exception e) {}
461532 }
462533 else {
463- long lastModifyTime = timeFile.lastModified();
464- arg3_basetime.argField.setText(dfjp.format(new Date(lastModifyTime)));
534+ long lastModifyTime = timeFile.lastModified();
535+ arg3_basetime.argField.setText(dfjp.format(new Date(lastModifyTime)));
465536 }
466537
467538 int size_x = imageSPane.getWidth() - 8;
@@ -476,21 +547,21 @@ public class AdjustTime extends JFrame
476547
477548 public void zoomin_Action(ActionEvent ev) {
478549 if (refImage != null) {
479- int size_x = imageLabel.getWidth();
480- String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
481- ImageIcon tmpIcon = new ImageIcon(path);
482- refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT));
483- imageLabel.setIcon(refImage);
550+ int size_x = imageLabel.getWidth();
551+ String path = (new File(arg1_srcFolder.getText(), arg2_baseTimeImg.getText())).getPath();
552+ ImageIcon tmpIcon = new ImageIcon(path);
553+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x * 2, -1, Image.SCALE_DEFAULT));
554+ imageLabel.setIcon(refImage);
484555 repaint();
485556 }
486557 }
487558
488559 public void zoomout_Action(ActionEvent ev) {
489560 if (refImage != null) {
490- int size_x = imageLabel.getWidth();
491- ImageIcon tmpIcon = refImage;
492- refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT));
493- imageLabel.setIcon(refImage);
561+ int size_x = imageLabel.getWidth();
562+ ImageIcon tmpIcon = refImage;
563+ refImage = new ImageIcon(tmpIcon.getImage().getScaledInstance(size_x / 2, -1, Image.SCALE_DEFAULT));
564+ imageLabel.setIcon(refImage);
494565 repaint();
495566 }
496567 }
@@ -507,17 +578,17 @@ public class AdjustTime extends JFrame
507578 JFileChooser fc;
508579
509580 //Set up the file chooser.
510- File sdir = new File(arg1_srcFolder.getText());
511- System.out.println(sdir.getPath());
512- if (sdir.isDirectory()) {
513- fc = new JFileChooser(sdir);
514- }
515- else {
516- fc = new JFileChooser();
517- }
518-
519- //Add a custom file filter and disable the default
520- //(Accept All) file filter.
581+ File sdir = new File(arg1_srcFolder.getText());
582+ System.out.println(sdir.getPath());
583+ if (sdir.isDirectory()) {
584+ fc = new JFileChooser(sdir);
585+ }
586+ else {
587+ fc = new JFileChooser();
588+ }
589+
590+ //Add a custom file filter and disable the default
591+ //(Accept All) file filter.
521592 fc.addChoosableFileFilter(new ImageFilter());
522593 fc.setAcceptAllFileFilterUsed(false);
523594
@@ -527,8 +598,8 @@ public class AdjustTime extends JFrame
527598 //Add the preview pane.
528599 fc.setAccessory(new ImagePreview(fc));
529600
530- //Show it.
531- int returnVal = fc.showDialog(this, "選択");
601+ //Show it. "選択"
602+ int returnVal = fc.showDialog(this, i18n.getString("dialog.select"));
532603
533604 //Process the results.
534605 if (returnVal == JFileChooser.APPROVE_OPTION) {
@@ -560,7 +631,7 @@ public class AdjustTime extends JFrame
560631 * @param event
561632 */
562633 void outputIMG_Action (ActionEvent event) {
563- arg5_outputFolder.setEnabled(outputIMG.isEnabled());
634+ arg5_outputFolder.setEnabled(outputIMG.isEnabled());
564635 }
565636
566637 /**
@@ -595,6 +666,7 @@ public class AdjustTime extends JFrame
595666 * [実行]ボタンをクリックしたときの動作
596667 * @param event
597668 */
669+ @SuppressWarnings("UseSpecificCatch")
598670 void doButton_Action(java.awt.event.ActionEvent event) {
599671 doButton.setEnabled(false);
600672
@@ -617,20 +689,20 @@ public class AdjustTime extends JFrame
617689 this.params.setProperty(AppParameters.GPX_BASETIME, "FILE_UPDATE");
618690 }
619691 try {
620- this.params.setProperty(AppParameters.IMG_SOURCE_FOLDER, arg1_srcFolder.getText());
621- this.params.setProperty(AppParameters.IMG_BASE_FILE, arg2_baseTimeImg.getText());
622- this.params.setProperty(AppParameters.IMG_TIME, ImportPicture.toUTCString(dfjp.parse(arg3_basetime.getText())));
623- this.params.setProperty(AppParameters.IMG_OUTPUT, String.valueOf(outputIMG.isSelected()));
624- this.params.setProperty(AppParameters.IMG_OUTPUT_FOLDER, arg5_outputFolder.getText());
625- this.params.setProperty(AppParameters.IMG_OUTPUT_ALL, String.valueOf(outputIMG_all.isSelected()));
626- this.params.setProperty(AppParameters.IMG_OUTPUT_EXIF, String.valueOf(exifON.isSelected()));
627- this.params.setProperty(AppParameters.GPX_OVERWRITE_MAGVAR, String.valueOf(gpxOverwriteMagvar.isSelected()));
628- this.params.setProperty(AppParameters.GPX_OUTPUT_SPEED, String.valueOf(gpxOutputSpeed.isSelected()));
629- this.params.setProperty(AppParameters.GPX_OUTPUT_WPT, String.valueOf(gpxOutputWpt.isSelected()));
692+ this.params.setProperty(AppParameters.IMG_SOURCE_FOLDER, arg1_srcFolder.getText());
693+ this.params.setProperty(AppParameters.IMG_BASE_FILE, arg2_baseTimeImg.getText());
694+ this.params.setProperty(AppParameters.IMG_TIME, ImportPicture.toUTCString(dfjp.parse(arg3_basetime.getText())));
695+ this.params.setProperty(AppParameters.IMG_OUTPUT, String.valueOf(outputIMG.isSelected()));
696+ this.params.setProperty(AppParameters.IMG_OUTPUT_FOLDER, arg5_outputFolder.getText());
697+ this.params.setProperty(AppParameters.IMG_OUTPUT_ALL, String.valueOf(outputIMG_all.isSelected()));
698+ this.params.setProperty(AppParameters.IMG_OUTPUT_EXIF, String.valueOf(exifON.isSelected()));
699+ this.params.setProperty(AppParameters.GPX_OVERWRITE_MAGVAR, String.valueOf(gpxOverwriteMagvar.isSelected()));
700+ this.params.setProperty(AppParameters.GPX_OUTPUT_SPEED, String.valueOf(gpxOutputSpeed.isSelected()));
701+ this.params.setProperty(AppParameters.GPX_OUTPUT_WPT, String.valueOf(gpxOutputWpt.isSelected()));
630702 this.params.store();
631703 }
632704 catch(Exception e) {
633- e.printStackTrace();
705+ e.printStackTrace();
634706 }
635707
636708 (new DoDialog(this, argv)).setVisible(true);
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/Command.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/Command.java
@@ -1,4 +1,5 @@
11 package osm.jp.gpx.matchtime.gui;
2+
23 import java.lang.reflect.InvocationTargetException;
34 import java.text.SimpleDateFormat;
45
@@ -6,7 +7,7 @@ class Command extends Thread {
67 String[] args; // コマンドパラメータ
78 private String commandName = ""; // コマンド名
89 @SuppressWarnings({ "rawtypes" })
9- private Class cmd; // 実行対象インスタンス
10+ private final Class cmd; // 実行対象インスタンス
1011
1112 /**
1213 * コンストラクタ:実行対象のインスタンスを得る
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/DoDialog.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/DoDialog.java
@@ -28,12 +28,14 @@ public class DoDialog extends JDialog {
2828 JTextArea textArea; // 実行結果を表示するJTextArea (中央)
2929 //}}
3030
31+ @SuppressWarnings("OverridableMethodCallInConstructor")
3132 public DoDialog(JFrame parentFrame, String[] args) {
3233 super(parentFrame, true); // モーダルダイアログを基盤にする
3334 this.parentFrame = parentFrame;
3435 this.args = args;
3536
3637 // INIT_CONTROLS
38+ @SuppressWarnings("OverridableMethodCallInConstructor")
3739 Container container = getContentPane();
3840 container.setLayout(new BorderLayout());
3941 parentFrame.setVisible(false);
@@ -109,8 +111,9 @@ public class DoDialog extends JDialog {
109111
110112 super.addNotify();
111113
112- if (fComponentsAdjusted)
114+ if (fComponentsAdjusted) {
113115 return;
116+ }
114117
115118 // Adjust components according to the insets
116119 setSize(getInsets().left + getInsets().right + d.width, getInsets().top + getInsets().bottom + d.height);
@@ -128,11 +131,11 @@ public class DoDialog extends JDialog {
128131 * JTextAreaに書き出すOutputStream
129132 */
130133 public static class JTextAreaOutputStream extends OutputStream {
131- private ByteArrayOutputStream os;
134+ private final ByteArrayOutputStream os;
132135
133136 /** 書き出し対象 */
134- private JTextArea textArea;
135- private String encode;
137+ private final JTextArea textArea;
138+ private final String encode;
136139
137140 public JTextAreaOutputStream(JTextArea textArea, String encode) {
138141 this.textArea = textArea;
@@ -143,6 +146,7 @@ public class DoDialog extends JDialog {
143146 /**
144147 * OutputStream#write(byte[])のオーバーライド
145148 * @param arg
149+ * @throws java.io.IOException
146150 */
147151 @Override
148152 public void write(int arg) throws IOException {
@@ -151,18 +155,21 @@ public class DoDialog extends JDialog {
151155
152156 /**
153157 * flush()でJTextAreaに書き出す
158+ * @throws java.io.IOException
154159 */
155160 @Override
156161 public void flush() throws IOException {
157162 // 文字列のエンコード
158163 final String str = new String(this.os.toByteArray(), this.encode);
159164 // 実際の書き出し処理
160- SwingUtilities.invokeLater(new Runnable(){
161- @Override
162- public void run() {
163- JTextAreaOutputStream.this.textArea.append(str);
165+ SwingUtilities.invokeLater(
166+ new Runnable(){
167+ @Override
168+ public void run() {
169+ JTextAreaOutputStream.this.textArea.append(str);
170+ }
164171 }
165- });
172+ );
166173 // 書き出した内容はクリアする
167174 this.os.reset();
168175 }
@@ -170,7 +177,7 @@ public class DoDialog extends JDialog {
170177
171178 // 非同期に行う処理を記述するためのクラス
172179 class LongTaskWorker extends SwingWorker<Object, Object> {
173- private JButton button;
180+ private final JButton button;
174181
175182 public LongTaskWorker(JButton button) {
176183 this.button = button;
@@ -178,6 +185,7 @@ public class DoDialog extends JDialog {
178185
179186 // 非同期に行われる処理
180187 @Override
188+ @SuppressWarnings("SleepWhileInLoop")
181189 public Object doInBackground() {
182190 // ながーい処理
183191 PrintStream defOut = System.out;
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/GpxAndFolderFilter.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/GpxAndFolderFilter.java
@@ -5,6 +5,7 @@ import javax.swing.filechooser.*;
55
66 public class GpxAndFolderFilter extends FileFilter {
77
8+ @Override
89 public boolean accept(File f) {
910 if (f.isDirectory()) {
1011 return true;
@@ -12,16 +13,12 @@ public class GpxAndFolderFilter extends FileFilter {
1213
1314 String extension = Utils.getExtension(f);
1415 if (extension != null) {
15- if (extension.equals("gpx")) {
16- return true;
17- }
18- else {
19- return false;
20- }
16+ return extension.equals("gpx");
2117 }
2218 return false;
2319 }
2420
21+ @Override
2522 public String getDescription() {
2623 return "Just GPXs";
2724 }
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ImageFileView.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ImageFileView.java
@@ -42,53 +42,72 @@ public class ImageFileView extends FileView {
4242 ImageIcon tiffIcon = Utils.createImageIcon("images/tiffIcon.gif");
4343 ImageIcon pngIcon = Utils.createImageIcon("images/pngIcon.png");
4444
45+ @Override
4546 public String getName(File f) {
4647 return null; //let the L&F FileView figure this out
4748 }
4849
50+ @Override
4951 public String getDescription(File f) {
5052 return null; //let the L&F FileView figure this out
5153 }
5254
55+ @Override
5356 public Boolean isTraversable(File f) {
5457 return null; //let the L&F FileView figure this out
5558 }
5659
60+ @Override
5761 public String getTypeDescription(File f) {
5862 String extension = Utils.getExtension(f);
5963 String type = null;
6064
6165 if (extension != null) {
62- if (extension.equals(Utils.jpeg) ||
63- extension.equals(Utils.jpg)) {
64- type = "JPEG Image";
65- } else if (extension.equals(Utils.gif)){
66- type = "GIF Image";
67- } else if (extension.equals(Utils.tiff) ||
68- extension.equals(Utils.tif)) {
69- type = "TIFF Image";
70- } else if (extension.equals(Utils.png)){
71- type = "PNG Image";
66+ switch (extension) {
67+ case Utils.jpeg:
68+ case Utils.jpg:
69+ type = "JPEG Image";
70+ break;
71+ case Utils.gif:
72+ type = "GIF Image";
73+ break;
74+ case Utils.tiff:
75+ case Utils.tif:
76+ type = "TIFF Image";
77+ break;
78+ case Utils.png:
79+ type = "PNG Image";
80+ break;
81+ default:
82+ break;
7283 }
7384 }
7485 return type;
7586 }
7687
88+ @Override
7789 public Icon getIcon(File f) {
7890 String extension = Utils.getExtension(f);
7991 Icon icon = null;
8092
8193 if (extension != null) {
82- if (extension.equals(Utils.jpeg) ||
83- extension.equals(Utils.jpg)) {
84- icon = jpgIcon;
85- } else if (extension.equals(Utils.gif)) {
86- icon = gifIcon;
87- } else if (extension.equals(Utils.tiff) ||
88- extension.equals(Utils.tif)) {
89- icon = tiffIcon;
90- } else if (extension.equals(Utils.png)) {
91- icon = pngIcon;
94+ switch (extension) {
95+ case Utils.jpeg:
96+ case Utils.jpg:
97+ icon = jpgIcon;
98+ break;
99+ case Utils.gif:
100+ icon = gifIcon;
101+ break;
102+ case Utils.tiff:
103+ case Utils.tif:
104+ icon = tiffIcon;
105+ break;
106+ case Utils.png:
107+ icon = pngIcon;
108+ break;
109+ default:
110+ break;
92111 }
93112 }
94113 return icon;
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ImageFilter.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ImageFilter.java
@@ -38,6 +38,7 @@ import javax.swing.filechooser.*;
3838 public class ImageFilter extends FileFilter {
3939
4040 //Accept all directories and all gif, jpg, tiff, or png files.
41+ @Override
4142 public boolean accept(File f) {
4243 if (f.isDirectory()) {
4344 return true;
@@ -45,22 +46,18 @@ public class ImageFilter extends FileFilter {
4546
4647 String extension = Utils.getExtension(f);
4748 if (extension != null) {
48- if (extension.equals(Utils.tiff) ||
49+ return extension.equals(Utils.tiff) ||
4950 extension.equals(Utils.tif) ||
5051 extension.equals(Utils.gif) ||
5152 extension.equals(Utils.jpeg) ||
5253 extension.equals(Utils.jpg) ||
53- extension.equals(Utils.png)) {
54- return true;
55- } else {
56- return false;
57- }
54+ extension.equals(Utils.png);
5855 }
59-
6056 return false;
6157 }
6258
6359 //The description of this filter
60+ @Override
6461 public String getDescription() {
6562 return "Just Images";
6663 }
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ImagePreview.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ImagePreview.java
@@ -45,6 +45,7 @@ public class ImagePreview extends JComponent implements PropertyChangeListener {
4545 static int IMAGE_SIZE_X = 320;
4646 static int IMAGE_SIZE_Y = 240;
4747
48+ @SuppressWarnings({"LeakingThisInConstructor", "OverridableMethodCallInConstructor"})
4849 public ImagePreview(JFileChooser fc) {
4950 setPreferredSize(new Dimension(IMAGE_SIZE_X + 10, IMAGE_SIZE_Y + 10));
5051 fc.addPropertyChangeListener(this);
@@ -70,22 +71,19 @@ public class ImagePreview extends JComponent implements PropertyChangeListener {
7071 }
7172 }
7273
74+ @Override
7375 public void propertyChange(PropertyChangeEvent e) {
7476 boolean update = false;
7577 String prop = e.getPropertyName();
7678
77- //If the directory changed, don't show an image.
7879 if (JFileChooser.DIRECTORY_CHANGED_PROPERTY.equals(prop)) {
7980 file = null;
8081 update = true;
81-
82- //If a file became selected, find out which one.
83- } else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
82+ }
83+ else if (JFileChooser.SELECTED_FILE_CHANGED_PROPERTY.equals(prop)) {
8484 file = (File) e.getNewValue();
8585 update = true;
8686 }
87-
88- //Update the preview accordingly.
8987 if (update) {
9088 thumbnail = null;
9189 if (isShowing()) {
@@ -95,6 +93,7 @@ public class ImagePreview extends JComponent implements PropertyChangeListener {
9593 }
9694 }
9795
96+ @Override
9897 protected void paintComponent(Graphics g) {
9998 if (thumbnail == null) {
10099 loadImage();
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanel.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanel.java
@@ -1,6 +1,8 @@
11 package osm.jp.gpx.matchtime.gui;
2+
23 import java.awt.Dimension;
34 import java.awt.LayoutManager;
5+import java.util.ResourceBundle;
46
57 import javax.swing.BoxLayout;
68 import javax.swing.JLabel;
@@ -12,42 +14,41 @@ import javax.swing.JTextField;
1214 * この1インスタンスで、1パラメータをあらわす。
1315 */
1416 public class ParameterPanel extends JPanel {
15- /**
16- *
17- */
18- private static final long serialVersionUID = 4629824800747170556L;
19- public JTextField argField;
17+ private static final long serialVersionUID = 4629824800747170556L;
18+ public JTextField argField;
2019 public JLabel argLabel;
20+ public ResourceBundle i18n = ResourceBundle.getBundle("i18n");
2121
22- public ParameterPanel(String label, String text) {
23- super();
24-
25- argLabel = new JLabel(label);
26- argField = new JTextField(text);
22+ @SuppressWarnings("OverridableMethodCallInConstructor")
23+ public ParameterPanel(String label, String text) {
24+ super();
25+
26+ argLabel = new JLabel(label);
27+ argField = new JTextField(text);
2728
2829 this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
2930 this.setMaximumSize(new Dimension(1920, 40));
3031 this.add(argLabel);
3132 this.add(argField);
32- }
33-
34- public String getText() {
35- return this.argField.getText();
36- }
37-
38- public ParameterPanel(boolean isDoubleBuffered) {
39- super(isDoubleBuffered);
40- // TODO 自動生成されたコンストラクター・スタブ
41- }
42-
43- public ParameterPanel(LayoutManager layout) {
44- super(layout);
45- // TODO 自動生成されたコンストラクター・スタブ
46- }
47-
48- public ParameterPanel(LayoutManager layout, boolean isDoubleBuffered) {
49- super(layout, isDoubleBuffered);
50- // TODO 自動生成されたコンストラクター・スタブ
51- }
33+ }
34+
35+ public String getText() {
36+ return this.argField.getText();
37+ }
38+
39+ public ParameterPanel(boolean isDoubleBuffered) {
40+ super(isDoubleBuffered);
41+ // TODO 自動生成されたコンストラクター・スタブ
42+ }
43+
44+ public ParameterPanel(LayoutManager layout) {
45+ super(layout);
46+ // TODO 自動生成されたコンストラクター・スタブ
47+ }
48+
49+ public ParameterPanel(LayoutManager layout, boolean isDoubleBuffered) {
50+ super(layout, isDoubleBuffered);
51+ // TODO 自動生成されたコンストラクター・スタブ
52+ }
5253
5354 }
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java
@@ -7,49 +7,56 @@ import javax.swing.JButton;
77 import javax.swing.JFileChooser;
88
99 @SuppressWarnings("serial")
10-public class ParameterPanelFolder extends ParameterPanel implements ActionListener {
11- JFileChooser fc;
12- JButton openButton;
13- int chooser;
10+public class ParameterPanelFolder extends ParameterPanel implements ActionListener
11+{
12+ JFileChooser fc;
13+ JButton openButton;
14+ int chooser;
1415
15- public ParameterPanelFolder(String label, String text, int chooser) {
16- super(label, text);
16+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
17+ public ParameterPanelFolder(String label, String text, int chooser) {
18+ super(label, text);
1719
18- //Create a file chooser
19- this.chooser = chooser;
20+ // Create a file chooser
21+ this.chooser = chooser;
2022
21- openButton = new JButton("選択...", AdjustTime.createImageIcon("images/Open16.gif"));
23+ // "選択..."
24+ openButton = new JButton(
25+ i18n.getString("button.select"),
26+ AdjustTime.createImageIcon("images/Open16.gif")
27+ );
2228 openButton.addActionListener(this);
2329 this.add(openButton);
24- }
25-
26- public ParameterPanelFolder(String label, String text) {
27- this(label, text, JFileChooser.DIRECTORIES_ONLY);
28- }
29-
30- public void setEnable(boolean f) {
31- super.setEnabled(f);
32- openButton.setEnabled(f);
33- }
30+ }
31+
32+ public ParameterPanelFolder(String label, String text) {
33+ this(label, text, JFileChooser.DIRECTORIES_ONLY);
34+ }
35+
36+ public void setEnable(boolean f) {
37+ super.setEnabled(f);
38+ openButton.setEnabled(f);
39+ }
3440
41+ @Override
3542 public void actionPerformed(ActionEvent e) {
36- if (e.getSource() == openButton){
37- System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
38- File sdir = new File(this.argField.getText());
39- if (sdir.exists()) {
40- this.fc = new JFileChooser(sdir);
41- }
42- else {
43- this.fc = new JFileChooser();
44- }
45- this.fc.setFileSelectionMode(this.chooser);
46-
47- int returnVal = this.fc.showOpenDialog(ParameterPanelFolder.this);
48-
49- if (returnVal == JFileChooser.APPROVE_OPTION) {
50- File file = this.fc.getSelectedFile();
51- this.argField.setText(file.getAbsolutePath());
52- }
53- }
43+ if (e.getSource() == openButton){
44+ System.out.println("ParameterPanelFolder.actionPerformed(openButton)");
45+ File sdir = new File(this.argField.getText());
46+ if (sdir.exists()) {
47+ this.fc = new JFileChooser(sdir);
48+ }
49+ else {
50+ this.fc = new JFileChooser();
51+ }
52+ this.fc.setFileSelectionMode(this.chooser);
53+
54+ int returnVal = this.fc.showOpenDialog(ParameterPanelFolder.this);
55+
56+ if (returnVal == JFileChooser.APPROVE_OPTION) {
57+ File file = this.fc.getSelectedFile();
58+ this.argField.setText(file.getAbsolutePath());
59+ }
60+ }
5461 }
5562 }
\ No newline at end of file
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelGpx.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelGpx.java
@@ -8,43 +8,50 @@ import javax.swing.JButton;
88 import javax.swing.JFileChooser;
99
1010 @SuppressWarnings("serial")
11-public class ParameterPanelGpx extends ParameterPanel implements ActionListener {
12- JFileChooser fc;
13- JButton openButton;
11+public class ParameterPanelGpx extends ParameterPanel implements ActionListener
12+{
13+ JFileChooser fc;
14+ JButton openButton;
1415
15- public ParameterPanelGpx(String label, String text) {
16- super(label, text);
16+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
17+ public ParameterPanelGpx(String label, String text) {
18+ super(label, text);
1719
18- openButton = new JButton("選択...", AdjustTime.createImageIcon("images/Open16.gif"));
20+ // "選択..."
21+ openButton = new JButton(
22+ i18n.getString("button.select"),
23+ AdjustTime.createImageIcon("images/Open16.gif")
24+ );
1925 openButton.addActionListener(this);
2026 this.add(openButton);
21- }
27+ }
2228
23- public void setEnable(boolean f) {
24- super.setEnabled(f);
25- openButton.setEnabled(f);
26- }
29+ public void setEnable(boolean f) {
30+ super.setEnabled(f);
31+ openButton.setEnabled(f);
32+ }
2733
34+ @Override
2835 public void actionPerformed(ActionEvent e) {
29- if (e.getSource() == openButton){
30- System.out.println("ParameterPanelGpx.actionPerformed(openButton)");
31- File sdir = new File(this.argField.getText());
32- if (sdir.exists()) {
33- this.fc = new JFileChooser(sdir);
34- }
35- else {
36- this.fc = new JFileChooser();
37- }
38- this.fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
39- this.fc.addChoosableFileFilter(new GpxAndFolderFilter());
40- this.fc.setAcceptAllFileFilterUsed(false);
41-
42- int returnVal = this.fc.showOpenDialog(ParameterPanelGpx.this);
43-
44- if (returnVal == JFileChooser.APPROVE_OPTION) {
45- File file = this.fc.getSelectedFile();
46- this.argField.setText(file.getAbsolutePath());
47- }
48- }
36+ if (e.getSource() == openButton){
37+ System.out.println("ParameterPanelGpx.actionPerformed(openButton)");
38+ File sdir = new File(this.argField.getText());
39+ if (sdir.exists()) {
40+ this.fc = new JFileChooser(sdir);
41+ }
42+ else {
43+ this.fc = new JFileChooser();
44+ }
45+ this.fc.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
46+ this.fc.addChoosableFileFilter(new GpxAndFolderFilter());
47+ this.fc.setAcceptAllFileFilterUsed(false);
48+
49+ int returnVal = this.fc.showOpenDialog(ParameterPanelGpx.this);
50+
51+ if (returnVal == JFileChooser.APPROVE_OPTION) {
52+ File file = this.fc.getSelectedFile();
53+ this.argField.setText(file.getAbsolutePath());
54+ }
55+ }
4956 }
5057 }
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelImageFile.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelImageFile.java
@@ -7,16 +7,16 @@ import javax.swing.JFileChooser;
77
88 @SuppressWarnings("serial")
99 public class ParameterPanelImageFile extends ParameterPanel implements ActionListener {
10- JFileChooser fc;
11- JButton openButton;
12- ParameterPanelFolder paramDir;
10+ JFileChooser fc;
11+ JButton openButton;
12+ ParameterPanelFolder paramDir;
1313
14- public ParameterPanelImageFile(String label, String text, ParameterPanelFolder paramDir) {
15- super(label, text);
14+ @SuppressWarnings("OverridableMethodCallInConstructor")
15+ public ParameterPanelImageFile(String label, String text, ParameterPanelFolder paramDir) {
16+ super(label, text);
1617
17- //Create the open button. We use the image from the JLF
18- //Graphics Repository (but we extracted it from the jar).
19- openButton = new JButton("選択...");
18+ // "選択..."
19+ openButton = new JButton(i18n.getString("button.select"));
2020
2121 /*
2222 openButton.addActionListener(this);
@@ -26,10 +26,11 @@ public class ParameterPanelImageFile extends ParameterPanel implements ActionLis
2626
2727 //Create a file chooser
2828 this.paramDir = paramDir;
29- }
29+ }
3030
31- public void actionPerformed(ActionEvent e) {
32- /*
31+ @SuppressWarnings("override")
32+ public void actionPerformed(ActionEvent e) {
33+ /*
3334 //Set up the file chooser.
3435 File sdir = new File(paramDir.getText());
3536 System.out.println(sdir.toPath());
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelSelecter.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelSelecter.java
@@ -10,35 +10,36 @@ import javax.swing.JPanel;
1010
1111 @SuppressWarnings("serial")
1212 public class ParameterPanelSelecter extends JPanel implements ActionListener {
13- public static final int ITEM_WIDTH_1 = 160;
14- public static final int ITEM_WIDTH_2 = 240;
13+ public static final int ITEM_WIDTH_1 = 160;
14+ public static final int ITEM_WIDTH_2 = 240;
1515 public static final int LINE_WIDTH = ITEM_WIDTH_1 + ITEM_WIDTH_2;
1616 public static final int LINE_HEIGHT = 18;
17- public JLabel label;
18- public JComboBox<String> field;
19- public String value;
17+ public JLabel label;
18+ public JComboBox<String> field;
19+ public String value;
2020
21- public ParameterPanelSelecter(String title, String[] items) {
22- super(null);
23- this.value = items[0];
21+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
22+ public ParameterPanelSelecter(String title, String[] items) {
23+ super(null);
24+ this.value = items[0];
2425
25- this.label = new JLabel(title, JLabel.RIGHT);
26- this.label.setBounds(0, 0, ITEM_WIDTH_1 - 6, LINE_HEIGHT);
27- add(this.label);
26+ this.label = new JLabel(title, JLabel.RIGHT);
27+ this.label.setBounds(0, 0, ITEM_WIDTH_1 - 6, LINE_HEIGHT);
28+ add(this.label);
2829
29- this.field = new JComboBox<String>();
30- this.field.addActionListener(this);
31- for (int i=0; i < items.length; i++) {
32- this.field.addItem(items[i]);
33- }
34- this.field.setBounds(ITEM_WIDTH_1, 0, ITEM_WIDTH_2, LINE_HEIGHT);
35- add(this.field);
36-
37- setPreferredSize(new Dimension(ITEM_WIDTH_1, LINE_HEIGHT));
38- }
30+ this.field = new JComboBox<>();
31+ this.field.addActionListener(this);
32+ for (String item : items) {
33+ this.field.addItem(item);
34+ }
35+ this.field.setBounds(ITEM_WIDTH_1, 0, ITEM_WIDTH_2, LINE_HEIGHT);
36+ add(this.field);
37+
38+ setPreferredSize(new Dimension(ITEM_WIDTH_1, LINE_HEIGHT));
39+ }
3940
40- @Override
41- public void actionPerformed(ActionEvent e) {
42- this.value = (String)this.field.getSelectedItem();
43- }
41+ @Override
42+ public void actionPerformed(ActionEvent e) {
43+ this.value = (String)this.field.getSelectedItem();
44+ }
4445 }
\ No newline at end of file
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java
@@ -7,17 +7,19 @@ import javax.swing.JFileChooser;
77
88 @SuppressWarnings("serial")
99 public class ParameterPanelTime extends ParameterPanel implements ActionListener {
10- JFileChooser fc;
11- public JButton doButton;
10+ JFileChooser fc;
11+ public JButton doButton;
1212
13- public ParameterPanelTime(String label, String text) {
14- super(label, text);
13+ @SuppressWarnings({"OverridableMethodCallInConstructor", "LeakingThisInConstructor"})
14+ public ParameterPanelTime(String label, String text) {
15+ super(label, text);
1516
1617 doButton = new JButton("処理実行", AdjustTime.createImageIcon("images/media_playback_start.png"));
1718 doButton.addActionListener(this);
1819 this.add(doButton);
19- }
20+ }
2021
22+ @Override
2123 public void actionPerformed(ActionEvent e) {
2224 }
2325 }
\ No newline at end of file
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/QuitDialog.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/QuitDialog.java
@@ -6,6 +6,7 @@ import java.awt.Toolkit;
66 import java.awt.Window;
77 import java.awt.event.WindowEvent;
88 import java.awt.event.WindowListener;
9+import java.util.ResourceBundle;
910
1011 import javax.swing.JButton;
1112 import javax.swing.JDialog;
@@ -15,49 +16,55 @@ import javax.swing.JLabel;
1516 @SuppressWarnings("serial")
1617 public class QuitDialog extends JDialog implements WindowListener
1718 {
18- public static final String TITLE = "終了?";
1919 JButton yesButton;
2020 JButton noButton;
2121 JLabel label1;
2222
23+ @SuppressWarnings("OverridableMethodCallInConstructor")
2324 public QuitDialog(JFrame parent, boolean modal) {
2425 super(parent, modal);
26+
27+ ResourceBundle i18n = ResourceBundle.getBundle("i18n");
28+
2529 addWindowListener((WindowListener) this);
2630 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
2731
2832 setLayout(null);
2933 setSize(getInsets().left + getInsets().right + 337, getInsets().top + getInsets().bottom + 135);
3034
31- yesButton = new JButton(" 終了 ");
35+ yesButton = new JButton(String.format(" %s ", i18n.getString("dialog.quit")));
3236 yesButton.addActionListener(new java.awt.event.ActionListener() {
33- public void actionPerformed(java.awt.event.ActionEvent evt) {
37+ @Override
38+ public void actionPerformed(java.awt.event.ActionEvent evt) {
3439 Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent((Window)getParent(), 201));
3540 System.exit(0);
36- }
41+ }
3742 });
3843 yesButton.setBounds(getInsets().left + 72, getInsets().top + 80, 79, 22);
3944 yesButton.setFont(new Font("Dialog", 1, 12));
4045 add(yesButton);
4146
42- noButton = new JButton("キャンセル");
47+ noButton = new JButton(i18n.getString("dialog.cancel"));
4348 noButton.addActionListener(new java.awt.event.ActionListener() {
44- public void actionPerformed(java.awt.event.ActionEvent evt) {
45- Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
46- setVisible(false);
47- }
49+ @Override
50+ public void actionPerformed(java.awt.event.ActionEvent evt) {
51+ Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(QuitDialog.this, WindowEvent.WINDOW_CLOSING));
52+ setVisible(false);
53+ }
4854 });
4955 noButton.setBounds(getInsets().left + 185, getInsets().top + 80, 99, 22);
5056 noButton.setFont(new Font("Dialog", 1, 12));
5157 add(noButton);
5258
53- label1 = new JLabel("プログラムを終了します。", JLabel.CENTER);
59+ label1 = new JLabel(i18n.getString("dialog.msg1"), JLabel.CENTER);
5460 label1.setBounds(78, 33, 180, 23);
5561 add(label1);
56- setTitle("プログラムの終了");
62+ setTitle(i18n.getString("dialog.msg1"));
5763 setResizable(false);
5864 setVisible(true);
5965 }
6066
67+ @Override
6168 public void setVisible(boolean b) {
6269 if(b) {
6370 Rectangle bounds = getParent().getBounds();
@@ -68,26 +75,33 @@ public class QuitDialog extends JDialog implements WindowListener
6875 }
6976
7077
71- public void windowActivated(WindowEvent e) {
72- }
78+ @Override
79+ public void windowActivated(WindowEvent e) {
80+ }
7381
74- public void windowClosed(WindowEvent e) {
75- setVisible(false);
76- }
82+ @Override
83+ public void windowClosed(WindowEvent e) {
84+ setVisible(false);
85+ }
7786
78- public void windowClosing(WindowEvent e) {
79- setVisible(false);
80- }
87+ @Override
88+ public void windowClosing(WindowEvent e) {
89+ setVisible(false);
90+ }
8191
82- public void windowDeactivated(WindowEvent e) {
83- }
92+ @Override
93+ public void windowDeactivated(WindowEvent e) {
94+ }
8495
85- public void windowDeiconified(WindowEvent e) {
86- }
96+ @Override
97+ public void windowDeiconified(WindowEvent e) {
98+ }
8799
88- public void windowIconified(WindowEvent e) {
89- }
100+ @Override
101+ public void windowIconified(WindowEvent e) {
102+ }
90103
91- public void windowOpened(WindowEvent e) {
92- }
104+ @Override
105+ public void windowOpened(WindowEvent e) {
106+ }
93107 }
--- a/importPicture/src/osm/jp/gpx/matchtime/gui/Utils.java
+++ b/importPicture/src/osm/jp/gpx/matchtime/gui/Utils.java
@@ -57,7 +57,10 @@ public class Utils {
5757 return ext;
5858 }
5959
60- /** Returns an ImageIcon, or null if the path was invalid. */
60+ /** Returns an ImageIcon, or null if the path was invalid.
61+ * @param path
62+ * @return
63+ */
6164 protected static ImageIcon createImageIcon(String path) {
6265 java.net.URL imgURL = Utils.class.getResource(path);
6366 if (imgURL != null) {
--- a/importPicture/src/osm/jp/gpx/utils/TarGz.java
+++ b/importPicture/src/osm/jp/gpx/utils/TarGz.java
@@ -1,6 +1,5 @@
11 package osm.jp.gpx.utils;
22
3-
43 import java.io.BufferedInputStream;
54 import java.io.BufferedOutputStream;
65 import java.io.File;
@@ -49,18 +48,16 @@ public abstract class TarGz
4948 else {
5049 File dir = new File(destPath.getParent());
5150 if (!dir.exists()) {
52- dir.mkdirs();
51+ dir.mkdirs();
5352 }
5453 destPath.createNewFile();
5554 byte[] btoRead = new byte[1024];
56- BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath));
57- int len = 0;
58-
59- while ((len = tarIn.read(btoRead)) != -1) {
60- bout.write(btoRead, 0, len);
55+ try (BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath))) {
56+ int len = 0;
57+ while ((len = tarIn.read(btoRead)) != -1) {
58+ bout.write(btoRead, 0, len);
59+ }
6160 }
62-
63- bout.close();
6461 destPath.setLastModified(tarEntry.getLastModifiedDate().getTime());
6562 btoRead = null;
6663 }
--- a/importPicture/test/osm/jp/gpx/AppParametersTest.java
+++ b/importPicture/test/osm/jp/gpx/AppParametersTest.java
@@ -6,6 +6,7 @@ import static org.junit.Assert.*;
66 import java.io.File;
77 import java.io.FileInputStream;
88 import java.io.FileOutputStream;
9+import java.io.IOException;
910 import java.nio.channels.FileChannel;
1011
1112 import org.junit.After;
@@ -16,188 +17,188 @@ import org.junit.experimental.runners.*;
1617
1718 @RunWith(Enclosed.class)
1819 public class AppParametersTest {
19-
20- public static class 定義ファイルが存在しない場合 {
21- AppParameters params;
22-
23- @Before
24- public void setUp() throws Exception {
25- File iniFile = new File("AdjustTime.ini");
26- File orgFile = new File("AdjustTime.ini.org");
27-
28- if (orgFile.exists()) {
29- orgFile.delete();
30- }
31- if (iniFile.exists()) {
32- iniFile.renameTo(orgFile);
33- }
34- }
35-
36- @After
37- public void tearDown() throws Exception {
38- File iniFile = new File("AdjustTime.ini");
39- File orgFile = new File("AdjustTime.ini.org");
40- if (iniFile.exists()) {
41- iniFile.delete();
42- }
43- if (orgFile.exists()) {
44- orgFile.renameTo(iniFile);
45- }
46- }
47-
48- @Test
49- public void IMG_OUTPUT_ALLが定義されていない時() {
50- try {
51- params = new AppParameters("testdata/AdjustTime.off.ini");
52- String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
53- assertThat(valueStr, is("false"));
54- }
55- catch (Exception e) {
56- fail("Exceptionが発生した。");
57- }
58- }
59- }
60-
61- public static class 定義ファイルがtureに定義されているとき {
62-
63- @Before
64- public void setUp() throws Exception {
65- File iniFile = new File("AdjustTime.ini");
66- File orgFile = new File("AdjustTime.ini.org");
67- File testFile = new File("testdata", "AdjustTime.on.ini");
68-
69- if (orgFile.exists()) {
70- orgFile.delete();
71- }
72- if (iniFile.exists()) {
73- iniFile.renameTo(orgFile);
74- }
75-
76- FileInputStream inStream = new FileInputStream(testFile);
77- FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
78- FileChannel inChannel = inStream.getChannel();
79- FileChannel outChannel = outStream.getChannel();
80- try {
81- inChannel.transferTo(0, inChannel.size(),outChannel);
82- }
83- finally {
84- if (inChannel != null) inChannel.close();
85- if (outChannel != null) outChannel.close();
86- inStream.close();
87- outStream.close();
88- }
89- }
90-
91- @After
92- public void tearDown() throws Exception {
93- File iniFile = new File("AdjustTime.ini");
94- File orgFile = new File("AdjustTime.ini.org");
95- if (iniFile.exists()) {
96- iniFile.delete();
97- }
98- if (orgFile.exists()) {
99- orgFile.renameTo(iniFile);
100- }
101- }
102-
103- @Test
104- public void IMG_OUTPUT_ALLがtureに定義されているとき() {
105- try {
106- AppParameters params;
107- params = new AppParameters();
108- String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
109- assertThat(valueStr, is("true"));
110- }
111- catch (Exception e) {
112- fail("Exceptionが発生した。");
113- }
114- }
115-
116- @Test
117- public void IMG_OUTPUT_ALLをfalseに書き換える() {
118- try {
119- AppParameters params = new AppParameters();
120- params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
121- params.store();
122- params = null;
123- AppParameters newParams = new AppParameters();
124- String valueStr = newParams.getProperty(AppParameters.IMG_OUTPUT_ALL);
125- assertThat(valueStr, is("false"));
126- }
127- catch (Exception e) {
128- fail("Exceptionが発生した。");
129- }
130- }
131- }
132-
133- public static class 定義ファイルがfalseに定義されているとき {
134-
135- @Before
136- public void setUp() throws Exception {
137- File iniFile = new File("AdjustTime.ini");
138- File orgFile = new File("AdjustTime.ini.org");
139- File testFile = new File("testdata", "AdjustTime.off.ini");
140-
141- if (orgFile.exists()) {
142- orgFile.delete();
143- }
144- if (iniFile.exists()) {
145- iniFile.renameTo(orgFile);
146- }
147-
148- FileInputStream inStream = new FileInputStream(testFile);
149- FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
150- FileChannel inChannel = inStream.getChannel();
151- FileChannel outChannel = outStream.getChannel();
152- try {
153- inChannel.transferTo(0, inChannel.size(),outChannel);
154- }
155- finally {
156- if (inChannel != null) inChannel.close();
157- if (outChannel != null) outChannel.close();
158- inStream.close();
159- outStream.close();
160- }
161- }
162-
163- @After
164- public void tearDown() throws Exception {
165- File iniFile = new File("AdjustTime.ini");
166- File orgFile = new File("AdjustTime.ini.org");
167- if (iniFile.exists()) {
168- iniFile.delete();
169- }
170- if (orgFile.exists()) {
171- orgFile.renameTo(iniFile);
172- }
173- }
174-
175- @Test
176- public void IMG_OUTPUT_ALLがfalseに定義されているとき() {
177- try {
178- AppParameters params = new AppParameters();
179- String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
180- assertThat(valueStr, is("false"));
181- }
182- catch (Exception e) {
183- fail("Exceptionが発生した。");
184- }
185- }
186-
187- @Test
188- public void IMG_OUTPUT_ALLをtrueに書き換える() {
189- try {
190- AppParameters params = new AppParameters();
191- params.setProperty(AppParameters.IMG_OUTPUT_ALL, "true");
192- params.store();
193- params = null;
194- AppParameters newParams = new AppParameters();
195- String valueStr = newParams.getProperty(AppParameters.IMG_OUTPUT_ALL);
196- assertThat(valueStr, is("true"));
197- }
198- catch (Exception e) {
199- fail("Exceptionが発生した。");
200- }
201- }
202- }
20+
21+ public static class 定義ファイルが存在しない場合 {
22+ AppParameters params;
23+
24+ @Before
25+ public void setUp() throws Exception {
26+ File iniFile = new File("AdjustTime.ini");
27+ File orgFile = new File("AdjustTime.ini.org");
28+
29+ if (orgFile.exists()) {
30+ orgFile.delete();
31+ }
32+ if (iniFile.exists()) {
33+ iniFile.renameTo(orgFile);
34+ }
35+ }
36+
37+ @After
38+ public void tearDown() throws Exception {
39+ File iniFile = new File("AdjustTime.ini");
40+ File orgFile = new File("AdjustTime.ini.org");
41+ if (iniFile.exists()) {
42+ iniFile.delete();
43+ }
44+ if (orgFile.exists()) {
45+ orgFile.renameTo(iniFile);
46+ }
47+ }
48+
49+ @Test
50+ public void IMG_OUTPUT_ALLが定義されていない時() {
51+ try {
52+ params = new AppParameters("testdata/AdjustTime.off.ini");
53+ String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
54+ assertThat(valueStr, is("false"));
55+ }
56+ catch (IOException e) {
57+ fail("Exceptionが発生した。");
58+ }
59+ }
60+ }
61+
62+ public static class 定義ファイルがtureに定義されているとき {
63+
64+ @Before
65+ public void setUp() throws Exception {
66+ File iniFile = new File("AdjustTime.ini");
67+ File orgFile = new File("AdjustTime.ini.org");
68+ File testFile = new File("testdata", "AdjustTime.on.ini");
69+
70+ if (orgFile.exists()) {
71+ orgFile.delete();
72+ }
73+ if (iniFile.exists()) {
74+ iniFile.renameTo(orgFile);
75+ }
76+
77+ FileInputStream inStream = new FileInputStream(testFile);
78+ FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
79+ FileChannel inChannel = inStream.getChannel();
80+ FileChannel outChannel = outStream.getChannel();
81+ try {
82+ inChannel.transferTo(0, inChannel.size(),outChannel);
83+ }
84+ finally {
85+ if (inChannel != null) inChannel.close();
86+ if (outChannel != null) outChannel.close();
87+ inStream.close();
88+ outStream.close();
89+ }
90+ }
91+
92+ @After
93+ public void tearDown() throws Exception {
94+ File iniFile = new File("AdjustTime.ini");
95+ File orgFile = new File("AdjustTime.ini.org");
96+ if (iniFile.exists()) {
97+ iniFile.delete();
98+ }
99+ if (orgFile.exists()) {
100+ orgFile.renameTo(iniFile);
101+ }
102+ }
103+
104+ @Test
105+ public void IMG_OUTPUT_ALLがtureに定義されているとき() {
106+ try {
107+ AppParameters params;
108+ params = new AppParameters();
109+ String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
110+ assertThat(valueStr, is("true"));
111+ }
112+ catch (IOException e) {
113+ fail("Exceptionが発生した。");
114+ }
115+ }
116+
117+ @Test
118+ public void IMG_OUTPUT_ALLをfalseに書き換える() {
119+ try {
120+ AppParameters params = new AppParameters();
121+ params.setProperty(AppParameters.IMG_OUTPUT_ALL, "false");
122+ params.store();
123+ params = null;
124+ AppParameters newParams = new AppParameters();
125+ String valueStr = newParams.getProperty(AppParameters.IMG_OUTPUT_ALL);
126+ assertThat(valueStr, is("false"));
127+ }
128+ catch (IOException e) {
129+ fail("Exceptionが発生した。");
130+ }
131+ }
132+ }
133+
134+ public static class 定義ファイルがfalseに定義されているとき {
135+
136+ @Before
137+ public void setUp() throws Exception {
138+ File iniFile = new File("AdjustTime.ini");
139+ File orgFile = new File("AdjustTime.ini.org");
140+ File testFile = new File("testdata", "AdjustTime.off.ini");
141+
142+ if (orgFile.exists()) {
143+ orgFile.delete();
144+ }
145+ if (iniFile.exists()) {
146+ iniFile.renameTo(orgFile);
147+ }
148+
149+ FileInputStream inStream = new FileInputStream(testFile);
150+ FileOutputStream outStream = new FileOutputStream(new File("AdjustTime.ini"));
151+ FileChannel inChannel = inStream.getChannel();
152+ FileChannel outChannel = outStream.getChannel();
153+ try {
154+ inChannel.transferTo(0, inChannel.size(),outChannel);
155+ }
156+ finally {
157+ if (inChannel != null) inChannel.close();
158+ if (outChannel != null) outChannel.close();
159+ inStream.close();
160+ outStream.close();
161+ }
162+ }
163+
164+ @After
165+ public void tearDown() throws Exception {
166+ File iniFile = new File("AdjustTime.ini");
167+ File orgFile = new File("AdjustTime.ini.org");
168+ if (iniFile.exists()) {
169+ iniFile.delete();
170+ }
171+ if (orgFile.exists()) {
172+ orgFile.renameTo(iniFile);
173+ }
174+ }
175+
176+ @Test
177+ public void IMG_OUTPUT_ALLがfalseに定義されているとき() {
178+ try {
179+ AppParameters params = new AppParameters();
180+ String valueStr = params.getProperty(AppParameters.IMG_OUTPUT_ALL);
181+ assertThat(valueStr, is("false"));
182+ }
183+ catch (IOException e) {
184+ fail("Exceptionが発生した。");
185+ }
186+ }
187+
188+ @Test
189+ public void IMG_OUTPUT_ALLをtrueに書き換える() {
190+ try {
191+ AppParameters params = new AppParameters();
192+ params.setProperty(AppParameters.IMG_OUTPUT_ALL, "true");
193+ params.store();
194+ params = null;
195+ AppParameters newParams = new AppParameters();
196+ String valueStr = newParams.getProperty(AppParameters.IMG_OUTPUT_ALL);
197+ assertThat(valueStr, is("true"));
198+ }
199+ catch (IOException e) {
200+ fail("Exceptionが発生した。");
201+ }
202+ }
203+ }
203204 }
--- a/importPicture/test/osm/jp/gpx/ElementMapTRKPTTest.java
+++ b/importPicture/test/osm/jp/gpx/ElementMapTRKPTTest.java
@@ -4,16 +4,12 @@ import static org.hamcrest.CoreMatchers.is;
44 import static org.hamcrest.CoreMatchers.notNullValue;
55 import static org.hamcrest.CoreMatchers.nullValue;
66 import static org.junit.Assert.*;
7-
87 import java.text.DateFormat;
98 import java.text.ParseException;
109 import java.text.SimpleDateFormat;
1110 import java.util.Date;
12-import java.util.Iterator;
13-
1411 import javax.xml.parsers.DocumentBuilder;
1512 import javax.xml.parsers.DocumentBuilderFactory;
16-
1713 import org.junit.Before;
1814 import org.junit.Test;
1915 import org.junit.experimental.runners.Enclosed;
@@ -24,269 +20,267 @@ import org.w3c.dom.Element;
2420
2521 @RunWith(Enclosed.class)
2622 public class ElementMapTRKPTTest {
27-
28- public static class Keyのみ {
29- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
30- ElementMapTRKPT map = null;
31- long timeL;
32- static String[] values = {
33- "1970-01-01 08:59:59.999",
34- "1970-01-01 09:00:00.000",
35- "1970-01-01 09:00:00.001",
36- "2018-10-25 07:59:59.999",
37- "2018-10-25 08:00:00.000",
38- "2018-10-25 08:00:00.001"
39- };
40-
41- @Before
42- public void setUp() throws Exception {
43- timeL = (sdf.parse("2018-10-25 08:00:00.000")).getTime();
44- map = new ElementMapTRKPT();
45- map.put(new Date(timeL), null); // 5-6: 2018-10-25 08:00:00.000
46- map.put(new Date(timeL + 1L), null); // 7: 2018-10-25 08:00:00.001
47- map.put(new Date(timeL - 1L), null); // 4: 2018-10-25 07:59:59.999
48- map.put(new Date(1L), null); // 3: 1970-01-01 09:00:00.001
49- map.put(new Date(0L), null); // 2: 1970-01-01 09:00:00.000
50- map.put(new Date(-1L), null); // 1: 1970-01-01 08:59:59.999
51- map.put(new Date(timeL), null); // 5-6: 2018-10-25 08:00:00.000
52- }
53-
54- @Test
55- public void 同一キーをPUTした場合() {
56- assertThat(map.size(), is(6));
57- }
58-
59- @Test
60- public void イテレータを使って読みだす() {
61- assertThat(map.size(), is(6));
62-
63- int i = 0;
64- for (Iterator<Date> itr = map.keySet().iterator(); itr.hasNext(); ) {
65- Date key = itr.next();
66- assertThat(sdf.format(key), is(values[i++]));
67- }
68- }
69-
70- @Test
71- public void 拡張FOR文を使って読みだす() {
72- assertThat(map.size(), is(6));
73-
74- int i = 0;
75- for (Date key : map.keySet()) {
76- assertThat(sdf.format(key), is(values[i++]));
77- }
78- }
79- }
80-
81- public static class Keyとvalueのセット {
82- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
83- ElementMapTRKPT map = null;
84- long timeL;
85-
86- /*
87- * <trkpt lat="35.8812697884" lon="137.9952202085"><time>2017-05-29T01:23:18Z</time></trkpt>
88- * <trkpt lat="35.8811769169" lon="137.9951928835"><time>2017-05-29T01:23:21Z</time><ele>614.90</ele></trkpt>
89- * <trkpt lat="35.881112963" lon="137.9951796401"><time>2017-05-29T01:23:24Z</time><ele>615.00</ele></trkpt>
90- * <trkpt lat="35.881072646" lon="137.9951728508"><time>2017-05-29T01:23:27Z</time><ele>615.03</ele></trkpt>
91- */
92- static String[][] values = {
93- {"2017-05-29T01:23:18Z", "35.8812697884", "137.9952202085", null},
94- {"2017-05-29T01:23:21Z", "35.8811769169", "137.9951928835", "614.90"},
95- {"2017-05-29T01:23:24Z", "35.881112963", "137.9951796401", "615.00"},
96- {"2017-05-29T01:23:27Z", "35.881072646", "137.9951728508", "615.03"}
97- };
98-
99- Element createElement(Document document, String[] values) {
100- Element trkpt = document.createElement("trkpt");
101- trkpt.setAttribute("lat", values[1]);
102- trkpt.setAttribute("lon", values[2]);
103- Element timeE = document.createElement("time");
104- timeE.appendChild(document.createTextNode(values[0]));
105- trkpt.appendChild(timeE);
106- if (values[3] != null) {
107- Element eleE = document.createElement("ele");
108- eleE.appendChild(document.createTextNode(values[3]));
109- trkpt.appendChild(eleE);
110- }
111- return trkpt;
112- }
113-
114- @Before
115- public void setUp() throws Exception {
116- Complementation.param_GpxOverwriteMagvar = true;
117-
118- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
119- DocumentBuilder builder = factory.newDocumentBuilder();
120- DOMImplementation domImpl=builder.getDOMImplementation();
121- Document document = domImpl.createDocument("","trkpt",null);
122-
123- map = new ElementMapTRKPT();
124- for (int cnt = 4; cnt > 0; cnt--) {
125- map.put(new TagTrkpt(createElement(document, values[cnt - 1])));
126- }
127- }
128-
129- @Test
130- public void コンテンツの数をチェック() {
131- assertThat(map.size(), is(4));
132- }
133-
134- @Test
135- public void KEYが時間順に取り出せるか() {
136- int i = 0;
137- for (Date key : map.keySet()) {
138- try {
139- String s = sdf.format(ImportPicture.toUTCDate(values[i++][0]));
140- assertThat(sdf.format(key), is(s));
141- } catch (ParseException e) {
142- e.printStackTrace();
143- }
144- }
145- }
146-
147- @Test
148- public void get_17() throws ParseException {
149- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:17Z"));
150- assertThat(tag, is(nullValue()));
151- }
152-
153- @Test
154- public void get_18() throws ParseException {
155- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:18Z"));
156- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
157- assertThat(tag.eleStr, is(nullValue()));
158- assertThat(tag.lat, is((new Double(values[0][1])).doubleValue()));
159- assertThat(tag.lon, is((new Double(values[0][2])).doubleValue()));
160- assertThat(tag.magvarStr, is(nullValue()));
161- }
162-
163- @Test
164- public void get_19() throws ParseException {
165- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:19Z"));
166- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
167- assertThat(tag.eleStr, is(nullValue()));
168- assertThat(tag.lat, is((new Double(values[0][1])).doubleValue()));
169- assertThat(tag.lon, is((new Double(values[0][2])).doubleValue()));
170- assertThat(tag.magvarStr, is(nullValue()));
171- }
172-
173- @Test
174- public void get_20() throws ParseException {
175- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:20Z"));
176- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
177- assertThat(tag.eleStr, is(nullValue()));
178- assertThat(tag.lat, is((new Double(values[0][1])).doubleValue()));
179- assertThat(tag.lon, is((new Double(values[0][2])).doubleValue()));
180- assertThat(tag.magvarStr, is(nullValue()));
181- }
182-
183- @Test
184- public void get_21() throws ParseException {
185- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:21Z"));
186- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
187- assertThat(tag.eleStr, is("614.90"));
188- assertThat(tag.lat, is((new Double(values[1][1])).doubleValue()));
189- assertThat(tag.lon, is((new Double(values[1][2])).doubleValue()));
190- assertThat(tag.magvarStr, is(notNullValue()));
191- }
192-
193- @Test
194- public void get_22() throws ParseException {
195- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:22Z"));
196- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
197- assertThat(tag.eleStr, is("614.90"));
198- assertThat(tag.lat, is((new Double(values[1][1])).doubleValue()));
199- assertThat(tag.lon, is((new Double(values[1][2])).doubleValue()));
200- assertThat(tag.magvarStr, is(notNullValue()));
201- }
202-
203- @Test
204- public void get_23() throws ParseException {
205- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:23Z"));
206- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
207- assertThat(tag.eleStr, is("614.90"));
208- assertThat(tag.lat, is((new Double(values[1][1])).doubleValue()));
209- assertThat(tag.lon, is((new Double(values[1][2])).doubleValue()));
210- assertThat(tag.magvarStr, is(notNullValue()));
211- }
212-
213- @Test
214- public void get_24() throws ParseException {
215- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:24Z"));
216- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
217- assertThat(tag.eleStr, is("615.00"));
218- assertThat(tag.lat, is((new Double(values[2][1])).doubleValue()));
219- assertThat(tag.lon, is((new Double(values[2][2])).doubleValue()));
220- assertThat(tag.magvarStr, is(notNullValue()));
221- }
222-
223- @Test
224- public void get_25() throws ParseException {
225- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:25Z"));
226- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
227- assertThat(tag.eleStr, is("615.00"));
228- assertThat(tag.lat, is((new Double(values[2][1])).doubleValue()));
229- assertThat(tag.lon, is((new Double(values[2][2])).doubleValue()));
230- assertThat(tag.magvarStr, is(notNullValue()));
231- }
232-
233- @Test
234- public void get_26() throws ParseException {
235- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:26Z"));
236- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
237- assertThat(tag.eleStr, is("615.00"));
238- assertThat(tag.lat, is((new Double(values[2][1])).doubleValue()));
239- assertThat(tag.lon, is((new Double(values[2][2])).doubleValue()));
240- assertThat(tag.magvarStr, is(notNullValue()));
241- }
242-
243- @Test
244- public void get_27() throws ParseException {
245- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:27Z"));
246- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
247- assertThat(tag.eleStr, is("615.03"));
248- assertThat(tag.lat, is((new Double(values[3][1])).doubleValue()));
249- assertThat(tag.lon, is((new Double(values[3][2])).doubleValue()));
250- assertThat(tag.magvarStr, is(notNullValue()));
251- }
252-
253- @Test
254- public void get_28() throws ParseException {
255- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:28Z"));
256- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
257- assertThat(tag.eleStr, is("615.03"));
258- assertThat(tag.lat, is((new Double(values[3][1])).doubleValue()));
259- assertThat(tag.lon, is((new Double(values[3][2])).doubleValue()));
260- assertThat(tag.magvarStr, is(notNullValue()));
261- }
262-
263- @Test
264- public void get_30() throws ParseException {
265- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:30Z"));
266- assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
267- assertThat(tag.eleStr, is("615.03"));
268- assertThat(tag.lat, is((new Double(values[3][1])).doubleValue()));
269- assertThat(tag.lon, is((new Double(values[3][2])).doubleValue()));
270- assertThat(tag.magvarStr, is(notNullValue()));
271- }
272-
273- @Test
274- public void get_31() throws ParseException {
275- TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:31Z"));
276- assertThat(tag, is(nullValue()));
277- }
278- }
279-
280- public static class タイムスタンプの書式 {
281- @Test
282- public void EXIF時刻書式テスト() throws Exception {
283- String dateTimeOriginal = "2017:06:30 09:59:59";
284- Date time = ImportPicture.toEXIFDate(dateTimeOriginal);
285- assertThat(ImportPicture.toEXIFString(time), is("2017:06:30 09:59:59"));
286- assertThat(ImportPicture.toUTCString(time), is("2017-06-30T00:59:59Z"));
287- DateFormat dfUTC = new SimpleDateFormat(ImportPicture.TIME_FORMAT_STRING);
288- assertThat(dfUTC.format(time), is("2017-06-30T09:59:59Z"));
289- }
290-
291- }
23+
24+ public static class Keyのみ {
25+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
26+ ElementMapTRKPT map = null;
27+ long timeL;
28+ static String[] values = {
29+ "1970-01-01 08:59:59.999",
30+ "1970-01-01 09:00:00.000",
31+ "1970-01-01 09:00:00.001",
32+ "2018-10-25 07:59:59.999",
33+ "2018-10-25 08:00:00.000",
34+ "2018-10-25 08:00:00.001"
35+ };
36+
37+ @Before
38+ public void setUp() throws Exception {
39+ timeL = (sdf.parse("2018-10-25 08:00:00.000")).getTime();
40+ map = new ElementMapTRKPT();
41+ map.put(new Date(timeL), null); // 5-6: 2018-10-25 08:00:00.000
42+ map.put(new Date(timeL + 1L), null); // 7: 2018-10-25 08:00:00.001
43+ map.put(new Date(timeL - 1L), null); // 4: 2018-10-25 07:59:59.999
44+ map.put(new Date(1L), null); // 3: 1970-01-01 09:00:00.001
45+ map.put(new Date(0L), null); // 2: 1970-01-01 09:00:00.000
46+ map.put(new Date(-1L), null); // 1: 1970-01-01 08:59:59.999
47+ map.put(new Date(timeL), null); // 5-6: 2018-10-25 08:00:00.000
48+ }
49+
50+ @Test
51+ public void 同一キーをPUTした場合() {
52+ assertThat(map.size(), is(6));
53+ }
54+
55+ @Test
56+ public void イテレータを使って読みだす() {
57+ assertThat(map.size(), is(6));
58+
59+ int i = 0;
60+ for (Date key : map.keySet()) {
61+ assertThat(sdf.format(key), is(values[i++]));
62+ }
63+ }
64+
65+ @Test
66+ public void 拡張FOR文を使って読みだす() {
67+ assertThat(map.size(), is(6));
68+
69+ int i = 0;
70+ for (Date key : map.keySet()) {
71+ assertThat(sdf.format(key), is(values[i++]));
72+ }
73+ }
74+ }
75+
76+ public static class Keyとvalueのセット {
77+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
78+ ElementMapTRKPT map = null;
79+ long timeL;
80+
81+ /*
82+ * <trkpt lat="35.8812697884" lon="137.9952202085"><time>2017-05-29T01:23:18Z</time></trkpt>
83+ * <trkpt lat="35.8811769169" lon="137.9951928835"><time>2017-05-29T01:23:21Z</time><ele>614.90</ele></trkpt>
84+ * <trkpt lat="35.881112963" lon="137.9951796401"><time>2017-05-29T01:23:24Z</time><ele>615.00</ele></trkpt>
85+ * <trkpt lat="35.881072646" lon="137.9951728508"><time>2017-05-29T01:23:27Z</time><ele>615.03</ele></trkpt>
86+ */
87+ static String[][] values = {
88+ {"2017-05-29T01:23:18Z", "35.8812697884", "137.9952202085", null},
89+ {"2017-05-29T01:23:21Z", "35.8811769169", "137.9951928835", "614.90"},
90+ {"2017-05-29T01:23:24Z", "35.881112963", "137.9951796401", "615.00"},
91+ {"2017-05-29T01:23:27Z", "35.881072646", "137.9951728508", "615.03"}
92+ };
93+
94+ Element createElement(Document document, String[] values) {
95+ Element trkpt = document.createElement("trkpt");
96+ trkpt.setAttribute("lat", values[1]);
97+ trkpt.setAttribute("lon", values[2]);
98+ Element timeE = document.createElement("time");
99+ timeE.appendChild(document.createTextNode(values[0]));
100+ trkpt.appendChild(timeE);
101+ if (values[3] != null) {
102+ Element eleE = document.createElement("ele");
103+ eleE.appendChild(document.createTextNode(values[3]));
104+ trkpt.appendChild(eleE);
105+ }
106+ return trkpt;
107+ }
108+
109+ @Before
110+ public void setUp() throws Exception {
111+ Complementation.param_GpxOverwriteMagvar = true;
112+
113+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
114+ DocumentBuilder builder = factory.newDocumentBuilder();
115+ DOMImplementation domImpl=builder.getDOMImplementation();
116+ Document document = domImpl.createDocument("","trkpt",null);
117+
118+ map = new ElementMapTRKPT();
119+ for (int cnt = 4; cnt > 0; cnt--) {
120+ map.put(new TagTrkpt(createElement(document, values[cnt - 1])));
121+ }
122+ }
123+
124+ @Test
125+ public void コンテンツの数をチェック() {
126+ assertThat(map.size(), is(4));
127+ }
128+
129+ @Test
130+ public void KEYが時間順に取り出せるか() {
131+ int i = 0;
132+ for (Date key : map.keySet()) {
133+ try {
134+ String s = sdf.format(ImportPicture.toUTCDate(values[i++][0]));
135+ assertThat(sdf.format(key), is(s));
136+ } catch (ParseException e) {
137+ e.printStackTrace();
138+ }
139+ }
140+ }
141+
142+ @Test
143+ public void get_17() throws ParseException {
144+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:17Z"));
145+ assertThat(tag, is(nullValue()));
146+ }
147+
148+ @Test
149+ public void get_18() throws ParseException {
150+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:18Z"));
151+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
152+ assertThat(tag.eleStr, is(nullValue()));
153+ assertThat(tag.lat, is(new Double(values[0][1])));
154+ assertThat(tag.lon, is(new Double(values[0][2])));
155+ assertThat(tag.magvarStr, is(nullValue()));
156+ }
157+
158+ @Test
159+ public void get_19() throws ParseException {
160+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:19Z"));
161+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
162+ assertThat(tag.eleStr, is(nullValue()));
163+ assertThat(tag.lat, is(new Double(values[0][1])));
164+ assertThat(tag.lon, is(new Double(values[0][2])));
165+ assertThat(tag.magvarStr, is(nullValue()));
166+ }
167+
168+ @Test
169+ public void get_20() throws ParseException {
170+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:20Z"));
171+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:18Z"));
172+ assertThat(tag.eleStr, is(nullValue()));
173+ assertThat(tag.lat, is(new Double(values[0][1])));
174+ assertThat(tag.lon, is(new Double(values[0][2])));
175+ assertThat(tag.magvarStr, is(nullValue()));
176+ }
177+
178+ @Test
179+ public void get_21() throws ParseException {
180+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:21Z"));
181+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
182+ assertThat(tag.eleStr, is("614.90"));
183+ assertThat(tag.lat, is(new Double(values[1][1])));
184+ assertThat(tag.lon, is(new Double(values[1][2])));
185+ assertThat(tag.magvarStr, is(notNullValue()));
186+ }
187+
188+ @Test
189+ public void get_22() throws ParseException {
190+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:22Z"));
191+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
192+ assertThat(tag.eleStr, is("614.90"));
193+ assertThat(tag.lat, is(new Double(values[1][1])));
194+ assertThat(tag.lon, is(new Double(values[1][2])));
195+ assertThat(tag.magvarStr, is(notNullValue()));
196+ }
197+
198+ @Test
199+ public void get_23() throws ParseException {
200+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:23Z"));
201+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:21Z"));
202+ assertThat(tag.eleStr, is("614.90"));
203+ assertThat(tag.lat, is(new Double(values[1][1])));
204+ assertThat(tag.lon, is(new Double(values[1][2])));
205+ assertThat(tag.magvarStr, is(notNullValue()));
206+ }
207+
208+ @Test
209+ public void get_24() throws ParseException {
210+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:24Z"));
211+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
212+ assertThat(tag.eleStr, is("615.00"));
213+ assertThat(tag.lat, is(new Double(values[2][1])));
214+ assertThat(tag.lon, is(new Double(values[2][2])));
215+ assertThat(tag.magvarStr, is(notNullValue()));
216+ }
217+
218+ @Test
219+ public void get_25() throws ParseException {
220+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:25Z"));
221+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
222+ assertThat(tag.eleStr, is("615.00"));
223+ assertThat(tag.lat, is(new Double(values[2][1])));
224+ assertThat(tag.lon, is(new Double(values[2][2])));
225+ assertThat(tag.magvarStr, is(notNullValue()));
226+ }
227+
228+ @Test
229+ public void get_26() throws ParseException {
230+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:26Z"));
231+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:24Z"));
232+ assertThat(tag.eleStr, is("615.00"));
233+ assertThat(tag.lat, is(new Double(values[2][1])));
234+ assertThat(tag.lon, is(new Double(values[2][2])));
235+ assertThat(tag.magvarStr, is(notNullValue()));
236+ }
237+
238+ @Test
239+ public void get_27() throws ParseException {
240+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:27Z"));
241+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
242+ assertThat(tag.eleStr, is("615.03"));
243+ assertThat(tag.lat, is(new Double(values[3][1])));
244+ assertThat(tag.lon, is(new Double(values[3][2])));
245+ assertThat(tag.magvarStr, is(notNullValue()));
246+ }
247+
248+ @Test
249+ public void get_28() throws ParseException {
250+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:28Z"));
251+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
252+ assertThat(tag.eleStr, is("615.03"));
253+ assertThat(tag.lat, is(new Double(values[3][1])));
254+ assertThat(tag.lon, is(new Double(values[3][2])));
255+ assertThat(tag.magvarStr, is(notNullValue()));
256+ }
257+
258+ @Test
259+ public void get_30() throws ParseException {
260+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:30Z"));
261+ assertThat(sdf.format(tag.time), is("2017-05-29T10:23:27Z"));
262+ assertThat(tag.eleStr, is("615.03"));
263+ assertThat(tag.lat, is(new Double(values[3][1])));
264+ assertThat(tag.lon, is(new Double(values[3][2])));
265+ assertThat(tag.magvarStr, is(notNullValue()));
266+ }
267+
268+ @Test
269+ public void get_31() throws ParseException {
270+ TagTrkpt tag = map.getValue(ImportPicture.toUTCDate("2017-05-29T01:23:31Z"));
271+ assertThat(tag, is(nullValue()));
272+ }
273+ }
274+
275+ public static class タイムスタンプの書式 {
276+ @Test
277+ public void EXIF時刻書式テスト() throws Exception {
278+ String dateTimeOriginal = "2017:06:30 09:59:59";
279+ Date time = ImportPicture.toEXIFDate(dateTimeOriginal);
280+ assertThat(ImportPicture.toEXIFString(time), is("2017:06:30 09:59:59"));
281+ assertThat(ImportPicture.toUTCString(time), is("2017-06-30T00:59:59Z"));
282+ DateFormat dfUTC = new SimpleDateFormat(ImportPicture.TIME_FORMAT_STRING);
283+ assertThat(dfUTC.format(time), is("2017-06-30T09:59:59Z"));
284+ }
285+ }
292286 }
--- a/importPicture/test/osm/jp/gpx/ElementMapTRKSEGTest.java
+++ b/importPicture/test/osm/jp/gpx/ElementMapTRKSEGTest.java
@@ -4,66 +4,66 @@ import static org.hamcrest.CoreMatchers.is;
44 import static org.hamcrest.CoreMatchers.notNullValue;
55 import static org.junit.Assert.assertThat;
66 import static org.junit.Assert.fail;
7-
87 import java.io.File;
8+import java.io.IOException;
9+import java.text.ParseException;
910 import java.util.Date;
10-
11+import javax.xml.parsers.ParserConfigurationException;
1112 import org.junit.experimental.theories.DataPoints;
1213 import org.junit.experimental.theories.Theories;
1314 import org.junit.experimental.theories.Theory;
1415 import org.junit.runner.RunWith;
16+import org.w3c.dom.DOMException;
17+import org.xml.sax.SAXException;
1518
1619 public class ElementMapTRKSEGTest {
17-
18- @RunWith(Theories.class)
19- public static class 各種GPXファイルを食わせる {
20- static class Fixture {
21- String gpxSourcePath; // GPXファイル(オリジナル)
22- int segCount; // GPXファイルに含まれるTRKSEGノードの数
23-
24- public Fixture(
25- String gpxSourcePath,
26- int segCount
27- ) {
28- this.gpxSourcePath = gpxSourcePath;
29- this.segCount = segCount;
30- }
31-
32- public String toString() {
33- String msg = "テストパターン : \n";
34- msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
35- msg += "\tsegCount = "+ segCount;
36- return msg;
37- }
38- }
3920
40- @DataPoints
41- public static Fixture[] datas = {
42- new Fixture("testdata/20170517.gpx", 1),
43- new Fixture("testdata/20170518.gpx", 1),
44- new Fixture("testdata/muiltiTRK.GarminColorado.gpx.xml", 3),
45- new Fixture("testdata/muiltiTRKSEG.GarminColorado.gpx.xml", 3),
46- new Fixture("testdata/muiltiTRKSEG.noNameSpace.gpx.xml", 3),
47- new Fixture("testdata/multiTRKSEG.eTrex_20J.gpx.xml", 3),
48- new Fixture("testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml", 3),
49- };
21+ @RunWith(Theories.class)
22+ public static class 各種GPXファイルを食わせる {
23+ static class Fixture {
24+ String gpxSourcePath; // GPXファイル(オリジナル)
25+ int segCount; // GPXファイルに含まれるTRKSEGノードの数
26+
27+ public Fixture(String gpxSourcePath, int segCount) {
28+ this.gpxSourcePath = gpxSourcePath;
29+ this.segCount = segCount;
30+ }
31+
32+ @Override
33+ public String toString() {
34+ String msg = "テストパターン : \n";
35+ msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
36+ msg += "\tsegCount = "+ segCount;
37+ return msg;
38+ }
39+ }
40+
41+ @DataPoints
42+ public static Fixture[] datas = {
43+ new Fixture("testdata/20170517.gpx", 1),
44+ new Fixture("testdata/20170518.gpx", 1),
45+ new Fixture("testdata/muiltiTRK.GarminColorado.gpx.xml", 3),
46+ new Fixture("testdata/muiltiTRKSEG.GarminColorado.gpx.xml", 3),
47+ new Fixture("testdata/muiltiTRKSEG.noNameSpace.gpx.xml", 3),
48+ new Fixture("testdata/multiTRKSEG.eTrex_20J.gpx.xml", 3),
49+ new Fixture("testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml", 3),
50+ };
5051
51- @Theory
52- public void TRKSEGを読み込む(Fixture dataset) {
53- try {
54- ElementMapTRKSEG mapTRKSEG = new ElementMapTRKSEG();
55- mapTRKSEG.parse(new File(dataset.gpxSourcePath));
56- mapTRKSEG.printinfo();
57- System.out.println("GPX file: "+ dataset.gpxSourcePath);
58- assertThat(mapTRKSEG.size(), is(dataset.segCount));
59- for (Date key : mapTRKSEG.keySet()) {
60- assertThat(key, is(notNullValue()));
61- }
62- }
63- catch (Exception e) {
64- fail();
65- }
66- }
67-
68- }
52+ @Theory
53+ public void TRKSEGを読み込む(Fixture dataset) {
54+ try {
55+ ElementMapTRKSEG mapTRKSEG = new ElementMapTRKSEG();
56+ mapTRKSEG.parse(new File(dataset.gpxSourcePath));
57+ mapTRKSEG.printinfo();
58+ System.out.println("GPX file: "+ dataset.gpxSourcePath);
59+ assertThat(mapTRKSEG.size(), is(dataset.segCount));
60+ for (Date key : mapTRKSEG.keySet()) {
61+ assertThat(key, is(notNullValue()));
62+ }
63+ }
64+ catch (IOException | ParseException | ParserConfigurationException | DOMException | SAXException e) {
65+ fail();
66+ }
67+ }
68+ }
6969 }
--- a/importPicture/test/osm/jp/gpx/ImportPictureTest.java
+++ b/importPicture/test/osm/jp/gpx/ImportPictureTest.java
@@ -26,650 +26,661 @@ import org.junit.experimental.theories.Theories;
2626 import org.junit.experimental.theories.Theory;
2727
2828 public class ImportPictureTest {
29- static class Expecter {
30- String value;
31- boolean expect;
32- String timeStr;
33- double latD;
34- double lonD;
35- boolean magvar;
36-
37- public Expecter(String value, boolean expect, String timeStr, double latD, double lonD, boolean magvar) {
38- this.value = value;
39- this.expect = expect;
40- this.timeStr = timeStr;
41- this.latD = latD;
42- this.lonD = lonD;
43- this.magvar = magvar;
44- }
45- }
46-
47- static class Fixture {
48- String comment; // テスト概要(コメント)
49- String tarFilePath; // TARデータ
50- String gpxSourcePath; // GPXファイル(オリジナル)
51- String gpxDestinationPath; // GPXファイル(配置先)
52- String iniFilePath; // iniファイル
53- Expecter[] expecters;
54-
55- public Fixture(
56- String comment,
57- String tarFilePath,
58- String gpxSourcePath,
59- String gpxDestinationPath,
60- String iniFilePath,
61- Expecter[] expecters
62- ) {
63- this.comment = comment;
64- this.tarFilePath = tarFilePath;
65- this.gpxSourcePath = gpxSourcePath;
66- this.gpxDestinationPath = gpxDestinationPath;
67- this.iniFilePath = iniFilePath;
68- this.expecters = expecters;
69- }
70-
71- public String toString() {
72- String msg = "テストパターン : "+ comment + "\n";
73- msg += "\ttarFilePath = "+ tarFilePath +"\n";
74- msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
75- msg += "\tgpxDestinationPath = "+ gpxDestinationPath +"\n";
76- msg += "\tiniFilePath = "+ iniFilePath;
77- return msg;
78- }
79- }
80-
81-
82- @RunWith(Theories.class)
83- public static class 各種カメラGPXファイル {
84-
85- @DataPoints
86- public static Fixture[] datas = {
87- // 1
88- new Fixture(
89- "[A1].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時",
90- "testdata/Sony20170518.tar.gz",
91- "testdata/20170518.gpx",
92- "testdata/cameradata/20170518.gpx",
93- "testdata/AdjustTime.20170518.A1.ini",
94- new Expecter[] {
95- new Expecter("10170518/20170518_.gpx", true, null, 90.0D, 180.0D, false),
96- new Expecter("10170518/DSC05183.JPG", false, null, 90.0D, 180.0D, false),
97- new Expecter("10170518/DSC05184.JPG", true, "2017:05:18 09:34:44", 35.4367520000D, 139.4082730000D, true),
98- new Expecter("10170518/DSC05196.JPG", true, "2017:05:18 09:37:32", 35.4376820000D, 139.4085150000D, true),
99- new Expecter("10170518/DSC05204.JPG", true, "2017:05:18 09:46:48", 35.4368560000D, 139.4082190000D, true),
100- new Expecter("10170518/DSC05205.JPG", false, null, 90.0D, 180.0D, false),
101- }),
102- // 2
103- new Fixture(
104- "[A2].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時",
105- "testdata/Sony20170518.tar.gz",
106- "testdata/20170518.gpx",
107- "testdata/cameradata/20170518.gpx",
108- "testdata/AdjustTime.20170518.A2.ini",
109- new Expecter[] {
110- new Expecter("10170518/20170518_.gpx", true, null, 90.0D, 180.0D, false),
111- new Expecter("10170518/DSC05183.JPG", true, "2017:05:18 09:16:48", 90.0D, 180.0D, true),
112- new Expecter("10170518/DSC05184.JPG", true, "2017:05:18 09:34:44", 35.4367520000D, 139.4082730000D, true),
113- new Expecter("10170518/DSC05196.JPG", true, "2017:05:18 09:37:32", 35.4376820000D, 139.4085150000D, true),
114- new Expecter("10170518/DSC05204.JPG", true, "2017:05:18 09:46:48", 35.4368560000D, 139.4082190000D, true),
115- new Expecter("10170518/DSC05205.JPG", true, "2017:05:18 09:48:04", 90.0D, 180.0D, true),
116- }),
117- // 3.
118- new Fixture(
119- "[B1].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時",
120- "testdata/WiMiUS20170518.tar.gz",
121- "testdata/20170518.gpx",
122- "testdata/cameradata/20170518.gpx",
123- "testdata/AdjustTime.20170518.B1.ini",
124- new Expecter[] {
125- new Expecter("cameradata/20170518_.gpx", true, null, 90.0D, 180.0D, false),
126- new Expecter("cameradata/20170518_092031A.jpg", false, null, 90.0D, 180.0D, false),
127- new Expecter("cameradata/20170518_094226A_snap.jpg", true, "2017:05:18 09:42:26", 35.4366860000D, 139.4082650000D, true),
128- new Expecter("cameradata/20170518_094737A.jpg", true, "2017:05:18 09:47:36", 35.4368200000D, 139.4082810000D, true),
129- new Expecter("cameradata/20170518_094827A.jpg", false, null, 90.0D, 180.0D, false),
130- }),
131- // 4.
132- new Fixture(
133- "[B2].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時",
134- "testdata/WiMiUS20170518.tar.gz",
135- "testdata/20170518.gpx",
136- "testdata/cameradata/20170518.gpx",
137- "testdata/AdjustTime.20170518.B2.ini",
138- new Expecter[] {
139- new Expecter("cameradata/20170518_.gpx", true, null, 90.0D, 180.0D, false),
140- new Expecter("cameradata/20170518_092031A.jpg", true, "2017:05:18 09:20:30", 90.0D, 180.0D, true),
141- new Expecter("cameradata/20170518_094226A_snap.jpg", true, "2017:05:18 09:42:26", 35.4366860000D, 139.4082650000D, true),
142- new Expecter("cameradata/20170518_094737A.jpg", true, "2017:05:18 09:47:36", 35.4368200000D, 139.4082810000D, true),
143- new Expecter("cameradata/20170518_094827A.jpg", true, "2017:05:18 09:48:26", 90.0D, 180.0D, true),
144- }),
145- // 5.
146- new Fixture(
147- "[M1a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.GarminColorado",
148- "testdata/separate.tar.gz",
149- "testdata/muiltiTRK.GarminColorado.gpx.xml",
150- "testdata/cameradata/separate.gpx",
151- "testdata/AdjustTime.M1a.separate.ini",
152- new Expecter[] {
153- // GPX file
154- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
155-
156- // out of time ( - 2017-05-29T01:23:18)
157- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
158- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
159-
160- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
161- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
162- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
163- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
164-
165- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
166- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
167- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
168-
169- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
170- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
171- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
172-
173- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
174- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
175- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
176-
177- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
178- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
179- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
180- }),
181-
182- new Fixture(
183- "[M1b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.GarminColorado",
184- "testdata/separate.tar.gz",
185- "testdata/muiltiTRK.GarminColorado.gpx.xml",
186- "testdata/cameradata/separate.gpx",
187- "testdata/AdjustTime.M1b.separate.ini",
188- new Expecter[] {
189- // GPX file
190- new Expecter("separate/separate_.gpx", true, null, 90.D, 180.0D, false),
191-
192- // out of time ( - 2017-05-29T01:23:18)
193- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
194- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
195-
196- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
197- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
198- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
199- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
200-
201- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
202- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
203- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
204-
205- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
206- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
207- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
208-
209- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
210- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
211- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
212-
213- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
214- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
215- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
216- }),
217-
218- new Fixture(
219- "[M1c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.GarminColorado",
220- "testdata/separate.tar.gz",
221- "testdata/muiltiTRK.GarminColorado.gpx.xml",
222- "testdata/cameradata/separate.gpx",
223- "testdata/AdjustTime.M1c.separate.ini",
224- new Expecter[] {
225- // GPX file
226- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
227-
228- // out of time ( - 2017-05-29T01:23:18)
229- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
230- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
231-
232- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
233- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
234- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
235- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
236-
237- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
238- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
239- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
240-
241- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
242- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
243- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
244-
245- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
246- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
247- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
248-
249- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
250- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
251- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339846227D, 138.0625408050D, true),
252- }),
253-
254- new Fixture(
255- "[M1d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.GarminColorado",
256- "testdata/separate.tar.gz",
257- "testdata/muiltiTRK.GarminColorado.gpx.xml",
258- "testdata/cameradata/separate.gpx",
259- "testdata/AdjustTime.M1d.separate.ini",
260- new Expecter[] {
261- // GPX file
262- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
263-
264- // out of time ( - 2017-05-29T01:23:18)
265- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
266- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
267-
268- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
269- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
270- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
271- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
272-
273- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
274- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
275- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
276-
277- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
278- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
279- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
280-
281- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
282- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
283- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
284-
285- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
286- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
287- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339846227D, 138.0625408050D, true),
288- }),
289-
290-
291- new Fixture(
292- "[M2a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20J",
293- "testdata/separate.tar.gz",
294- "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
295- "testdata/cameradata/separate.gpx",
296- "testdata/AdjustTime.M2a.separate.ini",
297- new Expecter[] {
298- // GPX file
299- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
300-
301- // out of time ( - 2017-05-29T01:23:18)
302- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
303- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
304-
305- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
306- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
307- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
308- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
309-
310- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
311- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
312- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
313-
314- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
315- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
316- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
317-
318- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
319- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
320- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
321-
322- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
323- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
324- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
325- }),
326-
327- new Fixture(
328- "[M2b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20J",
329- "testdata/separate.tar.gz",
330- "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
331- "testdata/cameradata/separate.gpx",
332- "testdata/AdjustTime.M2b.separate.ini",
333- new Expecter[] {
334- // GPX file
335- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
336-
337- // out of time ( - 2017-05-29T01:23:18)
338- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
339- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
340-
341- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
342- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
343- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
344- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
345-
346- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
347- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
348- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
349-
350- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
351- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
352- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
353-
354- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
355- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
356- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
357-
358- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
359- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
360- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
361- }),
362-
363- new Fixture(
364- "[M2c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20J",
365- "testdata/separate.tar.gz",
366- "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
367- "testdata/cameradata/separate.gpx",
368- "testdata/AdjustTime.M2c.separate.ini",
369- new Expecter[] {
370- // GPX file
371- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
372-
373- // out of time ( - 2017-05-29T01:23:18)
374- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
375- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
376-
377- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
378- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
379- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
380- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
381-
382- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
383- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
384- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
385-
386- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
387- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
388- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
389-
390- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
391- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
392- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
393-
394- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
395- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
396- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
397- }),
398-
399- new Fixture(
400- "[M2d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20J",
401- "testdata/separate.tar.gz",
402- "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
403- "testdata/cameradata/separate.gpx",
404- "testdata/AdjustTime.M2d.separate.ini",
405- new Expecter[] {
406- // GPX file
407- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
408-
409- // out of time ( - 2017-05-29T01:23:18)
410- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
411- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
412-
413- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
414- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
415- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
416- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
417-
418- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
419- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
420- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
421-
422- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
423- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
424- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
425-
426- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
427- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
428- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
429-
430- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
431- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
432- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
433- }),
434-
435- new Fixture(
436- "[M3a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20Jreverse",
437- "testdata/separate.tar.gz",
438- "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
439- "testdata/cameradata/separate.gpx",
440- "testdata/AdjustTime.M2a.separate.ini",
441- new Expecter[] {
442- // GPX file
443- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
444-
445- // out of time ( - 2017-05-29T01:23:18)
446- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
447- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
448-
449- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
450- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
451- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
452- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
453-
454- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
455- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
456- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
457-
458- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
459- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
460- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
461-
462- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
463- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
464- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
465-
466- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
467- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
468- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
469- }),
470-
471- new Fixture(
472- "[M3b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20Jreverse",
473- "testdata/separate.tar.gz",
474- "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
475- "testdata/cameradata/separate.gpx",
476- "testdata/AdjustTime.M2b.separate.ini",
477- new Expecter[] {
478- // GPX file
479- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
480-
481- // out of time ( - 2017-05-29T01:23:18)
482- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
483- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
484-
485- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
486- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
487- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
488- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
489-
490- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
491- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
492- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
493-
494- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
495- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
496- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
497-
498- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
499- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
500- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
501-
502- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
503- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
504- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
505- }),
506-
507- new Fixture(
508- "[M3c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20Jreverse",
509- "testdata/separate.tar.gz",
510- "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
511- "testdata/cameradata/separate.gpx",
512- "testdata/AdjustTime.M2c.separate.ini",
513- new Expecter[] {
514- // GPX file
515- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
516-
517- // out of time ( - 2017-05-29T01:23:18)
518- new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
519- new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
520-
521- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
522- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
523- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
524- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
525-
526- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
527- new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
528- new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
529-
530- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
531- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
532- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
533-
534- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
535- new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
536- new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
537-
538- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
539- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
540- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
541- }),
542-
543- new Fixture(
544- "[M3d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20Jreverse",
545- "testdata/separate.tar.gz",
546- "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
547- "testdata/cameradata/separate.gpx",
548- "testdata/AdjustTime.M2d.separate.ini",
549- new Expecter[] {
550- // GPX file
551- new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
552-
553- // out of time ( - 2017-05-29T01:23:18)
554- new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
555- new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
556-
557- // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
558- new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
559- new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
560- new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
561-
562- // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
563- new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
564- new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
565-
566- // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
567- new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
568- new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
569-
570- // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
571- new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
572- new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
573-
574- // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
575- new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
576- new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
577- }),
578- };
579-
580- @Theory
581- public void パラメータテスト(Fixture dataset) throws Exception {
582- ImportPictureTest.setup(dataset);
583- ImportPictureTest.testdo(dataset.iniFilePath);
584- //SimpleDateFormat format = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.UK);
585-
586- Expecter[] es = dataset.expecters;
587- AppParameters params = new AppParameters(dataset.iniFilePath);
588- File outDir = new File(params.getProperty(AppParameters.IMG_OUTPUT_FOLDER));
589- for (int i = 0; i < es.length; i++) {
590- File file = new File(outDir, es[i].value);
591- System.out.println("[JUnit.debug] assert file='"+ file.getAbsolutePath() +"'");
592- assertThat(file.exists(), is(es[i].expect));
593- if (es[i].timeStr != null) {
594- // JPEG メタデータが存在すること
595- ImageMetadata meta = Imaging.getMetadata(file);
596-
597- // メタデータは インスタンスJpegImageMetadata であること
598- assertThat((meta instanceof JpegImageMetadata), is(true));
599-
600- JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
601- assertNotNull(jpegMetadata);
602-
603- // EXIFデータが存在すること
604- TiffImageMetadata exif = jpegMetadata.getExif();
605- assertNotNull(exif);
606-
607- // EXIF-TIME が正しく設定されていること
608- String exifTime = ImportPicture.toEXIFString(ImportPicture.toEXIFDate(exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0]));
609- System.out.println("[debug] exifTime = '"+ exifTime +"' <--> '"+ es[i].timeStr +"'");
610- assertThat(exifTime, is(es[i].timeStr));
611-
612- // LAT,LON
613- GPSInfo gpsInfo = exif.getGPS();
614- if (es[i].latD != 90.0D) {
615- assertThat(comparePosition(gpsInfo.getLatitudeAsDegreesNorth()), is(comparePosition(es[i].latD)));
616- }
617- if (es[i].lonD != 180.0D) {
618- assertThat(comparePosition(gpsInfo.getLongitudeAsDegreesEast()), is(comparePosition(es[i].lonD)));
619- }
620- }
621- }
622- }
623-
624- static String comparePosition(double b) {
625- return String.format("%.4f", b);
626- }
627- }
628-
629- static void setup(Fixture dataset) throws IOException {
630- System.out.println(dataset.toString());
631-
632- // カメラディレクトリを削除する
633- File dir = new File("testdata/cameradata");
634- if (dir.exists()) {
635- ImportPictureTest.delete(dir);
636- }
637- File outDir = new File("testdata/output");
638- if (outDir.exists()) {
639- ImportPictureTest.delete(outDir);
640- }
641- outDir.mkdir();
642-
643- // カメラディレクトリを作成する
644- ImportPictureTest.uncompress(new File(dataset.tarFilePath), new File("testdata/cameradata"));
645-
646- // GPXファイルをセット
647- try ( FileInputStream inStream = new FileInputStream(new File(dataset.gpxSourcePath));
648- FileOutputStream outStream = new FileOutputStream(new File(dataset.gpxDestinationPath));
649- FileChannel inChannel = inStream.getChannel();
650- FileChannel outChannel = outStream.getChannel(); )
29+ static class Expecter {
30+ String value;
31+ boolean expect;
32+ String timeStr;
33+ double latD;
34+ double lonD;
35+ boolean magvar;
36+
37+ public Expecter(String value, boolean expect, String timeStr, double latD, double lonD, boolean magvar) {
38+ this.value = value;
39+ this.expect = expect;
40+ this.timeStr = timeStr;
41+ this.latD = latD;
42+ this.lonD = lonD;
43+ this.magvar = magvar;
44+ }
45+ }
46+
47+ static class Fixture {
48+ String comment; // テスト概要(コメント)
49+ String tarFilePath; // TARデータ
50+ String gpxSourcePath; // GPXファイル(オリジナル)
51+ String gpxDestinationPath; // GPXファイル(配置先)
52+ String iniFilePath; // iniファイル
53+ Expecter[] expecters;
54+
55+ public Fixture(
56+ String comment,
57+ String tarFilePath,
58+ String gpxSourcePath,
59+ String gpxDestinationPath,
60+ String iniFilePath,
61+ Expecter[] expecters
62+ ) {
63+ this.comment = comment;
64+ this.tarFilePath = tarFilePath;
65+ this.gpxSourcePath = gpxSourcePath;
66+ this.gpxDestinationPath = gpxDestinationPath;
67+ this.iniFilePath = iniFilePath;
68+ this.expecters = expecters;
69+ }
70+
71+ @Override
72+ public String toString() {
73+ String msg = "テストパターン : "+ comment + "\n";
74+ msg += "\ttarFilePath = "+ tarFilePath +"\n";
75+ msg += "\tgpxSourcePath = "+ gpxSourcePath +"\n";
76+ msg += "\tgpxDestinationPath = "+ gpxDestinationPath +"\n";
77+ msg += "\tiniFilePath = "+ iniFilePath;
78+ return msg;
79+ }
80+ }
81+
82+
83+ @RunWith(Theories.class)
84+ public static class 各種カメラGPXファイル {
85+
86+ @DataPoints
87+ public static Fixture[] datas = {
88+ // 1
89+ new Fixture(
90+ "[A1].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時",
91+ "testdata/Sony20170518.tar.gz",
92+ "testdata/20170518.gpx",
93+ "testdata/cameradata/20170518.gpx",
94+ "testdata/AdjustTime.20170518.A1.ini",
95+ new Expecter[] {
96+ new Expecter("10170518/20170518_.gpx", true, null, 90.0D, 180.0D, false),
97+ new Expecter("10170518/DSC05183.JPG", false, null, 90.0D, 180.0D, false),
98+ new Expecter("10170518/DSC05184.JPG", true, "2017:05:18 09:34:44", 35.4367520000D, 139.4082730000D, true),
99+ new Expecter("10170518/DSC05196.JPG", true, "2017:05:18 09:37:32", 35.4376820000D, 139.4085150000D, true),
100+ new Expecter("10170518/DSC05204.JPG", true, "2017:05:18 09:46:48", 35.4368560000D, 139.4082190000D, true),
101+ new Expecter("10170518/DSC05205.JPG", false, null, 90.0D, 180.0D, false),
102+ }
103+ ),
104+ // 2
105+ new Fixture(
106+ "[A2].SONYカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時",
107+ "testdata/Sony20170518.tar.gz",
108+ "testdata/20170518.gpx",
109+ "testdata/cameradata/20170518.gpx",
110+ "testdata/AdjustTime.20170518.A2.ini",
111+ new Expecter[] {
112+ new Expecter("10170518/20170518_.gpx", true, null, 90.0D, 180.0D, false),
113+ new Expecter("10170518/DSC05183.JPG", true, "2017:05:18 09:16:48", 90.0D, 180.0D, true),
114+ new Expecter("10170518/DSC05184.JPG", true, "2017:05:18 09:34:44", 35.4367520000D, 139.4082730000D, true),
115+ new Expecter("10170518/DSC05196.JPG", true, "2017:05:18 09:37:32", 35.4376820000D, 139.4085150000D, true),
116+ new Expecter("10170518/DSC05204.JPG", true, "2017:05:18 09:46:48", 35.4368560000D, 139.4082190000D, true),
117+ new Expecter("10170518/DSC05205.JPG", true, "2017:05:18 09:48:04", 90.0D, 180.0D, true),
118+ }
119+ ),
120+ // 3.
121+ new Fixture(
122+ "[B1].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルはコピー対象外の時",
123+ "testdata/WiMiUS20170518.tar.gz",
124+ "testdata/20170518.gpx",
125+ "testdata/cameradata/20170518.gpx",
126+ "testdata/AdjustTime.20170518.B1.ini",
127+ new Expecter[] {
128+ new Expecter("cameradata/20170518_.gpx", true, null, 90.0D, 180.0D, false),
129+ new Expecter("cameradata/20170518_092031A.jpg", false, null, 90.0D, 180.0D, false),
130+ new Expecter("cameradata/20170518_094226A_snap.jpg", true, "2017:05:18 09:42:26", 35.4366860000D, 139.4082650000D, true),
131+ new Expecter("cameradata/20170518_094737A.jpg", true, "2017:05:18 09:47:36", 35.4368200000D, 139.4082810000D, true),
132+ new Expecter("cameradata/20170518_094827A.jpg", false, null, 90.0D, 180.0D, false),
133+ }
134+ ),
135+ // 4.
136+ new Fixture(
137+ "[B2].WiMiUSカメラの場合.FILE_UPDATE時間を基準にして時間外のファイルもコピーする時",
138+ "testdata/WiMiUS20170518.tar.gz",
139+ "testdata/20170518.gpx",
140+ "testdata/cameradata/20170518.gpx",
141+ "testdata/AdjustTime.20170518.B2.ini",
142+ new Expecter[] {
143+ new Expecter("cameradata/20170518_.gpx", true, null, 90.0D, 180.0D, false),
144+ new Expecter("cameradata/20170518_092031A.jpg", true, "2017:05:18 09:20:30", 90.0D, 180.0D, true),
145+ new Expecter("cameradata/20170518_094226A_snap.jpg", true, "2017:05:18 09:42:26", 35.4366860000D, 139.4082650000D, true),
146+ new Expecter("cameradata/20170518_094737A.jpg", true, "2017:05:18 09:47:36", 35.4368200000D, 139.4082810000D, true),
147+ new Expecter("cameradata/20170518_094827A.jpg", true, "2017:05:18 09:48:26", 90.0D, 180.0D, true),
148+ }
149+ ),
150+ // 5.
151+ new Fixture(
152+ "[M1a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.GarminColorado",
153+ "testdata/separate.tar.gz",
154+ "testdata/muiltiTRK.GarminColorado.gpx.xml",
155+ "testdata/cameradata/separate.gpx",
156+ "testdata/AdjustTime.M1a.separate.ini",
157+ new Expecter[] {
158+ // GPX file
159+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
160+
161+ // out of time ( - 2017-05-29T01:23:18)
162+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
163+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
164+
165+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
166+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
167+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
168+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
169+
170+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
171+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
172+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
173+
174+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
175+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
176+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
177+
178+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
179+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
180+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
181+
182+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
183+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
184+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
185+ }
186+ ),
187+
188+ new Fixture(
189+ "[M1b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.GarminColorado",
190+ "testdata/separate.tar.gz",
191+ "testdata/muiltiTRK.GarminColorado.gpx.xml",
192+ "testdata/cameradata/separate.gpx",
193+ "testdata/AdjustTime.M1b.separate.ini",
194+ new Expecter[] {
195+ // GPX file
196+ new Expecter("separate/separate_.gpx", true, null, 90.D, 180.0D, false),
197+
198+ // out of time ( - 2017-05-29T01:23:18)
199+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
200+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
201+
202+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
203+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
204+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
205+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
206+
207+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
208+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
209+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
210+
211+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
212+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
213+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
214+
215+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
216+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
217+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
218+
219+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
220+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
221+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
222+ }
223+ ),
224+
225+ new Fixture(
226+ "[M1c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.GarminColorado",
227+ "testdata/separate.tar.gz",
228+ "testdata/muiltiTRK.GarminColorado.gpx.xml",
229+ "testdata/cameradata/separate.gpx",
230+ "testdata/AdjustTime.M1c.separate.ini",
231+ new Expecter[] {
232+ // GPX file
233+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
234+
235+ // out of time ( - 2017-05-29T01:23:18)
236+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
237+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
238+
239+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
240+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
241+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
242+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
243+
244+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
245+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
246+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
247+
248+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
249+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
250+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
251+
252+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
253+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
254+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
255+
256+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
257+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
258+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339846227D, 138.0625408050D, true),
259+ }
260+ ),
261+
262+ new Fixture(
263+ "[M1d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.GarminColorado",
264+ "testdata/separate.tar.gz",
265+ "testdata/muiltiTRK.GarminColorado.gpx.xml",
266+ "testdata/cameradata/separate.gpx",
267+ "testdata/AdjustTime.M1d.separate.ini",
268+ new Expecter[] {
269+ // GPX file
270+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
271+
272+ // out of time ( - 2017-05-29T01:23:18)
273+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
274+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
275+
276+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
277+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
278+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
279+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
280+
281+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
282+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
283+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
284+
285+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
286+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
287+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
288+
289+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
290+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
291+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
292+
293+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
294+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
295+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339846227D, 138.0625408050D, true),
296+ }
297+ ),
298+
299+
300+ new Fixture(
301+ "[M2a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20J",
302+ "testdata/separate.tar.gz",
303+ "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
304+ "testdata/cameradata/separate.gpx",
305+ "testdata/AdjustTime.M2a.separate.ini",
306+ new Expecter[] {
307+ // GPX file
308+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
309+
310+ // out of time ( - 2017-05-29T01:23:18)
311+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
312+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
313+
314+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
315+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
316+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
317+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
318+
319+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
320+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
321+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
322+
323+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
324+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
325+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
326+
327+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
328+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
329+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
330+
331+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
332+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
333+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
334+ }
335+ ),
336+
337+ new Fixture(
338+ "[M2b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20J",
339+ "testdata/separate.tar.gz",
340+ "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
341+ "testdata/cameradata/separate.gpx",
342+ "testdata/AdjustTime.M2b.separate.ini",
343+ new Expecter[] {
344+ // GPX file
345+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
346+
347+ // out of time ( - 2017-05-29T01:23:18)
348+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
349+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
350+
351+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
352+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
353+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
354+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
355+
356+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
357+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
358+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
359+
360+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
361+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
362+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
363+
364+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
365+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
366+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
367+
368+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
369+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
370+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
371+ }
372+ ),
373+
374+ new Fixture(
375+ "[M2c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20J",
376+ "testdata/separate.tar.gz",
377+ "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
378+ "testdata/cameradata/separate.gpx",
379+ "testdata/AdjustTime.M2c.separate.ini",
380+ new Expecter[] {
381+ // GPX file
382+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
383+
384+ // out of time ( - 2017-05-29T01:23:18)
385+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
386+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
387+
388+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
389+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
390+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
391+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
392+
393+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
394+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
395+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
396+
397+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
398+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
399+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
400+
401+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
402+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
403+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
404+
405+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
406+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
407+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
408+ }
409+ ),
410+
411+ new Fixture(
412+ "[M2d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20J",
413+ "testdata/separate.tar.gz",
414+ "testdata/multiTRKSEG.eTrex_20J.gpx.xml",
415+ "testdata/cameradata/separate.gpx",
416+ "testdata/AdjustTime.M2d.separate.ini",
417+ new Expecter[] {
418+ // GPX file
419+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
420+
421+ // out of time ( - 2017-05-29T01:23:18)
422+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
423+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
424+
425+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
426+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
427+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
428+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
429+
430+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
431+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
432+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
433+
434+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
435+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
436+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
437+
438+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
439+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
440+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
441+
442+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
443+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
444+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
445+ }
446+ ),
447+
448+ new Fixture(
449+ "[M3a].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20Jreverse",
450+ "testdata/separate.tar.gz",
451+ "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
452+ "testdata/cameradata/separate.gpx",
453+ "testdata/AdjustTime.M2a.separate.ini",
454+ new Expecter[] {
455+ // GPX file
456+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
457+
458+ // out of time ( - 2017-05-29T01:23:18)
459+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
460+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
461+
462+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
463+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
464+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
465+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
466+
467+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
468+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
469+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
470+
471+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
472+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
473+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
474+
475+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
476+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
477+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
478+
479+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
480+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
481+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
482+ }
483+ ),
484+
485+ new Fixture(
486+ "[M3b].GPXが複数のTRKSEGに分割している場合.FILE_UPDATE時間を基準.eTrex_20Jreverse",
487+ "testdata/separate.tar.gz",
488+ "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
489+ "testdata/cameradata/separate.gpx",
490+ "testdata/AdjustTime.M2b.separate.ini",
491+ new Expecter[] {
492+ // GPX file
493+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
494+
495+ // out of time ( - 2017-05-29T01:23:18)
496+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:06", 90.0D, 180.0D, true),
497+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
498+
499+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
500+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
501+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
502+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:04", 35.8808881603D, 137.9979396332D, true),
503+
504+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
505+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:10", 90.0D, 180.0D, true),
506+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
507+
508+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
509+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
510+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
511+
512+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
513+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:14", 90.0D, 180.0D, true),
514+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:44", 90.0D, 180.0D, true),
515+
516+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
517+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
518+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:18", 35.8339846227D, 138.0625408050D, true),
519+ }
520+ ),
521+
522+ new Fixture(
523+ "[M3c].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20Jreverse",
524+ "testdata/separate.tar.gz",
525+ "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
526+ "testdata/cameradata/separate.gpx",
527+ "testdata/AdjustTime.M2c.separate.ini",
528+ new Expecter[] {
529+ // GPX file
530+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
531+
532+ // out of time ( - 2017-05-29T01:23:18)
533+ new Expecter("separate/20170529_102305A.jpg", false, null, 90.0D, 180.0D, false),
534+ new Expecter("separate/20170529_102314A.jpg", false, null, 90.0D, 180.0D, false),
535+
536+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
537+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
538+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
539+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
540+
541+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
542+ new Expecter("separate/20170529_102409A.jpg", false, null, 90.0D, 180.0D, false),
543+ new Expecter("separate/20170529_102418A.jpg", false, null, 90.0D, 180.0D, false),
544+
545+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
546+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
547+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
548+
549+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
550+ new Expecter("separate/20170529_103315A.jpg", false, null, 90.0D, 180.0D, false),
551+ new Expecter("separate/20170529_103545A.jpg", false, null, 90.0D, 180.0D, false),
552+
553+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
554+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
555+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
556+ }
557+ ),
558+
559+ new Fixture(
560+ "[M3d].GPXが複数のTRKSEGに分割している場合.EXIF時間を基準.eTrex_20Jreverse",
561+ "testdata/separate.tar.gz",
562+ "testdata/multiTRKSEGreverse.eTrex_20J.gpx.xml",
563+ "testdata/cameradata/separate.gpx",
564+ "testdata/AdjustTime.M2d.separate.ini",
565+ new Expecter[] {
566+ // GPX file
567+ new Expecter("separate/separate_.gpx", true, null, 90.0D, 180.0D, false),
568+
569+ // out of time ( - 2017-05-29T01:23:18)
570+ new Expecter("separate/20170529_102305A.jpg", true, "2017:05:29 10:23:05", 90.0D, 180.0D, true),
571+ new Expecter("separate/20170529_102314A.jpg", true, "2017:05:29 10:23:14", 90.0D, 180.0D, true),
572+
573+ // in TRKSEG(1) (2017-05-29T01:23:18 - 2017-05-29T01:24:05)
574+ new Expecter("separate/20170529_102318A.jpg", true, "2017:05:29 10:23:18", 35.8812697884D, 137.9952202085D, true),
575+ new Expecter("separate/20170529_102322A.jpg", true, "2017:05:29 10:23:22", 35.8810500987D, 137.9951669835D, true),
576+ new Expecter("separate/20170529_102405A.jpg", true, "2017:05:29 10:24:05", 35.8808641881D, 137.9981065169D, true),
577+
578+ // out of time (2017-05-29T01:24:05 - 2017-05-29T01:24:37)
579+ new Expecter("separate/20170529_102409A.jpg", true, "2017:05:29 10:24:09", 90.0D, 180.0D, true),
580+ new Expecter("separate/20170529_102418A.jpg", true, "2017:05:29 10:24:18", 90.0D, 180.0D, true),
581+
582+ // in TRKSEG(2) (2017-05-29T01:24:37 - 2017-05-29T01:33:03)
583+ new Expecter("separate/20170529_102448A.jpg", true, "2017:05:29 10:24:48", 35.8788877353D, 138.0039562471D, true),
584+ new Expecter("separate/20170529_103246A.jpg", true, "2017:05:29 10:32:46", 35.8405660931D, 138.0353022180D, true),
585+
586+ // out of time (2017-05-29T01:33:03 - 2017-05-29T01:35:53)
587+ new Expecter("separate/20170529_103315A.jpg", true, "2017:05:29 10:33:15", 90.0D, 180.0D, true),
588+ new Expecter("separate/20170529_103545A.jpg", true, "2017:05:29 10:35:45", 90.0D, 180.0D, true),
589+
590+ // in TRKSEG(3) (2017-05-29T01:35:53 - 2017-05-29T01:47:35)
591+ new Expecter("separate/20170529_103615A.jpg", true, "2017:05:29 10:36:14", 35.8359798510D, 138.0600296706D, true),
592+ new Expecter("separate/20170529_104119A.jpg", true, "2017:05:29 10:41:19", 35.8339889813D, 138.0625394639D, true),
593+ }
594+ ),
595+ };
596+
597+ @Theory
598+ public void パラメータテスト(Fixture dataset) throws Exception {
599+ ImportPictureTest.setup(dataset);
600+ ImportPictureTest.testdo(dataset.iniFilePath);
601+ //SimpleDateFormat format = new SimpleDateFormat("yyyy:MM:dd HH:mm:ss", Locale.UK);
602+
603+ Expecter[] es = dataset.expecters;
604+ AppParameters params = new AppParameters(dataset.iniFilePath);
605+ File outDir = new File(params.getProperty(AppParameters.IMG_OUTPUT_FOLDER));
606+ for (Expecter e : es) {
607+ File file = new File(outDir, e.value);
608+ System.out.println("[JUnit.debug] assert file='"+ file.getAbsolutePath() +"'");
609+ assertThat(file.exists(), is(e.expect));
610+ if (e.timeStr != null) {
611+ // JPEG メタデータが存在すること
612+ ImageMetadata meta = Imaging.getMetadata(file);
613+ // メタデータは インスタンスJpegImageMetadata であること
614+ assertThat((meta instanceof JpegImageMetadata), is(true));
615+ JpegImageMetadata jpegMetadata = (JpegImageMetadata)meta;
616+ assertNotNull(jpegMetadata);
617+ // EXIFデータが存在すること
618+ TiffImageMetadata exif = jpegMetadata.getExif();
619+ assertNotNull(exif);
620+ // EXIF-TIME が正しく設定されていること
621+ String exifTime = ImportPicture.toEXIFString(ImportPicture.toEXIFDate(exif.getFieldValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL)[0]));
622+ System.out.println("[debug] exifTime = '"+ exifTime +"' <--> '" + e.timeStr + "'");
623+ assertThat(exifTime, is(e.timeStr));
624+ // LAT,LON
625+ GPSInfo gpsInfo = exif.getGPS();
626+ if (e.latD != 90.0D) {
627+ assertThat(comparePosition(gpsInfo.getLatitudeAsDegreesNorth()), is(comparePosition(e.latD)));
628+ }
629+ if (e.lonD != 180.0D) {
630+ assertThat(comparePosition(gpsInfo.getLongitudeAsDegreesEast()), is(comparePosition(e.lonD)));
631+ }
632+ }
633+ }
634+ }
635+
636+ static String comparePosition(double b) {
637+ return String.format("%.4f", b);
638+ }
639+ }
640+
641+ static void setup(Fixture dataset) throws IOException {
642+ System.out.println(dataset.toString());
643+
644+ // カメラディレクトリを削除する
645+ File dir = new File("testdata/cameradata");
646+ if (dir.exists()) {
647+ ImportPictureTest.delete(dir);
648+ }
649+ File outDir = new File("testdata/output");
650+ if (outDir.exists()) {
651+ ImportPictureTest.delete(outDir);
652+ }
653+ outDir.mkdir();
654+
655+ // カメラディレクトリを作成する
656+ ImportPictureTest.uncompress(new File(dataset.tarFilePath), new File("testdata/cameradata"));
657+
658+ // GPXファイルをセット
659+ try (FileInputStream inStream = new FileInputStream(new File(dataset.gpxSourcePath));
660+ FileOutputStream outStream = new FileOutputStream(new File(dataset.gpxDestinationPath));
661+ FileChannel inChannel = inStream.getChannel();
662+ FileChannel outChannel = outStream.getChannel())
651663 {
652664 inChannel.transferTo(0, inChannel.size(), outChannel);
653665 }
654- }
655-
656- /**
657- * 実行する
658- * @throws Exception
659- */
660- static void testdo(String iniFilePath) {
666+ }
667+
668+ /**
669+ * 実行する
670+ * @throws Exception
671+ */
672+ static void testdo(String iniFilePath) {
661673 try {
662- String[] argv = new String[1];
663- argv[0] = new String(iniFilePath);
664- ImportPicture.main(argv);
665- }
666- catch (Exception e) {
667- e.printStackTrace();
668- fail("Exceptionが発生した。");
669- }
670- }
671-
672- /**
674+ String[] argv = {iniFilePath};
675+ ImportPicture.main(argv);
676+ }
677+ catch (Exception e) {
678+ e.printStackTrace();
679+ fail("Exceptionが発生した。");
680+ }
681+ }
682+
683+ /**
673684 * *.tar.gz解凍
674685 * ファイル更新日時をオリジナルと同じにします。
675686 * @param tazFile 解凍する*.tar.gzファイル
@@ -679,37 +690,33 @@ public class ImportPictureTest {
679690 public static void uncompress(File tazFile, File dest) throws IOException {
680691 dest.mkdir();
681692
682- TarArchiveInputStream tarIn = null;
683- tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(new BufferedInputStream(new FileInputStream(tazFile))));
684-
685- TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
686- while (tarEntry != null) {
687- File destPath = new File(dest, tarEntry.getName());
688- //System.out.println("uncompress: " + destPath.getCanonicalPath());
689- if (tarEntry.isDirectory()) {
690- destPath.mkdirs();
691- }
692- else {
693- File dir = new File(destPath.getParent());
694- if (!dir.exists()) {
695- dir.mkdirs();
696- }
697- destPath.createNewFile();
698- byte[] btoRead = new byte[1024];
699- BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath));
700- int len = 0;
701-
702- while ((len = tarIn.read(btoRead)) != -1) {
703- bout.write(btoRead, 0, len);
693+ try (TarArchiveInputStream tarIn = new TarArchiveInputStream(new GzipCompressorInputStream(new BufferedInputStream(new FileInputStream(tazFile))))) {
694+ TarArchiveEntry tarEntry = tarIn.getNextTarEntry();
695+ while (tarEntry != null) {
696+ File destPath = new File(dest, tarEntry.getName());
697+ //System.out.println("uncompress: " + destPath.getCanonicalPath());
698+ if (tarEntry.isDirectory()) {
699+ destPath.mkdirs();
704700 }
705-
706- bout.close();
707- destPath.setLastModified(tarEntry.getLastModifiedDate().getTime());
708- btoRead = null;
701+ else {
702+ File dir = new File(destPath.getParent());
703+ if (!dir.exists()) {
704+ dir.mkdirs();
705+ }
706+ destPath.createNewFile();
707+ byte[] btoRead = new byte[1024];
708+ try (BufferedOutputStream bout = new BufferedOutputStream(new FileOutputStream(destPath))) {
709+ int len = 0;
710+ while ((len = tarIn.read(btoRead)) != -1) {
711+ bout.write(btoRead, 0, len);
712+ }
713+ }
714+ destPath.setLastModified(tarEntry.getLastModifiedDate().getTime());
715+ btoRead = null;
716+ }
717+ tarEntry = tarIn.getNextTarEntry();
709718 }
710- tarEntry = tarIn.getNextTarEntry();
711719 }
712- tarIn.close();
713720 }
714721
715722 public static void delete(File file) throws IOException {
@@ -721,14 +728,13 @@ public class ImportPictureTest {
721728 if (file.isDirectory()) {
722729 File files[] = file.listFiles();
723730 if (files != null) {
724- for (int i=0; i < files.length; i++) {
725- delete(files[i]); // 再帰呼び出し
731+ for (File file1 : files) {
732+ delete(file1); // 再帰呼び出し
726733 }
727734 }
728735 }
729736 if (!file.delete()) {
730- System.out.println("ERROR: ファイルは削除できませんでした。 '" + file.getAbsolutePath() +"'");
737+ System.out.println("ERROR: ファイルは削除できませんでした。 '" + file.getAbsolutePath() +"'");
731738 }
732- return;
733739 }
734740 }
\ No newline at end of file
--- a/importPicture/test/osm/jp/gpx/UnZip.java
+++ b/importPicture/test/osm/jp/gpx/UnZip.java
@@ -12,6 +12,7 @@ public class UnZip {
1212 * Zipファイルを展開します
1313 * @param aZipFile zipファイル
1414 * @param aOutDir 出力先ディレクトリ
15+ * @throws java.io.IOException
1516 */
1617 public static void decode(File aZipFile, String aOutDir) throws IOException {
1718 FileInputStream fileIn = null;
@@ -52,7 +53,7 @@ public class UnZip {
5253 zipIn.closeEntry();
5354 }
5455 }
55- catch (Exception e) {
56+ catch (IOException e) {
5657 e.printStackTrace();
5758 }
5859 finally {
@@ -60,13 +61,13 @@ public class UnZip {
6061 try {
6162 fileIn.close();
6263 }
63- catch (Exception e) {}
64+ catch (IOException e) {}
6465 }
6566 if (fileOut != null) {
6667 try {
6768 fileOut.close();
6869 }
69- catch(Exception e) {}
70+ catch(IOException e) {}
7071 }
7172 zipIn.close();
7273 }
Show on old repository browser