    001// License: GPL. For details, see LICENSE file.
    002package org.openstreetmap.josm.plugins.streetside.io.download;
    003
    004import java.io.IOException;
    005import java.net.URL;
    006import java.net.URLConnection;
    007import java.util.function.Function;
    008
    009import org.openstreetmap.josm.data.Bounds;
    010import org.openstreetmap.josm.plugins.streetside.StreetsideData;
    011import org.openstreetmap.josm.plugins.streetside.utils.StreetsideURL.APIv3;
    012
    013
    014public class ImageDetailsDownloadRunnable extends BoundsDownloadRunnable {
    015  private static final Function<Bounds, URL> URL_GEN = APIv3::searchStreetsideImages;
    016
    017  private final StreetsideData data;
    018
    019  public ImageDetailsDownloadRunnable(final StreetsideData data, final Bounds bounds) {
    020    super(bounds);
    021    this.data = data;
    022  }
    023
    024  // TODO: image infos for 360 degree viewer? @rrh
    025  @Override
    026  public void run(final URLConnection con) throws IOException {
    027     // TODO: modifiy decoder to handle Streetside image info. @rrh
    028          /*try (JsonReader reader = Json.createReader(new BufferedInputStream(con.getInputStream()))) {
    029      JsonImageDetailsDecoder.decodeImageInfos(reader.readObject(), data);
    030      logConnectionInfo(con, null);
    031      StreetsideMainDialog.getInstance().updateTitle();
    032    } catch (JsonException | NumberFormatException e) {
    033      throw new IOException(e);
    034    }*/
    035  }
    036
    037  @Override
    038  protected Function<Bounds, URL> getUrlGenerator() {
    039    return URL_GEN;
    040  }
    041
    042}