Changeset 32589 in osm for applications/editors/josm/plugins/mapillary/src/org
- Timestamp:
- 2016-07-06T15:40:30+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/mode/SelectMode.java
r32572 r32589 9 9 import java.awt.event.MouseEvent; 10 10 import java.util.concurrent.ConcurrentSkipListSet; 11 12 import javax.swing.SwingUtilities; 11 13 12 14 import org.openstreetmap.josm.Main; … … 32 34 public class SelectMode extends AbstractMode { 33 35 private Point start; 34 private int lastButton;35 36 private MapillaryAbstractImage closest; 36 37 private MapillaryAbstractImage lastClicked; … … 48 49 @Override 49 50 public void mousePressed(MouseEvent e) { 50 this.lastButton = e.getButton();51 51 if (e.getButton() != MouseEvent.BUTTON1) { 52 52 return; … … 99 99 @Override 100 100 public void mouseDragged(MouseEvent e) { 101 if (Main.getLayerManager().getActiveLayer() != MapillaryLayer.getInstance()) { 102 return; 103 } 104 105 if (!Main.pref.getBoolean("mapillary.developer")) { 106 for (MapillaryAbstractImage img : this.data.getMultiSelectedImages()) { 107 if (img instanceof MapillaryImage) { 108 return; 101 MapillaryAbstractImage highlightImg = data.getHighlightedImage(); 102 if ( 103 Main.getLayerManager().getActiveLayer() == MapillaryLayer.getInstance() 104 && SwingUtilities.isLeftMouseButton(e) 105 && highlightImg != null && highlightImg.getLatLon() != null 106 ) { 107 Point highlightImgPoint = Main.map.mapView.getPoint(highlightImg.getTempLatLon()); 108 if (e.isShiftDown()) { // turn 109 for (MapillaryAbstractImage img : data.getMultiSelectedImages()) { 110 if (Main.pref.getBoolean("mapillary.developer") || !(img instanceof MapillaryImage)) { 111 img.turn(Math.toDegrees(Math.atan2((e.getX() - highlightImgPoint.getX()), -(e.getY() - highlightImgPoint.getY()))) - highlightImg.getTempCa()); 112 } 109 113 } 110 } 111 } 112 if (this.data.getSelectedImage() != null) { 113 if (this.lastButton == MouseEvent.BUTTON1 && !e.isShiftDown()) { 114 LatLon to = Main.map.mapView.getLatLon(e.getX(), e.getY()); 115 LatLon from = Main.map.mapView.getLatLon(this.start.getX(), this.start.getY()); 114 } else { // move 116 115 for (MapillaryAbstractImage img : this.data.getMultiSelectedImages()) { 117 img.move(to.getX() - from.getX(), to.getY() - from.getY()); 116 if (Main.pref.getBoolean("mapillary.developer") || !(img instanceof MapillaryImage)) { 117 LatLon eventLatLon = Main.map.mapView.getLatLon(e.getX(), e.getY()); 118 LatLon imgLatLon = Main.map.mapView.getLatLon(highlightImgPoint.getX(), highlightImgPoint.getY()); 119 img.move(eventLatLon.getX() - imgLatLon.getX(), eventLatLon.getY() - imgLatLon.getY()); 120 } 118 121 } 119 Main.map.repaint(); 120 } else if (this.lastButton == MouseEvent.BUTTON1 && e.isShiftDown()) { 121 this.closest.turn(Math.toDegrees(Math.atan2((e.getX() - this.start.x), 122 -(e.getY() - this.start.y))) 123 - this.closest.getTempCa()); 124 for (MapillaryAbstractImage img : this.data.getMultiSelectedImages()) { 125 img.turn(Math.toDegrees(Math.atan2((e.getX() - this.start.x), 126 -(e.getY() - this.start.y))) - this.closest.getTempCa()); 127 } 128 Main.map.repaint(); 129 } 122 } 123 Main.map.repaint(); 130 124 } 131 125 }
Note:
See TracChangeset
for help on using the changeset viewer.