diff --git a/importPicture/src/LICENSE.txt b/importPicture/src/LICENSE.txt index 24cc95a..a37e276 100644 --- a/importPicture/src/LICENSE.txt +++ b/importPicture/src/LICENSE.txt @@ -36,7 +36,8 @@ ---------------- -osm.jp.gpx.Cords.java は'やまだらけ'様の著作物です。 +osm.jp.gpx.GeoDistance.java は'やまだらけ'様の著作物です。 Copyright (C) 2007-2012 やまだらけ The MIT License (MIT) 参照元: http://yamadarake.jp/trdi/report000001.html + 「Cords.java」を改変 diff --git a/importPicture/src/README.jp.txt b/importPicture/src/README.jp.txt index cd7de49..c5ea196 100644 --- a/importPicture/src/README.jp.txt +++ b/importPicture/src/README.jp.txt @@ -72,11 +72,11 @@ commons-imaging-1.0-SNAPSHOT.jarの入手元 https://repository.apache.org/content/groups/snapshots/org/apache/commons/commons-imaging/1.0-SNAPSHOT/ + commons-imaging-1.0-20170205.201009-115.jar commons-imaging-1.0-20150518.202342-66.jar ---------------- -osm.jp.gpx.Cords.java - は'やまだらけ'様の著作物です。 +osm.jp.gpx.GeoDistance.java は'やまだらけ'様の著作物です。 Copyright (C) 2007-2012 やまだらけ The MIT License (MIT) 参照元: http://yamadarake.jp/trdi/report000001.html diff --git a/importPicture/src/osm/jp/gpx/Complementation.java b/importPicture/src/osm/jp/gpx/Complementation.java index 42f7c58..7dd5725 100644 --- a/importPicture/src/osm/jp/gpx/Complementation.java +++ b/importPicture/src/osm/jp/gpx/Complementation.java @@ -52,7 +52,7 @@ } if (imaTag.speedStr == null) { - double d = Coords.calcDistHubeny(imaTag.lat, imaTag.lon, maeTag.lat, maeTag.lon); + double d = GeoDistance.calcDistHubeny(imaTag.lat, imaTag.lon, maeTag.lat, maeTag.lon); String str = Double.toString((d * 3600) / (imaTag.time.getTime() - maeTag.time.getTime())); int iDot = str.indexOf('.'); if (iDot > 0) { diff --git a/importPicture/src/osm/jp/gpx/Coords.java b/importPicture/src/osm/jp/gpx/Coords.java deleted file mode 100644 index 19d73e0..0000000 --- a/importPicture/src/osm/jp/gpx/Coords.java +++ /dev/null @@ -1,70 +0,0 @@ -package osm.jp.gpx; - -/** - * The MIT License (MIT) - * Copyright(C) 2007-2012 やまだらけ - * http://yamadarake.jp/trdi/report000001.html - * 2016-10-03 - * - * @author やまだらけ yama_darake@yahoo.co.jp - * - */ -public class Coords { - - 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 WGS84_A = 6378137.000; - public static final double WGS84_E2 = 0.00669437999019758; - public static final double WGS84_MNUM = 6335439.32729246; - - /** - * 角度(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 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 - 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); - - return Math.sqrt(dym * dym + dxncos * dxncos); - } - - - public static void main(String[] args){ - System.out.println("Coords Test Program"); - double lat1, lng1, lat2, lng2; - - lat1 = Double.parseDouble(args[0]); - lng1 = Double.parseDouble(args[1]); - lat2 = Double.parseDouble(args[2]); - lng2 = Double.parseDouble(args[3]); - - double d = calcDistHubeny(lat1, lng1, lat2, lng2); - - System.out.println("Distance = " + d + " m"); - } -} \ No newline at end of file diff --git a/importPicture/src/osm/jp/gpx/GeoDistance.java b/importPicture/src/osm/jp/gpx/GeoDistance.java new file mode 100644 index 0000000..f4f5eb1 --- /dev/null +++ b/importPicture/src/osm/jp/gpx/GeoDistance.java @@ -0,0 +1,71 @@ +package osm.jp.gpx; + +/** + * The MIT License (MIT) + * Copyright(C) 2007-2012 やまだらけ + * http://yamadarake.jp/trdi/report000001.html + * 「Cords.java」を改変 + * 2016-10-03 + * + * @author やまだらけ yama_darake@yahoo.co.jp + * + */ +public class GeoDistance { + + 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 WGS84_A = 6378137.000; + public static final double WGS84_E2 = 0.00669437999019758; + public static final double WGS84_MNUM = 6335439.32729246; + + /** + * 角度(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 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 - 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); + + return Math.sqrt(dym * dym + dxncos * dxncos); + } + + + public static void main(String[] args){ + System.out.println("Coords Test Program"); + double lat1, lng1, lat2, lng2; + + lat1 = Double.parseDouble(args[0]); + lng1 = Double.parseDouble(args[1]); + lat2 = Double.parseDouble(args[2]); + lng2 = Double.parseDouble(args[3]); + + double d = calcDistHubeny(lat1, lng1, lat2, lng2); + + System.out.println("Distance = " + d + " m"); + } +} \ No newline at end of file diff --git a/importPicture/src/osm/jp/gpx/ImportPicture.java b/importPicture/src/osm/jp/gpx/ImportPicture.java index 67b428a..18c98a9 100644 --- a/importPicture/src/osm/jp/gpx/ImportPicture.java +++ b/importPicture/src/osm/jp/gpx/ImportPicture.java @@ -460,11 +460,11 @@ System.out.println("GPX start time: "+ dfjp.format(new Date(gpxStartTime)) + "\t[GMT " + dfuk.format(new Date(gpxStartTime))+"]"); System.out.println(" GPX end time: "+ dfjp.format(new Date(gpxEndTime)) + "\t[GMT " + dfuk.format(new Date(gpxEndTime))+"]"); - System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|------|"); - System.out.println(" name | UpdateTime | GPStime | Latitude | Longitude | ele |magvar| km/h |"); - System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|------|"); + System.out.println("------------------------|--------------------|--------------------|------------|------------|--------|------|------|"); + System.out.println(" name | UpdateTime | GPStime | Latitude | Longitude | ele |magvar| km/h |"); + System.out.println("------------------------|--------------------|--------------------|------------|------------|--------|------|------|"); proc(imgDir, delta, gpxStartTime, gpxEndTime, map, exif, gpx); - System.out.println("------------|--------------------|--------------------|------------|------------|--------|------|------|"); + System.out.println("------------------------|--------------------|--------------------|------------|------------|--------|------|------|"); // 出力 outputFile.getParentFile().mkdirs(); @@ -500,7 +500,7 @@ File[] files = dir.listFiles(new JpegFileFilter()); Arrays.sort(files, new FileSort()); for (File image : files) { - System.out.print(String.format("%12s|", image.getName())); + System.out.print(String.format("%24s|", image.getName())); if (image.isDirectory()) { ret = proc(image, delta, gpxStartTime, gpxEndTime, map, exifWrite, gpx); continue;