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