Changeset 32341 in osm for applications
- Timestamp:
- 2016-06-20T17:21:21+02:00 (8 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r32078 r32341 32 32 protected double ca; 33 33 /** Temporal position of the picture until it is uploaded. */ 34 p ublicLatLon tempLatLon;34 private LatLon tempLatLon; 35 35 /** 36 36 * When the object is being dragged in the map, the temporal position is 37 37 * stored here. 38 38 */ 39 p ublicLatLon movingLatLon;39 private LatLon movingLatLon; 40 40 /** Temporal direction of the picture until it is uploaded */ 41 p ublicdouble tempCa;41 private double tempCa; 42 42 /** 43 43 * When the object direction is being moved in the map, the temporal direction … … 132 132 /** 133 133 * Returns the sequence which contains this image. 134 * Never null. 134 135 * 135 136 * @return The MapillarySequence object that contains this MapillaryImage. 136 137 */ 137 138 public MapillarySequence getSequence() { 138 if (this.sequence == null) { 139 this.sequence = new MapillarySequence(); 140 this.sequence.add(this); 141 } 142 139 if (sequence == null) { 140 sequence = new MapillarySequence(); 141 sequence.add(this); 142 } 143 143 return this.sequence; 144 144 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryImageInfoDownloadThread.java
r32069 r32341 5 5 import java.io.IOException; 6 6 import java.io.InputStreamReader; 7 import java.net.MalformedURLException;8 7 import java.util.concurrent.ExecutorService; 9 8 … … 11 10 import javax.json.JsonArray; 12 11 import javax.json.JsonObject; 12 import javax.json.JsonReader; 13 13 14 14 import org.openstreetmap.josm.Main; … … 50 50 )); 51 51 ) { 52 JsonObject jsonobj = Json.createReader(br).readObject(); 53 if (!jsonobj.getBoolean("more")) 54 this.ex.shutdown(); 55 JsonArray jsonarr = jsonobj.getJsonArray("ims"); 56 JsonObject data; 57 for (int i = 0; i < jsonarr.size(); i++) { 58 data = jsonarr.getJsonObject(i); 59 String key = data.getString("key"); 60 for (MapillaryAbstractImage image : MapillaryLayer.getInstance().getData().getImages()) { 61 if ( 62 image instanceof MapillaryImage 63 && ((MapillaryImage) image).getKey().equals(key) 64 && ((MapillaryImage) image).getUser() == null 65 ) { 66 ((MapillaryImage) image).setUser(data.getString("user")); 67 ((MapillaryImage) image).setCapturedAt(data.getJsonNumber("captured_at").longValue()); 52 try (JsonReader reader = Json.createReader(br)) { 53 JsonObject jsonObj = reader.readObject(); 54 if (!jsonObj.getBoolean("more")) 55 this.ex.shutdown(); 56 JsonArray jsonArr = jsonObj.getJsonArray("ims"); 57 JsonObject data; 58 for (int i = 0; i < jsonArr.size(); i++) { 59 data = jsonArr.getJsonObject(i); 60 String key = data.getString("key"); 61 for (MapillaryAbstractImage image : MapillaryLayer.getInstance().getData().getImages()) { 62 if ( 63 image instanceof MapillaryImage 64 && ((MapillaryImage) image).getKey().equals(key) 65 && ((MapillaryImage) image).getUser() == null 66 ) { 67 ((MapillaryImage) image).setUser(data.getString("user")); 68 ((MapillaryImage) image).setCapturedAt(data.getJsonNumber("captured_at").longValue()); 69 } 68 70 } 69 71 } 70 72 } 71 } catch (MalformedURLException e) {72 Main.error(e);73 73 } catch (IOException e) { 74 74 Main.error(e); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURL.java
r32069 r32341 79 79 * @param bounds the bounds in which you want to search for images 80 80 * @param page number of the page to retrieve from the API 81 * @param selector 81 * @param selector if set, only a specific type of image is returned by the URL 82 82 * @return the API-URL which gives you the images in the given bounds as JSON 83 83 */ -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
r32034 r32341 90 90 * @param format The format of the date. 91 91 * @return The date in Epoch format. 92 * @throws ParseException 92 * @throws ParseException if the date cannot be parsed with the given format 93 93 */ 94 94 public static long getEpoch(String date, String format) throws ParseException { … … 153 153 154 154 /** 155 * Joins two images into the same sequence. 156 * 157 * @param mapillaryAbstractImage 158 * @param mapillaryAbstractImage2 155 * Joins two images into the same sequence. One of them must be the last image of a sequence, the other one the beginning of a different one. 156 * 157 * @param mapillaryAbstractImage the first image, into whose sequence the images from the sequence of the second image are merged 158 * @param mapillaryAbstractImage2 the second image, whose sequence is merged into the sequence of the first image 159 159 */ 160 160 public static synchronized void join( … … 210 210 }); 211 211 } else { 212 Bounds zoomBounds = null;212 Bounds zoomBounds; 213 213 if (images.isEmpty()) { 214 214 zoomBounds = new Bounds(new LatLon(0, 0)); … … 236 236 237 237 /** 238 * Separates two images belonging to the same sequence. 239 * 240 * @param mapillaryAbstractImage 241 * @param mapillaryAbstractImage2 238 * Separates two images belonging to the same sequence. The two images have to be consecutive in the same sequence. 239 * Two new sequences are created and all images up to (and including) either {@code imgA} or {@code imgB} (whichever appears first in the sequence) are put into the first of the two sequences. 240 * All others are put into the second new sequence. 241 * 242 * @param mapillaryAbstractImage one of the images marking where to split the sequence 243 * @param mapillaryAbstractImage2 the other image marking where to split the sequence, needs to be a direct neighbour of {@code mapillaryAbstractImage} in the sequence. 242 244 */ 243 245 public static synchronized void unjoin(
Note:
See TracChangeset
for help on using the changeset viewer.