Changeset 31515 in osm for applications/editors
- Timestamp:
- 2015-08-21T20:44:37+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary
- Files:
-
- 3 added
- 16 edited
- 8 moved
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31514 r31515 9 9 10 10 /** 11 * Abstract superclass for all image objects. At the moment there isjust 2,11 * Abstract superclass for all image objects. At the moment there are just 2, 12 12 * {@link MapillaryImportedImage} and {@link MapillaryImage}. 13 13 * -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31513 r31515 52 52 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 53 53 import org.openstreetmap.josm.plugins.mapillary.cache.CacheUtils; 54 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader;55 54 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryFilterDialog; 56 55 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryMainDialog; 57 56 import org.openstreetmap.josm.plugins.mapillary.history.MapillaryRecord; 58 57 import org.openstreetmap.josm.plugins.mapillary.history.commands.CommandDelete; 58 import org.openstreetmap.josm.plugins.mapillary.io.download.MapillaryDownloader; 59 59 import org.openstreetmap.josm.plugins.mapillary.mode.AbstractMode; 60 60 import org.openstreetmap.josm.plugins.mapillary.mode.JoinMode; … … 312 312 continue; 313 313 Point p = mv.getPoint(imageAbs.getLatLon()); 314 315 314 Point nextp = null; 316 315 // Draw sequence line … … 327 326 g.drawLine(p.x, p.y, nextp.x, nextp.y); 328 327 } 329 328 // Draws icons 330 329 if (imageAbs instanceof MapillaryImage) { 331 330 MapillaryImage image = (MapillaryImage) imageAbs; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31513 r31515 25 25 import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryWalkAction; 26 26 import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryZoomAction; 27 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader;28 27 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryFilterDialog; 29 28 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryHistoryDialog; 30 29 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryMainDialog; 31 30 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryPreferenceSetting; 31 import org.openstreetmap.josm.plugins.mapillary.io.download.MapillaryDownloader; 32 32 import org.openstreetmap.josm.plugins.mapillary.oauth.MapillaryUser; 33 33 import org.openstreetmap.josm.tools.ImageProvider; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java
r31425 r31515 7 7 8 8 import org.openstreetmap.josm.actions.JosmAction; 9 import org.openstreetmap.josm.plugins.mapillary. downloads.MapillaryDownloader;9 import org.openstreetmap.josm.plugins.mapillary.io.download.MapillaryDownloader; 10 10 import org.openstreetmap.josm.tools.ImageProvider; 11 11 import org.openstreetmap.josm.tools.Shortcut; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
r31451 r31515 22 22 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer; 23 23 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin; 24 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryExportManager;25 24 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryExportDialog; 25 import org.openstreetmap.josm.plugins.mapillary.io.export.MapillaryExportManager; 26 26 import org.openstreetmap.josm.tools.Shortcut; 27 27 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/FinishedUploadDialog.java
r31511 r31515 52 52 } 53 53 } 54 55 54 } 56 57 55 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java
r31460 r31515 92 92 this.mousePointInImg = comp2imgCoord(visibleRect, e.getX(), e.getY()); 93 93 } 94 // Applicatethe zoom to the visible rectangle in image coordinates94 // Set the zoom to the visible rectangle in image coordinates 95 95 if (e.getWheelRotation() > 0) { 96 96 visibleRect.width = visibleRect.width * 3 / 2; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryPreferenceSetting.java
r31514 r31515 20 20 import org.openstreetmap.josm.gui.preferences.TabPreferenceSetting; 21 21 import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin; 22 import org.openstreetmap.josm.plugins.mapillary. downloads.MapillaryDownloader;22 import org.openstreetmap.josm.plugins.mapillary.io.download.MapillaryDownloader; 23 23 import org.openstreetmap.josm.plugins.mapillary.oauth.MapillaryUser; 24 24 import org.openstreetmap.josm.plugins.mapillary.oauth.OAuthPortListener; … … 52 52 public void addGui(PreferenceTabbedPane gui) { 53 53 JPanel panel = new JPanel(); 54 55 54 this.reverseButtons.setSelected(Main.pref 56 55 .getBoolean("mapillary.reverse-buttons")); … … 60 59 this.moveTo.setSelected(Main.pref.getBoolean("mapillary.move-to-picture", 61 60 true)); 62 63 61 panel.setLayout(new FlowLayout(FlowLayout.LEFT)); 64 62 panel.add(this.reverseButtons); 65 66 63 // Sets the value of the ComboBox. 67 64 if (Main.pref.get("mapillary.download-mode").equals( … … 78 75 downloadModePanel.add(this.downloadMode); 79 76 panel.add(downloadModePanel); 80 81 77 panel.add(this.displayHour); 82 78 panel.add(this.format24); … … 88 84 this.login.setText("Logged as: " + MapillaryUser.getUsername() 89 85 + ". Click to relogin."); 90 91 86 panel.add(this.login); 92 87 if (MapillaryUser.getUsername() != null) { 93 88 JButton logout = new JButton(new LogoutAction()); 94 89 logout.setText("Logout"); 95 96 90 panel.add(logout); 97 91 } … … 117 111 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.DOWNLOAD_VIEW_MENU, true); 118 112 } 119 120 113 Main.pref.put("mapillary.display-hour", this.displayHour.isSelected()); 121 114 Main.pref.put("mapillary.format-24", this.format24.isSelected()); … … 143 136 OAuthPortListener portListener = new OAuthPortListener(); 144 137 portListener.start(); 145 146 138 String url = "http://www.mapillary.com/connect?redirect_uri=http:%2F%2Flocalhost:8763%2F&client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz&response_type=token&scope=user:read%20public:upload%20public:write"; 147 139 try { … … 170 162 } 171 163 } 172 173 164 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryUploadDialog.java
r31514 r31515 16 16 17 17 /** 18 * JPanel used when uploading pictures. 19 * 18 20 * @author nokutu 19 21 * … … 31 33 32 34 /** 33 * Main constructor.35 * Creates the JPanel and adds the needed elements. 34 36 */ 35 37 public MapillaryUploadDialog() { … … 37 39 if (MapillaryUser.getUsername() != null) { 38 40 this.group = new ButtonGroup(); 39 40 41 this.sequence = new JRadioButton(tr("Upload selected sequence")); 41 42 if (MapillaryLayer.getInstance().getData().getSelectedImage() == null … … 45 46 add(this.sequence); 46 47 this.group.setSelected(this.sequence.getModel(), true); 47 48 48 this.delete = new JCheckBox(tr("Delete after upload")); 49 49 this.delete.setSelected(Main.pref.getBoolean( 50 50 "mapillary.delete-after-upload", true)); 51 51 add(this.delete); 52 } else {53 this.add(new JLabel( "Go to setting and log in to Mapillary before uploading."));54 }52 } else 53 this.add(new JLabel( 54 "Go to setting and log in to Mapillary before uploading.")); 55 55 } 56 56 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r31514 r31515 1 package org.openstreetmap.josm.plugins.mapillary. downloads;1 package org.openstreetmap.josm.plugins.mapillary.io.download; 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryImageInfoDownloadThread.java
r31514 r31515 1 package org.openstreetmap.josm.plugins.mapillary. downloads;1 package org.openstreetmap.josm.plugins.mapillary.io.download; 2 2 3 3 import java.io.BufferedReader; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySequenceDownloadThread.java
r31514 r31515 1 package org.openstreetmap.josm.plugins.mapillary. downloads;1 package org.openstreetmap.josm.plugins.mapillary.io.download; 2 2 3 3 import java.io.BufferedReader; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySquareDownloadManagerThread.java
r31514 r31515 1 package org.openstreetmap.josm.plugins.mapillary. downloads;1 package org.openstreetmap.josm.plugins.mapillary.io.download; 2 2 3 3 import java.io.UnsupportedEncodingException; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryTrafficSignDownloadThread.java
r31514 r31515 1 package org.openstreetmap.josm.plugins.mapillary. downloads;1 package org.openstreetmap.josm.plugins.mapillary.io.download; 2 2 3 3 import java.io.BufferedReader; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportDownloadThread.java
r31514 r31515 1 package org.openstreetmap.josm.plugins.mapillary. downloads;1 package org.openstreetmap.josm.plugins.mapillary.io.export; 2 2 3 3 import java.awt.image.BufferedImage; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportManager.java
r31514 r31515 1 package org.openstreetmap.josm.plugins.mapillary. downloads;1 package org.openstreetmap.josm.plugins.mapillary.io.export; 2 2 3 3 import static org.openstreetmap.josm.tools.I18n.tr; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java
r31514 r31515 1 package org.openstreetmap.josm.plugins.mapillary. downloads;1 package org.openstreetmap.josm.plugins.mapillary.io.export; 2 2 3 3 import java.awt.image.BufferedImage; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/AbstractMode.java
r31451 r31515 14 14 import org.openstreetmap.josm.plugins.mapillary.MapillaryData; 15 15 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer; 16 import org.openstreetmap.josm.plugins.mapillary. downloads.MapillaryDownloader;16 import org.openstreetmap.josm.plugins.mapillary.io.download.MapillaryDownloader; 17 17 18 18 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
r31512 r31515 36 36 private MapillaryAbstractImage lastClicked; 37 37 private MapillaryRecord record; 38 39 38 private boolean nothingHighlighted; 40 39 private boolean imageHighlighted = false; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryUser.java
r31514 r31515 51 51 return null; 52 52 HashMap<String, String> hash = new HashMap<>(); 53 if (images_hash == null)54 try {53 try { 54 if (images_hash == null) 55 55 images_hash = OAuthUtils 56 56 .getWithHeader( … … 58 58 "https://a.mapillary.com/v2/me/uploads/secrets?client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz")) 59 59 .getString("images_hash"); 60 } catch (IOException e) { 61 Main.error(e); 62 isTokenValid = false; 63 } 64 hash.put("images_hash", images_hash); 65 if (images_policy == null) 66 try { 60 hash.put("images_hash", images_hash); 61 if (images_policy == null) 67 62 images_policy = OAuthUtils 68 63 .getWithHeader( … … 70 65 "https://a.mapillary.com/v2/me/uploads/secrets?client_id=T1Fzd20xZjdtR0s1VDk5OFNIOXpYdzoxNDYyOGRkYzUyYTFiMzgz")) 71 66 .getString("images_policy"); 72 73 74 75 67 } catch (IOException e) { 68 Main.error(e); 69 isTokenValid = false; 70 } 76 71 hash.put("images_policy", images_policy); 77 72 return hash; … … 85 80 images_policy = null; 86 81 images_hash = null; 87 isTokenValid = true; 82 isTokenValid = false; 83 Main.pref.put("mapillary.access-token", null); 88 84 } 89 85 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/OAuthPortListener.java
r31512 r31515 63 63 + accessToken); 64 64 // Saves the access token in preferences. 65 MapillaryUser.isTokenValid = true; 65 66 if (Main.main != null) { 66 67 Main.pref.put("mapillary.access-token", accessToken); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
r31513 r31515 189 189 ImageIO.write(image.getImage(), "jpg", outputStream); 190 190 byte[] imageBytes = outputStream.toByteArray(); 191 192 191 new ExifRewriter().updateExifMetadataLossless(imageBytes, os, outputSet); 193 194 192 return tempFile; 195 193 } … … 203 201 public static void upload(MapillaryImportedImage image) { 204 202 upload(image, UUID.randomUUID()); 205 206 203 } 207 204 … … 228 225 hash.put("signature", signature); 229 226 hash.put("Content-Type", "image/jpeg"); 230 231 227 try { 232 228 uploadFile(updateFile(image), hash); … … 257 253 } 258 254 entityBuilder.addPart("file", new FileBody(file)); 259 260 255 HttpEntity entity = entityBuilder.build(); 261 256 httpPost.setEntity(entity); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/PluginState.java
r31482 r31515 99 99 100 100 /** 101 * Returns the stringto be written in the status bar.101 * Returns the text to be written in the status bar. 102 102 * 103 * @return The Stringthat is going to be written in the status bar.103 * @return The {@code String} that is going to be written in the status bar. 104 104 */ 105 105 public static String getUploadString() { -
applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThreadTest.java
r31501 r31515 15 15 import org.openstreetmap.josm.plugins.mapillary.AbstractTest; 16 16 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer; 17 import org.openstreetmap.josm.plugins.mapillary. downloads.MapillaryDownloader;18 import org.openstreetmap.josm.plugins.mapillary. downloads.MapillarySequenceDownloadThread;17 import org.openstreetmap.josm.plugins.mapillary.io.download.MapillaryDownloader; 18 import org.openstreetmap.josm.plugins.mapillary.io.download.MapillarySequenceDownloadThread; 19 19 20 20 /** … … 25 25 /** 26 26 * Test method for 27 * {@link org.openstreetmap.josm.plugins.mapillary. downloads.MapillarySequenceDownloadThread#run()}27 * {@link org.openstreetmap.josm.plugins.mapillary.io.download.MapillarySequenceDownloadThread#run()} 28 28 * . 29 29 *
Note:
See TracChangeset
for help on using the changeset viewer.