Changeset 6252 in josm
- Timestamp:
- 2013-09-24T08:38:26+02:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
r6162 r6252 74 74 private Stroke mainStroke; 75 75 76 /** settings value whether shared nodes should be ignored or not */ 77 private boolean ignoreSharedNodes; 78 76 79 /** 77 80 * drawing settings for helper lines … … 214 217 oldLineStroke = GuiHelper.getCustomizedStroke(Main.pref.get("extrude.ctrl.stroke.old-line", "1")); 215 218 mainStroke = GuiHelper.getCustomizedStroke(Main.pref.get("extrude.stroke.main", "3")); 219 220 ignoreSharedNodes = Main.pref.getBoolean("extrude.ignore-shared-nodes", true); 216 221 } 217 222 … … 443 448 Node prevNode = getPreviousNode(selectedSegment.lowerIndex); 444 449 boolean nodeOverlapsSegment = prevNode != null && Geometry.segmentsParallel(initialN1en, prevNode.getEastNorth(), initialN1en, newN1en); 450 // segmentAngleZero marks subset of nodeOverlapsSegment. nodeOverlapsSegment is true if angle between segments is 0 or PI, segmentAngleZero only if angle is 0 451 boolean segmentAngleZero = prevNode != null && Math.abs(Geometry.getCornerAngle(prevNode.getEastNorth(), initialN1en, newN1en)) < 1e-5; 445 452 boolean hasOtherWays = this.hasNodeOtherWays(selectedSegment.getFirstNode(), selectedSegment.way); 446 453 … … 449 456 Node n1Old = selectedSegment.getFirstNode(); 450 457 cmds.add(new MoveCommand(n1Old, Main.getProjection().eastNorth2latlon(newN1en))); 458 } else if (ignoreSharedNodes && segmentAngleZero && !alwaysCreateNodes && hasOtherWays) { 459 // replace shared node with new one 460 Node n1Old = selectedSegment.getFirstNode(); 461 Node n1New = new Node(Main.getProjection().eastNorth2latlon(newN1en)); 462 wnew.addNode(insertionPoint, n1New); 463 wnew.removeNode(n1Old); 464 wayWasModified = true; 465 cmds.add(new AddCommand(n1New)); 451 466 } else { 452 467 //introduce new node … … 461 476 Node nextNode = getNextNode(selectedSegment.lowerIndex + 1); 462 477 nodeOverlapsSegment = nextNode != null && Geometry.segmentsParallel(initialN2en, nextNode.getEastNorth(), initialN2en, newN2en); 478 segmentAngleZero = nextNode != null && Math.abs(Geometry.getCornerAngle(nextNode.getEastNorth(), initialN2en, newN2en)) < 1e-5; 463 479 hasOtherWays = hasNodeOtherWays(selectedSegment.getSecondNode(), selectedSegment.way); 464 480 … … 467 483 Node n2Old = selectedSegment.getSecondNode(); 468 484 cmds.add(new MoveCommand(n2Old, Main.getProjection().eastNorth2latlon(newN2en))); 485 } else if (ignoreSharedNodes && segmentAngleZero && !alwaysCreateNodes && hasOtherWays) { 486 // replace shared node with new one 487 Node n2Old = selectedSegment.getSecondNode(); 488 Node n2New = new Node(Main.getProjection().eastNorth2latlon(newN2en)); 489 wnew.addNode(insertionPoint, n2New); 490 wnew.removeNode(n2Old); 491 wayWasModified = true; 492 cmds.add(new AddCommand(n2New)); 469 493 } else { 470 494 //introduce new node
Note:
See TracChangeset
for help on using the changeset viewer.