Changeset 14010 in josm for trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java
- Timestamp:
- 2018-07-07T14:09:37+02:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/nmea/NmeaReader.java
r12620 r14010 14 14 import java.util.Date; 15 15 import java.util.Locale; 16 import java.util.Objects; 16 17 import java.util.Optional; 17 18 … … 21 22 import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack; 22 23 import org.openstreetmap.josm.data.gpx.WayPoint; 24 import org.openstreetmap.josm.io.IGpxReader; 23 25 import org.openstreetmap.josm.io.IllegalDataException; 24 26 import org.openstreetmap.josm.tools.Logging; 25 27 import org.openstreetmap.josm.tools.date.DateUtils; 28 import org.xml.sax.SAXException; 26 29 27 30 /** … … 40 43 * @author cbrill 41 44 */ 42 public class NmeaReader {45 public class NmeaReader implements IGpxReader { 43 46 44 47 enum VTG { … … 129 132 } 130 133 131 public GpxData data; 134 private final InputStream source; 135 GpxData data; 132 136 133 137 private final SimpleDateFormat rmcTimeFmt = new SimpleDateFormat("ddMMyyHHmmss.SSS", Locale.ENGLISH); … … 171 175 */ 172 176 public NmeaReader(InputStream source) throws IOException { 177 this.source = Objects.requireNonNull(source); 173 178 rmcTimeFmt.setTimeZone(DateUtils.UTC); 174 179 rmcTimeFmtStd.setTimeZone(DateUtils.UTC); 175 180 } 181 182 @Override 183 public boolean parse(boolean tryToFinish) throws SAXException, IOException { 176 184 // create the data tree 177 185 data = new GpxData(); … … 184 192 if (loopstartChar == -1) 185 193 //TODO tell user about the problem? 186 return ;194 return false; 187 195 sb.append((char) loopstartChar); 188 196 ps.pDate = "010100"; // TODO date problem … … 210 218 } catch (IllegalDataException e) { 211 219 Logging.warn(e); 212 } 220 return false; 221 } 222 return true; 213 223 } 214 224 … … 529 539 return new LatLon(lat, lon); 530 540 } 541 542 @Override 543 public GpxData getGpxData() { 544 return data; 545 } 531 546 }
Note:
See TracChangeset
for help on using the changeset viewer.