Changeset 27937 in osm for applications/editors/josm/plugins
- Timestamp:
- 2012-02-25T17:03:41+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/utilsplugin2/src/utilsplugin2/dumbutils/ReplaceGeometryAction.java
r27852 r27937 63 63 64 64 } 65 public voidreplace(OsmPrimitive firstObject, OsmPrimitive secondObject) {65 public boolean replace(OsmPrimitive firstObject, OsmPrimitive secondObject) { 66 66 if (firstObject instanceof Way && secondObject instanceof Way) { 67 re placeWayWithWay(Arrays.asList((Way) firstObject, (Way) secondObject));67 return replaceWayWithWay(Arrays.asList((Way) firstObject, (Way) secondObject)); 68 68 } else if (firstObject instanceof Node && secondObject instanceof Node) { 69 69 throw new IllegalArgumentException(tr("To replace a node with a node, use the node merge tool.")); 70 70 } else if (firstObject instanceof Node) { 71 re placeNode((Node) firstObject, secondObject);71 return replaceNode((Node) firstObject, secondObject); 72 72 } else if (secondObject instanceof Node) { 73 re placeNode((Node) secondObject, firstObject);73 return replaceNode((Node) secondObject, firstObject); 74 74 } else { 75 75 throw new IllegalArgumentException(tr("This tool can only replace a node with a way, a node with a multipolygon, or a way with a way.")); … … 83 83 * @param target 84 84 */ 85 public voidreplaceNode(Node node, OsmPrimitive target) {85 public boolean replaceNode(Node node, OsmPrimitive target) { 86 86 if (!OsmPrimitive.getFilteredList(node.getReferrers(), Way.class).isEmpty()) { 87 87 JOptionPane.showMessageDialog(Main.parent, tr("Node belongs to way(s), cannot replace."), 88 88 TITLE, JOptionPane.INFORMATION_MESSAGE); 89 return ;89 return false; 90 90 } 91 91 … … 93 93 JOptionPane.showMessageDialog(Main.parent, tr("Relation is not a multipolygon, cannot be used as a replacement."), 94 94 TITLE, JOptionPane.INFORMATION_MESSAGE); 95 return ;95 return false; 96 96 } 97 97 … … 125 125 if (tagResolutionCommands == null) { 126 126 // user canceled tag merge dialog 127 return ;127 return false; 128 128 } 129 129 commands.addAll(tagResolutionCommands); … … 161 161 tr("Replace geometry for node {0}", node.getDisplayName(DefaultNameFormatter.getInstance())), 162 162 commands)); 163 } 164 165 public void replaceWayWithWay(List<Way> selection) { 163 return true; 164 } 165 166 public boolean replaceWayWithWay(List<Way> selection) { 166 167 // determine which way will be replaced and which will provide the geometry 167 168 boolean overrideNewCheck = false; … … 190 191 tr("Please select one way that exists in the database and one new way with correct geometry."), 191 192 TITLE, JOptionPane.WARNING_MESSAGE); 192 return ;193 return false; 193 194 } 194 195 … … 198 199 tr("The ways must be entirely within the downloaded area."), 199 200 TITLE, JOptionPane.WARNING_MESSAGE); 200 return ;201 return false; 201 202 } 202 203 … … 205 206 tr("The way to be replaced cannot have any nodes with properties or relation memberships unless they belong to both ways."), 206 207 TITLE, JOptionPane.WARNING_MESSAGE); 207 return ;208 return false; 208 209 } 209 210 … … 214 215 if (tagResolutionCommands == null) { 215 216 // user canceled tag merge dialog 216 return ;217 return false; 217 218 } 218 219 commands.addAll(tagResolutionCommands); … … 273 274 tr("Replace geometry for way {0}", way.getDisplayName(DefaultNameFormatter.getInstance())), 274 275 commands)); 276 return true; 275 277 } 276 278
Note:
See TracChangeset
for help on using the changeset viewer.