Changeset 3555 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2010-09-22T23:03:40+02:00 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r3550 r3555 275 275 276 276 MapView c = Main.map.mapView; 277 278 277 Collection<OsmPrimitive> sel = getCurrentDataSet().getSelected(); 278 279 // take nearest node 279 280 OsmPrimitive osm = c.getNearestNode(p, OsmPrimitive.isSelectablePredicate); 280 281 … … 282 283 for (Node n : c.getNearestNodes(p, OsmPrimitive.isSelectablePredicate)) { 283 284 if (sel.contains(n)) { 285 // take nearest selected node 284 286 osm = n; 287 break; 285 288 } 286 289 } … … 290 293 291 294 Collection<WaySegment> virtualWaysInSel = new ArrayList<WaySegment>(); 292 osm = c.getNearestWay(p, OsmPrimitive.isSelectablePredicate); 293 294 for(WaySegment nearestWS : c.getNearestWaySegments(p, OsmPrimitive.isSelectablePredicate)) { 295 Collection<WaySegment> wss = c.getNearestWaySegments(p, OsmPrimitive.isSelectablePredicate); 296 for(WaySegment nearestWS : wss) { 295 297 if (nearestWS == null) { 296 298 continue; 297 299 } 298 if (sel.contains(w = nearestWS.way)) { 300 301 w = nearestWS.way; 302 if (osm == null && sel.contains(w)) { 303 // take nearest selected way 299 304 osm = w; 300 305 } … … 330 335 331 336 if (virtualNode != null) { 337 // insert virtualNode into all segments if nothing was selected, 338 // else only into the (previously) selected segments 332 339 virtualWays = virtualWaysInSel.isEmpty() ? virtualWays : virtualWaysInSel; 333 osm = virtualWays.iterator().next().way; 340 } 341 342 if (osm == null && !wss.isEmpty()) { 343 // take nearest way 344 osm = wss.iterator().next().way; 334 345 } 335 346 } … … 435 446 boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; 436 447 boolean alt = (e.getModifiers() & (ActionEvent.ALT_MASK|InputEvent.ALT_GRAPH_MASK)) != 0 437 || Main.pref.getBoolean("selectaction. rotates", false);448 || Main.pref.getBoolean("selectaction.cycles.multiple.matches", false); 438 449 439 450 virtualWays.clear(); … … 444 455 if (!c.isEmpty() && alt) { 445 456 if (c.iterator().next() instanceof Node) { 446 // there is at least one node under the cursor: 447 // - make sure (first element of new list) equals (result of getNearestCollection) 448 // - do not consider ways at all, but all nearest nodes 457 // consider all nearest nodes 449 458 c = new ArrayList<OsmPrimitive>(Main.map.mapView.getNearestNodes(e.getPoint(), OsmPrimitive.isSelectablePredicate)); 450 459 } else { 451 // consider all ways..460 // consider all nearest primitives (should be only ways at this point..) 452 461 c = Main.map.mapView.getAllNearest(e.getPoint(), OsmPrimitive.isSelectablePredicate); 453 462 } … … 536 545 boolean ctrl, boolean released, boolean area) { 537 546 DataSet ds = getCurrentDataSet(); 547 548 // decides on mousePressed whether 549 // to cycle on mouseReleased (selList already selected) 550 // or not (selList is a new selection) 551 selMorePrims = (released || area) ? selMorePrims : ds.getSelected().containsAll(selectionList); 552 553 // not allowed together: do not change dataset selection, return early 538 554 if ((shift && ctrl) || (ctrl && !released) || (!virtualWays.isEmpty())) 539 return; // not allowed together555 return; 540 556 541 557 // toggle through possible objects on mouse release … … 589 605 } 590 606 591 // hard-wiring to false due to performance reasons, should do w/out592 selMorePrims = (released || area) ? false : ds.getSelected().containsAll(selectionList);593 594 607 if (ctrl) { 595 608 // Ctrl on an item toggles its selection status,
Note:
See TracChangeset
for help on using the changeset viewer.