OSDN Git Service

function: <trkseg>セグメントの最初の1ノードは無視する。
authoryuuhayashi <hayashi.yuu@gmail.com>
Fri, 1 Jan 2016 09:14:11 +0000 (18:14 +0900)
committeryuuhayashi <hayashi.yuu@gmail.com>
Fri, 1 Jan 2016 09:14:11 +0000 (18:14 +0900)
importPicture/src/osm/jp/gpx/AppParameters.java
importPicture/src/osm/jp/gpx/Config.java [deleted file]
importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java

index 0bb11f2..5c7e549 100644 (file)
@@ -20,6 +20,8 @@ public class AppParameters extends Properties {
        // GPX: 基準時刻 {FILE_UPDATE | EXIF}
        public static String GPX_BASETIME = "GPX.BASETIME";
        
+       File file;
+       
        public AppParameters() throws FileNotFoundException, IOException {
                super();
                syncFile();
@@ -33,7 +35,7 @@ public class AppParameters extends Properties {
        void syncFile() throws FileNotFoundException, IOException {
                boolean update = false;
                
-               File file = new File(FILE_PATH);
+               this.file = new File(FILE_PATH);
                if (file.exists()) {
                        // ファイルが存在すれば、その内容をロードする。
                        this.load(new FileInputStream(file));
@@ -69,7 +71,11 @@ public class AppParameters extends Properties {
                if (update) {
                        // ・ファイルがなければ新たに作る
                        // ・項目が足りない時は書き足す。
-                       this.store(new FileOutputStream(file), "defuilt settings");     
+                       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/Config.java b/importPicture/src/osm/jp/gpx/Config.java
deleted file mode 100644 (file)
index 9f843a1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-package osm.jp.gpx;\r
-\r
-import java.io.File;\r
-import java.io.FileInputStream;\r
-import java.io.IOException;\r
-import java.io.InputStream;\r
-import java.util.Properties;\r
-\r
-/**\r
- * シンプルなサンプルログフォーマッタ\r
- */\r
-public class Config {\r
-    static Properties configuration = null;\r
-\r
-    public static Properties getProperties() throws IOException {\r
-        if (configuration == null) {\r
-               configuration = new Properties();\r
-               File f = new File("AdjustTime.ini");\r
-               if (f.isFile()) {\r
-               InputStream iniStream = new FileInputStream(f);\r
-               configuration.load(iniStream);\r
-               }\r
-       }\r
-       return configuration;\r
-    }\r
-\r
-}
\ No newline at end of file
index eb4f55f..2a4970d 100644 (file)
@@ -2,9 +2,9 @@ package osm.jp.gpx.matchtime.gui;
 import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.io.File;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.util.Date;
-import java.util.Properties;
 
 import javax.swing.*;
 
@@ -41,6 +41,7 @@ public class AdjustTime extends JFrame
     JScrollPane imageSPane;    // スクロールパネル
     JLabel imageLabel;         // 基準時刻画像表示
     JCheckBox exifBase;                // EXIF日時を基準にする/ !(ファイル更新日時を基準にする)
+    JCheckBox noFirstNode;     // GPX: <trkseg>セグメントの最初の1ノードは無視する。 {ON | OFF}
     JTextArea textArea;                // 実行結果表示領域
     //ImagePreview imagePane;  // 基準時刻画像表示
     ParameterPanelFolder arg1_srcFolder;
@@ -125,7 +126,7 @@ public class AdjustTime extends JFrame
         }
     }
     
-    Properties config;
+    AppParameters params;
 
        /**
         * データベース内のテーブルを一覧で表示するFrame
@@ -139,7 +140,7 @@ public class AdjustTime extends JFrame
         setSize(getInsets().left + getInsets().right + 960,getInsets().top + getInsets().bottom + 480);
         setTitle(AdjustTime.PROGRAM_NAME +" v"+ AdjustTime.PROGRAM_VARSION);
         
-        config = Config.getProperties();
+        params = new AppParameters();
         
         //---------------------------------------------------------------------
         cardPanel = new JPanel();
@@ -229,12 +230,14 @@ public class AdjustTime extends JFrame
         label4.setText("<html><p>ヒモ付を行うGPXファイルを選択してください。</p><ul><li>フォルダを指定すると、フォルダ内にあるすべてのGPXファイルを対象とします。</li><li>カメラの時計が正確ならば、どの画像を選んでも構いません。</li></ul>");
         cards[cardNo].add(label4, BorderLayout.NORTH);
         
-        JPanel tmpPanel4 = new JPanel();
-        tmpPanel4.setLayout(new BoxLayout(tmpPanel4, BoxLayout.Y_AXIS));
+        JPanel tmpPanel4a = new JPanel();
+        tmpPanel4a.setLayout(new BoxLayout(tmpPanel4a, BoxLayout.Y_AXIS));
         File gpxDir = new File(".");
         arg4_gpxFolder = new ParameterPanelFolder("GPXフォルダ: ", gpxDir.getAbsolutePath(), false);
-        tmpPanel4.add(arg4_gpxFolder);
-        cards[cardNo].add(tmpPanel4, BorderLayout.CENTER);
+        tmpPanel4a.add(arg4_gpxFolder);
+        noFirstNode = new JCheckBox("<trkseg>セグメントの最初の1ノードは無視する。", params.getProperty(AppParameters.GPX_NO_FIRST_NODE).equals("ON"));
+        tmpPanel4a.add(noFirstNode);
+        cards[cardNo].add(tmpPanel4a, BorderLayout.CENTER);
         
         //---------------------------------------------------------------------
         // 5.EXIF更新設定画面
@@ -293,6 +296,7 @@ public class AdjustTime extends JFrame
         arg2_baseTimeImg.openButton.addActionListener(lSymAction);
         doButton.addActionListener(lSymAction);
         exifON.addActionListener(lSymAction);
+        noFirstNode.addActionListener(lSymAction);
         //arg1Panel_4.field.addActionListener(lSymAction);
         nextButton.addActionListener(lSymAction);
         backButton.addActionListener(lSymAction);
@@ -500,6 +504,8 @@ public class AdjustTime extends JFrame
     /**
      * [実行]ボタンをクリックしたときの動作
      * @param event
+     * @throws IOException 
+     * @throws FileNotFoundException 
      */
     void doButton_Action(java.awt.event.ActionEvent event) {
        doButton.setEnabled(false);
@@ -510,6 +516,12 @@ public class AdjustTime extends JFrame
         argv[2] = arg3_basetiome.getText();
         argv[3] = (exifON.isSelected() ? arg5_outputFolder.getText() : "noEXIF");
         argv[4] = arg4_gpxFolder.getText();
+        
+        this.params.setProperty(AppParameters.GPX_NO_FIRST_NODE, (noFirstNode.isSelected() ? "ON" : "OFF"));
+        try {
+            this.params.store();
+        }
+        catch(Exception e) {}
 
         (new DoDialog(this, argv)).setVisible(true);