- Timestamp:
- 2014-06-09T17:21:00+02:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r7226 r7232 22 22 import java.awt.geom.Point2D; 23 23 import java.util.ArrayList; 24 import java.util.Arrays; 24 25 import java.util.Collection; 25 26 import java.util.LinkedList; … … 253 254 if (dualAlignEnabled) { 254 255 rv.append(" ").append(tr("Dual alignment active.")); 255 if (dualAlignSegmentCollapsed) {256 if (dualAlignSegmentCollapsed) 256 257 rv.append(" ").append(tr("Segment collapsed due to its direction reversing.")); 257 }258 258 } 259 259 } else { … … 270 270 rv = new StringBuilder(); 271 271 } 272 if (dualAlignActive) 272 if (dualAlignActive) { 273 273 rv.append(" ").append(tr("Dual alignment active.")); 274 if (dualAlignSegmentCollapsed) { 275 rv.append(" ").append(tr("Segment collapsed due to its direction reversing.")); 276 } 277 } 274 278 } 275 279 return rv.toString(); … … 586 590 wnew.addNode(selectedSegment.getSecondNode()); 587 591 wnew.addNode(third); 588 wnew.addNode(fourth); 592 if (newN1en.distance(newN2en)>1e-6) { 593 wnew.addNode(fourth); // rectangle can degrade to triangle for dual alignment 594 } 589 595 // ... and close the way 590 596 wnew.addNode(selectedSegment.getFirstNode()); … … 687 693 688 694 private void joinNodesIfCollapsed(List<Node> changedNodes) { 689 if ( newN1en.distance(newN2en) < 1e-6) {690 // If the dual alignment created moved two nodes to the same point, merge them691 Node targetNode = MergeNodesAction.selectTargetNode(changedNodes);692 Node locNode = MergeNodesAction.selectTargetLocationNode(changedNodes);693 Command mergeCmd = MergeNodesAction.mergeNodes(Main.main.getEditLayer(), changedNodes, targetNode, locNode);694 if (mergeCmd!=null) {695 Main.main.undoRedo.add(mergeCmd);696 } else {697 // undo extruding command itself698 Main.main.undoRedo.undo();699 }695 if (!dualAlignActive || newN1en == null || newN2en == null) return; 696 if (newN1en.distance(newN2en) > 1e-6) return; 697 // If the dual alignment moved two nodes to the same point, merge them 698 Node targetNode = MergeNodesAction.selectTargetNode(changedNodes); 699 Node locNode = MergeNodesAction.selectTargetLocationNode(changedNodes); 700 Command mergeCmd = MergeNodesAction.mergeNodes(Main.main.getEditLayer(), changedNodes, targetNode, locNode); 701 if (mergeCmd!=null) { 702 Main.main.undoRedo.add(mergeCmd); 703 } else { 704 // undo extruding command itself 705 Main.main.undoRedo.undo(); 700 706 } 701 707 } … … 848 854 EastNorth n1en = selectedSegment.getFirstNode().getEastNorth(); 849 855 EastNorth n2en = selectedSegment.getSecondNode().getEastNorth(); 856 if (n1en.distance(prevNode.getEastNorth())<1e-4 || 857 n2en.distance(nextNode.getEastNorth())<1e-4 ) { 858 return false; 859 } 860 850 861 boolean prevSegmentParallel = Geometry.segmentsParallel(n1en, prevNode.getEastNorth(), n1en, n2en); 851 862 boolean nextSegmentParallel = Geometry.segmentsParallel(n2en, nextNode.getEastNorth(), n1en, n2en);
Note:
See TracChangeset
for help on using the changeset viewer.