- Timestamp:
- 2020-04-15T11:38:48+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r16300 r16303 109 109 // If there aren't enough ways, maybe the user wanted to unglue the nodes 110 110 // (= copy tags to a new node) 111 if (!selfCrossing) {112 if ( selection.size() == 1 && selectedNode.isTagged()) {111 if (!selfCrossing) 112 if (checkForUnglueNode(selection)) { 113 113 unglueOneNodeAtMostOneWay(e); 114 114 } else { … … 116 116 errMsg = tr("This node is not glued to anything else."); 117 117 } 118 }119 118 } else { 120 119 // and then do the work. … … 244 243 getLayerManager().getEditDataSet().setSelected(moveSelectedNode ? selectedNode : unglued); 245 244 mv.repaint(); 245 } 246 247 /** 248 * Checks if selection is suitable for ungluing. This is the case when there's a single, 249 * tagged node selected that's part of at least one way (ungluing an unconnected node does 250 * not make sense. Due to the call order in actionPerformed, this is only called when the 251 * node is only part of one or less ways. 252 * 253 * @param selection The selection to check against 254 * @return {@code true} if selection is suitable 255 */ 256 private boolean checkForUnglueNode(Collection<? extends OsmPrimitive> selection) { 257 if (selection.size() != 1) 258 return false; 259 OsmPrimitive n = (OsmPrimitive) selection.toArray()[0]; 260 if (!(n instanceof Node)) 261 return false; 262 if (((Node) n).getParentWays().isEmpty()) 263 return false; 264 265 selectedNode = (Node) n; 266 return selectedNode.isTagged(); 246 267 } 247 268
Note:
See TracChangeset
for help on using the changeset viewer.