Changeset 31264 in osm for applications/editors
- Timestamp:
- 2015-06-13T13:17:09+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImage.java
r31257 r31264 3 3 import org.openstreetmap.josm.data.coor.LatLon; 4 4 5 /** 6 * Abstract supperclass for all image objects. At the moment there is just 2, 7 * {@code MapillaryImportedImage} and {@code MapillaryImage}. 8 * 9 * @author nokutu 10 * 11 */ 5 12 public abstract class MapillaryAbstractImage { 6 13 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImportedImage.java
r31261 r31264 9 9 public class MapillaryImportedImage extends MapillaryAbstractImage { 10 10 11 /** 12 * The picture file. 13 */ 11 14 protected File file; 12 15 … … 16 19 } 17 20 21 /** 22 * Returns the pictures of the file. 23 * 24 * @return 25 * @throws IOException 26 */ 18 27 public BufferedImage getImage() throws IOException { 19 28 return ImageIO.read(file); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryMouseAdapter.java
r31255 r31264 12 12 import org.openstreetmap.josm.plugins.mapillary.commands.MapillaryRecord; 13 13 14 /** 15 * Handles the input event related with the layer. Mainly clicks. 16 * 17 * @author nokutu 18 * 19 */ 14 20 public class MapillaryMouseAdapter extends MouseAdapter { 15 21 private Point start; … … 19 25 private MapillaryData mapillaryData; 20 26 private MapillaryRecord record; 21 22 public MapillaryMouseAdapter() {27 28 public MapillaryMouseAdapter() { 23 29 mapillaryData = MapillaryData.getInstance(); 24 30 record = MapillaryRecord.getInstance(); … … 30 36 if (e.getButton() != MouseEvent.BUTTON1) 31 37 return; 32 if (Main.map.mapView.getActiveLayer() != MapillaryLayer 33 .getInstance()) 38 if (Main.map.mapView.getActiveLayer() != MapillaryLayer.getInstance()) 34 39 return; 35 40 MapillaryAbstractImage closestTemp = getClosest(e.getPoint()); 36 if (closestTemp instanceof MapillaryImage 37 || closestTemp == null) { 41 if (closestTemp instanceof MapillaryImage || closestTemp == null) { 38 42 MapillaryImage closest = (MapillaryImage) closestTemp; 39 43 // Doube click … … 49 53 this.lastClicked = this.closest; 50 54 this.closest = closest; 51 if (mapillaryData.getMultiSelectedImages() 52 .contains(closest)) 55 if (mapillaryData.getMultiSelectedImages().contains(closest)) 53 56 return; 54 57 // ctrl+click … … 64 67 && ((MapillaryImage) this.closest).getSequence() == ((MapillaryImage) this.lastClicked) 65 68 .getSequence()) { 66 int i = ((MapillaryImage) this.closest).getSequence() .getImages()67 . indexOf(this.closest);68 int j = ((MapillaryImage) this.lastClicked).getSequence() .getImages()69 . indexOf(this.lastClicked);69 int i = ((MapillaryImage) this.closest).getSequence() 70 .getImages().indexOf(this.closest); 71 int j = ((MapillaryImage) this.lastClicked).getSequence() 72 .getImages().indexOf(this.lastClicked); 70 73 if (i < j) 71 74 mapillaryData 72 75 .addMultiSelectedImage(new ArrayList<MapillaryAbstractImage>( 73 ((MapillaryImage) this.closest) .getSequence()74 .get Images()76 ((MapillaryImage) this.closest) 77 .getSequence().getImages() 75 78 .subList(i, j + 1))); 76 79 else 77 80 mapillaryData 78 81 .addMultiSelectedImage(new ArrayList<MapillaryAbstractImage>( 79 ((MapillaryImage) this.closest) .getSequence()80 .get Images()82 ((MapillaryImage) this.closest) 83 .getSequence().getImages() 81 84 .subList(j, i + 1))); 82 85 } … … 84 87 } else 85 88 mapillaryData.setSelectedImage(closest); 86 // If you select an dimported image89 // If you select an imported image 87 90 } else if (closestTemp instanceof MapillaryImportedImage) { 88 91 MapillaryImportedImage closest = (MapillaryImportedImage) closestTemp; … … 90 93 this.lastClicked = this.closest; 91 94 this.closest = closest; 92 if (mapillaryData.getMultiSelectedImages() 93 .contains(closest)) 95 if (mapillaryData.getMultiSelectedImages().contains(closest)) 94 96 return; 95 97 if (e.getModifiers() == (MouseEvent.BUTTON1_MASK | MouseEvent.CTRL_MASK) … … 106 108 MapillaryAbstractImage closest = null; 107 109 for (MapillaryAbstractImage image : mapillaryData.getImages()) { 108 Point imagePoint = Main.map.mapView.getPoint(image 109 .getLatLon()); 110 imagePoint 111 .setLocation(imagePoint.getX(), imagePoint.getY()); 110 Point imagePoint = Main.map.mapView.getPoint(image.getLatLon()); 111 imagePoint.setLocation(imagePoint.getX(), imagePoint.getY()); 112 112 double dist = clickPoint.distanceSq(imagePoint); 113 113 if (minDistance > dist … … 122 122 @Override 123 123 public void mouseDragged(MouseEvent e) { 124 if (Main.map.mapView.getActiveLayer() != MapillaryLayer 125 .getInstance()) 124 if (Main.map.mapView.getActiveLayer() != MapillaryLayer.getInstance()) 126 125 return; 127 126 if (MapillaryData.getInstance().getSelectedImage() != null) { 128 127 if (lastButton == MouseEvent.BUTTON1 && !e.isShiftDown()) { 129 LatLon to = Main.map.mapView.getLatLon(e.getX(), 130 e.getY()); 128 LatLon to = Main.map.mapView.getLatLon(e.getX(), e.getY()); 131 129 LatLon from = Main.map.mapView.getLatLon(start.getX(), 132 130 start.getY()); 133 for (MapillaryAbstractImage img : MapillaryData 134 .getInstance().getMultiSelectedImages()) { 135 img.move(to.getX() - from.getX(), 136 to.getY() - from.getY()); 131 for (MapillaryAbstractImage img : MapillaryData.getInstance() 132 .getMultiSelectedImages()) { 133 img.move(to.getX() - from.getX(), to.getY() - from.getY()); 137 134 } 138 135 Main.map.repaint(); 139 } else if (lastButton == MouseEvent.BUTTON1 140 && e.isShiftDown()) { 136 } else if (lastButton == MouseEvent.BUTTON1 && e.isShiftDown()) { 141 137 this.closest.turn(Math.toDegrees(Math.atan2( 142 138 (e.getX() - start.x), -(e.getY() - start.y))) 143 139 - closest.getTempCa()); 144 for (MapillaryAbstractImage img : MapillaryData 145 .getInstance().getMultiSelectedImages()) { 146 img.turn(Math.toDegrees(Math.atan2( 147 (e.getX() - start.x), -(e.getY() - start.y))) 148 - closest.getTempCa()); 140 for (MapillaryAbstractImage img : MapillaryData.getInstance() 141 .getMultiSelectedImages()) { 142 img.turn(Math.toDegrees(Math.atan2((e.getX() - start.x), 143 -(e.getY() - start.y))) - closest.getTempCa()); 149 144 } 150 145 Main.map.repaint(); … … 165 160 } else if (mapillaryData.getSelectedImage().getTempLatLon() != mapillaryData 166 161 .getSelectedImage().getLatLon()) { 167 LatLon from = mapillaryData.getSelectedImage() 168 .getTempLatLon(); 162 LatLon from = mapillaryData.getSelectedImage().getTempLatLon(); 169 163 LatLon to = mapillaryData.getSelectedImage().getLatLon(); 170 164 record.addCommand(new CommandMoveImage(mapillaryData 171 .getMultiSelectedImages(), to.getX() - from.getX(), 172 to.getY() - from.getY()));165 .getMultiSelectedImages(), to.getX() - from.getX(), to 166 .getY() - from.getY())); 173 167 } 174 168 for (MapillaryAbstractImage img : mapillaryData -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
r31252 r31264 33 33 } 34 34 35 /*36 * (non-Javadoc)37 *38 * @see39 * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)40 */41 35 @Override 42 36 public void actionPerformed(ActionEvent arg0) { 43 37 this.layer = null; 44 38 if (Main.map == null || Main.map.mapView == null 45 || Main.map.mapView.getEditLayer() == null) {39 || Main.map.mapView.getEditLayer() == null) 46 40 return; 47 } 48 for (Layer layer : Main.map.mapView.getAllLayers()) { 49 if (layer instanceof MapillaryLayer) { 41 for (Layer layer : Main.map.mapView.getAllLayers()) 42 if (layer instanceof MapillaryLayer) 50 43 this.layer = (MapillaryLayer) layer; 51 }52 }53 44 54 45 if (this.layer == null) -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
r31261 r31264 69 69 export(MapillaryData.getInstance().getMultiSelectedImages()); 70 70 } 71 // This option ignores the selected directory. 71 72 } else if (dialog.group.isSelected(dialog.rewrite.getModel())) { 72 73 ArrayList<MapillaryImportedImage> images = new ArrayList<>(); -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryCommand.java
r31257 r31264 17 17 18 18 public abstract void redo(); 19 19 20 /** 21 * If two equal commands are applied consecutively to the same set of 22 * images, they are summed in order to reduce them to just one command. 23 * 24 * @param command 25 */ 20 26 public abstract void sum(MapillaryCommand command); 21 27 28 /** 29 * Checks if the image has been modified, compairing with its original 30 * values. 31 */ 22 32 public void checkModified() { 23 33 for (MapillaryAbstractImage image : images) -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillaryImageInfoDownloaderThread.java
r31259 r31264 39 39 JsonObject jsonobj = Json.createReader(br).readObject(); 40 40 if (!jsonobj.getBoolean("more")) 41 ex.shutdown Now();41 ex.shutdown(); 42 42 JsonArray jsonarr = jsonobj.getJsonArray("ims"); 43 43 JsonObject data; … … 53 53 ((MapillaryImage) image).setCapturedAt(data 54 54 .getJsonNumber("captured_at").intValue()); 55 ((MapillaryImage) image).setLocation(data.getString("location")); 55 ((MapillaryImage) image).setLocation(data 56 .getString("location")); 56 57 } 57 58 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/gui/MapillaryToggleDialog.java
r31263 r31264 45 45 ICachedLoaderListener, MapillaryDataListener { 46 46 47 public final static int NORMAL_MODE = 0; 48 public final static int SIGNAL_MODE = 1; 49 47 50 public static MapillaryToggleDialog INSTANCE; 48 51 … … 63 66 64 67 private int mode; 65 66 public final static int NORMAL_MODE = 0;67 public final static int SIGNAL_MODE = 1;68 68 69 69 private JPanel buttonsPanel; … … 182 182 c++; 183 183 } 184 if (first >= i) {184 if (first >= i) 185 185 previousSignalButton.setEnabled(false); 186 } 187 if (last <= i) { 186 if (last <= i) 188 187 nextSignalButton.setEnabled(false); 189 }190 188 } 191 189 … … 277 275 } 278 276 277 /** 278 * Action class to jump to the image following the red line. 279 * 280 * @author nokutu 281 * 282 */ 279 283 class redAction extends AbstractAction { 280 284 public redAction() { … … 294 298 } 295 299 300 /** 301 * Action class to jump to the image following the blue line. 302 * 303 * @author nokutu 304 * 305 */ 296 306 class blueAction extends AbstractAction { 297 307 public blueAction() { … … 377 387 } 378 388 389 /** 390 * Action class to jump to the next picture containing a signal. 391 * 392 * @author nokutu 393 * 394 */ 379 395 class NextSignalAction extends AbstractAction { 380 396 public NextSignalAction() { 381 397 putValue(NAME, tr("Next Signal")); 382 398 putValue(SHORT_DESCRIPTION, 383 tr("Jumps to the next picture that contains a sig anl"));399 tr("Jumps to the next picture that contains a signal")); 384 400 } 385 401 … … 406 422 } 407 423 424 /** 425 * Action class to jump to the previous picture containing a signal. 426 * 427 * @author nokutu 428 * 429 */ 408 430 class PreviousSignalAction extends AbstractAction { 409 431 public PreviousSignalAction() { 410 432 putValue(NAME, tr("Previous Signal")); 411 433 putValue(SHORT_DESCRIPTION, 412 tr("Jumps to the previous picture that contains a sig anl"));434 tr("Jumps to the previous picture that contains a signal")); 413 435 } 414 436
Note:
See TracChangeset
for help on using the changeset viewer.