Changeset 31840 in osm for applications/editors/josm/plugins/mapillary/src
- Timestamp:
- 2015-12-16T17:17:09+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/MapillaryLayer.java
r31802 r31840 477 477 if (image.getLatLon().greatCircleDistance(selectedCoords) < SEQUENCE_MAX_JUMP_DISTANCE 478 478 && selected.getSequence() != image.getSequence()) { 479 if ((ret[0] == null && ret[1] == null) 480 || (image.getLatLon().greatCircleDistance(selectedCoords) < distances[0] && (ret[1] == null || image 481 .getSequence() != ret[1].getSequence()))) { 479 if ( 480 ret[0] == null && ret[1] == null 481 || image.getLatLon().greatCircleDistance(selectedCoords) < distances[0] 482 && (ret[1] == null || image.getSequence() != ret[1].getSequence()) 483 ) { 482 484 ret[0] = image; 483 485 distances[0] = image.getLatLon().greatCircleDistance(selectedCoords); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
r31797 r31840 28 28 */ 29 29 public MapillaryDownloadAction() { 30 super(tr("Mapillary"), MapillaryPlugin.getProvider("icon24.png"), 31 tr("Create Mapillary layer"), Shortcut.registerShortcut("Mapillary", 32 tr("Start Mapillary layer"), KeyEvent.VK_COMMA, Shortcut.SHIFT), 33 false, "mapillaryDownload", false); 30 super( 31 tr("Mapillary"), 32 MapillaryPlugin.getProvider("icon24.png"), 33 tr("Create Mapillary layer"), 34 Shortcut.registerShortcut("Mapillary", tr("Start Mapillary layer"), KeyEvent.VK_COMMA, Shortcut.SHIFT), 35 false, 36 "mapillaryDownload", 37 false 38 ); 34 39 this.setEnabled(false); 35 40 } … … 38 43 public void actionPerformed(ActionEvent arg0) { 39 44 MapillaryLayer.getInstance(); 40 if (Main.map.mapView.getActiveLayer() != MapillaryLayer.getInstance()) 45 if (Main.map.mapView.getActiveLayer() == MapillaryLayer.getInstance()) { 46 Main.map.mapView.setActiveLayer(Main.map.mapView.getEditLayer()); 47 } else { 41 48 Main.map.mapView.setActiveLayer(MapillaryLayer.getInstance()); 42 else 43 Main.map.mapView.setActiveLayer(Main.map.mapView.getEditLayer()); 49 } 44 50 } 45 51 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
r31816 r31840 80 80 if (!images.contains(image)) 81 81 images.addAll(((MapillaryImage) image).getSequence().getImages()); 82 } else 82 } else { 83 83 images.add(image); 84 } 84 85 export(images); 85 86 } else if (this.dialog.group.isSelected(this.dialog.selected.getModel())) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
r31837 r31840 39 39 */ 40 40 public MapillaryImportAction() { 41 super(tr("Import pictures"), MapillaryPlugin.getProvider("icon24.png"), 42 tr("Import local pictures"), Shortcut.registerShortcut( 43 "Import Mapillary", tr("Import pictures into Mapillary layer"), 44 KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), false, "mapillaryImport", 41 super( 42 tr("Import pictures"), 43 MapillaryPlugin.getProvider("icon24.png"), 44 tr("Import local pictures"), 45 Shortcut.registerShortcut( 46 "Import Mapillary", 47 tr("Import pictures into Mapillary layer"), 48 KeyEvent.CHAR_UNDEFINED, 49 Shortcut.NONE 50 ), 51 false, 52 "mapillaryImport", 45 53 false); 46 54 this.setEnabled(false); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/cache/CacheUtils.java
r31797 r31840 63 63 break; 64 64 case FULL_IMAGE: 65 default: 65 66 submit(img.getKey(), MapillaryCache.Type.FULL_IMAGE, ignoreDownload); 66 67 break; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryHistoryDialog.java
r31811 r31840 132 132 * @return The unique instance of the class. 133 133 */ 134 public static MapillaryHistoryDialog getInstance() {134 public static synchronized MapillaryHistoryDialog getInstance() { 135 135 if (instance == null) 136 136 instance = new MapillaryHistoryDialog(); … … 229 229 230 230 @Override 231 public Component getTreeCellRendererComponent( JTree tree, Object value,232 boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus) {233 super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row,234 231 public Component getTreeCellRendererComponent( 232 JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus 233 ) { 234 super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus); 235 235 setIcon(ImageProvider.get("data/node.png")); 236 236 return this; … … 249 249 @Override 250 250 public void mouseClicked(MouseEvent e) { 251 // Method is enforced by MouseListener, but (currently) not needed 251 252 } 252 253 253 254 @Override 254 255 public void mouseEntered(MouseEvent e) { 256 // Method is enforced by MouseListener, but (currently) not needed 255 257 } 256 258 257 259 @Override 258 260 public void mouseExited(MouseEvent e) { 261 // Method is enforced by MouseListener, but (currently) not needed 259 262 } 260 263 … … 262 265 public void mousePressed(MouseEvent e) { 263 266 if (e.getClickCount() == 2) { 264 if ( MapillaryHistoryDialog.this.undoTree.getSelectionPath() != null) {265 Mapillary Command cmd = MapillaryHistoryDialog.this.map266 .get(MapillaryHistoryDialog.this.undoTree.getSelectionPath()267 268 if (!(cmd instanceof CommandDelete)) 267 if (undoTree.getSelectionPath() == null) { 268 MapillaryUtils.showPictures(map.get(redoTree.getSelectionPath().getLastPathComponent()).images, true); 269 } else { 270 MapillaryCommand cmd = map.get(undoTree.getSelectionPath().getLastPathComponent()); 271 if (!(cmd instanceof CommandDelete)) { 269 272 MapillaryUtils.showPictures(cmd.images, true); 270 } else 271 MapillaryUtils.showPictures(MapillaryHistoryDialog.this.map 272 .get(MapillaryHistoryDialog.this.redoTree.getSelectionPath() 273 .getLastPathComponent()).images, true); 273 } 274 } 274 275 } 275 276 } … … 277 278 @Override 278 279 public void mouseReleased(MouseEvent e) { 280 // Method is enforced by MouseListener, but (currently) not needed 279 281 } 280 282 } … … 284 286 private JTree source; 285 287 286 pr ivateUndoRedoSelectionListener(JTree source) {288 protected UndoRedoSelectionListener(JTree source) { 287 289 this.source = source; 288 290 } … … 290 292 @Override 291 293 public void valueChanged(TreeSelectionEvent e) { 292 if (this.source == MapillaryHistoryDialog.this.undoTree) { 293 MapillaryHistoryDialog.this.redoTree.getSelectionModel() 294 .removeTreeSelectionListener( 295 MapillaryHistoryDialog.this.redoSelectionListener); 296 MapillaryHistoryDialog.this.redoTree.clearSelection(); 297 MapillaryHistoryDialog.this.redoTree.getSelectionModel() 298 .addTreeSelectionListener( 299 MapillaryHistoryDialog.this.redoSelectionListener); 300 } 301 if (this.source == MapillaryHistoryDialog.this.redoTree) { 302 MapillaryHistoryDialog.this.undoTree.getSelectionModel() 303 .removeTreeSelectionListener( 304 MapillaryHistoryDialog.this.undoSelectionListener); 305 MapillaryHistoryDialog.this.undoTree.clearSelection(); 306 MapillaryHistoryDialog.this.undoTree.getSelectionModel() 307 .addTreeSelectionListener( 308 MapillaryHistoryDialog.this.undoSelectionListener); 294 if (this.source == undoTree) { 295 redoTree.getSelectionModel().removeTreeSelectionListener(redoSelectionListener); 296 redoTree.clearSelection(); 297 redoTree.getSelectionModel().addTreeSelectionListener(redoSelectionListener); 298 } 299 if (this.source == redoTree) { 300 undoTree.getSelectionModel().removeTreeSelectionListener(undoSelectionListener); 301 undoTree.clearSelection(); 302 undoTree.getSelectionModel().addTreeSelectionListener(undoSelectionListener); 309 303 } 310 304 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java
r31815 r31840 452 452 * @return the part of compRect with the same width/height ratio as the image 453 453 */ 454 static Rectangle calculateDrawImageRectangle(Rectangle imgRect, Rectangle compRect) {454 private static Rectangle calculateDrawImageRectangle(Rectangle imgRect, Rectangle compRect) { 455 455 int x = 0; 456 456 int y = 0; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/CommandDelete.java
r31811 r31840 6 6 import java.util.HashMap; 7 7 import java.util.List; 8 import java.util.Map; 8 9 9 10 import org.openstreetmap.josm.plugins.mapillary.MapillaryAbstractImage; … … 18 19 public class CommandDelete extends MapillaryExecutableCommand { 19 20 20 private final HashMap<MapillaryAbstractImage, Integer> changesHash = new HashMap<>();21 private final Map<MapillaryAbstractImage, Integer> changesHash = new HashMap<>(); 21 22 22 23 /** … … 32 33 @Override 33 34 public void sum(MapillaryCommand command) { 35 // TODO: Implement 34 36 } 35 37 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/history/commands/MapillaryCommand.java
r31788 r31840 24 24 */ 25 25 public MapillaryCommand(List<MapillaryAbstractImage> images) { 26 this.images = new ArrayList< MapillaryAbstractImage>(images);26 this.images = new ArrayList<>(images); 27 27 } 28 28 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/download/MapillaryDownloader.java
r31833 r31840 5 5 6 6 import java.util.ArrayList; 7 import java.util.List; 7 8 import java.util.concurrent.ArrayBlockingQueue; 8 9 import java.util.concurrent.ThreadPoolExecutor; … … 31 32 32 33 /** All the Threads that have been run. Used to interrupt them properly. */ 33 private static ArrayList<Thread> threads = new ArrayList<>();34 private static List<Thread> threads = new ArrayList<>(); 34 35 35 36 /** Max area to be downloaded */ 36 public static final double MAX_AREA = Main.pref.getDouble( 37 "mapillary.max-download-area", 0.015); 37 public static final double MAX_AREA = Main.pref.getDouble("mapillary.max-download-area", 0.015); 38 38 39 39 /** Executor that will run the petitions. */ … … 175 175 private static boolean isAreaTooBig() { 176 176 double area = 0; 177 for (Bounds bounds : Main.map.mapView.getEditLayer().data 178 .getDataSourceBounds()) { 177 for (Bounds bounds : Main.map.mapView.getEditLayer().data.getDataSourceBounds()) { 179 178 area += bounds.getArea(); 180 179 } 181 if (area > MAX_AREA) 182 return true; 183 return false; 180 return area > MAX_AREA; 184 181 } 185 182 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/io/export/MapillaryExportWriterThread.java
r31797 r31840 85 85 String path = ((MapillaryImportedImage) mimg).getFile().getPath(); 86 86 finalPath = path.substring(0, path.lastIndexOf('.')); 87 } else if (mimg instanceof MapillaryImage) 88 finalPath = this.path + "/"+ ((MapillaryImage) mimg).getKey();89 else if (mimg instanceof MapillaryImportedImage)90 finalPath = this.path + "/"91 + ((MapillaryImportedImage) mimg).getFile().getName();87 } else if (mimg instanceof MapillaryImage) { 88 finalPath = this.path + '/' + ((MapillaryImage) mimg).getKey(); 89 } else if (mimg instanceof MapillaryImportedImage) { 90 finalPath = this.path + '/' + ((MapillaryImportedImage) mimg).getFile().getName(); 91 } 92 92 93 93 // Transforms the image into a byte array. -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/oauth/UploadUtils.java
r31811 r31840 60 60 private final UUID uuid; 61 61 private final boolean delete; 62 ThreadPoolExecutor ex;62 private ThreadPoolExecutor ex; 63 63 64 64 private SequenceUploadThread(List<MapillaryAbstractImage> images,
Note:
See TracChangeset
for help on using the changeset viewer.