Changeset 31259 in osm for applications/editors/josm/plugins/mapillary/src/org
- Timestamp:
- 2015-06-11T15:26:31+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 2 added
- 1 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31252 r31259 156 156 public void setSelectedImage(MapillaryAbstractImage image) { 157 157 selectedImage = image; 158 if (image instanceof MapillaryImage) 159 System.out.println(((MapillaryImage) image).getLocation()); 158 160 multiSelectedImages.clear(); 159 161 multiSelectedImages.add(image); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r31256 r31259 1 1 package org.openstreetmap.josm.plugins.mapillary; 2 3 import java.util.ArrayList; 4 import java.util.List; 2 5 3 6 /** … … 13 16 /** Sequence of pictures containing this */ 14 17 private MapillarySequence sequence; 18 19 private int capturedAt; 20 private String user; 21 private List<String> signals; 22 private String location; 23 24 public String getLocation() { 25 return location; 26 } 27 28 public void setLocation(String location) { 29 this.location = location; 30 } 15 31 16 32 /** … … 29 45 super(lat, lon, ca); 30 46 this.key = key; 47 this.signals = new ArrayList<>(); 31 48 } 32 49 … … 38 55 public String getKey() { 39 56 return this.key; 57 } 58 59 public void addSignal(String signal) { 60 signals.add(signal); 61 } 62 63 public List<String> getSignals() { 64 return signals; 65 } 66 67 public void setCapturedAt(int capturedAt) { 68 this.capturedAt = capturedAt; 69 } 70 71 public int getCapturedAt() { 72 return capturedAt; 73 } 74 75 public void setUser(String user) { 76 this.user = user; 77 } 78 79 public String getUser() { 80 return user; 40 81 } 41 82 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31257 r31259 246 246 g.drawImage(op.filter(bi, null), p.x - (width / 2), p.y 247 247 - (height / 2), Main.map.mapView); 248 if (!image.getSignals().isEmpty()) { 249 g.drawImage(MapillaryPlugin.MAP_SIGNAL.getImage(), p.x 250 + width / 2, p.y - height / 2, 251 Main.map.mapView); 252 } 248 253 } else if (imageAbs instanceof MapillaryImportedImage) { 249 254 MapillaryImportedImage image = (MapillaryImportedImage) imageAbs; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31252 r31259 41 41 public static final ImageIcon MAP_ICON_IMPORTED = new ImageProvider( 42 42 "mapiconimported.png").get(); 43 public static final ImageIcon MAP_SIGNAL = new ImageProvider("signal.png") 44 .get(); 43 45 public static final int ICON_SIZE = 24; 44 46 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryDownloader.java
r31177 r31259 36 36 String url1 = BASE_URL; 37 37 String url2 = BASE_URL; 38 String url3 = BASE_URL; 38 39 url1 += "search/im/"; 39 40 url2 += "search/s/"; 41 url3 += "search/im/or"; 40 42 ConcurrentHashMap<String, Double> hash = new ConcurrentHashMap<>(); 41 43 hash.put("min_lat", minLatLon.lat()); … … 45 47 url1 += buildParameters(hash); 46 48 url2 += buildParameters(hash); 49 url3 += buildParameters(hash); 50 47 51 try { 48 52 Main.info("MapillaryPlugin GET " + url2); 49 Main.worker.submit(new MapillarySquareDownloadManagerThread(url1, url2, new Bounds(minLatLon, maxLatLon))); 53 Main.worker.submit(new MapillarySquareDownloadManagerThread(url1, url2, url3, new Bounds(minLatLon, maxLatLon))); 50 54 } catch (Exception e) { 51 55 Main.error(e); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySquareDownloadManagerThread.java
r31256 r31259 22 22 public class MapillarySquareDownloadManagerThread implements Runnable { 23 23 24 @SuppressWarnings("unused")25 24 private final String urlImages; 26 25 private final String urlSequences; 26 private final String urlSignals; 27 27 private final Bounds bounds; 28 28 29 29 public MapillarySquareDownloadManagerThread(String urlImages, 30 String urlSequences, Bounds bounds) { 30 String urlSequences, String urlSignals, Bounds bounds) { 31 31 this.urlImages = urlImages; 32 32 this.urlSequences = urlSequences; 33 this.urlSignals = urlSignals; 33 34 this.bounds = bounds; 34 35 } … … 38 39 try { 39 40 downloadSequences(); 41 completeImages(); 42 downloadSignals(); 40 43 } catch (InterruptedException e) { 41 44 Main.error(e); … … 46 49 else 47 50 Main.map.statusLine.setHelpText(tr("No images found")); 51 MapillaryData.getInstance().dataUpdated(); 48 52 } 49 53 50 p ublicvoid downloadSequences() throws InterruptedException {54 private void downloadSequences() throws InterruptedException { 51 55 ThreadPoolExecutor ex = new ThreadPoolExecutor(3, 5, 25, 52 56 TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(5)); … … 62 66 MapillaryData.getInstance().dataUpdated(); 63 67 } 68 69 private void completeImages() throws InterruptedException { 70 ThreadPoolExecutor ex = new ThreadPoolExecutor(3, 5, 25, 71 TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(5)); 72 int page = 0; 73 while (!ex.isShutdown()) { 74 ex.execute(new MapillaryImageInfoDownloaderThread(ex, urlImages 75 + "&page=" + page + "&limit=20")); 76 while (ex.getQueue().remainingCapacity() == 0) 77 Thread.sleep(100); 78 page++; 79 } 80 ex.awaitTermination(15, TimeUnit.SECONDS); 81 } 82 83 private void downloadSignals() throws InterruptedException { 84 ThreadPoolExecutor ex = new ThreadPoolExecutor(3, 5, 25, 85 TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(5)); 86 int page = 0; 87 while (!ex.isShutdown()) { 88 ex.execute(new MapillarySignalDownloaderThread(ex, urlSignals 89 + "&page=" + page + "&limit=20")); 90 while (ex.getQueue().remainingCapacity() == 0) 91 Thread.sleep(100); 92 page++; 93 } 94 ex.awaitTermination(15, TimeUnit.SECONDS); 95 } 64 96 }
Note:
See TracChangeset
for help on using the changeset viewer.