Changeset 31796 in osm for applications/editors/josm
- Timestamp:
- 2015-12-03T22:27:51+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31787 r31796 87 87 */ 88 88 public String getDate() { 89 String format = "";89 StringBuilder format = new StringBuilder(""); 90 90 if (Main.pref.getBoolean("iso.dates")) 91 format += "yyyy-MM-dd";91 format.append("yyyy-MM-dd"); 92 92 else 93 format += "dd/MM/yyyy";93 format.append("dd/MM/yyyy"); 94 94 if (Main.pref.getBoolean("mapillary.display-hour", true)) { 95 95 if (Main.pref.getBoolean("mapillary.format-24")) 96 format += " - HH:mm:ss (z)";96 format.append(" - HH:mm:ss (z)"); 97 97 else 98 format += " - h:mm:ss a (z)";99 } 100 return getDate(format );98 format.append(" - h:mm:ss a (z)"); 99 } 100 return getDate(format.toString()); 101 101 } 102 102 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31787 r31796 29 29 private final List<MapillaryAbstractImage> multiSelectedImages; 30 30 /** Listeners of the class. */ 31 private CopyOnWriteArrayList<MapillaryDataListener> listeners = new CopyOnWriteArrayList<>();31 private final CopyOnWriteArrayList<MapillaryDataListener> listeners = new CopyOnWriteArrayList<>(); 32 32 /** The bounds of the areas for which the pictures have been downloaded. */ 33 33 public CopyOnWriteArrayList<Bounds> bounds; … … 177 177 * Repaints mapView object. 178 178 */ 179 public s ynchronized staticvoid dataUpdated() {179 public static synchronized void dataUpdated() { 180 180 if (Main.main != null) 181 181 Main.map.mapView.repaint(); … … 312 312 this.multiSelectedImages.clear(); 313 313 this.multiSelectedImages.add(image); 314 if (image != null && Main.main != null) { 315 if (image instanceof MapillaryImage) { 316 MapillaryImage mapillaryImage = (MapillaryImage) image; 317 // Downloading thumbnails of surrounding pictures. 318 if (mapillaryImage.next() != null) { 319 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next()); 320 if (mapillaryImage.next().next() != null) 321 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next() 322 .next()); 323 } 324 if (mapillaryImage.previous() != null) { 325 CacheUtils 326 .downloadPicture((MapillaryImage) mapillaryImage.previous()); 327 if (mapillaryImage.previous().previous() != null) 328 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage 329 .previous().previous()); 330 } 314 if (image != null && Main.main != null && image instanceof MapillaryImage) { 315 MapillaryImage mapillaryImage = (MapillaryImage) image; 316 // Downloading thumbnails of surrounding pictures. 317 if (mapillaryImage.next() != null) { 318 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next()); 319 if (mapillaryImage.next().next() != null) 320 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.next().next()); 321 } 322 if (mapillaryImage.previous() != null) { 323 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.previous()); 324 if (mapillaryImage.previous().previous() != null) 325 CacheUtils.downloadPicture((MapillaryImage) mapillaryImage.previous().previous()); 331 326 } 332 327 } … … 396 391 * Sets a new ArrayList object as the used set of images. 397 392 * 398 * @param images 393 * @param images the new image list (previously set images are completely replaced) 399 394 */ 400 395 public synchronized void setImages(List<MapillaryAbstractImage> images) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r31787 r31796 23 23 24 24 /** 25 * Main constructor of the class MapillaryImage 26 * 27 * @param key 28 * The unique identifier of the image. 29 * @param lat 30 * The latitude where it is positioned. 31 * @param lon 32 * The longitude where it is positioned. 33 * @param ca 34 * The direction of the images in degrees, meaning 0 north. 35 */ 36 public MapillaryImage(String key, double lat, double lon, double ca) { 37 super(lat, lon, ca); 38 this.key = key; 39 this.signs = new ArrayList<>(); 40 } 41 42 /** 25 43 * Returns the location where the image was taken. 26 44 * … … 39 57 public void setLocation(String location) { 40 58 this.location = location; 41 }42 43 /**44 * Main constructor of the class MapillaryImage45 *46 * @param key47 * The unique identifier of the image.48 * @param lat49 * The latitude where it is positioned.50 * @param lon51 * The longitude where it is positioned.52 * @param ca53 * The direction of the images in degrees, meaning 0 north.54 */55 public MapillaryImage(String key, double lat, double lon, double ca) {56 super(lat, lon, ca);57 this.key = key;58 this.signs = new ArrayList<>();59 59 } 60 60 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31787 r31796 119 119 if (Main.map.mapView.getEditLayer() != null) 120 120 Main.map.mapView.getEditLayer().data.addDataSetListener(this); 121 if (MapillaryDownloader.getMode() == MapillaryDownloader. AUTOMATIC)121 if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Automatic) 122 122 MapillaryDownloader.automaticDownload(); 123 if (MapillaryDownloader.getMode() == MapillaryDownloader. SEMIAUTOMATIC)123 if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Semiautomatic) 124 124 this.mode.zoomChanged(); 125 125 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31787 r31796 45 45 public static final String SEPARATOR = System.getProperty("file.separator"); 46 46 /** 24x24 icon. */ 47 public static ImageIcon ICON24;47 public static final ImageIcon ICON24 = new ImageProvider("icon24.png").get(); 48 48 /** 16x16 icon. */ 49 public static ImageIcon ICON16;49 public static final ImageIcon ICON16 = new ImageProvider("icon16.png").get(); 50 50 /** Icon representing an image in the map. */ 51 public static ImageIcon MAP_ICON;51 public static final ImageIcon MAP_ICON = new ImageProvider("mapicon.png").get(); 52 52 /** Icon representing a selected image in the map. */ 53 public static ImageIcon MAP_ICON_SELECTED;53 public static final ImageIcon MAP_ICON_SELECTED = new ImageProvider("mapiconselected.png").get(); 54 54 /** Icon representing an imported image in the map. */ 55 public static ImageIcon MAP_ICON_IMPORTED;55 public static final ImageIcon MAP_ICON_IMPORTED = new ImageProvider("mapiconimported.png").get(); 56 56 /** Icon used to identify which images have signs on them */ 57 public static ImageIcon MAP_SIGN;57 public static final ImageIcon MAP_SIGN = new ImageProvider("sign.png").get(); 58 58 59 59 /** Cache that stores the pictures the downloaded pictures. */ … … 102 102 super(info); 103 103 104 ICON24 = new ImageProvider("icon24.png").get();105 ICON16 = new ImageProvider("icon16.png").get();106 MAP_ICON = new ImageProvider("mapicon.png").get();107 MAP_ICON_SELECTED = new ImageProvider("mapiconselected.png").get();108 MAP_ICON_IMPORTED = new ImageProvider("mapiconimported.png").get();109 MAP_SIGN = new ImageProvider("sign.png").get();110 111 104 this.downloadAction = new MapillaryDownloadAction(); 112 105 walkAction = new MapillaryWalkAction(); … … 167 160 Main.map.addToggleDialog(MapillaryFilterDialog.getInstance(), false); 168 161 setMenuEnabled(DOWNLOAD_MENU, true); 169 if (MapillaryDownloader.getMode() == MapillaryDownloader.M ANUAL)162 if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Manual) 170 163 setMenuEnabled(DOWNLOAD_VIEW_MENU, true); 171 164 setMenuEnabled(IMPORT_MENU, true); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java
r31787 r31796 36 36 private JCheckBox reverseButtons = new JCheckBox( 37 37 tr("Reverse buttons position when displaying images.")); 38 private JComboBox<String> downloadMode = new JComboBox<>( 39 MapillaryDownloader.MODES); 38 private JComboBox<String> downloadMode = new JComboBox<>(new String[]{ 39 MapillaryDownloader.MODES.Automatic.toString(), 40 MapillaryDownloader.MODES.Semiautomatic.toString(), 41 MapillaryDownloader.MODES.Manual.toString() 42 }); 40 43 private JCheckBox displayHour = new JCheckBox( 41 44 tr("Display hour when the picture was taken")); … … 63 66 panel.add(this.reverseButtons); 64 67 // Sets the value of the ComboBox. 65 if (Main.pref.get("mapillary.download-mode").equals( 66 MapillaryDownloader.MODES[0])) 67 this.downloadMode.setSelectedItem(MapillaryDownloader.MODES[0]); 68 if (Main.pref.get("mapillary.download-mode").equals( 69 MapillaryDownloader.MODES[1])) 70 this.downloadMode.setSelectedItem(MapillaryDownloader.MODES[1]); 71 if (Main.pref.get("mapillary.download-mode").equals( 72 MapillaryDownloader.MODES[2])) 73 this.downloadMode.setSelectedItem(MapillaryDownloader.MODES[2]); 68 if (Main.pref.get("mapillary.download-mode").equals(MapillaryDownloader.MODES.Automatic.toString()) 69 || Main.pref.get("mapillary.download-mode").equals(MapillaryDownloader.MODES.Semiautomatic.toString()) 70 || Main.pref.get("mapillary.download-mode").equals(MapillaryDownloader.MODES.Manual.toString())) { 71 this.downloadMode.setSelectedItem(Main.pref.get("mapillary.download-mode")); 72 } 74 73 JPanel downloadModePanel = new JPanel(); 75 74 downloadModePanel.add(new JLabel(tr("Download mode: "))); … … 101 100 102 101 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.DOWNLOAD_VIEW_MENU, false); 103 if (this.downloadMode.getSelectedItem() 104 .equals(MapillaryDownloader.MODES[0])) 105 Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES[0]); 106 if (this.downloadMode.getSelectedItem() 107 .equals(MapillaryDownloader.MODES[1])) 108 Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES[1]); 109 if (this.downloadMode.getSelectedItem() 110 .equals(MapillaryDownloader.MODES[2])) { 111 Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES[2]); 102 if (this.downloadMode.getSelectedItem().equals(MapillaryDownloader.MODES.Automatic.toString())) 103 Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES.Automatic.toString()); 104 if (this.downloadMode.getSelectedItem().equals(MapillaryDownloader.MODES.Semiautomatic.toString())) 105 Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES.Semiautomatic.toString()); 106 if (this.downloadMode.getSelectedItem().equals(MapillaryDownloader.MODES.Manual.toString())) { 107 Main.pref.put("mapillary.download-mode", MapillaryDownloader.MODES.Manual.toString()); 112 108 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.DOWNLOAD_VIEW_MENU, true); 113 109 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r31787 r31796 29 29 30 30 /** Possible download modes. */ 31 public static final String[] MODES = new String[] { "Automatic", 32 "Semiautomatic", "Manual" }; 33 /** Automatic mode. */ 34 public static final int AUTOMATIC = 0; 35 /** Semiautomatic mode. */ 36 public static final int SEMIAUTOMATIC = 1; 37 /** Manual mode. */ 38 public static final int MANUAL = 2; 31 public enum MODES {Automatic, Semiautomatic, Manual}; 39 32 40 33 /** All the Threads that have been run. Used to interrupt them properly. */ … … 80 73 */ 81 74 public static void completeView() { 82 if (getMode() != SEMIAUTOMATIC && getMode() != MANUAL)75 if (getMode() != MODES.Semiautomatic && getMode() != MODES.Manual) 83 76 throw new IllegalStateException("Must be in semiautomatic or manual mode"); 84 77 Bounds view = Main.map.mapView.getRealBounds(); … … 151 144 return; 152 145 } 153 if (getMode() != AUTOMATIC)146 if (getMode() != MODES.Automatic) 154 147 throw new IllegalStateException("Must be in automatic mode."); 155 148 for (Bounds bounds : Main.map.mapView.getEditLayer().data … … 184 177 * @return 0 - automatic; 1 - semiautomatic; 2 - manual. 185 178 */ 186 public static intgetMode() {187 if (Main.pref.get("mapillary.download-mode").equals(MODES [0])179 public static MapillaryDownloader.MODES getMode() { 180 if (Main.pref.get("mapillary.download-mode").equals(MODES.Automatic.toString()) 188 181 && (MapillaryLayer.INSTANCE == null || !MapillaryLayer.INSTANCE.TEMP_SEMIAUTOMATIC)) 189 return 0;190 else if (Main.pref.get("mapillary.download-mode").equals(MODES [1])182 return MODES.Automatic; 183 else if (Main.pref.get("mapillary.download-mode").equals(MODES.Semiautomatic.toString()) 191 184 || (MapillaryLayer.INSTANCE != null && MapillaryLayer.getInstance().TEMP_SEMIAUTOMATIC)) 192 return 1;193 else if (Main.pref.get("mapillary.download-mode").equals(MODES [2]))194 return 2;185 return MODES.Semiautomatic; 186 else if (Main.pref.get("mapillary.download-mode").equals(MODES.Manual.toString())) 187 return MODES.Manual; 195 188 else if (Main.pref.get("mapillary.download-mode").equals("")) 196 return 0;189 return MODES.Automatic; 197 190 else 198 191 throw new IllegalStateException(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java
r31787 r31796 66 66 @Override 67 67 public void zoomChanged() { 68 if (MapillaryDownloader.getMode() == MapillaryDownloader. SEMIAUTOMATIC) {68 if (MapillaryDownloader.getMode() == MapillaryDownloader.MODES.Semiautomatic) { 69 69 if (!semiautomaticThread.isAlive()) 70 70 semiautomaticThread.start(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthPortListener.java
r31787 r31796 24 24 public class OAuthPortListener extends Thread { 25 25 26 protected static String RESPONSE = tr("<html><head><title>Mapillary login</title></head><body>Login successful, return to JOSM.</body></html>");26 protected static final String RESPONSE = tr("<html><head><title>Mapillary login</title></head><body>Login successful, return to JOSM.</body></html>"); 27 27 28 28 @Override -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthUtils.java
r31795 r31796 38 38 39 39 try ( 40 BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream() ))40 BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream(), "UTF-8")) 41 41 ) { 42 42 return Json.createReader(in).readObject();
Note:
See TracChangeset
for help on using the changeset viewer.