Class DownloadOsmChangeTask

    • Method Detail

      • download

        public java.util.concurrent.Future<?> download​(DownloadParams settings,
                                                       Bounds downloadArea,
                                                       ProgressMonitor progressMonitor)
        Description copied from interface: DownloadTask
        Asynchronously launches the download task for a given bounding box.

        Set progressMonitor to null, if the task should create, open, and close a progress monitor. Set progressMonitor to NullProgressMonitor.INSTANCE if progress information is to be discarded.

        You can wait for the asynchronous download task to finish by synchronizing on the returned Future, but make sure not to freeze up JOSM. Example:

            Future<?> future = task.download(...);
            // DON'T run this on the Swing EDT or JOSM will freeze
            future.get(); // waits for the dowload task to complete
         
        The following example uses a pattern which is better suited if a task is launched from the Swing EDT:
            final Future<?> future = task.download(...);
            Runnable runAfterTask = new Runnable() {
               public void run() {
                   // this is not strictly necessary because of the type of executor service
                   // Main.worker is initialized with, but it doesn't harm either
                   //
                   future.get(); // wait for the download task to complete
                   doSomethingAfterTheTaskCompleted();
               }
            }
            MainApplication.worker.submit(runAfterTask);
         
        Specified by:
        download in interface DownloadTask
        Overrides:
        download in class DownloadOsmTask
        Parameters:
        settings - download settings
        downloadArea - the area to download
        progressMonitor - the progressMonitor
        Returns:
        the future representing the asynchronous task
      • getToLoad

        private static java.util.Map<OsmPrimitive,​java.time.Instant> getToLoad​(DataSet ds)
        Get the primitives to load more information
        Parameters:
        ds - The dataset to look for incomplete primitives from
        Returns:
        The objects that still need to be loaded