Changeset 12759 in josm for trunk/src/org
- Timestamp:
- 2017-09-06T17:00:54+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/MoveAction.java
r12641 r12759 144 144 ((MoveCommand) c).moveAgain(distx, disty); 145 145 } else { 146 c = new MoveCommand( selection, distx, disty);146 c = new MoveCommand(ds, selection, distx, disty); 147 147 MainApplication.undoRedo.add(c); 148 148 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r12726 r12759 1244 1244 virtualCmds.add(new ChangeCommand(ds, w, wnew)); 1245 1245 } 1246 virtualCmds.add(new MoveCommand( virtualNode, startEN, currentEN));1246 virtualCmds.add(new MoveCommand(ds, virtualNode, startEN, currentEN)); 1247 1247 String text = trn("Add and move a virtual new node to way", 1248 1248 "Add and move a virtual new node to {0} ways", virtualWays.size(), -
trunk/src/org/openstreetmap/josm/command/MoveCommand.java
r12726 r12759 16 16 import org.openstreetmap.josm.data.coor.EastNorth; 17 17 import org.openstreetmap.josm.data.coor.LatLon; 18 import org.openstreetmap.josm.data.osm.DataSet; 18 19 import org.openstreetmap.josm.data.osm.Node; 19 20 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 92 93 */ 93 94 public MoveCommand(Collection<OsmPrimitive> objects, double x, double y) { 94 super(objects.iterator().next().getDataSet()); 95 this(objects.iterator().next().getDataSet(), objects, x, y); 96 } 97 98 /** 99 * Constructs a new {@code MoveCommand} and assign the initial object set and movement vector. 100 * @param ds the dataset context for moving these primitives. Must not be null. 101 * @param objects The primitives to move. Must neither be null. 102 * @param x X difference movement. Coordinates are in northern/eastern 103 * @param y Y difference movement. Coordinates are in northern/eastern 104 * @throws NullPointerException if objects is null or contain null item 105 * @throws NoSuchElementException if objects is empty 106 * @since 12759 107 */ 108 public MoveCommand(DataSet ds, Collection<OsmPrimitive> objects, double x, double y) { 109 super(ds); 95 110 startEN = null; 96 111 saveCheckpoint(); // (0,0) displacement will be saved … … 106 121 /** 107 122 * Constructs a new {@code MoveCommand} to move a collection of primitives. 123 * @param ds the dataset context for moving these primitives. Must not be null. 108 124 * @param objects The primitives to move 109 125 * @param start The starting position (northern/eastern) 110 126 * @param end The ending position (northern/eastern) 127 * @since 12759 128 */ 129 public MoveCommand(DataSet ds, Collection<OsmPrimitive> objects, EastNorth start, EastNorth end) { 130 this(Objects.requireNonNull(ds, "ds"), 131 Objects.requireNonNull(objects, "objects"), 132 Objects.requireNonNull(end, "end").getX() - Objects.requireNonNull(start, "start").getX(), 133 Objects.requireNonNull(end, "end").getY() - Objects.requireNonNull(start, "start").getY()); 134 startEN = start; 135 } 136 137 /** 138 * Constructs a new {@code MoveCommand} to move a collection of primitives. 139 * @param objects The primitives to move 140 * @param start The starting position (northern/eastern) 141 * @param end The ending position (northern/eastern) 111 142 */ 112 143 public MoveCommand(Collection<OsmPrimitive> objects, EastNorth start, EastNorth end) { 113 this( 114 Objects.requireNonNull(objects, "objects"), 115 Objects.requireNonNull(end, "end").getX() - Objects.requireNonNull(start, "start").getX(), 116 Objects.requireNonNull(end, "end").getY() - Objects.requireNonNull(start, "start").getY()); 117 startEN = start; 144 this(Objects.requireNonNull(objects, "objects").iterator().next().getDataSet(), objects, start, end); 145 } 146 147 /** 148 * Constructs a new {@code MoveCommand} to move a primitive. 149 * @param ds the dataset context for moving these primitives. Must not be null. 150 * @param p The primitive to move 151 * @param start The starting position (northern/eastern) 152 * @param end The ending position (northern/eastern) 153 * @since 12759 154 */ 155 public MoveCommand(DataSet ds, OsmPrimitive p, EastNorth start, EastNorth end) { 156 this(ds, Collections.singleton(Objects.requireNonNull(p, "p")), start, end); 118 157 } 119 158 … … 125 164 */ 126 165 public MoveCommand(OsmPrimitive p, EastNorth start, EastNorth end) { 127 this( 128 Collections.singleton(Objects.requireNonNull(p, "p")), 129 Objects.requireNonNull(end, "end").getX() - Objects.requireNonNull(start, "start").getX(), 130 Objects.requireNonNull(end, "end").getY() - Objects.requireNonNull(start, "start").getY()); 131 startEN = start; 166 this(Collections.singleton(Objects.requireNonNull(p, "p")), start, end); 132 167 } 133 168
Note:
See TracChangeset
for help on using the changeset viewer.