Changeset 31218 in osm for applications/editors
- Timestamp:
- 2015-06-04T16:39:36+02:00 (10 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31185 r31218 157 157 if (image.next() != null) { 158 158 new MapillaryCache(image.next().getKey(), 159 MapillaryCache.Type.THUMBNAIL).submit( 160 this, false); 159 MapillaryCache.Type.THUMBNAIL).submit(this, false); 161 160 if (image.next().next() != null) 162 161 new MapillaryCache(image.next().next().getKey(), 163 MapillaryCache.Type.THUMBNAIL) 164 .submit(this, false); 162 MapillaryCache.Type.THUMBNAIL).submit(this, false); 165 163 } 166 164 if (image.previous() != null) { 167 165 new MapillaryCache(image.previous().getKey(), 168 MapillaryCache.Type.THUMBNAIL).submit( 169 this, false); 166 MapillaryCache.Type.THUMBNAIL).submit(this, false); 170 167 if (image.previous().previous() != null) 171 168 new MapillaryCache(image.previous().previous().getKey(), 172 MapillaryCache.Type.THUMBNAIL) 173 .submit(this, false); 169 MapillaryCache.Type.THUMBNAIL).submit(this, false); 174 170 } 175 171 } … … 187 183 */ 188 184 public void addMultiSelectedImage(MapillaryImage image) { 189 this.multiSelectedImages.add(image); 185 if (this.getSelectedImage() != null) 186 this.multiSelectedImages.add(image); 187 else 188 this.setSelectedImage(image); 190 189 Main.map.mapView.repaint(); 191 190 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryImage.java
r31217 r31218 11 11 */ 12 12 public class MapillaryImage { 13 /** Unique identifier of the object */ 13 14 private final String key; 15 /** Postion of the picture */ 14 16 private final LatLon latLon; 17 /** Direction of the picture */ 15 18 private final double ca; 19 /** Sequence of pictures containing this */ 16 20 private MapillarySequence sequence; 17 21 18 22 private boolean isModified = false; 23 /** Temporal position of the picture until it is uplaoded */ 19 24 private LatLon tempLatLon; 25 /** 26 * When the object is being dragged in the map, the temporal position is 27 * stored here 28 */ 29 private LatLon movingLatLon; 30 /** Temporal direction of the picture until it is uplaoded */ 20 31 private double tempCa; 21 32 … … 36 47 this.latLon = new LatLon(lat, lon); 37 48 this.tempLatLon = new LatLon(lat, lon); 49 this.movingLatLon = new LatLon(lat, lon); 38 50 this.ca = ca; 39 51 this.tempCa = ca; … … 55 67 */ 56 68 public LatLon getLatLon() { 57 return tempLatLon;69 return movingLatLon; 58 70 } 59 71 60 72 /** 61 73 * Moves the image temporally to another position … … 63 75 * @param pos 64 76 */ 65 public void move(LatLon pos) { 66 this.tempLatLon = pos; 77 public void move(double x, double y) { 78 this.movingLatLon = new LatLon(this.tempLatLon.getY() + y, 79 this.tempLatLon.getX() + x); 67 80 this.isModified = true; 68 81 } 69 82 70 83 /** 71 84 * Turns the image direction. 85 * 72 86 * @param ca 73 87 */ … … 75 89 this.tempCa = ca; 76 90 this.isModified = true; 91 } 92 93 /** 94 * Called when the mouse button is released, meaning that the picture has 95 * stopped being dragged. 96 */ 97 public void stopMoving() { 98 this.tempLatLon = this.movingLatLon; 77 99 } 78 100 -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31217 r31218 136 136 } 137 137 start = e.getPoint(); 138 if (mapillaryData.getMultiSelectedImages().contains(closest)) 139 return; 138 140 if (e.getModifiers() == (MouseEvent.BUTTON1_MASK | MouseEvent.CTRL_MASK)) 139 141 mapillaryData.addMultiSelectedImage(closest); … … 146 148 if (MapillaryData.getInstance().getSelectedImage() != null) { 147 149 if (lastButton == MouseEvent.BUTTON1 && !e.isShiftDown()) { 148 MapillaryData 149 .getInstance() 150 .getSelectedImage() 151 .move(Main.map.mapView.getLatLon(e.getX(), 152 e.getY())); 150 LatLon to = Main.map.mapView.getLatLon(e.getX(), 151 e.getY()); 152 LatLon from = Main.map.mapView.getLatLon(start.getX(), 153 start.getY()); 154 for (MapillaryImage img : MapillaryData.getInstance() 155 .getMultiSelectedImages()) { 156 img.move(to.getX() - from.getX(), 157 to.getY() - from.getY()); 158 } 153 159 Main.map.repaint(); 154 } else if (lastButton == MouseEvent.BUTTON1 && e.isShiftDown()) { 155 MapillaryData 156 .getInstance() 157 .getSelectedImage().turn(Math.toDegrees(Math.atan2((e.getX() - start.x), -(e.getY() - start.y)))); 160 } else if (lastButton == MouseEvent.BUTTON1 161 && e.isShiftDown()) { 162 for (MapillaryImage img : MapillaryData.getInstance() 163 .getMultiSelectedImages()) { 164 img.turn(Math.toDegrees(Math.atan2( 165 (e.getX() - start.x), -(e.getY() - start.y)))); 166 } 158 167 Main.map.repaint(); 159 168 } 169 } 170 } 171 172 @Override 173 public void mouseReleased(MouseEvent e) { 174 for (MapillaryImage img : MapillaryData.getInstance() 175 .getMultiSelectedImages()) { 176 if (img != null) 177 img.stopMoving(); 160 178 } 161 179 }
Note:
See TracChangeset
for help on using the changeset viewer.