Changeset 8158 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2015-03-28T21:35:44+01:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/OsmDataLayer.java
r8126 r8158 580 580 doneNodes.add(n); 581 581 } 582 WayPoint wpt = new WayPoint(n.getCoor()); 583 if (!n.isTimestampEmpty()) { 584 wpt.put("time", DateUtils.fromDate(n.getTimestamp())); 585 wpt.setTime(); 586 } 587 trkseg.add(wpt); 582 trkseg.add(nodeToWayPoint(n)); 588 583 } 589 584 590 585 gpxData.tracks.add(new ImmutableGpxTrack(trk, trkAttr)); 591 586 } 587 } 588 589 private static WayPoint nodeToWayPoint(Node n) { 590 WayPoint wpt = new WayPoint(n.getCoor()); 591 592 // Position info 593 594 addDoubleIfPresent(wpt, n, GpxConstants.PT_ELE); 595 596 if (!n.isTimestampEmpty()) { 597 wpt.put("time", DateUtils.fromDate(n.getTimestamp())); 598 wpt.setTime(); 599 } 600 601 addDoubleIfPresent(wpt, n, GpxConstants.PT_MAGVAR); 602 addDoubleIfPresent(wpt, n, GpxConstants.PT_GEOIDHEIGHT); 603 604 // Description info 605 606 addStringIfPresent(wpt, n, GpxConstants.GPX_NAME); 607 addStringIfPresent(wpt, n, GpxConstants.GPX_DESC, "description"); 608 addStringIfPresent(wpt, n, GpxConstants.GPX_CMT, "comment"); 609 addStringIfPresent(wpt, n, GpxConstants.GPX_SRC, "source", "source:position"); 610 611 Collection<GpxLink> links = new ArrayList<>(); 612 for (String key : new String[]{"link", "url", "website", "contact:website"}) { 613 String value = n.get(key); 614 if (value != null) { 615 links.add(new GpxLink(value)); 616 } 617 } 618 wpt.put(GpxConstants.META_LINKS, links); 619 620 addStringIfPresent(wpt, n, GpxConstants.PT_SYM, "wpt_symbol"); 621 addStringIfPresent(wpt, n, GpxConstants.PT_TYPE); 622 623 // Accuracy info 624 addStringIfPresent(wpt, n, GpxConstants.PT_FIX, "gps:fix"); 625 addIntegerIfPresent(wpt, n, GpxConstants.PT_SAT, "gps:sat"); 626 addDoubleIfPresent(wpt, n, GpxConstants.PT_HDOP, "gps:hdop"); 627 addDoubleIfPresent(wpt, n, GpxConstants.PT_VDOP, "gps:vdop"); 628 addDoubleIfPresent(wpt, n, GpxConstants.PT_PDOP, "gps:pdop"); 629 addDoubleIfPresent(wpt, n, GpxConstants.PT_AGEOFDGPSDATA, "gps:ageofdgpsdata"); 630 addIntegerIfPresent(wpt, n, GpxConstants.PT_DGPSID, "gps:dgpsid"); 631 632 return wpt; 592 633 } 593 634 … … 600 641 continue; 601 642 } 602 WayPoint wpt = new WayPoint(n.getCoor()); 603 604 // Position info 605 606 addDoubleIfPresent(wpt, n, GpxConstants.PT_ELE); 607 608 if (!n.isTimestampEmpty()) { 609 wpt.put("time", DateUtils.fromDate(n.getTimestamp())); 610 wpt.setTime(); 611 } 612 613 addDoubleIfPresent(wpt, n, GpxConstants.PT_MAGVAR); 614 addDoubleIfPresent(wpt, n, GpxConstants.PT_GEOIDHEIGHT); 615 616 // Description info 617 618 addStringIfPresent(wpt, n, GpxConstants.GPX_NAME); 619 addStringIfPresent(wpt, n, GpxConstants.GPX_DESC, "description"); 620 addStringIfPresent(wpt, n, GpxConstants.GPX_CMT, "comment"); 621 addStringIfPresent(wpt, n, GpxConstants.GPX_SRC, "source", "source:position"); 622 623 Collection<GpxLink> links = new ArrayList<>(); 624 for (String key : new String[]{"link", "url", "website", "contact:website"}) { 625 String value = n.get(key); 626 if (value != null) { 627 links.add(new GpxLink(value)); 628 } 629 } 630 wpt.put(GpxConstants.META_LINKS, links); 631 632 addStringIfPresent(wpt, n, GpxConstants.PT_SYM, "wpt_symbol"); 633 addStringIfPresent(wpt, n, GpxConstants.PT_TYPE); 634 635 // Accuracy info 636 addStringIfPresent(wpt, n, GpxConstants.PT_FIX, "gps:fix"); 637 addIntegerIfPresent(wpt, n, GpxConstants.PT_SAT, "gps:sat"); 638 addDoubleIfPresent(wpt, n, GpxConstants.PT_HDOP, "gps:hdop"); 639 addDoubleIfPresent(wpt, n, GpxConstants.PT_VDOP, "gps:vdop"); 640 addDoubleIfPresent(wpt, n, GpxConstants.PT_PDOP, "gps:pdop"); 641 addDoubleIfPresent(wpt, n, GpxConstants.PT_AGEOFDGPSDATA, "gps:ageofdgpsdata"); 642 addIntegerIfPresent(wpt, n, GpxConstants.PT_DGPSID, "gps:dgpsid"); 643 644 gpxData.waypoints.add(wpt); 643 gpxData.waypoints.add(nodeToWayPoint(n)); 645 644 } 646 645 }
Note:
See TracChangeset
for help on using the changeset viewer.