Changeset 18868 in josm
- Timestamp:
- 2023-10-12T22:32:39+02:00 (14 months ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadNotesTask.java
r15784 r18868 13 13 14 14 import org.openstreetmap.josm.data.Bounds; 15 import org.openstreetmap.josm.data.DataSource; 15 16 import org.openstreetmap.josm.data.ProjectionBounds; 16 17 import org.openstreetmap.josm.data.ViewportData; … … 73 74 @Override 74 75 public Future<?> download(DownloadParams settings, Bounds downloadArea, ProgressMonitor progressMonitor) { 75 downloadTask = new DownloadBoundingBoxTask( new BoundingBoxDownloader(downloadArea), progressMonitor);76 downloadTask = new DownloadBoundingBoxTask(downloadArea, progressMonitor); 76 77 return MainApplication.worker.submit(downloadTask); 77 78 } … … 145 146 146 147 noteLayer = new NoteLayer(notesData, tr("Notes")); 148 if (this instanceof DownloadBoundingBoxTask && ((DownloadBoundingBoxTask) this).bounds != null) { 149 noteLayer.getNoteData().addDataSource(new DataSource(((DownloadBoundingBoxTask) this).bounds, "OpenStreetMap server")); 150 } 147 151 NoteLayer l = MainApplication.getLayerManager().getNoteLayer(); 148 152 if (l != null) { … … 170 174 171 175 class DownloadBoundingBoxTask extends DownloadTask { 176 private Bounds bounds; 177 178 DownloadBoundingBoxTask(Bounds bounds, ProgressMonitor progressMonitor) { 179 this(new BoundingBoxDownloader(bounds), progressMonitor); 180 this.bounds = bounds; 181 } 172 182 173 183 DownloadBoundingBoxTask(OsmServerReader reader, ProgressMonitor progressMonitor) { -
trunk/src/org/openstreetmap/josm/data/osm/NoteData.java
r18208 r18868 7 7 import java.util.Collections; 8 8 import java.util.Comparator; 9 import java.util.HashSet; 9 10 import java.util.List; 10 11 import java.util.Map; 12 import java.util.Set; 11 13 12 14 import org.openstreetmap.josm.data.Data; … … 53 55 private final ListenerList<NoteDataUpdateListener> listeners = ListenerList.create(); 54 56 57 private final Set<DataSource> dataSourceSet = new HashSet<>(); 58 55 59 /** 56 60 * Construct a new note container without notes … … 140 144 if (this != from) { 141 145 addNotes(from.noteList); 146 from.getDataSources().forEach(this::addDataSource); 142 147 } 143 148 } … … 315 320 @Override 316 321 public Collection<DataSource> getDataSources() { 317 return Collections.emptyList(); // Notes don't currently store data sources 322 return Collections.unmodifiableSet(this.dataSourceSet); 323 } 324 325 /** 326 * Adds a new data source. 327 * @param source data source to add 328 * @return {@code true} if the collection changed as a result of the call 329 * @since 18868 330 */ 331 public synchronized boolean addDataSource(DataSource source) { 332 return this.dataSourceSet.add(source); 318 333 } 319 334 }
Note:
See TracChangeset
for help on using the changeset viewer.