OSDN Git Service

Parameterファイルの設定
authoryuuhayashi <hayashi.yuu@gmail.com>
Sun, 27 Dec 2015 10:28:43 +0000 (19:28 +0900)
committeryuuhayashi <hayashi.yuu@gmail.com>
Sun, 27 Dec 2015 10:28:43 +0000 (19:28 +0900)
importPicture/src/AdjustTime.ini
importPicture/src/osm/jp/gpx/AppParameters.java [new file with mode: 0644]
importPicture/src/osm/jp/gpx/ImportPicture.java

index d9e599a..500ecc0 100644 (file)
@@ -1 +1 @@
-javaw -cp .;AdjustTime2.jar;commons-imaging-1.0-SNAPSHOT.jar osm.jp.gpx.matchtime.gui.AdjustTime
\ No newline at end of file
+GPX.gpxSplit=ON
diff --git a/importPicture/src/osm/jp/gpx/AppParameters.java b/importPicture/src/osm/jp/gpx/AppParameters.java
new file mode 100644 (file)
index 0000000..64b2e49
--- /dev/null
@@ -0,0 +1,64 @@
+package osm.jp.gpx;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Properties;
+
+@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";
+       
+       // EXIF出力: 画像ファイルのEXIF情報を変更する {ON | OFF}
+       public static String EXIF_GPXSPLIT = "EXIF.noEXIF";
+       
+       public AppParameters() throws FileNotFoundException, IOException {
+               super();
+               syncFile();
+       }
+
+       public AppParameters(Properties defaults) throws FileNotFoundException, IOException {
+               super(defaults);
+               syncFile();
+       }
+       
+       void syncFile() throws FileNotFoundException, IOException {
+               boolean update = false;
+               
+               File file = new File(FILE_PATH);
+               if (file.exists()) {
+                       update = true;
+               }
+               else {
+                       // ファイルがあれば、その内容をロードする。
+                       this.load(new FileInputStream(file));
+               }
+               
+               //------------------------------------------------
+               // GPX出力: 時間的に間隔が開いたGPXログを別の<>セグメントに分割する。 {ON | OFF}
+               String valueStr = this.getProperty(GPX_GPXSPLIT);
+               if (valueStr == null) {
+                       update = true;
+                       this.setProperty(GPX_GPXSPLIT, "ON");           
+               }
+
+               //------------------------------------------------
+               //  EXIF出力: 画像ファイルのEXIF情報を変更する {ON | OFF}
+               valueStr = this.getProperty(EXIF_GPXSPLIT);
+               if (valueStr == null) {
+                       update = true;
+                       this.setProperty(EXIF_GPXSPLIT, "ON");
+               }
+
+               if (update) {
+                       // ・ファイルがなければ新たに作る
+                       // ・項目が足りない時は書き足す。
+                       this.store(new FileOutputStream(file), "defuilt settings");     
+               }
+       }
+}
index 3c798bb..9a5c961 100644 (file)
@@ -167,6 +167,9 @@ public class ImportPicture extends Thread {
             }\r
         }\r
         \r
+        // その他のパラメータを読み取る\r
+        obj.params = new AppParameters();\r
+        \r
         obj.start();\r
         try {\r
             obj.join();                            \r
@@ -179,6 +182,7 @@ public class ImportPicture extends Thread {
     public long delta = 0;\r
     public boolean exif = false;\r
     public ArrayList<File> gpxFiles = new ArrayList<>();\r
+    public AppParameters params;\r
     \r
     @Override\r
     public void run() {\r
@@ -280,6 +284,8 @@ public class ImportPicture extends Thread {
                     System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|");\r
                     change = proc(imgDir, delta, gpxStartTime, gpxEndTime, map, exif, gpx);\r
                     System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|");\r
+                    System.out.println("          param: "+ AppParameters.EXIF_GPXSPLIT +"="+ params.getProperty(AppParameters.EXIF_GPXSPLIT) );\r
+                    System.out.println("          param: "+ AppParameters.GPX_GPXSPLIT +"="+ params.getProperty(AppParameters.GPX_GPXSPLIT) );\r
                 }\r
 \r
                 // 出力\r