Ignore:
Timestamp:
2015-07-16T13:56:01+02:00 (10 years ago)
Author:
nokutu
Message:

In select mode, when an image is highlighted, just the thumbnail is downloaded.

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

Legend:

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

    r31377 r31385  
    4040/**
    4141 * Toggle dialog that shows an image and some buttons.
    42  * 
     42 *
    4343 * @author nokutu
    4444 *
     
    116116
    117117  /**
    118    * Downloads the image of the selected MapillaryImage and sets in the
     118   * Downloads the full quality picture of the selected MapillaryImage and sets
     119   * in the MapillaryImageDisplay object.
     120   */
     121  public synchronized void updateImage() {
     122    updateImage(true);
     123  }
     124
     125  /**
     126   * Downloads the picture of the selected MapillaryImage and sets in the
    119127   * MapillaryImageDisplay object.
    120    */
    121   public synchronized void updateImage() {
     128   *
     129   * @param fullQuality
     130   *          If the full quality picture must be downloaded or just the
     131   *          thumbnail.
     132   */
     133  public synchronized void updateImage(boolean fullQuality) {
    122134    if (!SwingUtilities.isEventDispatchThread()) {
    123135      SwingUtilities.invokeLater(new Runnable() {
     
    173185
    174186        // Downloads the full resolution image.
    175         if (imageCache != null)
    176           imageCache.cancelOutstandingTasks();
    177         imageCache = new MapillaryCache(mapillaryImage.getKey(),
    178             MapillaryCache.Type.FULL_IMAGE);
    179         imageCache.submit(this, false);
     187        if (fullQuality) {
     188          if (imageCache != null)
     189            imageCache.cancelOutstandingTasks();
     190          imageCache = new MapillaryCache(mapillaryImage.getKey(),
     191              MapillaryCache.Type.FULL_IMAGE);
     192          imageCache.submit(this, false);
     193        }
    180194      } else if (image instanceof MapillaryImportedImage) {
    181195        mapillaryImageDisplay.hyperlink.setVisible(false);
     
    190204      updateTitle();
    191205    }
     206
    192207  }
    193208
     
    202217  /**
    203218   * Sets a new MapillaryImage to be shown.
    204    * 
     219   *
    205220   * @param image
    206221   */
     
    244259  /**
    245260   * Returns the MapillaryImage objects which is being shown.
    246    * 
     261   *
    247262   * @return
    248263   */
     
    253268  /**
    254269   * Action class form the next image button.
    255    * 
     270   *
    256271   * @author Jorge
    257272   *
     
    271286  /**
    272287   * Action class for the previous image button.
    273    * 
     288   *
    274289   * @author Jorge
    275290   *
     
    290305  /**
    291306   * Action class to jump to the image following the red line.
    292    * 
     307   *
    293308   * @author nokutu
    294309   *
     
    311326  /**
    312327   * Action class to jump to the image following the blue line.
    313    * 
     328   *
    314329   * @author nokutu
    315330   *
     
    364379  /**
    365380   * Creates the layout of the dialog.
    366    * 
     381   *
    367382   * @param data
    368383   *          The content of the dialog
  • applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java

    r31375 r31385  
    3939
    4040  public SelectMode() {
    41     data = MapillaryData.getInstance();
    4241    record = MapillaryRecord.getInstance();
    4342  }
     
    4948      return;
    5049    MapillaryAbstractImage closest = getClosest(e.getPoint());
    51     if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer
    52         && closest != null && Main.map.mapMode == Main.map.mapModeSelect) {
     50    if (Main.map.mapView.getActiveLayer() instanceof OsmDataLayer && closestTemp != null
     51        && Main.map.mapMode == Main.map.mapModeSelect) {
    5352      this.lastClicked = this.closest;
    54       MapillaryData.getInstance().setSelectedImage(closest);
     53      data.setSelectedImage(closest);
    5554      return;
    5655    } else if (Main.map.mapView.getActiveLayer() != MapillaryLayer
     
    9998
    10099    if (!Main.pref.getBoolean("mapillary.developer"))
    101       for (MapillaryAbstractImage img : MapillaryData.getInstance()
    102           .getMultiSelectedImages()) {
     100      for (MapillaryAbstractImage img : data.getMultiSelectedImages()) {
    103101        if (img instanceof MapillaryImage)
    104102          return;
    105103      }
    106     if (MapillaryData.getInstance().getSelectedImage() != null) {
     104    if (data.getSelectedImage() != null) {
    107105      if (lastButton == MouseEvent.BUTTON1 && !e.isShiftDown()) {
    108106        LatLon to = Main.map.mapView.getLatLon(e.getX(), e.getY());
    109107        LatLon from = Main.map.mapView.getLatLon(start.getX(), start.getY());
    110         for (MapillaryAbstractImage img : MapillaryData.getInstance()
    111             .getMultiSelectedImages()) {
     108        for (MapillaryAbstractImage img : data.getMultiSelectedImages()) {
    112109
    113110          img.move(to.getX() - from.getX(), to.getY() - from.getY());
     
    115112        Main.map.repaint();
    116113      } else if (lastButton == MouseEvent.BUTTON1 && e.isShiftDown()) {
    117         this.closest.turn(Math.toDegrees(Math.atan2((e.getX() - start.x),
    118             -(e.getY() - start.y)))
    119             - closest.getTempCa());
    120         for (MapillaryAbstractImage img : MapillaryData.getInstance()
    121             .getMultiSelectedImages()) {
    122           img.turn(Math.toDegrees(Math.atan2((e.getX() - start.x),
    123               -(e.getY() - start.y))) - closest.getTempCa());
     114        this.closest
     115            .turn(Math.toDegrees(Math.atan2((e.getX() - start.x), -(e.getY() - start.y))) - closest.getTempCa());
     116        for (MapillaryAbstractImage img : data.getMultiSelectedImages()) {
     117          img.turn(Math.toDegrees(Math.atan2((e.getX() - start.x), -(e.getY() - start.y))) - closest.getTempCa());
    124118        }
    125119        Main.map.repaint();
     
    184178    }
    185179
    186     if (MapillaryData.getInstance().getHighlighted() != closestTemp
    187         && closestTemp != null) {
    188       MapillaryData.getInstance().setHighlightedImage(closestTemp);
     180    if (data.getHighlighted() != closestTemp && closestTemp != null) {
     181      data.setHighlightedImage(closestTemp);
    189182      MapillaryMainDialog.getInstance().setImage(closestTemp);
     183      MapillaryMainDialog.getInstance().updateImage(false);
     184    } else if (data.getHighlighted() != closestTemp && closestTemp == null) {
     185      data.setHighlightedImage(null);
     186      MapillaryMainDialog.getInstance().setImage(data.getSelectedImage());
    190187      MapillaryMainDialog.getInstance().updateImage();
    191     } else if (MapillaryData.getInstance().getHighlighted() != closestTemp
    192         && closestTemp == null) {
    193       MapillaryData.getInstance().setHighlightedImage(null);
    194       MapillaryMainDialog.getInstance().setImage(
    195           MapillaryData.getInstance().getSelectedImage());
    196       MapillaryMainDialog.getInstance().updateImage();
    197     }
    198     MapillaryData.getInstance().dataUpdated();
     188    }
     189    data.dataUpdated();
    199190  }
    200191
Note: See TracChangeset for help on using the changeset viewer.