    001// License: GPL. For details, see LICENSE file.
    002package org.openstreetmap.josm.plugins.streetside.io.download;
    003
    004import org.apache.log4j.Logger;
    005import org.openstreetmap.josm.data.Bounds;
    006import org.openstreetmap.josm.plugins.streetside.StreetsideLayer;
    007import org.openstreetmap.josm.plugins.streetside.gui.StreetsideMainDialog;
    008import org.openstreetmap.josm.plugins.streetside.utils.PluginState;
    009import org.openstreetmap.josm.plugins.streetside.utils.StreetsideUtils;
    010
    011public class StreetsideSquareDownloadRunnable implements Runnable {
    012
    013  final static Logger logger = Logger.getLogger(StreetsideSquareDownloadRunnable.class);
    014
    015  private final Bounds bounds;
    016
    017  /**
    018   * Main constructor.
    019   *
    020   * @param bounds the bounds of the area that should be downloaded
    021   *
    022   */
    023  public StreetsideSquareDownloadRunnable(Bounds bounds) {
    024    this.bounds = bounds;
    025  }
    026
    027  @Override
    028  public void run() {
    029    PluginState.startDownload();
    030    StreetsideUtils.updateHelpText();
    031
    032    // Download basic sequence data synchronously
    033    new SequenceDownloadRunnable(StreetsideLayer.getInstance().getData(), bounds).run();
    034
    035    if (Thread.interrupted()) {
    036      return;
    037    }
    038
    039    // Image detections are not currently supported for Streetside (Mapillary code removed)
    040
    041    PluginState.finishDownload();
    042
    043    StreetsideUtils.updateHelpText();
    044    StreetsideLayer.invalidateInstance();
    045    StreetsideMainDialog.getInstance().updateImage();
    046  }
    047}