Changeset 31974 in osm for applications/editors/josm/plugins/mapillary/src/org/openstreetmap
- Timestamp:
- 2016-01-11T23:05:25+01:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31972 r31974 111 111 * @param lis Listener to be added. 112 112 */ 113 public void addListener(MapillaryDataListener lis) { 113 public final void addListener(MapillaryDataListener lis) { 114 114 this.listeners.add(lis); 115 115 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31972 r31974 68 68 * 69 69 */ 70 public class MapillaryLayer extends AbstractModifiableLayer implements 70 public final class MapillaryLayer extends AbstractModifiableLayer implements 71 71 DataSetListener, EditLayerChangeListener, LayerChangeListener { 72 72 … … 371 371 * Draws the highlight of the icon. 372 372 * 373 * @param g 374 * @param p 375 * The {@link Point} where the image must be set. 376 * @param size 377 * The width in pixels of the highlight. 373 * @param g the graphics context 374 * @param p the {@link Point} where the image must be set. 375 * @param size the width in pixels of the highlight. 378 376 */ 379 377 private void drawPointHighlight(Graphics2D g, Point p, int size) { … … 396 394 * image. 397 395 * 398 * @param g 399 * @param image 400 * The {@link MapillaryAbstractImage} which is being drown. 401 * @param icon 402 * The {@link ImageIcon} that represents the image. 403 * @param p 404 * The P¡{@link Point} when the image lies. 396 * @param g the graphics context 397 * @param image The {@link MapillaryAbstractImage} which is being drown. 398 * @param icon The {@link ImageIcon} that represents the image. 399 * @param p The P¡{@link Point} when the image lies. 405 400 */ 406 401 private void draw(Graphics2D g, MapillaryAbstractImage image, ImageIcon icon, Point p) { … … 531 526 @Override 532 527 public void primitivesAdded(PrimitivesAddedEvent event) { 528 // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed. 533 529 } 534 530 535 531 @Override 536 532 public void primitivesRemoved(PrimitivesRemovedEvent event) { 533 // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed. 537 534 } 538 535 539 536 @Override 540 537 public void tagsChanged(TagsChangedEvent event) { 538 // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed. 541 539 } 542 540 543 541 @Override 544 542 public void nodeMoved(NodeMovedEvent event) { 543 // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed. 545 544 } 546 545 547 546 @Override 548 547 public void wayNodesChanged(WayNodesChangedEvent event) { 548 // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed. 549 549 } 550 550 551 551 @Override 552 552 public void relationMembersChanged(RelationMembersChangedEvent event) { 553 // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed. 553 554 } 554 555 555 556 @Override 556 557 public void otherDatasetChange(AbstractDatasetChangedEvent event) { 558 // Required by DataSetListener. But we are not interested in what changed, only _that_ something changed. 557 559 } 558 560 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java
r31838 r31974 8 8 import java.awt.event.KeyEvent; 9 9 import java.util.ArrayList; 10 import java.util.List; 10 11 11 12 import javax.swing.JDialog; … … 32 33 33 34 private WalkThread thread = null; 34 private final ArrayList<WalkListener> listeners = new ArrayList<>();35 private final List<WalkListener> listeners = new ArrayList<>(); 35 36 36 37 /** -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryExportDialog.java
r31811 r31974 82 82 this.group.add(this.rewrite); 83 83 // Some options are disabled depending on the circumstances 84 if (MapillaryLayer.getInstance().getData().getSelectedImage() == null85 || !(MapillaryLayer.getInstance().getData().getSelectedImage()instanceof MapillaryImage && ((MapillaryImage) MapillaryLayer86 .getInstance().getData().getSelectedImage()).getSequence() != null)) {84 if (!(MapillaryLayer.getInstance().getData().getSelectedImage() instanceof MapillaryImage) 85 || ((MapillaryImage) MapillaryLayer.getInstance().getData().getSelectedImage()).getSequence() == null 86 ) { 87 87 this.sequence.setEnabled(false); 88 88 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
r31972 r31974 14 14 import java.util.ArrayList; 15 15 import java.util.Arrays; 16 import java.util.List; 16 17 import java.util.concurrent.ConcurrentHashMap; 17 18 … … 141 142 this.redoButton.setEnabled(true); 142 143 this.undoButton.setEnabled(true); 143 ArrayList<MapillaryCommand> commands = MapillaryRecord.getInstance().commandList;144 List<MapillaryCommand> commands = MapillaryRecord.getInstance().commandList; 144 145 int position = MapillaryRecord.getInstance().position; 145 146 ArrayList<MapillaryCommand> undoCommands = new ArrayList<>(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/MapillaryRecord.java
r31951 r31974 3 3 4 4 import java.util.ArrayList; 5 import java.util.List; 5 6 6 7 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage; … … 18 19 private static MapillaryRecord instance; 19 20 20 private final ArrayList<MapillaryRecordListener> listeners = new ArrayList<>();21 private final List<MapillaryRecordListener> listeners = new ArrayList<>(); 21 22 22 23 /** The set of commands that have taken place or that have been undone. */ 23 public ArrayList<MapillaryCommand> commandList;24 public List<MapillaryCommand> commandList; 24 25 /** Last written command. */ 25 26 public int position; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r31972 r31974 69 69 * Returns the current download mode. 70 70 * 71 * @return 0 - automatic; 1 - semiautomatic; 2 - manual.71 * @return the currently enabled of the available {@link MODES} 72 72 */ 73 73 public static MapillaryDownloader.MODES getMode() { 74 if (Main.pref.get("mapillary.download-mode").equals(MODES.Automatic.toString()) 75 && (!MapillaryLayer.hasInstance() || !MapillaryLayer.getInstance().tempSemiautomatic)) 76 return MODES.Automatic; 77 else if (Main.pref.get("mapillary.download-mode").equals(MODES.Semiautomatic.toString()) 78 || (MapillaryLayer.hasInstance() && MapillaryLayer.getInstance().tempSemiautomatic)) 74 String downloadMode = Main.pref.get("mapillary.download-mode", MODES.Automatic.toString()); 75 boolean isTempSemiautomatic = MapillaryLayer.hasInstance() && MapillaryLayer.getInstance().tempSemiautomatic; 76 if (MODES.Semiautomatic.toString().equals(downloadMode) || isTempSemiautomatic) 79 77 return MODES.Semiautomatic; 80 else if (M ain.pref.get("mapillary.download-mode").equals(MODES.Manual.toString()))78 else if (MODES.Manual.toString().equals(downloadMode)) 81 79 return MODES.Manual; 82 else if ( "".equals(Main.pref.get("mapillary.download-mode")))80 else if (MODES.Automatic.toString().equals(downloadMode)) 83 81 return MODES.Automatic; 84 82 else -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillarySquareDownloadManagerThread.java
r31951 r31974 95 95 while (!this.completeExecutor.isShutdown()) { 96 96 this.completeExecutor.execute(new MapillaryImageInfoDownloadThread(completeExecutor, bounds, page)); 97 while (this.completeExecutor.getQueue().remainingCapacity() == 0) 97 while (this.completeExecutor.getQueue().remainingCapacity() == 0) { 98 98 Thread.sleep(100); 99 } 99 100 page++; 100 101 } … … 112 113 while (!this.signsExecutor.isShutdown()) { 113 114 this.signsExecutor.execute(new MapillaryTrafficSignDownloadThread(this.signsExecutor, bounds, page)); 114 while (this.signsExecutor.getQueue().remainingCapacity() == 0) 115 while (this.signsExecutor.getQueue().remainingCapacity() == 0) { 115 116 Thread.sleep(100); 117 } 116 118 page++; 117 119 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/JoinMode.java
r31787 r31974 44 44 if (this.data.getHighlightedImage() == null) 45 45 return; 46 if (this.lastClick == null 47 && this.data.getHighlightedImage() instanceof MapillaryImportedImage) { 46 if (this.lastClick == null && this.data.getHighlightedImage() instanceof MapillaryImportedImage) { 48 47 this.lastClick = (MapillaryImportedImage) this.data.getHighlightedImage(); 49 48 } else if (this.lastClick != null 50 49 && this.data.getHighlightedImage() instanceof MapillaryImportedImage) { 51 if ( ((this.data.getHighlightedImage().previous() == null && this.lastClick52 .next() == null) ||(this.data.getHighlightedImage().next() == null && this.lastClick53 .previous() == null ))54 55 .getSequence() || this.lastClick.getSequence() == null)) {50 if ( 51 (this.data.getHighlightedImage().previous() == null && this.lastClick.next() == null 52 || this.data.getHighlightedImage().next() == null && this.lastClick.previous() == null) 53 && (this.data.getHighlightedImage().getSequence() != this.lastClick.getSequence() || this.lastClick.getSequence() == null) 54 ) { 56 55 57 56 MapillaryRecord.getInstance().addCommand( … … 59 58 this.lastClick, this.data.getHighlightedImage() }))); 60 59 } else if (this.lastClick.next() == this.data.getHighlightedImage() 61 || this.lastClick.previous() == this.data.getHighlightedImage()) 60 || this.lastClick.previous() == this.data.getHighlightedImage()) { 62 61 MapillaryRecord.getInstance().addCommand( 63 62 new CommandUnjoin(Arrays.asList(new MapillaryAbstractImage[] { 64 63 this.lastClick, this.data.getHighlightedImage() }))); 64 } 65 65 this.lastClick = null; 66 66 } 67 if (Main.main != null) 68 MapillaryData.dataUpdated(); 67 MapillaryData.dataUpdated(); 69 68 } 70 69 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/MapillaryLoginListener.java
r31810 r31974 13 13 * @param username the username that the user is now logged in with 14 14 */ 15 publicvoid onLogin(final String username);15 void onLogin(final String username); 16 16 /** 17 17 * Should be called whenever the user logs out of a mapillary account. 18 18 * E.g. for updating the GUI to reflect the login status. 19 19 */ 20 publicvoid onLogout();20 void onLogout(); 21 21 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
r31972 r31974 9 9 import java.io.OutputStream; 10 10 import java.util.HashMap; 11 import java.util.Map; 11 12 import java.util.Set; 12 13 import java.util.UUID; … … 56 57 public class UploadUtils { 57 58 59 private UploadUtils() { 60 // Private constructor to avoid instantiation. 61 } 62 58 63 /** 59 64 * Required keys for POST … … 145 150 throws ImageReadException, IOException, ImageWriteException { 146 151 TiffOutputSet outputSet = null; 147 TiffOutputDirectory exifDirectory = null;148 TiffOutputDirectory gpsDirectory = null;149 TiffOutputDirectory rootDirectory = null;152 TiffOutputDirectory exifDirectory; 153 TiffOutputDirectory gpsDirectory; 154 TiffOutputDirectory rootDirectory; 150 155 151 156 // If the image is imported, loads the rest of the EXIF data. … … 216 221 + image.getCa() + "_" + image.getCapturedAt() + ".jpg"; 217 222 218 String policy = null;219 String signature = null;223 String policy; 224 String signature; 220 225 policy = MapillaryUser.getSecrets().get("images_policy"); 221 226 signature = MapillaryUser.getSecrets().get("images_hash"); 222 227 223 HashMap<String, String> hash = new HashMap<>();228 Map<String, String> hash = new HashMap<>(); 224 229 hash.put("key", key); 225 230 hash.put("AWSAccessKeyId", "AKIAI2X3BJAT2W75HILA"); … … 241 246 * @throws IllegalArgumentException if the hash doesn't contain all the needed keys. 242 247 */ 243 public static void uploadFile(File file, HashMap<String, String> hash) 244 throws IOException { 248 public static void uploadFile(File file, Map<String, String> hash) throws IOException { 245 249 HttpClientBuilder builder = HttpClientBuilder.create(); 246 250 HttpClient httpClient = builder.build(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtils.java
r31972 r31974 363 363 zoomBounds = new Bounds(new LatLon(0, 0)); 364 364 } else { 365 zoomBounds = new Bounds(images.iterator().next().getLatLon()); 365 366 for (MapillaryAbstractImage img : images) { 366 if (zoomBounds == null) { 367 zoomBounds = new Bounds(img.getLatLon()); 368 } else 369 zoomBounds.extend(img.getLatLon()); 367 zoomBounds.extend(img.getLatLon()); 370 368 } 371 369 }
Note:
See TracChangeset
for help on using the changeset viewer.