diff --git a/importPicture/src/osm/jp/gpx/ElementMapTRKPT.java b/importPicture/src/osm/jp/gpx/ElementMapTRKPT.java index 296254c..8bb015e 100644 --- a/importPicture/src/osm/jp/gpx/ElementMapTRKPT.java +++ b/importPicture/src/osm/jp/gpx/ElementMapTRKPT.java @@ -53,16 +53,10 @@ * @throws ParseException */ public Element getValue(Date jptime) throws ParseException { - System.out.println("jptime="+ ImportPicture.dfuk.format(jptime)); - Element imaE = getTrkpt(jptime); if (imaE != null) { - System.out.println("\timaTime="+ ImportPicture.dfuk.format((new TagTrkpt(imaE)).time)); - Element maeE = getMaeTrkpt((new TagTrkpt(imaE)).time); if (maeE != null) { - System.out.println("\t\tmaeTime="+ ImportPicture.dfuk.format((new TagTrkpt(maeE)).time)); - Complementation comp = new Complementation(imaE, maeE); // がなければ、 diff --git a/importPicture/src/osm/jp/gpx/ImportPicture.java b/importPicture/src/osm/jp/gpx/ImportPicture.java index 24a5a44..fe2a689 100644 --- a/importPicture/src/osm/jp/gpx/ImportPicture.java +++ b/importPicture/src/osm/jp/gpx/ImportPicture.java @@ -1,4 +1,5 @@ package osm.jp.gpx; + import java.io.*; import java.nio.channels.FileChannel; import java.text.DecimalFormat; @@ -10,10 +11,7 @@ import java.util.Comparator; import java.util.Date; import java.util.GregorianCalendar; -import java.util.Iterator; import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; import java.util.TimeZone; import java.util.TreeMap; import java.util.logging.LogManager; @@ -294,8 +292,6 @@ public boolean param_GpxSplit = false; public boolean param_GpxNoFirstNode = false; public boolean param_GpxReuse = false; - //public boolean Complementation.param_GpxOutputSpeed = false; - //public boolean Complementation.param_GpxOverwriteMagvar = false; public boolean param_GpxOutputWpt = true; public boolean param_ImgOutputAll = false; public String param_GpxSourceFolder = "."; @@ -373,8 +369,6 @@ /* * * - * - * * * * 47.20000076293945 @@ -383,7 +377,6 @@ * * * - * * */ TreeMap mapTRKSEG = new TreeMap(); @@ -400,7 +393,6 @@ for (int i1=0; i1 < nodes1.getLength(); i1++) { Node nodeTRKSEG = nodes1.item(i1); if (nodeTRKSEG.getNodeName().equals("trkseg")) { - //Element newTRKSEG = document.createElement("trkseg"); NodeList nodes2 = nodeTRKSEG.getChildNodes(); ElementMapTRKPT mapTRKPT = new ElementMapTRKPT(); @@ -418,15 +410,7 @@ } } - // からを削除する。 - //trk.removeChild(nodeTRKSEG); - - // に、新たなを追加する。 - //trk.appendChild(newTRKSEG); - - System.out.println("\tdebug: mapTRKSEG.put(k=" + dfjp.format(trksegStartTime) +", mapTRKPT)"); mapTRKSEG.put(trksegStartTime.getTime(), mapTRKPT); - //newTRKSEG = null; } } } @@ -437,27 +421,6 @@ System.out.println("| name | UpdateTime | GPStime | Latitude | Longitude | ele |magvar| km/h |"); System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|"); proc(imgDir, delta, mapTRKSEG, exif, gpx); - for (Map.Entry mapEntry : mapTRKSEG.entrySet()) { - System.out.println("\tdebug: k=" + dfjp.format(new Date(mapEntry.getKey().longValue()))); - - ElementMapTRKPT mapPT = mapEntry.getValue(); - - // の開始時刻と終了時刻を求める - long segStartTimeL = new Date().getTime(); // の開始時刻 - long segEndTimeL = 0L; // 対象とする終了時刻 - for (Entry entryPT : mapPT.entrySet()) { - Date key = entryPT.getKey(); - if (segStartTimeL > key.getTime()) { - segStartTimeL = key.getTime(); - } - if (segEndTimeL < key.getTime()) { - segEndTimeL = key.getTime(); - } - } - - System.out.println("|-------------------------|"+ dfjp.format(new Date(segStartTimeL)) + "-->"+ dfjp.format(new Date(segEndTimeL)) +"|"); - //proc(imgDir, delta, segStartTimeL, segEndTimeL, mapPT, exif, gpx); - } System.out.println("|--------------------------------|--------------------|--------------------|--------------|--------------|--------|------|------|"); // 出力 @@ -530,23 +493,22 @@ Date uktime = new Date(itime.getTime() + delta); System.out.print(String.format("%20s|", dfjp.format(uktime))); - /* - if ((uktime.getTime() < gpxStartTime) || (uktime.getTime() > gpxEndTime)) { - System.out.println(String.format("%20s ", "out of time.")); - if (!this.param_ImgOutputAll) { - continue; - } - } - */ - // 時刻uktimeにおけるをtrkptに追加する - Element trkptE = mapTRKPT.get(uktime); String eleStr = "-"; String magvarStr = "-"; String speedStr = "-"; double latitude = 90.5D; double longitude = 180.5D; + Element trkptE = null; TagTrkpt trkptT = null; + + for (Map.Entry map : mapTRKSEG.entrySet()) { + ElementMapTRKPT mapTRKPT = map.getValue(); + trkptE = mapTRKPT.getValue(uktime); + if (trkptE != null) { + break; + } + } if (trkptE == null) { System.out.println(String.format("%20s ", "Out of GPX logging time.")); if (!this.param_ImgOutputAll) { @@ -730,68 +692,6 @@ public static SimpleDateFormat dfuk = new SimpleDateFormat(TIME_FORMAT_STRING +"'Z'"); /** - * XMLエレメント<trkpt>をTIMEでキー付したHashMapを生成する
- * - * - * - * 267.291 - * 359 - * - * - * - * - * @return gpxStartTimeL : long 格納したエレメントの最小時刻(startTime)をかえす。呼び出し元はこの値を使ってエレメントを時系列にソートする - * @param trk - * @param map - * @throws ParseException - */ - /* - public long trkptMap(Element trkseg, TreeMap map) throws ParseException { - dfuk.setTimeZone(TimeZone.getTimeZone("GMT")); - long gpxStartTimeL = (new Date()).getTime(); // 対象とする開始時刻(現在時刻) - - NodeList nodes2 = trkseg.getChildNodes(); - for (int i2=0; i2 < nodes2.getLength(); i2++) { - Node node3 = nodes2.item(i2); - if (node3.getNodeName().equals("trkpt")) { - Element trkpt = (Element) node3; - - NodeList nodes3 = trkpt.getChildNodes(); - for (int i3=0; i3 < nodes3.getLength(); i3++) { - Node node4 = nodes3.item(i3); - if (node4.getNodeName().equals("time")) { - Element time = (Element) node4; - NodeList nodes4 = time.getChildNodes(); // 子ノードを取得 - for (int i4=0; i4< nodes4.getLength(); i4++) { - Node node5 = nodes4.item(i4); - if (node5 != null) { - if (node5.getNodeType() == Node.TEXT_NODE) { - String timeStr = node5.getNodeValue(); - long timeL = dfuk.parse(timeStr).getTime(); - long gpxTime = timeL; - if (gpxStartTimeL > gpxTime) { - gpxStartTimeL = gpxTime; - } - map.put(timeL, getCopy(trkseg.getOwnerDocument(), trkpt)); - } - } - } - } - } - } - } - return gpxStartTimeL; - } - */ - - - - - - - - - /** * 対象は '*.JPG' のみ対象とする * @return * @param name