OSDN Git Service

SpeedとMagverを表示
authoryuuhayashi <hayashi.yuu@gmail.com>
Sat, 29 Oct 2016 05:07:03 +0000 (14:07 +0900)
committeryuuhayashi <hayashi.yuu@gmail.com>
Sat, 29 Oct 2016 05:07:03 +0000 (14:07 +0900)
AdjustTime.ini
importPicture/src/osm/jp/gpx/Complementation.java
importPicture/src/osm/jp/gpx/Coords.java
importPicture/src/osm/jp/gpx/ImportPicture.java

index fae4bfb..9d854b5 100644 (file)
@@ -1,10 +1,10 @@
 #by AdjustTime
-#Sat Oct 29 09:48:44 JST 2016
+#Sat Oct 29 14:05:55 JST 2016
 GPX.BASETIME=EXIF_TIME
 IMG.OUTPUT_EXIF=true
-GPX.OUTPUT_SPEED=true
 GPX.OUTPUT_WPT=false
-GPX.noFirstNode=true
+GPX.OUTPUT_SPEED=true
+GPX.noFirstNode=false
 IMG.OUTPUT=true
 GPX.gpxSplit=ON
 GPX.OVERWRITE_MAGVAR=true
index 24a753c..42f7c58 100644 (file)
@@ -36,7 +36,7 @@ public class Complementation {
 
     
     /**
-     * 緯度・経度と時間差から速度(m/sec)を求める
+     * 緯度・経度と時間差から速度(km/h)を求める
      * 
      */
     public void complementationSpeed() {
@@ -53,7 +53,7 @@ public class Complementation {
        
        if (imaTag.speedStr == null)  {
                double d = Coords.calcDistHubeny(imaTag.lat, imaTag.lon, maeTag.lat, maeTag.lon);
-            String str = Double.toString((d * 1000) / (imaTag.time.getTime() - maeTag.time.getTime()));
+            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);
index a7d8672..19d73e0 100644 (file)
@@ -11,37 +11,41 @@ package osm.jp.gpx;
  */
 public class Coords {
 
-  public static final double BESSEL_A = 6377397.155;
-  public static final double BESSEL_E2 = 0.00667436061028297;
-  public static final double BESSEL_MNUM = 6334832.10663254;
-
-  public static final double GRS80_A = 6378137.000;
+  public static final double GRS80_A = 6378137.000;                            // 赤道半径(m)
   public static final double GRS80_E2 = 0.00669438002301188;
-  public static final double GRS80_MNUM = 6335439.32708317;
+  public static final double GRS80_MNUM = 6335439.32708317;            //
 
   public static final double WGS84_A = 6378137.000;
   public static final double WGS84_E2 = 0.00669437999019758;
   public static final double WGS84_MNUM = 6335439.32729246;
 
-  public static final int BESSEL = 0;
-  public static final int GRS80 = 1;
-  public static final int WGS84 = 2;
-
+  /**
+   *  角度(180度)をラジアン(2π)に変換する
+   * @param deg
+   * @return
+   */
   public static double deg2rad(double deg){
        return deg * Math.PI / 180.0;
   }
 
+  /**
+   * 距離(m)を返す 
+   * @param lat1
+   * @param lng1
+   * @param lat2
+   * @param lng2
+   * @return
+   */
   public static double calcDistHubeny(double lat1, double lng1,
-                                      double lat2, double lng2,
-                                      double a, double e2, double mnum){
-    double my = deg2rad((lat1 + lat2) / 2.0);
-    double dy = deg2rad(lat1 - lat2);
-    double dx = deg2rad(lng1 - lng2);
+                                      double lat2, double lng2){
+    double my = deg2rad((lat1 + lat2) / 2.0);  // 平均緯度
+    double dy = deg2rad(lat1 - lat2);                  // 2点間の緯度
+    double dx = deg2rad(lng1 - lng2);                  // 2点間の経度
 
     double sin = Math.sin(my);
-    double w = Math.sqrt(1.0 - e2 * sin * sin);
-    double m = mnum / (w * w * w);
-    double n = a / w;
+    double w = Math.sqrt(1.0 - GRS80_E2 * sin * sin);
+    double m = GRS80_MNUM / (w * w * w);
+    double n = GRS80_A / w;
        
     double dym = dy * m;
     double dxncos = dx * n * Math.cos(my);
@@ -49,27 +53,7 @@ public class Coords {
     return Math.sqrt(dym * dym + dxncos * dxncos);
   }
 
-  public static double calcDistHubeny(double lat1, double lng1,
-                                      double lat2, double lng2){
-    return calcDistHubeny(lat1, lng1, lat2, lng2,
-                          GRS80_A, GRS80_E2, GRS80_MNUM);
-  }
 
-  public static double calcDistHubery(double lat1, double lng1,
-                                      double lat2, double lng2, int type){
-    switch(type){
-      case BESSEL:
-        return calcDistHubeny(lat1, lng1, lat2, lng2,
-                              BESSEL_A, BESSEL_E2, BESSEL_MNUM);
-      case WGS84:
-        return calcDistHubeny(lat1, lng1, lat2, lng2,
-                              WGS84_A, WGS84_E2, WGS84_MNUM);
-      default:
-        return calcDistHubeny(lat1, lng1, lat2, lng2,
-                              GRS80_A, GRS80_E2, GRS80_MNUM);
-     }
-  }
-  
   public static void main(String[] args){
     System.out.println("Coords Test Program");
     double lat1, lng1, lat2, lng2;
index c03faaf..e0ef313 100644 (file)
@@ -425,7 +425,7 @@ public class ImportPicture extends Thread {
                System.out.println("GPX start time: "+ dfjp.format(new Date(gpxStartTime)) + "\t[GMT " + dfuk.format(new Date(gpxStartTime))+"]");\r
                System.out.println("  GPX end time: "+ dfjp.format(new Date(gpxEndTime)) + "\t[GMT " + dfuk.format(new Date(gpxEndTime))+"]");\r
                System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|------|");\r
-               System.out.println(" name       | UpdateTime         | GPStime            | Latitude   | Longitude  | ele    |magvar| speed|");\r
+               System.out.println(" name       | UpdateTime         | GPStime            | Latitude   | Longitude  | ele    |magvar| km/h |");\r
                System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|------|");\r
                proc(imgDir, delta, gpxStartTime, gpxEndTime, map, exif, gpx);\r
                System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|------|");\r
@@ -534,7 +534,7 @@ public class ImportPicture extends Thread {
             }\r
 \r
             System.out.print(String.format("%12s %12s|", (new Double(latitude)).toString(), (new Double(longitude)).toString()));\r
-            System.out.println(String.format("%8s|%6s|%s|", eleStr, magvarStr, speedStr));\r
+            System.out.println(String.format("%8s|%6s|%6s|", eleStr, magvarStr, speedStr));\r
             ret = true;\r
 \r
             if (exifWrite) {\r
@@ -742,7 +742,7 @@ public class ImportPicture extends Thread {
                        comp.complementationMagvar();\r
                 }\r
 \r
-                // 緯度・経度と時間差から速度(m/sec)を求める\r
+                // 緯度・経度と時間差から速度(km/h)を求める\r
                 if (Complementation.param_GpxOutputSpeed) {\r
                        comp.complementationSpeed();\r
                 }\r