Changeset 31987 in osm for applications/editors/josm/plugins/mapillary
- Timestamp:
- 2016-01-16T15:22:13+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31983 r31987 375 375 } 376 376 377 private void fireSelectedImageChanged(MapillaryAbstractImage oldImage, 378 MapillaryAbstractImage newImage) { 377 private void fireSelectedImageChanged(MapillaryAbstractImage oldImage, MapillaryAbstractImage newImage) { 379 378 if (this.listeners.isEmpty()) 380 379 return; 381 for (MapillaryDataListener lis : this.listeners) 380 for (MapillaryDataListener lis : this.listeners) { 382 381 if (lis != null) 383 382 lis.selectedImageChanged(oldImage, newImage); 383 } 384 384 } 385 385 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
r31909 r31987 91 91 } else if (this.dialog.group.isSelected(this.dialog.rewrite.getModel())) { 92 92 ArrayList<MapillaryImportedImage> images = new ArrayList<>(); 93 for (MapillaryAbstractImage image : MapillaryLayer.getInstance() 94 .getData().getImages()) 93 for (MapillaryAbstractImage image : MapillaryLayer.getInstance().getData().getImages()) { 95 94 if (image instanceof MapillaryImportedImage) { 96 95 images.add((MapillaryImportedImage) image); 97 96 } 97 } 98 98 try { 99 99 Main.worker.submit(new Thread(new MapillaryExportManager(images))); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java
r31838 r31987 58 58 while (!this.end && this.data.getSelectedImage().next() != null) { 59 59 MapillaryAbstractImage image = this.data.getSelectedImage(); 60 if (image instanceof MapillaryImage) {60 if (image != null && image.next() instanceof MapillaryImage) { 61 61 // Predownload next 10 thumbnails. 62 for (int i = 0; i < 10; i++) { 63 if (image.next() == null) { 64 break; 65 } 66 image = image.next(); 67 CacheUtils.downloadPicture((MapillaryImage) image, CacheUtils.PICTURE.THUMBNAIL); 62 preDownloadImages((MapillaryImage) image.next(), 10, CacheUtils.PICTURE.THUMBNAIL); 63 if (this.waitForFullQuality) { 64 // Start downloading 3 next full images. 65 preDownloadImages((MapillaryImage) image.next(), 3, CacheUtils.PICTURE.FULL_IMAGE); 68 66 } 69 if (this.waitForFullQuality)70 // Start downloading 3 next full images.71 for (int i = 0; i < 3; i++) {72 if (image.next() == null) {73 break;74 }75 image = image.next();76 CacheUtils.downloadPicture((MapillaryImage) image, CacheUtils.PICTURE.FULL_IMAGE);77 }78 67 } 79 68 try { … … 117 106 } 118 107 end(); 108 } 109 110 /** 111 * Downloads n images into the cache beginning from the supplied start-image (including the start-image itself). 112 * @param startImage the image to start with (this and the next n-1 images in the same sequence are downloaded) 113 * @param n the number of images to download 114 * @param type the quality of the image (full or thumbnail) 115 */ 116 private void preDownloadImages(MapillaryImage startImage, int n, CacheUtils.PICTURE type) { 117 if (n >= 1 && startImage != null) { 118 CacheUtils.downloadPicture(startImage, type); 119 if (startImage.next() instanceof MapillaryImage && n >= 2) { 120 preDownloadImages((MapillaryImage) startImage.next(), n - 1, type); 121 } 122 } 119 123 } 120 124 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java
r31974 r31987 122 122 123 123 private void fireRecordChanged() { 124 for (MapillaryRecordListener lis : this.listeners) 124 for (MapillaryRecordListener lis : this.listeners) { 125 125 if (lis != null) 126 126 lis.recordChanged(); 127 } 127 128 } 128 129 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r31974 r31987 26 26 * 27 27 */ 28 public class MapillaryDownloader {28 public final class MapillaryDownloader { 29 29 30 30 /** Possible download modes. */ … … 39 39 /** Executor that will run the petitions. */ 40 40 private static ThreadPoolExecutor executor = new ThreadPoolExecutor(3, 5, 100, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(100)); 41 42 private MapillaryDownloader() { 43 // Private constructor to avoid instantiation 44 } 41 45 42 46 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthUtils.java
r31807 r31987 19 19 * 20 20 */ 21 public class OAuthUtils { 21 public final class OAuthUtils { 22 23 private OAuthUtils() { 24 // Private constructor to avoid instantiation 25 } 22 26 23 27 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
r31985 r31987 33 33 import org.apache.commons.imaging.formats.tiff.write.TiffOutputSet; 34 34 import org.apache.http.HttpEntity; 35 import org.apache.http.HttpResponse; 36 import org.apache.http.client.HttpClient; 35 import org.apache.http.client.methods.CloseableHttpResponse; 37 36 import org.apache.http.client.methods.HttpPost; 38 37 import org.apache.http.entity.ContentType; … … 260 259 HttpEntity entity = entityBuilder.build(); 261 260 httpPost.setEntity(entity); 262 HttpResponse response = httpClient.execute(httpPost);263 264 if (response.getStatusLine().toString().contains("204")) {265 PluginState.imageUploaded();266 Main.info(PluginState.getUploadString() + " (Mapillary)");267 } else {268 Main.info("Upload error");261 try (CloseableHttpResponse response = httpClient.execute(httpPost)) { 262 if (response.getStatusLine().toString().contains("204")) { 263 PluginState.imageUploaded(); 264 Main.info(PluginState.getUploadString() + " (Mapillary)"); 265 } else { 266 Main.info("Upload error"); 267 } 269 268 } 270 269 }
Note:
See TracChangeset
for help on using the changeset viewer.