Revisión | b5f3cdbba6daf1a4b8cc5286a9a3d0de8d26b191 (tree) |
---|---|
Tiempo | 2016-10-30 10:56:53 |
Autor | ![]() |
Commiter | yuuhayashi |
FIX: 出力GPXにWPTが出力されない問題を解消
@@ -300,6 +300,7 @@ public class ImportPicture extends Thread { | ||
300 | 300 | } |
301 | 301 | } |
302 | 302 | catch(ParserConfigurationException | DOMException | SAXException | IOException | ParseException | ImageReadException | ImageWriteException | IllegalArgumentException | TransformerException e) { |
303 | + e.printStackTrace(); | |
303 | 304 | } |
304 | 305 | } |
305 | 306 |
@@ -355,12 +356,12 @@ public class ImportPicture extends Thread { | ||
355 | 356 | * <wpt lat="35.2564461" lon="139.15437809"></wpt> |
356 | 357 | * </gpx> |
357 | 358 | */ |
358 | - TreeMap<Long,Element> map = new TreeMap<>(); | |
359 | + TreeMap<Long,Element> map = new TreeMap<Long, Element>(); | |
359 | 360 | TreeMap<Long,Element> mapTRKSEG = new TreeMap<>(); |
360 | 361 | Element trk = null; |
361 | 362 | //Element maeTRKPT = null; |
362 | 363 | gpx = builder.parse(gpxFile).getFirstChild(); |
363 | - Document doc = gpx.getOwnerDocument(); | |
364 | + document = gpx.getOwnerDocument(); | |
364 | 365 | NodeList nodes = gpx.getChildNodes(); |
365 | 366 | for (int i=0; i < nodes.getLength(); i++) { |
366 | 367 | Node node2 = nodes.item(i); |
@@ -373,7 +374,7 @@ public class ImportPicture extends Thread { | ||
373 | 374 | Node nodeTRKSEG = nodes1.item(i1); |
374 | 375 | if (nodeTRKSEG.getNodeName().equals("trkseg")) { |
375 | 376 | trksegCounter++; |
376 | - Element newTRKSEG = doc.createElement("trkseg"); | |
377 | + Element newTRKSEG = document.createElement("trkseg"); | |
377 | 378 | Element trkseg = (Element) nodeTRKSEG; |
378 | 379 | NodeList nodes2 = trkseg.getChildNodes(); |
379 | 380 | for (int i2=0; i2 < nodes2.getLength(); i2++) { |
@@ -382,10 +383,10 @@ public class ImportPicture extends Thread { | ||
382 | 383 | if (param_GpxNoFirstNode && (i2 == 0)) { |
383 | 384 | continue; |
384 | 385 | } |
385 | - newTRKSEG.appendChild(getCopy(doc, nodeTRKPT)); | |
386 | + newTRKSEG.appendChild(getCopy(document, nodeTRKPT)); | |
386 | 387 | } |
387 | 388 | } |
388 | - mapTRKSEG.put(new Long(trksegCounter), getCopy(doc, newTRKSEG)); | |
389 | + mapTRKSEG.put(new Long(trksegCounter), getCopy(document, newTRKSEG)); | |
389 | 390 | |
390 | 391 | // <trk>から<trkseg>を削除する。 |
391 | 392 | trk.removeChild(nodeTRKSEG); |
@@ -421,6 +422,29 @@ public class ImportPicture extends Thread { | ||
421 | 422 | gpxEndTime = gpxTime; |
422 | 423 | } |
423 | 424 | } |
425 | + | |
426 | + /* | |
427 | + * SPEEDをGPXに設定する | |
428 | + * 条件: SPEEDを書き出すフラグがONの時 | |
429 | + * 条件: オリジナルのSPEEDがある場合「上書きする/変更しない」(GPX_OUTPUT_SPEED) | |
430 | + */ | |
431 | + /* | |
432 | + TreeMap<Long,Element> map2 = new TreeMap<Long, Element>(); | |
433 | + if (Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_SPEED))) { | |
434 | + for (Long timeL : keySet) { | |
435 | + Element trkptE = trkpt(map, new Date(timeL)); | |
436 | + if (trkptE != null) { | |
437 | + map2.put(timeL, trkptE); | |
438 | + } | |
439 | + else { | |
440 | + map2.put(timeL, map.get(timeL)); | |
441 | + } | |
442 | + } | |
443 | + } | |
444 | + else { | |
445 | + map2 = (TreeMap<Long, Element>) map.clone(); | |
446 | + } | |
447 | + */ | |
424 | 448 | |
425 | 449 | System.out.println("GPX start time: "+ dfjp.format(new Date(gpxStartTime)) + "\t[GMT " + dfuk.format(new Date(gpxStartTime))+"]"); |
426 | 450 | System.out.println(" GPX end time: "+ dfjp.format(new Date(gpxEndTime)) + "\t[GMT " + dfuk.format(new Date(gpxEndTime))+"]"); |
@@ -652,7 +676,7 @@ public class ImportPicture extends Thread { | ||
652 | 676 | } |
653 | 677 | |
654 | 678 | if (Boolean.parseBoolean(params.getProperty(AppParameters.GPX_OUTPUT_WPT))) { |
655 | - Element temp = getCopy(gpx.getOwnerDocument(), trkptT.trkpt); | |
679 | + Element temp = createWptTag(image, itime.getTime(), trkptT.trkpt); | |
656 | 680 | gpx.appendChild(temp); |
657 | 681 | } |
658 | 682 | } |