OSDN Git Service

refactering
authorhaya4 <hayashi.yuu@gmail.com>
Mon, 13 Jan 2020 00:44:40 +0000 (09:44 +0900)
committerhaya4 <hayashi.yuu@gmail.com>
Mon, 13 Jan 2020 00:44:40 +0000 (09:44 +0900)
12 files changed:
pom.xml
src/main/java/osm/jp/gpx/Complementation.java
src/main/java/osm/jp/gpx/ElementMapTRKPT.java
src/main/java/osm/jp/gpx/ElementMapTRKSEG.java
src/main/java/osm/jp/gpx/YuuLogFormatter.java
src/main/java/osm/jp/gpx/matchtime/gui/Command.java
src/main/java/osm/jp/gpx/matchtime/gui/ImageFileView.java
src/main/java/osm/jp/gpx/matchtime/gui/ImageFilter.java
src/main/java/osm/jp/gpx/matchtime/gui/ImagePreview.java
src/main/java/osm/jp/gpx/matchtime/gui/ParameterPanelTime.java
src/main/java/osm/jp/gpx/matchtime/gui/Utils.java
src/main/java/osm/jp/gpx/matchtime/gui/restamp/RestampDialog.java

diff --git a/pom.xml b/pom.xml
index ffe1aa6..e26e3a2 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,41 @@
     <groupId>AdjustTime</groupId>
     <artifactId>AdjustTime</artifactId>
     <version>3.1.3-SNAPSHOT</version>
-    
+
+    <distributionManagement>
+      <repository>
+        <id>hayashi_repository</id>
+        <url>http://surveyor.mydns.jp/archiva/repository/hayashi_repository/</url>
+      </repository>
+    </distributionManagement>
+
+    <repositories>
+      <repository>
+        <id>hayashi_repository</id>
+        <name>Hayashi Repository</name>
+        <url>http://surveyor.mydns.jp/archiva/repository/hayashi_repository/</url>
+        <releases>
+          <enabled>true</enabled>
+        </releases>
+        <snapshots>
+          <enabled>false</enabled>
+        </snapshots>
+      </repository>
+    </repositories>
+    <pluginRepositories>
+      <pluginRepository>
+        <id>hayashi_repository</id>
+        <name>Hayashi Repository</name>
+        <url>http://surveyor.mydns.jp/archiva/repository/hayashi_repository/</url>
+        <releases>
+          <enabled>true</enabled>
+        </releases>
+        <snapshots>
+          <enabled>false</enabled>
+        </snapshots>
+      </pluginRepository>
+    </pluginRepositories>
+
     <properties>
         <!-- configurations -->
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
index 617f183..3eaed7a 100644 (file)
@@ -4,8 +4,6 @@ import java.text.ParseException;
 
 public class Complementation {
     public static final Double R = (6378137D + 6356752.314D)/2D;       // 6367444.657m
-    //public static final double dLat = 0.00453D;                      // 1km距離を表す緯度(差分)
-    //public static final double dLon = 0.005588D;             // 1km距離を表す経度(差分)
     
     public TagTrkpt imaTag = null;
     public TagTrkpt maeTag = null;
@@ -15,6 +13,7 @@ public class Complementation {
     /**
      * @param imaE
      * @param maeE
+     * @throws java.text.ParseException
      * @code{
      *         <trkpt lat="34.976635" lon="138.466228">
      *                 <ele>267.291</ele>
index 538f025..7d22a8e 100644 (file)
@@ -17,6 +17,8 @@ public class ElementMapTRKPT extends TreeMap<Date, TagTrkpt> {
     /**
      * 拡張put value:ElementをputするとElement内のtimeを読み取ってkeyとしてthis.put(key,value)する。
      * @param tag
+     * @return 
+     * @throws java.text.ParseException
      * @code{
      * <trkpt lat="36.4260153752" lon="138.0117778201">
      *   <ele>614.90</ele>
index 892fc7b..ca9dbc1 100644 (file)
@@ -37,6 +37,7 @@ public class ElementMapTRKSEG extends TreeMap<Date, ElementMapTRKPT> {
 
     /**
      * GPXファイルをパースする
+     * @param gpxFile
      * @code{
      * <gpx>
      *   <trk>
index 1650465..99ffc0b 100644 (file)
@@ -16,7 +16,7 @@ public class YuuLogFormatter extends Formatter {
     public String format(final LogRecord argLogRecord) {\r
         final StringBuffer buf = new StringBuffer();\r
 \r
-        buf.append(sdFormat.format(new Date(argLogRecord.getMillis())) +" ");\r
+        buf.append(sdFormat.format(new Date(argLogRecord.getMillis()))).append(" ");\r
 \r
         if (argLogRecord.getLevel() == Level.FINEST) {\r
             buf.append("[FINEST]");\r
@@ -40,9 +40,9 @@ public class YuuLogFormatter extends Formatter {
             buf.append("[SEVERE]");\r
         }\r
         else {\r
-            buf.append(Integer.toString(argLogRecord.getLevel().intValue()) +" ");\r
+            buf.append(Integer.toString(argLogRecord.getLevel().intValue())).append(" ");\r
         }\r
-        buf.append(" "+ /* argLogRecord.getLoggerName() +" - "+ */ argLogRecord.getMessage() +"\n");\r
+        buf.append(" ").append(argLogRecord.getMessage()).append("\n");\r
         return buf.toString();\r
     }\r
 }
\ No newline at end of file
index a1e0686..cb0f78e 100644 (file)
@@ -22,7 +22,7 @@ public class Command extends Thread {
 
     /**
      * コマンドパラメータの設定
-     * @param folder
+     * @param args
      */
     public void setArgs(String[] args) {
         this.args = args;
index b04236f..5507511 100644 (file)
@@ -64,18 +64,18 @@ public class ImageFileView extends FileView {
 
         if (extension != null) {
             switch (extension) {
-                case Utils.jpeg:
-                case Utils.jpg:
+                case Utils.JPEG:
+                case Utils.JPG:
                     type = "JPEG Image";
                     break;
-                case Utils.gif:
+                case Utils.GIF:
                     type = "GIF Image";
                     break;
-                case Utils.tiff:
-                case Utils.tif:
+                case Utils.TIFF:
+                case Utils.TIF:
                     type = "TIFF Image";
                     break;
-                case Utils.png:
+                case Utils.PNG:
                     type = "PNG Image";
                     break;
                 default:
@@ -92,18 +92,18 @@ public class ImageFileView extends FileView {
 
         if (extension != null) {
             switch (extension) {
-                case Utils.jpeg:
-                case Utils.jpg:
+                case Utils.JPEG:
+                case Utils.JPG:
                     icon = jpgIcon;
                     break;
-                case Utils.gif:
+                case Utils.GIF:
                     icon = gifIcon;
                     break;
-                case Utils.tiff:
-                case Utils.tif:
+                case Utils.TIFF:
+                case Utils.TIF:
                     icon = tiffIcon;
                     break;
-                case Utils.png:
+                case Utils.PNG:
                     icon = pngIcon;
                     break;
                 default:
index e49b543..012eeb6 100644 (file)
@@ -46,12 +46,12 @@ public class ImageFilter extends FileFilter {
 
         String extension = Utils.getExtension(f);
         if (extension != null) {
-            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 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 false;
     }
index bd306e7..203d3a2 100644 (file)
@@ -61,13 +61,11 @@ public class ImagePreview extends JComponent implements PropertyChangeListener {
         //because the image we're trying to load is probably not one
         //of this program's own resources.
         ImageIcon tmpIcon = new ImageIcon(file.getPath());
-        if (tmpIcon != null) {
-            if (tmpIcon.getIconWidth() > IMAGE_SIZE_X) {
-                thumbnail = new ImageIcon(tmpIcon.getImage().
-                                          getScaledInstance(IMAGE_SIZE_X, -1, Image.SCALE_DEFAULT));
-            } else { //no need to miniaturize
-                thumbnail = tmpIcon;
-            }
+        if (tmpIcon.getIconWidth() > IMAGE_SIZE_X) {
+            thumbnail = new ImageIcon(tmpIcon.getImage().
+                                      getScaledInstance(IMAGE_SIZE_X, -1, Image.SCALE_DEFAULT));
+        } else { //no need to miniaturize
+            thumbnail = tmpIcon;
         }
     }
 
index 03c3e02..b50ed43 100644 (file)
@@ -3,12 +3,15 @@ package osm.jp.gpx.matchtime.gui;
 import java.awt.Window;
 import java.awt.event.ActionEvent;
 import java.io.File;
+import java.io.IOException;
 import java.text.DateFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import javax.swing.ButtonGroup;
 import javax.swing.JButton;
 import javax.swing.JRadioButton;
+import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.Imaging;
 import org.apache.commons.imaging.common.ImageMetadata;
 import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
@@ -160,7 +163,7 @@ public class ParameterPanelTime extends ParameterPanel {
                         }
                     }
                 }
-                catch (Exception ex) {}
+                catch (IOException | ParseException | ImageReadException ex) {}
             }
             else {
                 long lastModified = timeFile.lastModified();
@@ -182,7 +185,7 @@ public class ParameterPanelTime extends ParameterPanel {
                     sdf.parse(text);
                     return true;
                 }
-                catch (Exception e) {
+                catch (ParseException e) {
                     return false;
                 }
             }
index ca44214..2f3880f 100644 (file)
@@ -36,12 +36,16 @@ import javax.swing.ImageIcon;
 
 /* Utils.java is used by FileChooserDemo2.java. */
 public class Utils {
-    public final static String jpeg = "jpeg";
-    public final static String jpg = "jpg";
-    public final static String gif = "gif";
-    public final static String tiff = "tiff";
-    public final static String tif = "tif";
-    public final static String png = "png";
+
+    /**
+     *
+     */
+    public final static String JPEG = "jpeg";
+    public final static String JPG = "jpg";
+    public final static String GIF = "gif";
+    public final static String TIFF = "tiff";
+    public final static String TIF = "tif";
+    public final static String PNG = "png";
 
     /*
      * Get the extension of a file.
index 7c0d218..0df254a 100644 (file)
@@ -1,8 +1,6 @@
 package osm.jp.gpx.matchtime.gui.restamp;
 import java.awt.*;
 import java.io.IOException;
-import java.util.Observable;
-import java.util.Observer;
 import javax.swing.*;
 import javax.swing.event.DocumentEvent;
 import osm.jp.gpx.AppParameters;
@@ -15,7 +13,7 @@ import osm.jp.gpx.matchtime.gui.ParameterPanelTime;
 import osm.jp.gpx.matchtime.gui.SimpleDocumentListener;
 
 @SuppressWarnings("serial")
-public class RestampDialog extends JDialog implements Observer
+public class RestampDialog extends JDialog
 {
     //{{DECLARE_CONTROLS
     java.awt.Button closeButton;
@@ -29,17 +27,6 @@ public class RestampDialog extends JDialog implements Observer
     AppParameters params;
     //}}
 
-    /**
-     * 
-     * @param arg0
-     * @param arg1 
-     */
-    @Override
-    public void update(Observable arg0, Object arg1) {
-        String str = (String) arg1;
-        System.out.println("私はAです。観察対象の通知を検知したよ。" + str);
-    }
-
     class SymWindow extends java.awt.event.WindowAdapter
     {
         @Override