Changeset 31400 in osm for applications


Ignore:
Timestamp:
2015-07-24T12:53:18+02:00 (10 years ago)
Author:
nokutu
Message:

Fixed bug when downloading multiple times, several instances of the same image object would be created.

Location:
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java

    r31398 r31400  
    237237   */
    238238  public void setSelectedImage(MapillaryAbstractImage image, boolean zoom) {
     239    if (image != null) {
     240      System.out.println("----------------------------");
     241      for (MapillaryAbstractImage img : getImages())
     242        System.out.println(img.getSequence());
     243    }
    239244    MapillaryAbstractImage oldImage = selectedImage;
    240245    selectedImage = image;
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java

    r31399 r31400  
    251251  }
    252252
    253   /**
    254    * Returns true any of the images from the database has been modified.
    255    */
    256253  @Override
    257254  public boolean isModified() {
     
    304301  }
    305302
    306   /**
    307    * Paints the database in the map.
    308    */
    309303  @Override
    310304  public synchronized void paint(Graphics2D g, MapView mv, Bounds box) {
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/Utils.java

    r31398 r31400  
    88
    99/**
    10  * Downloads and stores pictures in cache.
     10 * Utility methods for working with cache.
    1111 *
    1212 * @author nokutu
    1313 *
    1414 */
    15 public class Utils implements ICachedLoaderListener {
     15public class Utils {
    1616
    17   static Utils INSTANCE = new Utils();
    18 
     17  private static IgnoreDownload IGNORE_DOWNLOAD = new IgnoreDownload();
    1918
    2019  /**
    21    * Downloads the picture of the given image.
     20   * Downloads the picture of the given image and does nothing when it is downloaded.
    2221   *
    2322   * @param img
     
    2726      throw new IllegalArgumentException();
    2827    new MapillaryCache(((MapillaryImage) img).getKey(), MapillaryCache.Type.THUMBNAIL).submit(
    29         INSTANCE, false);
     28        IGNORE_DOWNLOAD, false);
    3029    new MapillaryCache(((MapillaryImage) img).getKey(), MapillaryCache.Type.FULL_IMAGE).submit(
    31         INSTANCE, false);
     30        IGNORE_DOWNLOAD, false);
    3231  }
    3332
    34   @Override
    35   public void loadingFinished(CacheEntry arg0, CacheEntryAttributes arg1,
    36       LoadResult arg2) {
    37     // Nothing
     33  private static class IgnoreDownload implements ICachedLoaderListener {
     34
     35    @Override
     36    public void loadingFinished(CacheEntry arg0, CacheEntryAttributes arg1,
     37        LoadResult arg2) {
     38      // Nothing
     39    }
    3840  }
    39 
    4041}
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java

    r31399 r31400  
    102102        for (MapillaryImage img : finalImages) {
    103103          if (layer.getMapillaryData().getImages().contains(img)) {
     104            // The image in finalImages is substituted by the one in the
     105            // database, as they are equal.
     106            img = (MapillaryImage) layer.getMapillaryData().getImages()
     107                .get(layer.getMapillaryData().getImages().indexOf(img));
    104108            sequence.add(img);
    105109            ((MapillaryImage) layer.getMapillaryData().getImages()
    106110                .get(layer.getMapillaryData().getImages().indexOf(img)))
    107111                .setSequence(sequence);
    108             finalImages.set(
    109                 finalImages.indexOf(img),
    110                 (MapillaryImage) layer.getMapillaryData().getImages()
    111                     .get(layer.getMapillaryData().getImages().indexOf(img)));
     112            finalImages.set(finalImages.indexOf(img), img);
    112113          } else {
    113114            img.setSequence(sequence);
Note: See TracChangeset for help on using the changeset viewer.