Changeset 31266 in osm for applications/editors/josm/plugins/mapillary
- Timestamp:
- 2015-06-15T13:07:24+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31263 r31266 178 178 */ 179 179 public void setSelectedImage(MapillaryAbstractImage image, boolean zoom) { 180 MapillaryAbstractImage oldImage = selectedImage; 180 181 selectedImage = image; 181 182 multiSelectedImages.clear(); … … 208 209 Main.map.mapView.repaint(); 209 210 } 210 fireSelectedImageChanged( );211 } 212 213 private void fireSelectedImageChanged( ) {211 fireSelectedImageChanged(oldImage, selectedImage); 212 } 213 214 private void fireSelectedImageChanged(MapillaryAbstractImage oldImage, MapillaryAbstractImage newImage) { 214 215 if (listeners.isEmpty()) 215 216 return; 216 217 for (MapillaryDataListener lis : listeners) 217 lis.selectedImageChanged( );218 lis.selectedImageChanged(oldImage, newImage); 218 219 } 219 220 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDataListener.java
r31263 r31266 6 6 * manually clicking on the icon. 7 7 */ 8 public void selectedImageChanged( );8 public void selectedImageChanged(MapillaryAbstractImage oldImage, MapillaryAbstractImage newImage); 9 9 10 10 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31261 r31266 109 109 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.EXPORT_MENU, true); 110 110 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.SIGNAL_MENU, true); 111 download();112 111 Main.map.mapView.setActiveLayer(this); 113 112 Main.map.repaint(); … … 127 126 * Downloads all images of the area covered by the OSM data. 128 127 */ 129 p rotectedvoid download() {128 public void download() { 130 129 for (Bounds bounds : Main.map.mapView.getEditLayer().data 131 130 .getDataSourceBounds()) { … … 156 155 .setImage(null); 157 156 MapillaryLayer.INSTANCE = null; 157 MapillaryData.INSTANCE = null; 158 158 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.EXPORT_MENU, false); 159 159 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.SIGNAL_MENU, false); 160 Mapillary Data.INSTANCE = null;160 MapillaryPlugin.setMenuEnabled(MapillaryPlugin.ZOOM_MENU, false); 161 161 Main.map.mapView.removeMouseListener(mouseAdapter); 162 162 Main.map.mapView.removeMouseMotionListener(mouseAdapter); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
r31261 r31266 51 51 private final MapillaryImportAction importAction; 52 52 private final MapillarySignalAction signalAction; 53 private final MapillaryZoomAction zoomAction; 53 54 54 55 public static JMenuItem DOWNLOAD_MENU; … … 56 57 public static JMenuItem IMPORT_MENU; 57 58 public static JMenuItem SIGNAL_MENU; 59 public static JMenuItem ZOOM_MENU; 58 60 59 61 public MapillaryPlugin(PluginInformation info) { … … 63 65 importAction = new MapillaryImportAction(); 64 66 signalAction = new MapillarySignalAction(); 67 zoomAction = new MapillaryZoomAction(); 65 68 66 69 DOWNLOAD_MENU = MainMenu.add(Main.main.menu.imageryMenu, … … 72 75 SIGNAL_MENU = MainMenu.add(Main.main.menu.dataMenu, signalAction, 73 76 false); 77 ZOOM_MENU = MainMenu.add(Main.main.menu.viewMenu, zoomAction, 78 false); 74 79 75 80 EXPORT_MENU.setEnabled(false); … … 77 82 IMPORT_MENU.setEnabled(false); 78 83 SIGNAL_MENU.setEnabled(false); 84 ZOOM_MENU.setEnabled(false); 79 85 80 86 MapView.addEditLayerChangeListener(this); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
r31264 r31266 31 31 KeyEvent.VK_M, Shortcut.ALT_CTRL_SHIFT), false, 32 32 "mapillaryDownload", false); 33 this.setEnabled(false); 33 34 } 34 35 … … 36 37 public void actionPerformed(ActionEvent arg0) { 37 38 this.layer = null; 38 if (Main.map == null || Main.map.mapView == null39 || Main.map.mapView.getEditLayer() == null)40 return;41 39 for (Layer layer : Main.map.mapView.getAllLayers()) 42 40 if (layer instanceof MapillaryLayer) 43 41 this.layer = (MapillaryLayer) layer; 44 42 45 if (this.layer == null) 43 if (this.layer == null) { 46 44 layer = new MapillaryLayer(); 47 else { 45 layer.download(); 46 } else { 48 47 if (Main.map.mapView.getActiveLayer() != layer) 49 48 Main.map.mapView.setActiveLayer(layer); … … 53 52 } 54 53 } 55 56 54 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
r31264 r31266 39 39 "Export Mapillary", tr("Export Mapillary pictures"), 40 40 KeyEvent.VK_M, Shortcut.NONE), false, "mapillaryExport", false); 41 this.setEnabled(false); 41 42 } 42 43 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
r31261 r31266 40 40 KeyEvent.VK_M, Shortcut.NONE), false, 41 41 "mapillaryImport", false); 42 this.setEnabled(false); 42 43 } 43 44 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillarySignalAction.java
r31263 r31266 23 23 super(tr("Switch signal mode"), new ImageProvider("icon24signal.png"), 24 24 tr("Switch signal mode"), Shortcut.registerShortcut( 25 "Mapillary signal", tr("Switch signal mode on/off"),25 "Mapillary signal", tr("Switch Mapillary plugin's signal mode on/off"), 26 26 KeyEvent.VK_M, Shortcut.NONE), false, 27 27 "mapillarySignal", false); 28 this.setEnabled(false); 28 29 } 29 30 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryImageDisplay.java
r31256 r31266 32 32 33 33 private static final int DRAG_BUTTON = 3; 34 private static final int OPTION_BUTTON = 2; 34 35 private static final int ZOOM_BUTTON = 1; 35 36 … … 138 139 if (image == null) 139 140 return; 140 if (e.getButton() != DRAG_BUTTON) 141 if (e.getButton() == OPTION_BUTTON) { 142 if (!MapillaryImageDisplay.this.visibleRect 143 .equals(new Rectangle(0, 0, image.getWidth(null), image 144 .getHeight(null)))) 145 // Zooms to 1:1 146 MapillaryImageDisplay.this.visibleRect = new Rectangle(0, 147 0, image.getWidth(null), image.getHeight(null)); 148 else 149 // Zooms to best fit. 150 MapillaryImageDisplay.this.visibleRect = new Rectangle( 151 0, 152 (image.getHeight(null) - (image.getWidth(null) * getHeight()) 153 / getWidth()) / 2, image.getWidth(null), 154 (image.getWidth(null) * getHeight()) / getWidth()); 155 MapillaryImageDisplay.this.repaint(); 156 return; 157 } else if (e.getButton() != DRAG_BUTTON) 141 158 return; 142 159 // Calculate the translation to set the clicked point the center of -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java
r31264 r31266 382 382 383 383 @Override 384 public void selectedImageChanged( ) {384 public void selectedImageChanged(MapillaryAbstractImage oldImage, MapillaryAbstractImage newImage) { 385 385 setImage(MapillaryData.getInstance().getSelectedImage()); 386 386 updateImage();
Note:
See TracChangeset
for help on using the changeset viewer.