Changeset 31415 in osm for applications/editors/josm/plugins/mapillary/src
- Timestamp:
- 2015-07-30T13:17:32+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31409 r31415 281 281 */ 282 282 public MapillaryAbstractImage next() { 283 synchronized (LOCK) { 284 if (this.getSequence() == null) 283 LOCK.lock(); 284 try { 285 if (this.getSequence() == null) { 285 286 return null; 287 } 286 288 return this.getSequence().next(this); 289 } finally { 290 LOCK.unlock(); 287 291 } 288 292 } … … 295 299 */ 296 300 public MapillaryAbstractImage previous() { 297 synchronized (LOCK) { 298 if (this.getSequence() == null) 301 LOCK.lock(); 302 try { 303 if (this.getSequence() == null) { 299 304 return null; 305 } 300 306 return this.getSequence().previous(this); 307 } finally { 308 LOCK.unlock(); 301 309 } 310 302 311 } 303 312 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31409 r31415 57 57 * Destroys the unique instance. 58 58 */ 59 public void destroy() {59 public static void clearInstance() { 60 60 INSTANCE = null; 61 61 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31409 r31415 182 182 if (Main.map.mapView.getEditLayer() != null) 183 183 Main.map.mapView.getEditLayer().data.removeDataSetListener(this); 184 MapillaryData. INSTANCE = null;185 MapillaryLayer.INSTANCE = null;184 MapillaryData.clearInstance(); 185 clearInstance(); 186 186 super.destroy(); 187 } 188 189 /** 190 * Clears the unique instance of this class. 191 */ 192 public static void clearInstance() { 193 INSTANCE = null; 187 194 } 188 195 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
r31412 r31415 75 75 MapillaryLayer.getInstance(); 76 76 if (file.isDirectory()) { 77 if (file.listFiles() == null) 78 continue; 77 79 for (int j = 0; j < file.listFiles().length; j++) { 78 80 int k = file.listFiles()[j].getName().lastIndexOf('.'); … … 87 89 else if (extension.equals("png")) 88 90 readPNG(file.listFiles()[j]); 89 } catch (ImageReadException | IOException e1) {91 } catch (ImageReadException | IOException | NullPointerException e1) { 90 92 Main.error(e1); 91 93 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java
r31401 r31415 77 77 for (int i = 0; i < chooser.getSelectedFiles().length; i++) { 78 78 File file = chooser.getSelectedFiles()[i]; 79 if (file == null) 80 break; 79 81 Main.pref.put("mapillary.start-directory", file.getParent()); 80 82 MapillaryLayer.getInstance(); … … 89 91 if (extension.equals("jpg") || extension.equals("jpeg")) 90 92 readJPG(file.listFiles()[j]); 91 } catch (ImageReadException e) { 92 Main.error(e); 93 } catch (IOException e) { 93 } catch (ImageReadException | NullPointerException | IOException e) { 94 94 Main.error(e); 95 95 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java
r31409 r31415 51 51 JOptionPane pane = new JOptionPane(dialog, JOptionPane.PLAIN_MESSAGE, 52 52 JOptionPane.OK_CANCEL_OPTION); 53 JDialog dlg = pane.createDialog(Main.parent, tr(" Export images"));53 JDialog dlg = pane.createDialog(Main.parent, tr("Walk mode")); 54 54 dlg.setMinimumSize(new Dimension(400, 150)); 55 55 dlg.setVisible(true); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/WalkThread.java
r31409 r31415 57 57 break; 58 58 image = image.next(); 59 Utils.downloadPicture((MapillaryImage) image, Utils.PICTURE.THUMBNAIL); 59 Utils.downloadPicture((MapillaryImage) image, 60 Utils.PICTURE.THUMBNAIL); 60 61 } 61 62 } … … 96 97 lastImage = MapillaryMainDialog.getInstance().mapillaryImageDisplay 97 98 .getImage(); 98 synchronized (lock) {99 100 }99 lock.lock(); 100 data.selectNext(followSelected); 101 lock.unlock(); 101 102 } catch (InterruptedException e) { 102 103 return; 104 } finally { 105 lock.unlock(); 103 106 } 104 107 } … … 111 114 @Override 112 115 public void interrupt() { 113 super.interrupt(); 116 lock.lock(); 117 try { 118 super.interrupt(); 119 } catch (Exception e) { 120 } finally { 121 lock.unlock(); 122 } 123 114 124 } 115 125 … … 123 133 MapillaryAbstractImage newImage) { 124 134 if (newImage != oldImage.next()) { 125 synchronized (lock) { 126 interrupt(); 127 } 135 interrupt(); 128 136 } 129 137 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java
r31412 r31415 46 46 * @param queryString 47 47 */ 48 public MapillarySequenceDownloadThread(ExecutorService ex, 49 String queryString) { 48 public MapillarySequenceDownloadThread(ExecutorService ex, String queryString) { 50 49 this.queryString = queryString; 51 50 this.ex = ex; … … 95 94 } 96 95 96 LOCK.lock(); 97 97 MapillaryImage.LOCK.lock(); 98 synchronized (LOCK) { 99 for (MapillaryImage img : finalImages) { 100 if (layer.getMapillaryData().getImages().contains(img)) { 101 // The image in finalImages is substituted by the one in the 102 // database, as they represent the same picture. 103 img = (MapillaryImage) layer.getMapillaryData().getImages() 104 .get(layer.getMapillaryData().getImages().indexOf(img)); 105 sequence.add(img); 106 ((MapillaryImage) layer.getMapillaryData().getImages() 107 .get(layer.getMapillaryData().getImages().indexOf(img))) 108 .setSequence(sequence); 109 finalImages.set(finalImages.indexOf(img), img); 110 } else { 111 img.setSequence(sequence); 112 sequence.add(img); 113 } 98 for (MapillaryImage img : finalImages) { 99 if (layer.getMapillaryData().getImages().contains(img)) { 100 // The image in finalImages is substituted by the one in the 101 // database, as they represent the same picture. 102 img = (MapillaryImage) layer.getMapillaryData().getImages() 103 .get(layer.getMapillaryData().getImages().indexOf(img)); 104 sequence.add(img); 105 ((MapillaryImage) layer.getMapillaryData().getImages() 106 .get(layer.getMapillaryData().getImages().indexOf(img))) 107 .setSequence(sequence); 108 finalImages.set(finalImages.indexOf(img), img); 109 } else { 110 img.setSequence(sequence); 111 sequence.add(img); 114 112 } 115 113 } 116 114 MapillaryImage.LOCK.unlock(); 115 LOCK.unlock(); 117 116 118 117 layer.getMapillaryData().addWithoutUpdate( … … 122 121 Main.error("Error reading the url " + URL + queryString 123 122 + " might be a Mapillary problem."); 123 } finally { 124 LOCK.unlock(); 125 MapillaryImage.LOCK.unlock(); 124 126 } 125 127 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryFilterDialog.java
r31401 r31415 203 203 // Calculates the amount of days since the image was taken 204 204 Long currentTime = currentTime(); 205 if (time.getSelectedItem() == TIME_LIST[1]) {205 if (time.getSelectedItem().equals(TIME_LIST[1])) { 206 206 if (img.getCapturedAt() < currentTime 207 207 - ((Integer) spinner.getValue()).longValue() * 365 * 24 * 60 * 60 … … 211 211 } 212 212 } 213 if (time.getSelectedItem() == TIME_LIST[2]) {213 if (time.getSelectedItem().equals(TIME_LIST[2])) { 214 214 if (img.getCapturedAt() < currentTime 215 215 - ((Integer) spinner.getValue()).longValue() * 30 * 24 * 60 * 60 … … 219 219 } 220 220 } 221 if (time.getSelectedItem() == TIME_LIST[3]) {221 if (time.getSelectedItem().equals(TIME_LIST[3])) { 222 222 if (img.getCapturedAt() < currentTime 223 223 - ((Integer) spinner.getValue()).longValue() * 60 * 60 * 1000) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryWalkDialog.java
r31409 r31415 30 30 public MapillaryWalkDialog() { 31 31 JPanel interval = new JPanel(); 32 spin = new SpinnerNumberModel( 3000, 100, 15000, 100);32 spin = new SpinnerNumberModel(2000, 500, 10000, 500); 33 33 interval.add(new JLabel("Interval (miliseconds): ")); 34 34 interval.add(new JSpinner(spin)); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
r31404 r31415 173 173 174 174 } else if (imageHighlighted && !nothingHighlighted 175 && Main.map.mapView != null176 175 && Main.map.mapView.getEditLayer().data != null 177 176 && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
Note:
See TracChangeset
for help on using the changeset viewer.