Changeset 7518 in josm for trunk/src/org/openstreetmap/josm/io/NmeaReader.java
- Timestamp:
- 2014-09-10T02:29:55+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/io/NmeaReader.java
r7299 r7518 15 15 import org.openstreetmap.josm.Main; 16 16 import org.openstreetmap.josm.data.coor.LatLon; 17 import org.openstreetmap.josm.data.gpx.GpxConstants; 17 18 import org.openstreetmap.josm.data.gpx.GpxData; 18 19 import org.openstreetmap.josm.data.gpx.ImmutableGpxTrack; … … 287 288 // As this sentence has no complete time only use it 288 289 // if there is no time so far 289 currentwp. attr.put("time", DateUtils.fromDate(d));290 currentwp.put(GpxConstants.PT_TIME, DateUtils.fromDate(d)); 290 291 } 291 292 // elevation … … 299 300 // device sends nonstandard data. 300 301 if(!accu.isEmpty()) { // FIX ? same check 301 currentwp. attr.put("ele", accu);302 currentwp.put(GpxConstants.PT_ELE, accu); 302 303 } 303 304 } … … 308 309 if(!accu.isEmpty()) { 309 310 sat = Integer.parseInt(accu); 310 currentwp. attr.put("sat", accu);311 currentwp.put(GpxConstants.PT_SAT, accu); 311 312 } 312 313 // h-dilution 313 314 accu=e[GPGGA.HDOP.position]; 314 315 if(!accu.isEmpty()) { 315 currentwp. attr.put("hdop", Float.parseFloat(accu));316 currentwp.put(GpxConstants.PT_HDOP, Float.parseFloat(accu)); 316 317 } 317 318 // fix … … 321 322 switch(fixtype) { 322 323 case 0: 323 currentwp. attr.put("fix", "none");324 currentwp.put(GpxConstants.PT_FIX, "none"); 324 325 break; 325 326 case 1: 326 327 if(sat < 4) { 327 currentwp. attr.put("fix", "2d");328 currentwp.put(GpxConstants.PT_FIX, "2d"); 328 329 } else { 329 currentwp. attr.put("fix", "3d");330 currentwp.put(GpxConstants.PT_FIX, "3d"); 330 331 } 331 332 break; 332 333 case 2: 333 currentwp. attr.put("fix", "dgps");334 currentwp.put(GpxConstants.PT_FIX, "dgps"); 334 335 break; 335 336 default: … … 345 346 if(!accu.isEmpty()) { 346 347 Double.parseDouble(accu); 347 currentwp. attr.put("course", accu);348 currentwp.put("course", accu); 348 349 } 349 350 } … … 355 356 double speed = Double.parseDouble(accu); 356 357 speed /= 3.6; // speed in m/s 357 currentwp. attr.put("speed", Double.toString(speed));358 currentwp.put("speed", Double.toString(speed)); 358 359 } 359 360 } … … 362 363 accu=e[GPGSA.VDOP.position]; 363 364 if(!accu.isEmpty()) { 364 currentwp. attr.put("vdop", Float.parseFloat(accu));365 currentwp.put(GpxConstants.PT_VDOP, Float.parseFloat(accu)); 365 366 } 366 367 // hdop 367 368 accu=e[GPGSA.HDOP.position]; 368 369 if(!accu.isEmpty()) { 369 currentwp. attr.put("hdop", Float.parseFloat(accu));370 currentwp.put(GpxConstants.PT_HDOP, Float.parseFloat(accu)); 370 371 } 371 372 // pdop 372 373 accu=e[GPGSA.PDOP.position]; 373 374 if(!accu.isEmpty()) { 374 currentwp. attr.put("pdop", Float.parseFloat(accu));375 currentwp.put(GpxConstants.PT_PDOP, Float.parseFloat(accu)); 375 376 } 376 377 } … … 399 400 } 400 401 // time: this sentence has complete time so always use it. 401 currentwp. attr.put("time", DateUtils.fromDate(d));402 currentwp.put(GpxConstants.PT_TIME, DateUtils.fromDate(d)); 402 403 // speed 403 404 accu = e[GPRMC.SPEED.position]; … … 405 406 double speed = Double.parseDouble(accu); 406 407 speed *= 0.514444444; // to m/s 407 currentwp. attr.put("speed", Double.toString(speed));408 currentwp.put("speed", Double.toString(speed)); 408 409 } 409 410 // course … … 411 412 if(!accu.isEmpty() && !currentwp.attr.containsKey("course")) { 412 413 Double.parseDouble(accu); 413 currentwp. attr.put("course", accu);414 currentwp.put("course", accu); 414 415 } 415 416
Note:
See TracChangeset
for help on using the changeset viewer.