Changeset 31263 in osm for applications/editors/josm
- Timestamp:
- 2015-06-12T16:24:50+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31261 r31263 25 25 private MapillaryAbstractImage selectedImage; 26 26 private final List<MapillaryAbstractImage> multiSelectedImages; 27 28 private List<MapillaryDataListener> listeners = new ArrayList<>();27 28 private List<MapillaryDataListener> listeners = new ArrayList<>(); 29 29 30 30 public MapillaryData() { … … 65 65 dataUpdated(); 66 66 } 67 67 68 68 public void addListener(MapillaryDataListener lis) { 69 69 listeners.add(lis); 70 70 } 71 71 72 72 public void removeListener(MapillaryDataListener lis) { 73 73 listeners.remove(lis); … … 137 137 if (((MapillaryImage) getSelectedImage()).getSequence() == null) 138 138 return; 139 setSelectedImage(((MapillaryImage) getSelectedImage()).next() );139 setSelectedImage(((MapillaryImage) getSelectedImage()).next(), true); 140 140 } 141 141 } … … 151 151 if (((MapillaryImage) getSelectedImage()).getSequence() == null) 152 152 throw new IllegalStateException(); 153 setSelectedImage(((MapillaryImage) getSelectedImage()).previous()); 153 setSelectedImage(((MapillaryImage) getSelectedImage()).previous(), 154 true); 154 155 } 155 156 } … … 164 165 */ 165 166 public void setSelectedImage(MapillaryAbstractImage image) { 167 setSelectedImage(image, false); 168 } 169 170 /** 171 * Selects a new image and then starts a new MapillaryImageDownloadThread 172 * thread in order to download its surrounding thumbnails. If the user does 173 * ctrl+click, this isn't triggered. You can choose wheter to center the 174 * view on the new image or not. 175 * 176 * @param image 177 * @param zoom 178 */ 179 public void setSelectedImage(MapillaryAbstractImage image, boolean zoom) { 166 180 selectedImage = image; 167 181 multiSelectedImages.clear(); … … 188 202 } 189 203 } 204 if (zoom) 205 Main.map.mapView.zoomTo(MapillaryData.getInstance() 206 .getSelectedImage().getLatLon()); 190 207 if (Main.map != null) { 191 208 Main.map.mapView.repaint(); … … 193 210 fireSelectedImageChanged(); 194 211 } 195 212 196 213 private void fireSelectedImageChanged() { 197 214 if (listeners.isEmpty()) -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryDataListener.java
r31261 r31263 2 2 3 3 public interface MapillaryDataListener { 4 4 /** 5 * Fired when the selected image is changed by something different from 6 * manually clicking on the icon. 7 */ 5 8 public void selectedImageChanged(); 6 9 7 10 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillarySignalAction.java
r31261 r31263 11 11 import org.openstreetmap.josm.tools.Shortcut; 12 12 13 /** 14 * Switches the window mode from normal to signal and viceversa. 15 * 16 * @author nokutu 17 * @see MapillaryToggleDialog 18 * 19 */ 13 20 public class MapillarySignalAction extends JosmAction { 14 21 … … 20 27 "mapillarySignal", false); 21 28 } 29 22 30 @Override 23 31 public void actionPerformed(ActionEvent e) { -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java
r31262 r31263 65 65 66 66 public final static int NORMAL_MODE = 0; 67 public final static int SIGNAL_MODE = 0;67 public final static int SIGNAL_MODE = 1; 68 68 69 69 private JPanel buttonsPanel; … … 112 112 } 113 113 114 /** 115 * Switches from one mode to the other one. 116 */ 114 117 public void switchMode() { 115 118 this.removeAll(); … … 122 125 mode = NORMAL_MODE; 123 126 } 124 this.setLayout(new BorderLayout());125 127 top = new JPanel(); 126 128 top.setLayout(new BorderLayout()); … … 128 130 createLayout(mapillaryImageDisplay, list, 129 131 Main.pref.getBoolean("mapillary.reverse-buttons")); 132 updateImage(); 130 133 } 131 134 … … 232 235 } 233 236 234 private void centerAtSelected() {235 Main.map.mapView.zoomTo(MapillaryData.getInstance().getSelectedImage()236 .getLatLon());237 }238 239 237 /** 240 238 * Action class form the next image button. … … 254 252 if (MapillaryToggleDialog.getInstance().getImage() != null) { 255 253 MapillaryData.getInstance().selectNext(); 256 if (MapillaryData.getInstance().getSelectedImage() != null)257 centerAtSelected();258 254 } 259 255 } … … 277 273 if (MapillaryToggleDialog.getInstance().getImage() != null) { 278 274 MapillaryData.getInstance().selectPrevious(); 279 if (MapillaryData.getInstance().getSelectedImage() != null)280 centerAtSelected();281 275 } 282 276 } … … 294 288 public void actionPerformed(ActionEvent e) { 295 289 if (MapillaryToggleDialog.getInstance().getImage() != null) { 296 MapillaryData.getInstance() 297 .setSelectedImage(MapillaryLayer.RED); 298 MapillaryToggleDialog.getInstance() 299 .setImage(MapillaryLayer.RED); 300 MapillaryToggleDialog.getInstance().updateImage(); 301 centerAtSelected(); 290 MapillaryData.getInstance().setSelectedImage( 291 MapillaryLayer.RED, true); 302 292 } 303 293 } … … 316 306 if (MapillaryToggleDialog.getInstance().getImage() != null) { 317 307 MapillaryData.getInstance().setSelectedImage( 318 MapillaryLayer.BLUE); 319 MapillaryToggleDialog.getInstance().setImage( 320 MapillaryLayer.BLUE); 321 MapillaryToggleDialog.getInstance().updateImage(); 322 centerAtSelected(); 308 MapillaryLayer.BLUE, true); 323 309 } 324 310 } … … 411 397 if (img instanceof MapillaryImage) 412 398 if (!((MapillaryImage) img).getSignals().isEmpty()) { 413 MapillaryData.getInstance().setSelectedImage(img); 399 MapillaryData.getInstance().setSelectedImage(img, 400 true); 414 401 return; 415 402 } 416 403 } 417 centerAtSelected();418 404 } 419 405 } … … 439 425 if (img instanceof MapillaryImage) 440 426 if (!((MapillaryImage) img).getSignals().isEmpty()) { 441 MapillaryData.getInstance().setSelectedImage(img); 427 MapillaryData.getInstance().setSelectedImage(img, 428 true); 442 429 return; 443 430 } 444 431 } 445 centerAtSelected();446 432 } 447 433 }
Note:
See TracChangeset
for help on using the changeset viewer.