Class DownloadGeoJsonTask

All Implemented Interfaces:
DownloadTask

GeoJson download task.
Since:
15424
  • Constructor Details

  • Method Details

    • getPatterns

      public String[] getPatterns()
      Description copied from interface: DownloadTask
      Returns regular expressions that match the URLs
      Specified by:
      getPatterns in interface DownloadTask
      Overrides:
      getPatterns in class DownloadOsmTask
      Returns:
      The array of accepted URL patterns
    • getTitle

      public String getTitle()
      Description copied from interface: DownloadTask
      Returns human-readable description of the task
      Specified by:
      getTitle in interface DownloadTask
      Overrides:
      getTitle in class DownloadOsmTask
      Returns:
      The task description
    • download

      public 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
    • loadUrl

      public Future<?> loadUrl(DownloadParams settings, String url, ProgressMonitor progressMonitor)
      Description copied from class: DownloadOsmTask
      Loads a given URL from the OSM Server
      Specified by:
      loadUrl in interface DownloadTask
      Overrides:
      loadUrl in class DownloadOsmTask
      Parameters:
      settings - download settings
      url - The URL as String
      progressMonitor - the progressMonitor
      Returns:
      the future representing the asynchronous task
      See Also: