- Timestamp:
- 2014-02-24T17:49:12+01:00 (11 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/relation/DuplicateRelationAction.java
r6093 r6881 11 11 import org.openstreetmap.josm.tools.ImageProvider; 12 12 13 14 13 /** 15 14 * Creates a new relation with a copy of the current editor state … … 17 16 */ 18 17 public class DuplicateRelationAction extends AbstractRelationAction { 19 18 20 19 /** 21 * Constructs a new {@code DuplicateRelationAction}. 20 * Constructs a new {@code DuplicateRelationAction}. 22 21 */ 23 22 public DuplicateRelationAction() { … … 27 26 } 28 27 28 /** 29 * Duplicates the given relation and launches the relation editor for the created copy. 30 * @param original The relation to duplicate 31 */ 29 32 public static void duplicateRelationAndLaunchEditor(Relation original) { 30 33 Relation copy = new Relation(original, true); … … 50 53 // only one selected relation can be edited 51 54 setEnabled( relations.size()==1 ); 52 } 55 } 53 56 } -
trunk/src/org/openstreetmap/josm/command/AddCommand.java
r6380 r6881 17 17 18 18 /** 19 * A command that adds an osm primitive to a dataset. Keys cannot be added this 20 * way. 19 * A command that adds an osm primitive to a dataset. Keys cannot be added this way. 21 20 * 22 21 * See {@link ChangeCommand} for comments on relation back references. … … 32 31 33 32 /** 34 * Create the command and specify the element to add. 33 * Creates the command and specify the element to add in the context of the current edit layer, if any. 34 * @param osm The primitive to add 35 35 */ 36 36 public AddCommand(OsmPrimitive osm) { 37 super();38 37 this.osm = osm; 39 38 } 40 39 41 40 /** 42 * Create the command and specify the element to add. 41 * Creates the command and specify the element to add in the context of the given data layer. 42 * @param layer The data layer. Must not be {@code null} 43 * @param osm The primitive to add 43 44 */ 44 45 public AddCommand(OsmDataLayer layer, OsmPrimitive osm) { … … 47 48 } 48 49 49 @Override public boolean executeCommand() { 50 @Override 51 public boolean executeCommand() { 50 52 getLayer().data.addPrimitive(osm); 51 53 osm.setModified(true); … … 53 55 } 54 56 55 @Override public void undoCommand() { 57 @Override 58 public void undoCommand() { 56 59 getLayer().data.removePrimitive(osm); 57 60 } 58 61 59 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 62 @Override 63 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 60 64 added.add(osm); 61 65 } -
trunk/src/org/openstreetmap/josm/command/ChangeCommand.java
r6380 r6881 27 27 private final OsmPrimitive newOsm; 28 28 29 /** 30 * Constructs a new {@code ChangeCommand} in the context of the current edit layer, if any. 31 * @param osm The existing primitive to modify 32 * @param newOsm The new primitive 33 */ 29 34 public ChangeCommand(OsmPrimitive osm, OsmPrimitive newOsm) { 30 super();31 35 this.osm = osm; 32 36 this.newOsm = newOsm; … … 34 38 } 35 39 40 /** 41 * Constructs a new {@code ChangeCommand} in the context of a given data layer. 42 * @param layer The data layer 43 * @param osm The existing primitive to modify 44 * @param newOsm The new primitive 45 */ 36 46 public ChangeCommand(OsmDataLayer layer, OsmPrimitive osm, OsmPrimitive newOsm) { 37 47 super(layer); … … 40 50 sanityChecks(); 41 51 } 42 52 43 53 private void sanityChecks() { 44 54 CheckParameterUtil.ensureParameterNotNull(osm, "osm"); -
trunk/src/org/openstreetmap/josm/command/ChangeNodesCommand.java
r4918 r6881 6 6 import java.util.Collection; 7 7 import java.util.List; 8 8 9 import javax.swing.Icon; 9 10 10 11 import org.openstreetmap.josm.data.osm.Node; 11 import org.openstreetmap.josm.data.osm.Way;12 12 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 13 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 14 import org.openstreetmap.josm.data.osm.Way; 14 15 import org.openstreetmap.josm.gui.DefaultNameFormatter; 15 16 import org.openstreetmap.josm.tools.ImageProvider; … … 28 29 private final List<Node> newNodes; 29 30 31 /** 32 * Constructs a new {@code ChangeNodesCommand}. 33 * @param way The way to modify 34 * @param newNodes The new list of nodes for the given way 35 */ 30 36 public ChangeNodesCommand(Way way, List<Node> newNodes) { 31 super();32 37 this.way = way; 33 38 this.newNodes = newNodes; 34 39 } 35 40 36 @Override public boolean executeCommand() { 41 @Override 42 public boolean executeCommand() { 37 43 super.executeCommand(); 38 44 way.setNodes(newNodes); … … 41 47 } 42 48 43 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 49 @Override 50 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 44 51 modified.add(way); 45 52 } -
trunk/src/org/openstreetmap/josm/command/ChangePropertyCommand.java
r6679 r6881 49 49 */ 50 50 public ChangePropertyCommand(Collection<? extends OsmPrimitive> objects, AbstractMap<String, String> tags) { 51 super();52 51 this.objects = new LinkedList<OsmPrimitive>(); 53 52 this.tags = tags; … … 184 183 185 184 if (allnull) { 186 /* I18n: plural form detected for objects only (but value < 2 not possible!), try to do your best for tags */ 185 /* I18n: plural form detected for objects only (but value < 2 not possible!), try to do your best for tags */ 187 186 text = trn("Deleted {0} tags for {1} object", "Deleted {0} tags for {1} objects", objects.size(), tags.size(), objects.size()); 188 187 } else { … … 222 221 } 223 222 223 /** 224 * Returns the tags to set (key/value pairs). 225 * @return the tags to set (key/value pairs) 226 */ 224 227 public Map<String, String> getTags() { 225 228 return Collections.unmodifiableMap(tags); -
trunk/src/org/openstreetmap/josm/command/ChangeRelationMemberRoleCommand.java
r6830 r6881 33 33 private Boolean oldModified; 34 34 35 /** 36 * Constructs a new {@code ChangeRelationMemberRoleCommand}. 37 * @param relation The relation to be changed 38 * @param position Member position 39 * @param newRole New role 40 */ 35 41 public ChangeRelationMemberRoleCommand(Relation relation, int position, String newRole) { 36 super();37 42 this.relation = relation; 38 43 this.position = position; … … 40 45 } 41 46 42 @Override public boolean executeCommand() { 47 @Override 48 public boolean executeCommand() { 43 49 if (position < 0 || position >= relation.getMembersCount()) 44 50 return false; … … 53 59 } 54 60 55 @Override public void undoCommand() { 61 @Override 62 public void undoCommand() { 56 63 relation.setMember(position, new RelationMember(oldRole, relation.getMember(position).getMember())); 57 64 relation.setModified(oldModified); 58 65 } 59 66 60 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 67 @Override 68 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 61 69 modified.add(relation); 62 70 } -
trunk/src/org/openstreetmap/josm/command/Command.java
r6639 r6881 3 3 4 4 import java.awt.GridBagLayout; 5 import java.awt.geom.Area;6 5 import java.util.ArrayList; 7 6 import java.util.Collection; … … 160 159 * 161 160 */ 162 protected 161 protected OsmDataLayer getLayer() { 163 162 return layer; 164 163 } -
trunk/src/org/openstreetmap/josm/command/ConflictResolveCommand.java
r6248 r6881 21 21 private ConflictCollection resolvedConflicts; 22 22 23 /** 24 * Constructs a new {@code ConflictResolveCommand} in the context of the current edit layer, if any. 25 */ 23 26 public ConflictResolveCommand() { 24 27 super(); … … 26 29 } 27 30 31 /** 32 * Constructs a new {@code ConflictResolveCommand} in the context of a given data layer. 33 * @param layer the data layer. Must not be null. 34 */ 28 35 public ConflictResolveCommand(OsmDataLayer layer) { 29 36 super(layer); -
trunk/src/org/openstreetmap/josm/command/CoordinateConflictResolveCommand.java
r5816 r6881 5 5 6 6 import java.util.Collection; 7 7 8 import javax.swing.Icon; 8 9 … … 14 15 15 16 /** 16 * Represents a the resolution of a conflict between the coordinates of two {@link Node}s17 * Represents the resolution of a conflict between the coordinates of two {@link Node}s. 17 18 * 18 19 */ -
trunk/src/org/openstreetmap/josm/command/DeleteCommand.java
r6639 r6881 348 348 349 349 if (alsoDeleteNodesInWay) { 350 // delete untagged nodes only referenced by primitives in primitivesToDelete, 351 // too 350 // delete untagged nodes only referenced by primitives in primitivesToDelete, too 352 351 Collection<Node> nodesToDelete = computeNodesToDelete(layer, primitivesToDelete); 353 352 primitivesToDelete.addAll(nodesToDelete); … … 371 370 } 372 371 373 // get a confirmation that the objects to delete can be removed from their parent 374 // relations 372 // get a confirmation that the objects to delete can be removed from their parent relations 375 373 // 376 374 if (!silent) { -
trunk/src/org/openstreetmap/josm/command/DeletedStateConflictResolveCommand.java
r5816 r6881 9 9 10 10 import org.openstreetmap.josm.data.conflict.Conflict; 11 import org.openstreetmap.josm.data.osm.Node;12 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 13 12 import org.openstreetmap.josm.gui.conflict.pair.MergeDecisionType; … … 16 15 17 16 /** 18 * Represents a the resolution of a conflict between the coordinates of two {@link Node}s17 * Represents the resolution of a conflict between the deleted flag of two {@link OsmPrimitive}s. 19 18 * 20 19 */ -
trunk/src/org/openstreetmap/josm/command/ModifiedConflictResolveCommand.java
r5926 r6881 15 15 16 16 /** 17 * Represents a command for to set the modified flag {@link OsmPrimitive}17 * Represents the resolution of a conflict between the modified flag of two {@link OsmPrimitive}s. 18 18 * 19 19 * -
trunk/src/org/openstreetmap/josm/command/MoveCommand.java
r6380 r6881 53 53 private List<OldNodeState> oldState = new LinkedList<OldNodeState>(); 54 54 55 /** 56 * Constructs a new {@code MoveCommand} to move a primitive. 57 * @param osm The primitive to move 58 * @param x X difference movement. Coordinates are in northern/eastern 59 * @param y Y difference movement. Coordinates are in northern/eastern 60 */ 55 61 public MoveCommand(OsmPrimitive osm, double x, double y) { 56 62 this(Collections.singleton(osm), x, y); 57 63 } 58 64 65 /** 66 * Constructs a new {@code MoveCommand} to move a node. 67 * @param node The node to move 68 */ 59 69 public MoveCommand(Node node, LatLon position) { 60 70 this(Collections.singleton((OsmPrimitive) node), node.getEastNorth().sub(Projections.project(position))); 61 71 } 62 72 73 /** 74 * Constructs a new {@code MoveCommand} to move a collection of primitives. 75 * @param objects The primitives to move 76 * @param offset The movement vector 77 */ 63 78 public MoveCommand(Collection<OsmPrimitive> objects, EastNorth offset) { 64 79 this(objects, offset.getX(), offset.getY()); … … 66 81 67 82 /** 68 * Create a MoveCommand and assign the initial object set and movement vector. 83 * Constructs a new {@code MoveCommand} and assign the initial object set and movement vector. 84 * @param objects The primitives to move 85 * @param x X difference movement. Coordinates are in northern/eastern 86 * @param y Y difference movement. Coordinates are in northern/eastern 69 87 */ 70 88 public MoveCommand(Collection<OsmPrimitive> objects, double x, double y) { 71 super();72 89 startEN = null; 73 90 saveCheckpoint(); // (0,0) displacement will be saved … … 97 114 * The move is immediately executed and any undo will undo both vectors to 98 115 * the original position the objects had before first moving. 116 * 117 * @param x X difference movement. Coordinates are in northern/eastern 118 * @param y Y difference movement. Coordinates are in northern/eastern 99 119 */ 100 120 public void moveAgain(double x, double y) { … … 157 177 } 158 178 159 @Override public boolean executeCommand() { 179 @Override 180 public boolean executeCommand() { 160 181 for (Node n : nodes) { 161 182 // in case #3892 happens again … … 171 192 } 172 193 173 @Override public void undoCommand() { 194 @Override 195 public void undoCommand() { 174 196 Iterator<OldNodeState> it = oldState.iterator(); 175 197 for (Node n : nodes) { … … 180 202 } 181 203 182 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 204 @Override 205 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 183 206 for (OsmPrimitive osm : nodes) { 184 207 modified.add(osm); -
trunk/src/org/openstreetmap/josm/command/RelationMemberConflictResolverCommand.java
r6336 r6881 17 17 18 18 /** 19 * Represent a command for resolving conflicts in the member lists of two 20 * {@link Relation}s. 19 * Represents the resolution of conflicts in the member list of two {@link Relation}s. 21 20 * 22 21 */ 23 public class RelationMemberConflictResolverCommand extends Co mmand {22 public class RelationMemberConflictResolverCommand extends ConflictResolveCommand { 24 23 /** my relation */ 25 24 private final Relation my; … … 30 29 */ 31 30 private final List<RelationMember> mergedMembers; 32 33 /** the layer this conflict is resolved in */34 private OsmDataLayer layer;35 31 36 32 /** … … 62 58 super.executeCommand(); 63 59 64 // replace the list of members of 'my' relation by the list of merged 65 // members 60 // replace the list of members of 'my' relation by the list of merged members 66 61 // 67 62 my.setMembers(mergedMembers); 68 63 69 // remember the layer70 layer = Main.main.getEditLayer();71 64 return true; 72 65 } … … 80 73 @Override 81 74 public void undoCommand() { 75 OsmDataLayer layer = getLayer(); 82 76 if (! Main.map.mapView.hasLayer(layer)) { 83 77 Main.warn(tr("Cannot undo command ''{0}'' because layer ''{1}'' is not present any more", -
trunk/src/org/openstreetmap/josm/command/RemoveNodesCommand.java
r6316 r6881 12 12 13 13 import org.openstreetmap.josm.data.osm.Node; 14 import org.openstreetmap.josm.data.osm.Way;15 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; 16 15 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; 16 import org.openstreetmap.josm.data.osm.Way; 17 17 import org.openstreetmap.josm.gui.DefaultNameFormatter; 18 18 import org.openstreetmap.josm.tools.ImageProvider; … … 30 30 private final Set<Node> rmNodes; 31 31 32 /** 33 * Constructs a new {@code RemoveNodesCommand}. 34 * @param way The way to modify 35 * @param rmNodes The list of nodes to remove 36 */ 32 37 public RemoveNodesCommand(Way way, List<Node> rmNodes) { 33 super();34 38 this.way = way; 35 39 this.rmNodes = new HashSet<Node>(rmNodes); 36 40 } 37 41 38 @Override public boolean executeCommand() { 42 @Override 43 public boolean executeCommand() { 39 44 super.executeCommand(); 40 45 way.removeNodes(rmNodes); … … 43 48 } 44 49 45 @Override public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 50 @Override 51 public void fillModifiedData(Collection<OsmPrimitive> modified, Collection<OsmPrimitive> deleted, Collection<OsmPrimitive> added) { 46 52 modified.add(way); 47 53 } -
trunk/src/org/openstreetmap/josm/command/TagConflictResolveCommand.java
r6679 r6881 2 2 package org.openstreetmap.josm.command; 3 3 4 import static org.openstreetmap.josm.tools.I18n.marktr;5 import static org.openstreetmap.josm.tools.I18n.tr;6 4 import static org.openstreetmap.josm.tools.I18n.trn; 7 5 8 6 import java.util.Collection; 9 7 import java.util.List; 8 10 9 import javax.swing.Icon; 11 12 10 13 11 import org.openstreetmap.josm.data.conflict.Conflict; … … 19 17 20 18 /** 21 * Represents a the resolution of a tag conflict in an {@link OsmPrimitive}19 * Represents the resolution of a tag conflict in an {@link OsmPrimitive}. 22 20 * 23 21 */ -
trunk/src/org/openstreetmap/josm/command/VersionConflictResolveCommand.java
r5816 r6881 6 6 7 7 import java.util.Collection; 8 8 9 import javax.swing.Icon; 9 10 … … 14 15 15 16 /** 16 * Represents a command for resolving a version conflict between two {@link OsmPrimitive}17 * Represents the resolution of a version conflict between two {@link OsmPrimitive}s. 17 18 * 18 19 * -
trunk/src/org/openstreetmap/josm/command/WayNodesConflictResolverCommand.java
r6248 r6881 17 17 18 18 /** 19 * Represent a command for resolving conflicts in the node list of two 20 * {@link Way}s. 19 * Represents the resolution of conflicts in the node list of two {@link Way}s. 21 20 * 22 21 */ … … 39 38 this.mergedNodeList = mergedNodeList; 40 39 } 40 41 41 @Override 42 42 public String getDescriptionText() { -
trunk/src/org/openstreetmap/josm/data/osm/DataSetMerger.java
r6316 r6881 393 393 * 394 394 * See {@link #getConflicts()} for a map of conflicts after the merge operation. 395 * @param progressMonitor The progress monitor 395 396 */ 396 397 public void merge(ProgressMonitor progressMonitor) { -
trunk/src/org/openstreetmap/josm/io/OsmChangeReader.java
r5927 r6881 14 14 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 15 15 16 /** 17 * Reader for <a href="http://wiki.openstreetmap.org/wiki/OsmChange">OsmChange</a> file format. 18 */ 16 19 public class OsmChangeReader extends OsmReader { 17 20 21 /** 22 * List of possible actions. 23 */ 18 24 public static final String[] ACTIONS = {"create", "modify", "delete"}; 19 25 20 26 /** 21 27 * constructor (for private and subclasses use only) … … 25 31 protected OsmChangeReader() { 26 32 } 27 28 /* (non-Javadoc) 29 * @see org.openstreetmap.josm.io.OsmReader#parseRoot() 30 */ 33 31 34 @Override 32 35 protected void parseRoot() throws XMLStreamException { … … 43 46 throwException(tr("Missing mandatory attribute ''{0}''.", "version")); 44 47 } 45 if (! v.equals("0.6")) {48 if (!"0.6".equals(v)) { 46 49 throwException(tr("Unsupported version: {0}", v)); 47 50 } … … 87 90 } 88 91 } 89 92 90 93 /** 91 94 * Parse the given input source and return the dataset.
Note:
See TracChangeset
for help on using the changeset viewer.