Changeset 32064 in osm
- Timestamp:
- 2016-02-11T23:17:18+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r32033 r32064 28 28 private MapillarySequence sequence; 29 29 /** Position of the picture. */ 30 p ublic finalLatLon latLon;30 protected LatLon latLon; 31 31 /** Direction of the picture. */ 32 p ublic finaldouble ca;32 protected double ca; 33 33 /** Temporal position of the picture until it is uploaded. */ 34 34 public LatLon tempLatLon; … … 218 218 } 219 219 220 public void setCa(final double ca) { 221 this.ca = ca; 222 } 223 220 224 /** 221 225 * Sets the Epoch time when the picture was captured. … … 225 229 public void setCapturedAt(final long capturedAt) { 226 230 this.capturedAt = capturedAt; 231 } 232 233 public void setLatLon(final LatLon latLon) { 234 if (latLon != null) { 235 this.latLon = latLon; 236 } 227 237 } 228 238 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31989 r32064 11 11 import org.openstreetmap.josm.Main; 12 12 import org.openstreetmap.josm.data.Bounds; 13 import org.openstreetmap.josm.data.coor.LatLon; 13 14 import org.openstreetmap.josm.plugins.mapillary.cache.CacheUtils; 14 15 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryMainDialog; 16 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils; 15 17 16 18 /** … … 22 24 */ 23 25 public class MapillaryData { 24 25 26 private final Set<MapillaryAbstractImage> images; 26 27 /** … … 39 40 * Listeners of the class. 40 41 */ 41 private final CopyOnWriteArrayList<MapillaryDataListener> listeners = new CopyOnWriteArrayList<>();42 private final List<MapillaryDataListener> listeners = new CopyOnWriteArrayList<>(); 42 43 /** 43 44 * The bounds of the areas for which the pictures have been downloaded. 44 45 */ 45 p ublicList<Bounds> bounds;46 private final List<Bounds> bounds; 46 47 47 48 /** … … 52 53 this.multiSelectedImages = Collections.newSetFromMap(new ConcurrentHashMap<MapillaryAbstractImage, Boolean>()); 53 54 this.selectedImage = null; 55 this.bounds = new CopyOnWriteArrayList<>(); 54 56 55 57 // Adds the basic set of listeners. … … 82 84 this.images.add(image); 83 85 } 84 if (update) 86 if (update) { 85 87 dataUpdated(); 88 } 86 89 fireImagesAdded(); 87 90 } … … 151 154 } 152 155 Main.map.mapView.repaint(); 156 } 157 158 public List<Bounds> getBounds() { 159 return bounds; 153 160 } 154 161 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r32033 r32064 6 6 7 7 import org.openstreetmap.josm.data.coor.LatLon; 8 import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils; 9 import org.openstreetmap.josm.plugins.mapillary.utils.ValidationUtil; 8 10 9 11 /** … … 33 35 public MapillaryImage(final String key, final LatLon latLon, final double ca) { 34 36 super(latLon, ca); 37 ValidationUtil.throwExceptionForInvalidImgKey(key, true); 35 38 this.key = key; 36 39 } … … 105 108 @Override 106 109 public String toString() { 107 return "Image[key=" + this.key + ";lat=" + this.latLon.lat() + ";lon=" 108 + this.latLon.lon() + ";ca=" + this.ca + ']'; 110 return String.format( 111 "Image[key=%s,lat=%f,lon=%f,ca=%f,location=%s,user=%s,capturedAt=%d]", 112 key, latLon.lat(), latLon.lon(), ca, location, user, capturedAt 113 ); 109 114 } 110 115 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r32039 r32064 20 20 import java.awt.image.AffineTransformOp; 21 21 import java.awt.image.BufferedImage; 22 import java.util.concurrent.CopyOnWriteArrayList;23 22 24 23 import javax.swing.AbstractAction; … … 101 100 super(tr("Mapillary Images")); 102 101 this.data = new MapillaryData(); 103 this.data.bounds = new CopyOnWriteArrayList<>();104 102 } 105 103 … … 291 289 // paint remainder 292 290 g.setPaint(this.hatched); 293 g.fill(MapViewGeometryUtil.getNonDownloadedArea(mv, this.data. bounds));291 g.fill(MapViewGeometryUtil.getNonDownloadedArea(mv, this.data.getBounds())); 294 292 } 295 293 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillarySequence.java
r32039 r32064 2 2 package org.openstreetmap.josm.plugins.mapillary; 3 3 4 import java.util.ArrayList;5 4 import java.util.List; 6 5 import java.util.concurrent.CopyOnWriteArrayList; 6 7 import org.openstreetmap.josm.plugins.mapillary.utils.ValidationUtil; 7 8 8 9 /** … … 39 40 * @param key The unique identifier of the sequence. 40 41 * @param createdAt The date the sequence was created. 42 * @throws IllegalArgumentException if the key is invalid 43 * according to {@link ValidationUtil#validateSequenceKey(String)} 41 44 */ 42 45 public MapillarySequence(String key, long createdAt) { 46 ValidationUtil.throwExceptionForInvalidSeqKey(key, true); 47 43 48 this.images = new CopyOnWriteArrayList<>(); 44 49 this.key = key; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
r32038 r32064 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 5 6 import java.awt.*; 6 import java.awt.FlowLayout; 7 import java.awt.GridBagConstraints; 8 import java.awt.GridBagLayout; 7 9 import java.awt.event.ActionEvent; 8 10 import java.awt.event.KeyEvent; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r31987 r32064 104 104 if (isViewDownloaded(view)) 105 105 return; 106 MapillaryLayer.getInstance().getData(). bounds.add(view);106 MapillaryLayer.getInstance().getData().getBounds().add(view); 107 107 getImages(view); 108 108 } … … 139 139 */ 140 140 private static boolean isInBounds(LatLon latlon) { 141 for (Bounds bounds : MapillaryLayer.getInstance().getData(). bounds) {141 for (Bounds bounds : MapillaryLayer.getInstance().getData().getBounds()) { 142 142 if (bounds.contains(latlon)) 143 143 return true; … … 162 162 for (Bounds bounds : Main.map.mapView.getEditLayer().data 163 163 .getDataSourceBounds()) { 164 if (!layer.getData(). bounds.contains(bounds)) {165 layer.getData(). bounds.add(bounds);164 if (!layer.getData().getBounds().contains(bounds)) { 165 layer.getData().getBounds().add(bounds); 166 166 MapillaryDownloader.getImages(bounds.getMin(), bounds.getMax()); 167 167 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySequenceDownloadThread.java
r32033 r32064 127 127 128 128 private static boolean isInside(MapillaryAbstractImage image) { 129 for (Bounds b : MapillaryLayer.getInstance().getData(). bounds) {129 for (Bounds b : MapillaryLayer.getInstance().getData().getBounds()) { 130 130 if (b.contains(image.getLatLon())) { 131 131 return true; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURL.java
r31969 r32064 26 26 /** 27 27 * Gives you the URL for the online editor of a specific mapillary image. 28 * @param key the key of the image to which you want to link28 * @param imgKey the key of the image to which you want to link 29 29 * @return the URL of the online editor for the image with the given image key 30 * @throws IllegalArgumentException if the image key is <code>null</code> or invalid according 31 * to {@link ValidationUtil#validateImageKey(String)} 30 32 */ 31 public static URL browseEditURL(String key) { 32 if (key == null || !key.matches("[a-zA-Z0-9\\-_]{22}")) { 33 throw new IllegalArgumentException("Invalid image key"); 34 } 35 return string2URL(BASE_WEBSITE_URL + "map/e/" + key); 33 public static URL browseEditURL(String imgKey) { 34 ValidationUtil.throwExceptionForInvalidImgKey(imgKey, false); 35 return string2URL(BASE_WEBSITE_URL + "map/e/" + imgKey); 36 36 } 37 37 … … 40 40 * @param key the key of the image to which you want to link 41 41 * @return the URL of the online viewer for the image with the given image key 42 * @throws IllegalArgumentException if the image key is <code>null</code> or invalid according 43 * to {@link ValidationUtil#validateImageKey(String)} 42 44 */ 43 45 public static URL browseImageURL(String key) { 44 if (key == null || !key.matches("[a-zA-Z0-9\\-_]{22}")) { 45 throw new IllegalArgumentException("Invalid image key"); 46 } 46 ValidationUtil.throwExceptionForInvalidImgKey(key, false); 47 47 return string2URL(BASE_WEBSITE_URL + "map/im/" + key); 48 48 } -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySequenceDownloadThreadTest.java
r31833 r32064 40 40 ExecutorService ex = Executors.newSingleThreadExecutor(); 41 41 Bounds bounds = new Bounds(minLatLon, maxLatLon); 42 MapillaryLayer.getInstance().getData(). bounds.add(new Bounds(minLatLon,42 MapillaryLayer.getInstance().getData().getBounds().add(new Bounds(minLatLon, 43 43 maxLatLon)); 44 44
Note:
See TracChangeset
for help on using the changeset viewer.