Changeset 31416 in osm for applications
- Timestamp:
- 2015-07-30T13:17:37+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31415 r31416 445 445 * Returns the 2 closest images belonging to a different sequence. 446 446 * 447 * @return 447 * @return An array of length 2 containing the two closest images belonging 448 * to different sequences. 448 449 */ 449 450 private MapillaryImage[] getClosestImagesFromDifferentSequences() { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java
r31415 r31416 57 57 && (int) pane.getValue() == JOptionPane.OK_OPTION) { 58 58 thread = new WalkThread((int) dialog.spin.getValue(), 59 dialog.waitForPicture.isSelected(), dialog.followSelection.isSelected()); 59 dialog.waitForPicture.isSelected(), 60 dialog.followSelection.isSelected(), dialog.goForward.isSelected()); 60 61 fireWalkStarted(); 61 62 thread.start(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java
r31415 r31416 28 28 private final boolean waitForFullQuality; 29 29 private final boolean followSelected; 30 private final boolean goForward; 30 31 private BufferedImage lastImage; 31 32 private volatile boolean paused = false; … … 37 38 * @param waitForPicture 38 39 * @param followSelected 40 * @param goForward 39 41 */ 40 public WalkThread(int interval, boolean waitForPicture, boolean followSelected) { 42 public WalkThread(int interval, boolean waitForPicture, 43 boolean followSelected, boolean goForward) { 41 44 this.interval = interval; 42 45 this.waitForFullQuality = waitForPicture; 43 46 this.followSelected = followSelected; 47 this.goForward = goForward; 44 48 data = MapillaryLayer.getInstance().getMapillaryData(); 45 49 data.addListener(this); … … 67 71 break; 68 72 image = image.next(); 69 Utils.downloadPicture((MapillaryImage) image, Utils.PICTURE.FULL );73 Utils.downloadPicture((MapillaryImage) image, Utils.PICTURE.FULL_IMAGE); 70 74 } 71 75 try { … … 98 102 .getImage(); 99 103 lock.lock(); 100 data.selectNext(followSelected); 104 if (goForward) 105 data.selectNext(followSelected); 106 else 107 data.selectPrevious(followSelected); 101 108 lock.unlock(); 102 109 } catch (InterruptedException e) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/MapillaryCache.java
r31401 r31416 45 45 this.key = key; 46 46 try { 47 if (type == Type.FULL_IMAGE) { 48 url = new URL("https://d1cuyjsrcm0gby.cloudfront.net/" + key 49 + "/thumb-2048.jpg"); 50 this.key += ".FULL_IMAGE"; 51 52 } else if (type == Type.THUMBNAIL) { 53 url = new URL("https://d1cuyjsrcm0gby.cloudfront.net/" + key 54 + "/thumb-320.jpg"); 55 this.key += ".THUMBNAIL"; 47 switch (type) { 48 case FULL_IMAGE: 49 url = new URL("https://d1cuyjsrcm0gby.cloudfront.net/" + key 50 + "/thumb-2048.jpg"); 51 this.key += ".FULL_IMAGE"; 52 break; 53 case THUMBNAIL: 54 url = new URL("https://d1cuyjsrcm0gby.cloudfront.net/" + key 55 + "/thumb-320.jpg"); 56 this.key += ".THUMBNAIL"; 57 break; 56 58 } 57 59 } catch (MalformedURLException e) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/Utils.java
r31409 r31416 18 18 /** Picture quality */ 19 19 public enum PICTURE { 20 /** Thumbnail quality picture ( ) */20 /** Thumbnail quality picture (320 p) */ 21 21 THUMBNAIL, 22 /** Full quality picture ( ) */23 FULL ,22 /** Full quality picture (2048 p) */ 23 FULL_IMAGE, 24 24 /** Both of them */ 25 25 BOTH; … … 27 27 28 28 /** 29 * Downloads the picture of the given image and does nothing when it is30 * downloaded.29 * Downloads the the thumbnail and the full resolution picture of the given 30 * image. Does nothing if it is already in cache. 31 31 * 32 32 * @param img 33 * The image whose picture is going to be downloaded. 33 34 */ 34 35 public static void downloadPicture(MapillaryImage img) { … … 37 38 38 39 /** 39 * Downloads the picture of the given image and does nothing when it is40 * downloaded.40 * Downloads the picture of the given image. Does nothing when it is already 41 * in cache. 41 42 * 42 43 * @param img … … 46 47 */ 47 48 public static void downloadPicture(MapillaryImage img, PICTURE pic) { 48 if (pic == PICTURE.BOTH) { 49 if (new MapillaryCache(img.getKey(), MapillaryCache.Type.THUMBNAIL).get() == null) 49 switch (pic) { 50 case BOTH: 51 if (new MapillaryCache(img.getKey(), MapillaryCache.Type.THUMBNAIL) 52 .get() == null) 53 new MapillaryCache(img.getKey(), MapillaryCache.Type.THUMBNAIL) 54 .submit(IGNORE_DOWNLOAD, false); 55 if (new MapillaryCache(img.getKey(), MapillaryCache.Type.FULL_IMAGE) 56 .get() == null) 57 new MapillaryCache(img.getKey(), MapillaryCache.Type.FULL_IMAGE) 58 .submit(IGNORE_DOWNLOAD, false); 59 break; 60 case THUMBNAIL: 50 61 new MapillaryCache(img.getKey(), MapillaryCache.Type.THUMBNAIL).submit( 51 62 IGNORE_DOWNLOAD, false); 52 if (new MapillaryCache(img.getKey(), MapillaryCache.Type.FULL_IMAGE)53 .get() == null)63 break; 64 case FULL_IMAGE: 54 65 new MapillaryCache(img.getKey(), MapillaryCache.Type.FULL_IMAGE) 55 66 .submit(IGNORE_DOWNLOAD, false); 56 } else if (pic == PICTURE.THUMBNAIL 57 && new MapillaryCache(img.getKey(), MapillaryCache.Type.THUMBNAIL) 58 .get() == null) { 59 new MapillaryCache(img.getKey(), MapillaryCache.Type.THUMBNAIL).submit( 60 IGNORE_DOWNLOAD, false); 61 } else if (pic == PICTURE.FULL 62 && new MapillaryCache(img.getKey(), MapillaryCache.Type.FULL_IMAGE) 63 .get() == null) { 64 new MapillaryCache(img.getKey(), MapillaryCache.Type.FULL_IMAGE).submit( 65 IGNORE_DOWNLOAD, false); 67 break; 66 68 } 67 69 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryWalkDialog.java
r31415 r31416 24 24 /** Whether the view must follow the selected image. */ 25 25 public JCheckBox followSelection; 26 /** Go forward or backwards */ 27 public JCheckBox goForward; 26 28 27 29 /** … … 42 44 followSelection.setSelected(true); 43 45 add(followSelection); 46 47 goForward = new JCheckBox("Go forward"); 48 goForward.setSelected(true); 49 add(goForward); 44 50 } 45 51 }
Note:
See TracChangeset
for help on using the changeset viewer.