Changeset 512 in josm for trunk/src/org
- Timestamp:
- 2008-01-04T01:25:43+01:00 (17 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r494 r512 254 254 for (Collection<WayPoint> segment : trk.trackSegs) { 255 255 for (WayPoint trkPnt : segment) { 256 if (Double.isNaN(trkPnt.latlon.lat()) || Double.isNaN(trkPnt.latlon.lon())) 257 continue; 256 258 Point screen = mv.getPoint(trkPnt.eastNorth); 257 259 if (lines && old != null) { -
trunk/src/org/openstreetmap/josm/io/GpxReader.java
r449 r512 66 66 } 67 67 68 private double parseCoord(String s) { 69 try { 70 return Double.parseDouble(s); 71 } catch (NumberFormatException ex) { 72 return Double.NaN; 73 } 74 } 75 76 private LatLon parseLatLon(Attributes atts) { 77 return new LatLon( 78 parseCoord(atts.getValue("lat")), 79 parseCoord(atts.getValue("lon"))); 80 } 81 68 82 @Override public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { 69 83 switch(currentState) { … … 73 87 currentState = state.metadata; 74 88 } else if (qName.equals("wpt")) { 75 LatLon ll = new LatLon(Double.parseDouble(atts.getValue("lat")), Double.parseDouble(atts.getValue("lon")));76 89 states.push(currentState); 77 90 currentState = state.wpt; 78 currentWayPoint = new WayPoint( ll);91 currentWayPoint = new WayPoint(parseLatLon(atts)); 79 92 } else if (qName.equals("rte")) { 80 93 states.push(currentState); … … 122 135 case trkseg: 123 136 if (qName.equals("trkpt")) { 124 LatLon ll = new LatLon(Double.parseDouble(atts.getValue("lat")), Double.parseDouble(atts.getValue("lon")));125 137 states.push(currentState); 126 138 currentState = state.wpt; 127 currentWayPoint = new WayPoint( ll);139 currentWayPoint = new WayPoint(parseLatLon(atts)); 128 140 } 129 141 break; … … 144 156 currentLink = new GpxLink(atts.getValue("href")); 145 157 } else if (qName.equals("rtept")) { 146 LatLon ll = new LatLon(Double.parseDouble(atts.getValue("lat")), Double.parseDouble(atts.getValue("lon")));147 158 states.push(currentState); 148 159 currentState = state.wpt; 149 currentWayPoint = new WayPoint( ll);160 currentWayPoint = new WayPoint(parseLatLon(atts)); 150 161 } else if (qName.equals("extensions")) { 151 162 states.push(currentState); … … 198 209 currentLink.type = accumulator.toString(); 199 210 } else if (qName.equals("link")) { 211 // <link>URL</link> 212 if (currentLink.uri == null) 213 currentLink.uri = accumulator.toString(); 214 200 215 currentState = states.pop(); 201 216 }
Note:
See TracChangeset
for help on using the changeset viewer.