Changeset 23191 in osm for applications/editors/josm/plugins/globalsat/src/org/openstreetmap
- Timestamp:
- 2010-09-15T18:56:19+02:00 (14 years ago)
- Location:
- applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatDg100.java
r20267 r23191 135 135 */ 136 136 public GpxData readData(ProgressMonitor progressMonitor) throws ConnectionException { 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 137 progressMonitor.beginTask(null); 138 try { 139 GpxData result = null; 140 cancelled = false; 141 if(port == null){ 142 connect(); 143 } 144 145 List<FileInfoRec> fileInfoList = readFileInfoList(); 146 List<GpsRec> gpsRecList = readGpsRecList(fileInfoList); 147 148 progressMonitor.setTicksCount(gpsRecList.size()); 149 if(gpsRecList.size() > 0){ 150 GpsRec last = null; 151 result = new GpxData(); 152 Collection<WayPoint> seg = new ArrayList<WayPoint>(100); 153 for(GpsRec r:gpsRecList){ 154 if(cancelled){ 155 return result; 156 } 157 WayPoint p = wayPointFrom(r); 158 if(r.equals(last)){ 159 result.waypoints.add(p); 160 }else{ 161 seg.add(p); 162 } 163 last = r; 164 progressMonitor.worked(1); 165 } 166 result.tracks.add(new SingleSegmentGpxTrack(new ImmutableGpxTrackSegment(seg), Collections.<String, Object>emptyMap())); 167 } 168 return result; 169 } finally { 170 progressMonitor.finishTask(); 171 } 172 172 } 173 173 -
applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/GlobalsatPlugin.java
r19436 r23191 47 47 48 48 @Override public void realRun() throws IOException, SAXException { 49 49 progressMonitor.subTask(tr("Importing data from DG100...")); 50 50 try{ 51 51 data = GlobalsatPlugin.dg100().readData(progressMonitor.createSubTaskMonitor(ProgressMonitor.ALL_TICKS, true)); … … 89 89 GlobalsatImportAction importAction; 90 90 public GlobalsatPlugin(PluginInformation info) { 91 91 super(info); 92 92 boolean error = false; 93 93 try{ -
applications/editors/josm/plugins/globalsat/src/org/openstreetmap/josm/plugins/globalsat/SingleSegmentGpxTrack.java
r20431 r23191 11 11 public class SingleSegmentGpxTrack implements GpxTrack { 12 12 13 14 13 private final Map<String, Object> attributes; 14 private final GpxTrackSegment trackSegment; 15 15 16 17 18 19 16 public SingleSegmentGpxTrack(GpxTrackSegment trackSegment, Map<String, Object> attributes) { 17 this.attributes = Collections.unmodifiableMap(attributes); 18 this.trackSegment = trackSegment; 19 } 20 20 21 21 22 23 24 22 public Map<String, Object> getAttributes() { 23 return attributes; 24 } 25 25 26 27 28 26 public Bounds getBounds() { 27 return trackSegment.getBounds(); 28 } 29 29 30 31 32 30 public Collection<GpxTrackSegment> getSegments() { 31 return Collections.singleton(trackSegment); 32 } 33 33 34 35 36 34 public double length() { 35 return trackSegment.length(); 36 } 37 37 38 39 40 41 38 @Override 39 public int getUpdateCount() { 40 return trackSegment.getUpdateCount(); 41 } 42 42 43 43 }
Note:
See TracChangeset
for help on using the changeset viewer.