Changeset 31972 in osm for applications/editors
- Timestamp:
- 2016-01-11T16:17:06+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31909 r31972 5 5 import java.util.Calendar; 6 6 import java.util.Date; 7 import java.util.Locale; 7 8 8 9 import org.openstreetmap.josm.Main; … … 118 119 public String getDate(String format) { 119 120 final Date date = new Date(getCapturedAt()); 120 121 final SimpleDateFormat formatter = new SimpleDateFormat(format); 121 final SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.UK); 122 122 formatter.setTimeZone(Calendar.getInstance().getTimeZone()); 123 123 return formatter.format(date); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31951 r31972 22 22 public class MapillaryData { 23 23 24 private Set<MapillaryAbstractImage> images;24 private final Set<MapillaryAbstractImage> images; 25 25 /** 26 26 * The image currently selected, this is the one being shown. … … 123 123 public void addMultiSelectedImage(MapillaryAbstractImage image) { 124 124 if (!this.multiSelectedImages.contains(image)) { 125 if (this.getSelectedImage() != null) 125 if (this.getSelectedImage() == null) 126 this.setSelectedImage(image); 127 else 126 128 this.multiSelectedImages.add(image); 127 else128 this.setSelectedImage(image);129 129 } 130 130 if (Main.main != null) -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31951 r31972 357 357 } else if (imageAbs instanceof MapillaryImportedImage) { 358 358 MapillaryImportedImage image = (MapillaryImportedImage) imageAbs; 359 ImageIcon icon; 360 if (!this.data.getMultiSelectedImages().contains(image)) 361 icon = MapillaryPlugin.MAP_ICON_IMPORTED; 362 else 363 icon = MapillaryPlugin.MAP_ICON_SELECTED; 359 ImageIcon icon = this.data.getMultiSelectedImages().contains(image) 360 ? MapillaryPlugin.MAP_ICON_SELECTED 361 : MapillaryPlugin.MAP_ICON_IMPORTED; 364 362 draw(g, image, icon, p); 365 363 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31832 r31972 273 273 */ 274 274 public static ImageProvider getProvider(String s) { 275 if (Main.main == null) 275 if (Main.main == null) { 276 276 return null; 277 else278 277 } 278 return new ImageProvider(s); 279 279 } 280 280 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/FinishedUploadDialog.java
r31833 r31972 34 34 public FinishedUploadDialog() { 35 35 this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); 36 JLabel text = new JLabel(tr("Uploaded {0} images", PluginState. imagesUploaded));36 JLabel text = new JLabel(tr("Uploaded {0} images", PluginState.getImagesUploaded())); 37 37 text.setAlignmentX(Component.CENTER_ALIGNMENT); 38 38 this.add(text); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
r31840 r31972 284 284 private class UndoRedoSelectionListener implements TreeSelectionListener { 285 285 286 private JTree source;286 private final JTree source; 287 287 288 288 protected UndoRedoSelectionListener(JTree source) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryMainDialog.java
r31909 r31972 579 579 : new GridLayout(1, buttons.size())); 580 580 this.buttonsPanel.add(buttonRowPanel); 581 for (SideButton button : buttons) 581 for (SideButton button : buttons) { 582 582 buttonRowPanel.add(button); 583 } 583 584 } 584 585 panel.add(this.buttonsPanel, BorderLayout.NORTH); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecordListener.java
r31787 r31972 13 13 * Fired when any command is undone or redone. 14 14 */ 15 publicvoid recordChanged();15 void recordChanged(); 16 16 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandJoin.java
r31909 r31972 18 18 public class CommandJoin extends MapillaryExecutableCommand { 19 19 20 private MapillaryAbstractImage a;21 private MapillaryAbstractImage b;20 private final MapillaryAbstractImage a; 21 private final MapillaryAbstractImage b; 22 22 23 23 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandUnjoin.java
r31909 r31972 18 18 public class CommandUnjoin extends MapillaryExecutableCommand { 19 19 20 private MapillaryAbstractImage a;21 private MapillaryAbstractImage b;20 private final MapillaryAbstractImage a; 21 private final MapillaryAbstractImage b; 22 22 23 23 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r31951 r31972 205 205 for (Thread t : threads) { 206 206 if (t.isAlive()) 207 System.out.println(t);207 Main.info(t+" is still alive!"); 208 208 t.interrupt(); 209 209 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java
r31797 r31972 86 86 private long lastDownload; 87 87 88 private boolean moved = false;88 private boolean moved; 89 89 90 90 @Override -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
r31909 r31972 37 37 private final MapillaryRecord record; 38 38 private boolean nothingHighlighted; 39 private boolean imageHighlighted = false;39 private boolean imageHighlighted; 40 40 41 41 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
r31909 r31972 88 88 @Override 89 89 public void run() { 90 PluginState. imagesToUpload(this.images.size());90 PluginState.addImagesToUpload(this.images.size()); 91 91 MapillaryUtils.updateHelpText(); 92 92 for (MapillaryAbstractImage img : this.images) { … … 194 194 byte[] imageBytes = outputStream.toByteArray(); 195 195 new ExifRewriter().updateExifMetadataLossless(imageBytes, os, outputSet); 196 os.close(); 196 197 return tempFile; 197 198 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/traffico/TrafficoGlyph.java
r31795 r31972 11 11 12 12 public final class TrafficoGlyph { 13 private static Map<String, Character> glyphs; 14 13 15 private TrafficoGlyph() { 14 16 // private constructor to avoid instantiation 15 17 } 16 private static Map<String, Character> glyphs;17 18 18 19 private static Map<String, Character> readGlyphsFromResources() { … … 25 26 glyphs.put(name, glyphObject.getString(name).charAt(0)); 26 27 } 28 reader.close(); 27 29 return glyphs; 28 30 } 29 31 30 public static Character getGlyph(String key) {32 public static synchronized Character getGlyph(String key) { 31 33 if (glyphs == null) { 32 34 glyphs = readGlyphsFromResources(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
r31882 r31972 125 125 * not one of the values mentioned above 126 126 */ 127 public static double degMinSecToDouble(RationalNumber[] degMinSec, 128 String ref) { 127 public static double degMinSecToDouble(RationalNumber[] degMinSec, String ref) { 129 128 if (degMinSec == null || degMinSec.length != 3) { 130 129 throw new IllegalArgumentException("Array's length must be 3."); … … 256 255 ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); 257 256 if (lat_ref == null || lat == null || lon == null || lon_ref == null) { 258 if (exceptionNoTags) 259 throw new IllegalArgumentException( 260 "The image doesn't have the needed EXIF tags."); 261 else 262 return readNoTags(file); 257 if (exceptionNoTags) { 258 throw new IllegalArgumentException("The image doesn't have the needed EXIF tags."); 259 } 260 return readNoTags(file); 263 261 } 264 262 double latValue = 0; … … 273 271 if (ca != null && ca.getValue() instanceof RationalNumber) 274 272 caValue = ((RationalNumber) ca.getValue()).doubleValue(); 275 if (datetimeOriginal != null) 276 return new MapillaryImportedImage(latValue, lonValue, caValue, file, 277 datetimeOriginal.getStringValue()); 278 else 279 return new MapillaryImportedImage(latValue, lonValue, caValue, file); 273 if (datetimeOriginal != null) { 274 return new MapillaryImportedImage(latValue, lonValue, caValue, file, datetimeOriginal.getStringValue()); 275 } 276 return new MapillaryImportedImage(latValue, lonValue, caValue, file); 280 277 } 281 278 throw new IllegalStateException("Invalid format."); … … 317 314 .findEXIFValueWithExactMatch( 318 315 ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL); 319 if (datetimeOriginal == null) 320 return new MapillaryImportedImage(pos.lat(), pos.lon(), 0, 321 file); 322 else { 323 try { 324 return new MapillaryImportedImage(pos.lat(), pos.lon(), 0, 325 file, datetimeOriginal.getStringValue()); 326 } catch (ImageReadException e) { 327 Main.error(e); 328 } 316 if (datetimeOriginal == null) { 317 return new MapillaryImportedImage(pos.lat(), pos.lon(), 0, file); 318 } 319 try { 320 return new MapillaryImportedImage(pos.lat(), pos.lon(), 0, file, datetimeOriginal.getStringValue()); 321 } catch (ImageReadException e) { 322 Main.error(e); 329 323 } 330 324 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/PluginState.java
r31841 r31972 19 19 private static int runningDownloads; 20 20 /** Images that have to be uploaded. */ 21 pr otectedstatic int imagesToUpload;21 private static int imagesToUpload; 22 22 /** Images that have been uploaded. */ 23 p ublicstatic int imagesUploaded;23 private static int imagesUploaded; 24 24 25 25 private PluginState() { … … 68 68 * The amount of images that are going to be uploaded. 69 69 */ 70 public static void imagesToUpload(int amount) {70 public static void addImagesToUpload(int amount) { 71 71 if (imagesToUpload <= imagesUploaded) { 72 72 imagesToUpload = 0; … … 74 74 } 75 75 imagesToUpload += amount; 76 } 77 78 public static int getImagesToUpload() { 79 return imagesToUpload; 80 } 81 82 public static int getImagesUploaded() { 83 return imagesUploaded; 76 84 } 77 85 -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryURLTest.java
r31970 r31972 61 61 62 62 @Test 63 public void testConnectURL() throws MalformedURLException{63 public void testConnectURL() { 64 64 assertUrlEquals( 65 65 MapillaryURL.connectURL("http://redirect-host/ä"), … … 89 89 90 90 @Test 91 public void testSearchImageURL() throws MalformedURLException{91 public void testSearchImageURL() { 92 92 assertUrlEquals( 93 93 MapillaryURL.searchImageURL(new Bounds(1.1, 2.22, 3.333, 4.4444), 42), … … 111 111 112 112 @Test 113 public void testSearchSequenceURL() throws MalformedURLException{113 public void testSearchSequenceURL() { 114 114 assertUrlEquals( 115 115 MapillaryURL.searchSequenceURL(new Bounds(-55.55555, -66.666666, 77.7777777, 88.88888888, false), 42), … … 133 133 134 134 @Test 135 public void testSearchTrafficSignURL() throws MalformedURLException{135 public void testSearchTrafficSignURL() { 136 136 assertUrlEquals( 137 137 MapillaryURL.searchTrafficSignURL(new Bounds(1.1, 2.22, 3.333, 4.4444), -42), -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/PluginStateTest.java
r31484 r31972 35 35 public void uploadTest() { 36 36 assertEquals(false, PluginState.isUploading()); 37 PluginState. imagesToUpload(2);38 assertEquals(2, PluginState. imagesToUpload);39 assertEquals(0, PluginState. imagesUploaded);37 PluginState.addImagesToUpload(2); 38 assertEquals(2, PluginState.getImagesToUpload()); 39 assertEquals(0, PluginState.getImagesUploaded()); 40 40 assertEquals(true, PluginState.isUploading()); 41 41 PluginState.imageUploaded(); 42 assertEquals(1, PluginState. imagesUploaded);42 assertEquals(1, PluginState.getImagesUploaded()); 43 43 assertEquals(true, PluginState.isUploading()); 44 44 PluginState.imageUploaded(); 45 45 assertEquals(false, PluginState.isUploading()); 46 assertEquals(2, PluginState. imagesToUpload);47 assertEquals(2, PluginState. imagesUploaded);46 assertEquals(2, PluginState.getImagesToUpload()); 47 assertEquals(2, PluginState.getImagesUploaded()); 48 48 } 49 49 }
Note:
See TracChangeset
for help on using the changeset viewer.