- Timestamp:
- 2009-03-18T17:56:07+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r1459 r1503 325 325 // have to switch modes) 326 326 Main.ds.setSelected(n); 327 selection = Main.ds.getSelected(); 327 328 return; 328 329 } … … 396 397 boolean wayIsFinishedTemp = wayIsFinished; 397 398 wayIsFinished = false; 398 if (selection.size() > 0 && !wayIsFinishedTemp) {399 if (selection.size() > 0) { 399 400 Node selectedNode = null; 400 401 Way selectedWay = null; … … 425 426 return; 426 427 } 427 428 if(isSelfContainedWay(selectedWay, n0, n)) 429 return; 430 431 // User clicked last node again, finish way 432 if(n0 == n) { 433 finishDrawing(); 434 return; 435 } 436 437 // Ok we know now that we'll insert a line segment, but will it connect to an 438 // existing way or make a new way of its own? The "alt" modifier means that the 439 // user wants a new way. 440 Way way = alt ? null : (selectedWay != null) ? selectedWay : getWayForNode(n0); 441 442 // Don't allow creation of self-overlapping ways 443 if(way != null) { 444 int nodeCount=0; 445 for (Node p : way.nodes) 446 if(p.equals(n0)) nodeCount++; 447 if(nodeCount > 1) way = null; 448 } 449 450 if (way == null) { 451 way = new Way(); 452 way.addNode(n0); 453 cmds.add(new AddCommand(way)); 454 } else { 455 int i; 456 if ((i = replacedWays.indexOf(way)) != -1) { 457 way = reuseWays.get(i); 428 if(!wayIsFinishedTemp) 429 { 430 if(isSelfContainedWay(selectedWay, n0, n)) 431 return; 432 433 // User clicked last node again, finish way 434 if(n0 == n) { 435 finishDrawing(); 436 return; 437 } 438 439 // Ok we know now that we'll insert a line segment, but will it connect to an 440 // existing way or make a new way of its own? The "alt" modifier means that the 441 // user wants a new way. 442 Way way = alt ? null : (selectedWay != null) ? selectedWay : getWayForNode(n0); 443 444 // Don't allow creation of self-overlapping ways 445 if(way != null) { 446 int nodeCount=0; 447 for (Node p : way.nodes) 448 if(p.equals(n0)) nodeCount++; 449 if(nodeCount > 1) way = null; 450 } 451 452 if (way == null) { 453 way = new Way(); 454 way.addNode(n0); 455 cmds.add(new AddCommand(way)); 458 456 } else { 459 Way wnew = new Way(way); 460 cmds.add(new ChangeCommand(way, wnew)); 461 way = wnew; 457 int i; 458 if ((i = replacedWays.indexOf(way)) != -1) { 459 way = reuseWays.get(i); 460 } else { 461 Way wnew = new Way(way); 462 cmds.add(new ChangeCommand(way, wnew)); 463 way = wnew; 464 } 462 465 } 463 } 464 465 // Connected to a node that's already in the way466 if(way.nodes.contains(n)) {467 wayIsFinished = true;468 selection.clear();469 } 470 471 // Add new node to way472 if (way.nodes.get(way.nodes.size() - 1) == n0)473 way.addNode(n);474 else475 way.addNode(0, n); 476 477 extendedWay = true;478 Main.ds.setSelected(way);466 467 // Connected to a node that's already in the way 468 if(way.nodes.contains(n)) { 469 wayIsFinished = true; 470 selection.clear(); 471 } 472 473 // Add new node to way 474 if (way.nodes.get(way.nodes.size() - 1) == n0) 475 way.addNode(n); 476 else 477 way.addNode(0, n); 478 479 extendedWay = true; 480 Main.ds.setSelected(way); 481 } 479 482 } 480 483 -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r1497 r1503 165 165 } 166 166 // when multiple nodes on one point, prefer new or selected nodes 167 else if(dist == minDistanceSq && ((n.id == 0 && n.selected) 167 else if(dist == minDistanceSq && minPrimitive != null 168 && ((n.id == 0 && n.selected) 168 169 || (!minPrimitive.selected && (n.selected || n.id == 0)))) 169 170 minPrimitive = n;
Note:
See TracChangeset
for help on using the changeset viewer.