OSDN Git Service

FIX: GPXフォルダを選択できない
authoryuuhayashi <hayashi.yuu@gmail.com>
Sun, 26 Jun 2016 03:22:21 +0000 (12:22 +0900)
committeryuuhayashi <hayashi.yuu@gmail.com>
Sun, 26 Jun 2016 03:22:21 +0000 (12:22 +0900)
importPicture/src/osm/jp/gpx/AppParameters.java
importPicture/src/osm/jp/gpx/matchtime/gui/AdjustTime.java
importPicture/src/osm/jp/gpx/matchtime/gui/ParameterPanelFolder.java

index 85e398d..a58a49a 100644 (file)
@@ -23,6 +23,15 @@ public class AppParameters extends Properties {
        // GPX: 基準時刻 {FILE_UPDATE | EXIF}
        public static String GPX_BASETIME = "GPX.BASETIME";
        
+       // 対象フォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
+       public static String IMG_SOURCE_FOLDER = "IMG.SOURCE_FOLDER";
+       
+       // 基準時刻画像(正確な撮影時刻が判明できる画像)
+       public static String IMG_BASE_FILE = "IMG.BASE_FILE";
+       
+       // 出力フォルダ:(変換した画像ファイルとGPXファイルを出力するフォルダ)
+       public static String IMG_OUTPUT_FOLDER = "IMG.OUTPUT_FOLDER";
+       
        File file;
        
        public AppParameters() throws FileNotFoundException, IOException {
@@ -48,8 +57,32 @@ public class AppParameters extends Properties {
                }
                
                //------------------------------------------------
+               // 対象フォルダ:(位置情報を付加したい画像ファイルが格納されているフォルダ)
+               String valueStr = this.getProperty(IMG_SOURCE_FOLDER);
+               if (valueStr == null) {
+                       update = true;
+                       this.setProperty(IMG_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());
+               }
+
+               //------------------------------------------------
                // GPX出力: 時間的に間隔が開いたGPXログを別の<trkseg>セグメントに分割する。 {ON | OFF}
-               String valueStr = this.getProperty(GPX_GPXSPLIT);
+               valueStr = this.getProperty(GPX_GPXSPLIT);
                if (valueStr == null) {
                        update = true;
                        this.setProperty(GPX_GPXSPLIT, "ON");           
index 481debe..65f4bec 100644 (file)
@@ -171,7 +171,7 @@ public class AdjustTime extends JFrame
         
         argsPanel = new JPanel();
         argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
-        arg1_srcFolder = new ParameterPanelFolder("対象フォルダ: ", (new File(".")).getAbsolutePath());
+        arg1_srcFolder = new ParameterPanelFolder("対象フォルダ: ", params.getProperty(AppParameters.IMG_SOURCE_FOLDER));
         argsPanel.add(arg1_srcFolder);
         cards[cardNo].add(argsPanel, BorderLayout.CENTER);
         
@@ -185,7 +185,7 @@ public class AdjustTime extends JFrame
 
         argsPanel = new JPanel();
         argsPanel.setLayout(new BoxLayout(argsPanel, BoxLayout.Y_AXIS));
-        arg2_baseTimeImg = new ParameterPanelImageFile("基準時刻画像: ", "", arg1_srcFolder);
+        arg2_baseTimeImg = new ParameterPanelImageFile("基準時刻画像: ", params.getProperty(AppParameters.IMG_BASE_FILE), arg1_srcFolder);
         argsPanel.add(arg2_baseTimeImg);
         
         exifBase = new JCheckBox("EXIFの日時を基準にする", false);
@@ -234,7 +234,7 @@ public class AdjustTime extends JFrame
         JPanel tmpPanel4a = new JPanel();
         tmpPanel4a.setLayout(new BoxLayout(tmpPanel4a, BoxLayout.Y_AXIS));
         File gpxDir = new File(".");
-        arg4_gpxFolder = new ParameterPanelFolder("GPXフォルダ: ", gpxDir.getAbsolutePath(), false);
+        arg4_gpxFolder = new ParameterPanelFolder("GPXフォルダ: ", gpxDir.getAbsolutePath(), JFileChooser.FILES_AND_DIRECTORIES);
         tmpPanel4a.add(arg4_gpxFolder);
         noFirstNode = new JCheckBox("<trkseg>セグメントの最初の1ノードは無視する。", params.getProperty(AppParameters.GPX_NO_FIRST_NODE).equals("ON"));
         tmpPanel4a.add(noFirstNode);
index 517df40..eaf5268 100644 (file)
@@ -11,7 +11,7 @@ public class ParameterPanelFolder extends ParameterPanel implements ActionListen
        JFileChooser fc;
        JButton openButton;
 
-       public ParameterPanelFolder(String label, String text, boolean onlyDir) {
+       public ParameterPanelFolder(String label, String text, int chooser) {
                super(label, text);
 
         //Create a file chooser
@@ -24,9 +24,7 @@ public class ParameterPanelFolder extends ParameterPanel implements ActionListen
                fc = new JFileChooser();
                }
                
-               if (onlyDir) {
-                       fc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
-               }
+               fc.setFileSelectionMode(chooser);
 
         openButton = new JButton("選択...", AdjustTime.createImageIcon("images/Open16.gif"));
         openButton.addActionListener(this);
@@ -34,7 +32,7 @@ public class ParameterPanelFolder extends ParameterPanel implements ActionListen
        }
        
        public ParameterPanelFolder(String label, String text) {
-               this(label, text, true);
+               this(label, text, JFileChooser.DIRECTORIES_ONLY);
        }
        
        public void setEnable(boolean f) {