Changeset 31487 in osm for applications/editors/josm/plugins/mapillary/src
- Timestamp:
- 2015-08-12T12:39:16+02:00 (9 years ago)
- Location:
- applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryData.java
r31460 r31487 20 20 public class MapillaryData { 21 21 22 private finalList<MapillaryAbstractImage> images;22 private List<MapillaryAbstractImage> images; 23 23 private MapillaryAbstractImage selectedImage; 24 24 /** The image under the cursor */ … … 64 64 public synchronized void add(MapillaryAbstractImage image) { 65 65 add(image, true); 66 } 67 68 /** 69 * Removes an image from the database. 70 * 71 * @param image 72 */ 73 public synchronized void delete(MapillaryAbstractImage image) { 74 if (MapillaryMainDialog.getInstance().getImage() != null) { 75 MapillaryMainDialog.getInstance().setImage(null); 76 MapillaryMainDialog.getInstance().updateImage(); 77 } 78 setSelectedImage(null); 79 this.images.remove(image); 80 if (image.getSequence() != null) 81 image.getSequence().remove(image); 82 if (Main.main != null) 83 dataUpdated(); 84 } 85 86 /** 87 * Removes a set of images from the database. 88 * 89 * @param images 90 */ 91 public synchronized void delete(List<MapillaryAbstractImage> images) { 92 for (MapillaryAbstractImage img : images) 93 delete(img); 66 94 } 67 95 … … 359 387 360 388 /** 389 * Sets a new ArrayList object as the used set of images. 390 * 391 * @param images 392 */ 393 public synchronized void setImages(List<MapillaryAbstractImage> images) { 394 this.images = new ArrayList<>(images); 395 } 396 397 /** 361 398 * Returns the amount of images contained by this object. 362 399 * -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryLayer.java
r31460 r31487 5 5 6 6 import org.openstreetmap.josm.plugins.mapillary.cache.CacheUtils; 7 import org.openstreetmap.josm.plugins.mapillary.commands.CommandDeleteImage; 8 import org.openstreetmap.josm.plugins.mapillary.commands.MapillaryRecord; 7 9 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader; 8 10 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryFilterDialog; … … 44 46 import java.awt.Rectangle; 45 47 import java.awt.TexturePaint; 48 import java.awt.event.ActionEvent; 46 49 import java.awt.geom.AffineTransform; 47 50 import java.awt.geom.Area; … … 49 52 import java.awt.image.BufferedImage; 50 53 54 import javax.swing.AbstractAction; 51 55 import javax.swing.ImageIcon; 52 56 import javax.swing.Action; 53 57 import javax.swing.Icon; 58 import javax.swing.JComponent; 59 import javax.swing.KeyStroke; 54 60 55 61 import java.util.List; … … 126 132 } 127 133 createHatchTexture(); 134 135 MapillaryMainDialog.getInstance() 136 .getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) 137 .put(KeyStroke.getKeyStroke("DELETE"), "MapillaryDel"); 138 MapillaryMainDialog.getInstance().getActionMap() 139 .put("MapillaryDel", new DeleteImageAction()); 140 128 141 if (Main.main != null) 129 142 MapillaryData.dataUpdated(); … … 176 189 public void destroy() { 177 190 setMode(null); 191 178 192 AbstractMode.resetThread(); 179 193 MapillaryDownloader.stopAll(); … … 593 607 // Nothing 594 608 } 609 610 /** 611 * Action used to delete images. 612 * 613 * @author nokutu 614 * 615 */ 616 private class DeleteImageAction extends AbstractAction { 617 618 private static final long serialVersionUID = -982809854631863962L; 619 620 @Override 621 public void actionPerformed(ActionEvent e) { 622 if (INSTANCE != null) { 623 MapillaryRecord.getInstance().addCommand( 624 new CommandDeleteImage(getData().getMultiSelectedImages())); 625 } 626 } 627 } 595 628 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/CommandMoveImage.java
r31479 r31487 3 3 import static org.openstreetmap.josm.tools.I18n.trn; 4 4 5 import java.util.ArrayList;6 5 import java.util.List; 7 6 … … 31 30 public CommandMoveImage(List<MapillaryAbstractImage> images, double x, 32 31 double y) { 33 this.images = new ArrayList<MapillaryAbstractImage>(images);32 super(images); 34 33 this.x = x; 35 34 this.y = y; -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/CommandTurnImage.java
r31479 r31487 3 3 import static org.openstreetmap.josm.tools.I18n.trn; 4 4 5 import java.util.ArrayList;6 5 import java.util.List; 7 6 … … 27 26 */ 28 27 public CommandTurnImage(List<MapillaryAbstractImage> images, double ca) { 29 this.images = new ArrayList<MapillaryAbstractImage>(images);28 super(images); 30 29 this.ca = ca; 31 30 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryCommand.java
r31445 r31487 1 1 package org.openstreetmap.josm.plugins.mapillary.commands; 2 2 3 import java.util.ArrayList; 3 4 import java.util.List; 4 5 … … 13 14 public abstract class MapillaryCommand { 14 15 protected List<MapillaryAbstractImage> images; 16 17 /** 18 * Main constructor. 19 * 20 * @param images 21 * The images that are affected by the command. 22 */ 23 public MapillaryCommand(List<MapillaryAbstractImage> images) { 24 this.images = new ArrayList<MapillaryAbstractImage>(images); 25 } 15 26 16 27 /** … … 28 39 * they are summed in order to reduce them to just one command. 29 40 * 30 * @param command The command to be summed to last command. 41 * @param command 42 * The command to be summed to last command. 31 43 */ 32 44 public abstract void sum(MapillaryCommand command); … … 39 51 image.isModified = (image.tempLatLon == image.latLon || image.tempCa == image.ca); 40 52 } 53 54 @Override 55 public abstract String toString(); 41 56 } -
applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/commands/MapillaryRecord.java
r31479 r31487 69 69 */ 70 70 public void addCommand(MapillaryCommand command) { 71 if (command instanceof MapillaryExecutableCommand) 72 ((MapillaryExecutableCommand) command).execute(); 71 73 // Checks if it is a continuation of last command 72 74 if (this.position != -1) {
Note:
See TracChangeset
for help on using the changeset viewer.