Ticket #3690: speed-up-selections.big.patch
| File speed-up-selections.big.patch, 27.1 KB (added by , 16 years ago) |
|---|
-
src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
349 349 * cursor to movement. 350 350 */ 351 351 @Override public void mousePressed(MouseEvent e) { 352 //Main.debug("mousePressed() 0" + " time: " + System.currentTimeMillis()); 352 353 if(!Main.map.mapView.isActiveLayerVisible()) 353 354 return; 354 355 // request focus in order to enable the expected keyboard shortcuts … … 362 363 boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0; 363 364 boolean alt = (e.getModifiers() & (ActionEvent.ALT_MASK|InputEvent.ALT_GRAPH_MASK)) != 0; 364 365 boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; 366 //Main.debug("mousePressed() 1" + " time: " + System.currentTimeMillis()); 365 367 366 368 // We don't want to change to draw tool if the user tries to (de)select 367 369 // stuff but accidentally clicks in an empty area when selection is empty … … 373 375 didMove = false; 374 376 initialMoveThresholdExceeded = false; 375 377 378 //Main.debug("mousePressed() 2" + " time: " + System.currentTimeMillis()); 376 379 Collection<OsmPrimitive> osmColl = getNearestCollectionVirtual(e.getPoint(), alt); 380 //Main.debug("mousePressed() 3" + " time: " + System.currentTimeMillis()); 377 381 378 382 if (ctrl && shift) { 379 383 if (getCurrentDataSet().getSelected().isEmpty()) { … … 382 386 mode = Mode.rotate; 383 387 setCursor(ImageProvider.getCursor("rotate", null)); 384 388 } else if (!osmColl.isEmpty()) { 389 //Main.debug("mousePressed() 4" + " time: " + System.currentTimeMillis()); 385 390 // Don't replace the selection now if the user clicked on a 386 391 // selected object (this would break moving of selected groups). 387 392 // We'll do that later in mouseReleased if the user didn't try to … … 390 395 shift || getCurrentDataSet().getSelected().containsAll(osmColl), 391 396 ctrl, false, false); 392 397 mode = Mode.move; 398 //Main.debug("mousePressed() 5" + " time: " + System.currentTimeMillis()); 393 399 } else { 394 400 mode = Mode.select; 395 401 oldCursor = Main.map.mapView.getCursor(); 396 402 selectionManager.register(Main.map.mapView); 397 403 selectionManager.mousePressed(e); 398 404 } 405 //Main.debug("mousePressed() 6" + " time: " + System.currentTimeMillis()); 399 406 if(mode != Mode.move || shift || ctrl) 400 407 { 401 408 virtualNode = null; 402 409 virtualWays.clear(); 403 410 } 411 //Main.debug("mousePressed() 7 time: " + System.currentTimeMillis()); 404 412 405 413 updateStatusLine(); 406 414 // Mode.select redraws when selectPrims is called … … 411 419 } 412 420 413 421 mousePos = e.getPoint(); 422 //Main.debug("mousePressed() e" + " time: " + System.currentTimeMillis()); 414 423 } 415 424 416 425 /** 417 426 * Restore the old mouse cursor. 418 427 */ 419 428 @Override public void mouseReleased(MouseEvent e) { 429 //Main.debug("mouseReleasd() 0" + " time: " + System.currentTimeMillis()); 420 430 if(!Main.map.mapView.isActiveLayerVisible()) 421 431 return; 422 432 … … 430 440 } 431 441 } 432 442 restoreCursor(); 443 //Main.debug("mouseReleasd() 1" + " time: " + System.currentTimeMillis()); 433 444 434 445 if (mode == Mode.move) { 446 //Main.debug("mouseReleasd() 1.1" + " time: " + System.currentTimeMillis()); 435 447 boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0; 436 448 boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; 437 449 if (!didMove) { 450 //Main.debug("mouseReleasd() 1.2" + " time: " + System.currentTimeMillis()); 438 451 selectPrims( 439 452 Main.map.mapView.getNearestCollection(e.getPoint()), 440 453 shift, ctrl, true, false); 454 //Main.debug("mouseReleasd() 1.3" + " time: " + System.currentTimeMillis()); 441 455 442 456 // If the user double-clicked a node, change to draw mode 443 457 List<OsmPrimitive> sel = new ArrayList<OsmPrimitive>(getCurrentDataSet().getSelected()); … … 449 463 Main.map.selectDrawTool(true); 450 464 } 451 465 }); 466 //Main.debug("mouseReleasd() 1.4" + " time: " + System.currentTimeMillis()); 452 467 return; 453 468 } 469 //Main.debug("mouseReleasd() 1.5" + " time: " + System.currentTimeMillis()); 454 470 } else { 471 //Main.debug("mouseReleasd() 2" + " time: " + System.currentTimeMillis()); 455 472 Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected(); 456 473 Collection<OsmPrimitive> s = new TreeSet<OsmPrimitive>(); 457 474 int max = Main.pref.getInteger("warn.move.maxelements", 20); … … 484 501 } 485 502 break; 486 503 } 504 //Main.debug("mouseReleasd() 3" + " time: " + System.currentTimeMillis()); 487 505 } 488 506 if (ctrl) { 489 507 Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection); … … 499 517 } 500 518 } 501 519 } 520 //Main.debug("mouseReleasd() 4" + " time: " + System.currentTimeMillis()); 502 521 DataSet.fireSelectionChanged(selection); 522 //Main.debug("mouseReleasd() 5" + " time: " + System.currentTimeMillis()); 503 523 } 504 524 } 505 525 … … 507 527 //updateStatusLine(); 508 528 mode = null; 509 529 updateStatusLine(); 530 //Main.debug("mouseReleasd() end" + " time: " + System.currentTimeMillis()); 510 531 } 511 532 512 533 public void selectionEnded(Rectangle r, boolean alt, boolean shift, boolean ctrl) { … … 518 539 if ((shift && ctrl) || (ctrl && !released)) 519 540 return; // not allowed together 520 541 542 //Main.debug("selectPrims() 0 time: " + System.currentTimeMillis()); 521 543 Collection<OsmPrimitive> curSel; 522 544 if (!ctrl && !shift) { 545 //Main.debug("selectPrims() 1 time: " + System.currentTimeMillis()); 523 546 curSel = new LinkedList<OsmPrimitive>(); // new selection will replace the old. 524 547 } else { 548 //Main.debug("selectPrims() 2 time: " + System.currentTimeMillis()); 525 549 curSel = getCurrentDataSet().getSelected(); 526 550 } 551 //Main.debug("selectPrims() 3 time: " + System.currentTimeMillis()); 527 552 528 553 for (OsmPrimitive osm : selectionList) 529 554 { … … 538 563 curSel.add(osm); 539 564 } 540 565 } 566 //Main.debug("selectPrims() 4 time: " + System.currentTimeMillis()); 541 567 getCurrentDataSet().setSelected(curSel); 568 //Main.debug("selectPrims() 5 time: " + System.currentTimeMillis()); 542 569 Main.map.mapView.repaint(); 570 //Main.debug("selectPrims() 6 time: " + System.currentTimeMillis()); 543 571 } 544 572 545 573 @Override public String getModeHelpText() { -
src/org/openstreetmap/josm/actions/CombineWayAction.java
210 210 for (OsmPrimitive osm : selection) 211 211 if (osm instanceof Way) { 212 212 numWays++; 213 if (numWays >= 2) 214 break; 213 215 } 214 216 setEnabled(numWays >= 2); 215 217 } -
src/org/openstreetmap/josm/gui/SelectionManager.java
17 17 18 18 import org.openstreetmap.josm.data.osm.Node; 19 19 import org.openstreetmap.josm.data.osm.OsmPrimitive; 20 import org.openstreetmap.josm.data.osm.DataSet; 21 import org.openstreetmap.josm.data.osm.QuadBuckets; 20 22 import org.openstreetmap.josm.data.osm.Way; 21 23 22 24 /** … … 272 274 */ 273 275 public Collection<OsmPrimitive> getObjectsInRectangle(Rectangle r, boolean alt) { 274 276 Collection<OsmPrimitive> selection = new LinkedList<OsmPrimitive>(); 277 DataSet ds = nc.getCurrentDataSet(); 275 278 276 279 // whether user only clicked, not dragged. 277 280 boolean clicked = r.width <= 2 && r.height <= 2; … … 284 287 } 285 288 } else { 286 289 // nodes 287 for (Node n : nc.getCurrentDataSet().nodes) {290 for (Node n : ds.nodes) { 288 291 if (n.isUsable() && r.contains(nc.getPoint(n))) { 289 292 selection.add(n); 290 293 } 291 294 } 292 295 293 296 // ways 294 for (Way w : nc.getCurrentDataSet().ways) { 297 QuadBuckets<Way> qbw = ds.ways; 298 for (Way w : qbw) { 295 299 if (!w.isUsable() || w.getNodesCount() == 0){ 296 300 continue; 297 301 } -
src/org/openstreetmap/josm/gui/NavigatableComponent.java
305 305 DataSet ds = getCurrentDataSet(); 306 306 if(ds == null) 307 307 return null; 308 for (Node n : ds.nodes) { 308 LatLon p1 = getLatLon(p.x+snapDistance, p.y+snapDistance); 309 LatLon p2 = getLatLon(p.x-snapDistance, p.y-snapDistance); 310 for (Node n : ds.nodes.search(p1, p2)) { 309 311 if (!n.isUsable()) { 310 312 continue; 311 313 } … … 322 324 minPrimitive = n; 323 325 } 324 326 } 327 //Main.debug("getNearestNode() done"); 325 328 return minPrimitive; 326 329 } 327 330 … … 336 339 DataSet ds = getCurrentDataSet(); 337 340 if(ds == null) 338 341 return null; 339 for (Way w : ds.ways) { 342 LatLon p1 = getLatLon(p.x+snapDistance, p.y+snapDistance); 343 LatLon p2 = getLatLon(p.x-snapDistance, p.y-snapDistance); 344 for (Way w : ds.ways.search(p1, p2)) { 340 345 if (!w.isUsable()) { 341 346 continue; 342 347 } … … 379 384 for (List<WaySegment> wss : nearest.values()) { 380 385 nearestList.addAll(wss); 381 386 } 387 //Main.debug("getNearestWaySegments() done"); 382 388 return nearestList; 383 389 } 384 390 -
src/org/openstreetmap/josm/data/UndoRedoHandler.java
8 8 import org.openstreetmap.josm.Main; 9 9 import org.openstreetmap.josm.command.Command; 10 10 import org.openstreetmap.josm.data.osm.DataSet; 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 11 12 import org.openstreetmap.josm.gui.layer.Layer; 12 13 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 13 14 import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener; … … 41 42 redoCommands.clear(); 42 43 } 43 44 44 public void afterAdd() { 45 public void sendNotifications(Command c) 46 { 45 47 if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) { 46 48 OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer(); 47 49 data.fireDataChange(); 48 50 } 51 LinkedList<OsmPrimitive> modified = new LinkedList<OsmPrimitive>(); 52 LinkedList<OsmPrimitive> deleted = new LinkedList<OsmPrimitive>(); 53 LinkedList<OsmPrimitive> added = new LinkedList<OsmPrimitive>(); 54 c.fillModifiedData(modified, deleted, added); 55 Main.main.getCurrentDataSet().notifyPrimitiveChange(modified); 49 56 fireCommandsChanged(); 57 } 50 58 59 public void afterAdd(Command c) { 60 sendNotifications(c); 51 61 // the command may have changed the selection so tell the listeners about the current situation 52 62 DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected()); 53 63 } … … 57 67 */ 58 68 public void add(final Command c) { 59 69 addNoRedraw(c); 60 afterAdd( );70 afterAdd(c); 61 71 } 62 72 63 73 /** … … 69 79 final Command c = commands.removeLast(); 70 80 c.undoCommand(); 71 81 redoCommands.push(c); 72 if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) { 73 OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer(); 74 data.fireDataChange(); 75 } 76 fireCommandsChanged(); 82 sendNotifications(c); 77 83 Main.main.getCurrentDataSet().setSelected(); 78 84 } 79 85 … … 87 93 final Command c = redoCommands.pop(); 88 94 c.executeCommand(); 89 95 commands.add(c); 90 if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) { 91 OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer(); 92 data.fireDataChange(); 93 } 94 fireCommandsChanged(); 96 sendNotifications(c); 95 97 } 96 98 97 99 public void fireCommandsChanged() { -
src/org/openstreetmap/josm/data/osm/QuadBuckets.java
212 212 return ret; 213 213 } 214 214 } 215 /* 216 * This is a quick hack. The problem is that we need the 217 * way's bounding box a *bunch* of times when it gets 218 * inserted. It gets expensive if we have to recreate 219 * them each time. 220 * 221 * An alternative would be to calculate it at .add() time 222 * and passing it down the call chain. 223 */ 224 HashMap<Way,BBox> way_bbox_cache = new HashMap<Way, BBox>(); 225 BBox way_bbox(Way w) 226 { 227 if (way_bbox_cache.size() > 100) 228 way_bbox_cache.clear(); 229 BBox b = way_bbox_cache.get(w); 230 if (b == null) { 231 b = new BBox(w); 232 way_bbox_cache.put(w, b); 233 } 234 return b; 235 //return new BBox(w); 236 } 237 215 238 class QBLevel 216 239 { 217 240 int level; … … 364 387 return; 365 388 } 366 389 } 367 /*368 * This is a quick hack. The problem is that we need the369 * way's bounding box a *bunch* of times when it gets370 * inserted. It gets expensive if we have to recreate371 * them each time.372 *373 * An alternative would be to calculate it at .add() time374 * and passing it down the call chain.375 */376 HashMap<Way,BBox> way_bbox_cache = new HashMap<Way, BBox>();377 BBox way_bbox(Way w)378 {379 if (way_bbox_cache.size() > 100)380 way_bbox_cache.clear();381 BBox b = way_bbox_cache.get(w);382 if (b == null) {383 b = new BBox(w);384 way_bbox_cache.put(w, b);385 }386 return b;387 //return new BBox(w);388 }389 390 390 391 boolean matches(T o, BBox search_bbox) 391 392 { … … 559 560 } 560 561 QBLevel find_exact(T n) 561 562 { 562 if ( isLeaf())563 return find_exact_ leaf(n);563 if (hasContent()) 564 return find_exact_content(n); 564 565 return find_exact_branch(n); 565 566 } 566 QBLevel find_exact_ leaf(T n)567 QBLevel find_exact_content(T n) 567 568 { 568 569 QBLevel ret = null; 569 570 if (content != null && content.contains(n)) … … 883 884 check_type(o); 884 885 return this.remove(convert(o)); 885 886 } 887 public boolean remove_slow(T removeme) 888 { 889 boolean ret = false; 890 Iterator<T> i = this.iterator(); 891 while (i.hasNext()) { 892 T o = i.next(); 893 if (o != removeme) 894 continue; 895 i.remove(); 896 ret = true; 897 break; 898 } 899 out("qb slow remove result: " + ret); 900 return ret; 901 } 886 902 public boolean remove(T n) 887 903 { 904 /* 905 * We first try a locational search 906 */ 888 907 QBLevel bucket = root.find_exact(n); 908 if (n instanceof Way) 909 way_bbox_cache.remove(n); 910 /* 911 * That may fail because the object was 912 * moved or changed in some way, so we 913 * resort to an iterative search: 914 */ 889 915 if (bucket == null) 890 return false;916 return remove_slow(n); 891 917 boolean ret = bucket.remove_content(n); 918 out("qb remove result: " + ret); 892 919 return ret; 893 920 } 894 921 public boolean contains(Object o) … … 1078 1105 // search spot can not cover the current 1079 1106 // search 1080 1107 while (!search_cache.bbox().bounds(search_bbox)) { 1081 out("bbox: " + search_bbox); 1108 if (debug) 1109 out("bbox: " + search_bbox); 1082 1110 if (debug) { 1083 1111 out("search_cache: " + search_cache + " level: " + search_cache.level); 1084 1112 out("search_cache.bbox(): " + search_cache.bbox()); -
src/org/openstreetmap/josm/data/osm/DataSet.java
6 6 import java.util.ArrayList; 7 7 import java.util.Arrays; 8 8 import java.util.Collection; 9 import java.util.Collections; 9 10 import java.util.Comparator; 10 11 import java.util.HashMap; 12 import java.util.LinkedHashSet; 11 13 import java.util.HashSet; 12 14 import java.util.Iterator; 13 15 import java.util.LinkedList; … … 16 18 17 19 import org.openstreetmap.josm.data.SelectionChangedListener; 18 20 import org.openstreetmap.josm.data.osm.QuadBuckets; 21 import org.openstreetmap.josm.data.osm.OsmPrimitive; 19 22 20 23 /** 21 24 * DataSet is the data behind the application. It can consists of only a few points up to the whole … … 142 145 } else if (primitive instanceof Relation) { 143 146 relations.remove(primitive); 144 147 } 148 selectedPrimitives.remove(primitive); 145 149 } 146 150 147 151 public Collection<OsmPrimitive> getSelectedNodesAndWays() { 148 Collection<OsmPrimitive> sel = getSelected(nodes); 149 sel.addAll(getSelected(ways)); 152 Collection<OsmPrimitive> sel = new LinkedList<OsmPrimitive>(); 153 for (OsmPrimitive osm : selectedPrimitives) { 154 if (osm instanceof Way || 155 osm instanceof Node) 156 sel.add(osm); 157 } 150 158 return sel; 151 159 } 152 160 … … 156 164 * @return List of all selected objects. 157 165 */ 158 166 public Collection<OsmPrimitive> getSelected() { 159 Collection<OsmPrimitive> sel = getSelected(nodes); 160 sel.addAll(getSelected(ways)); 161 sel.addAll(getSelected(relations)); 162 return sel; 167 // It would be nice to have this be a copy-on-write list 168 // or an Collections.unmodifiableList(). It would be 169 // much faster for large selections. May users just 170 // call this, and only check the .size(). 171 return new ArrayList<OsmPrimitive>(selectedPrimitives); 163 172 } 164 173 165 174 /** … … 215 224 } 216 225 } 217 226 218 public boolean addSelected(OsmPrimitive osm) { 219 osm.setSelected(true); 220 return true; 221 } 227 LinkedHashSet<OsmPrimitive> selectedPrimitives = new LinkedHashSet<OsmPrimitive>(); 222 228 223 229 public boolean toggleSelected(OsmPrimitive osm) { 224 osm.setSelected(!osm.isSelected()); 230 if (!selectedPrimitives.remove(osm)) 231 selectedPrimitives.add(osm); 225 232 return true; 226 233 } 227 234 public boolean isSelected(OsmPrimitive osm) { 228 return osm.isSelected();235 return selectedPrimitives.contains(osm); 229 236 } 230 237 231 238 public void setDisabled(OsmPrimitive... osm) { … … 250 257 * @param fireSelectionChangeEvent true, if the selection change listeners are to be notified; false, otherwise 251 258 */ 252 259 public void setSelected(Collection<? extends OsmPrimitive> selection, boolean fireSelectionChangeEvent) { 253 clearSelection(nodes); 254 clearSelection(ways); 255 clearSelection(relations); 256 for (OsmPrimitive osm : selection) { 257 osm.setSelected(true); 258 } 260 selectedPrimitives = new LinkedHashSet<OsmPrimitive>(selection); 259 261 if (fireSelectionChangeEvent) { 260 262 fireSelectionChanged(selection); 261 263 } … … 289 291 * @param fireSelectionChangeEvent true, if the selection change listeners are to be notified; false, otherwise 290 292 */ 291 293 public void addSelected(Collection<? extends OsmPrimitive> selection, boolean fireSelectionChangeEvent) { 292 for (OsmPrimitive osm : selection) { 293 osm.setSelected(true); 294 } 294 selectedPrimitives.addAll(selection); 295 295 if (fireSelectionChangeEvent) { 296 296 fireSelectionChanged(selection); 297 297 } … … 303 303 setSelected(); 304 304 return; 305 305 } 306 clearSelection(nodes); 307 clearSelection(ways); 308 clearSelection(relations); 309 for (OsmPrimitive o : osm) 310 if (o != null) { 311 o.setSelected(true); 312 } 313 fireSelectionChanged(Arrays.asList(osm)); 306 List<OsmPrimitive> list = Arrays.asList(osm); 307 setSelected(list); 308 fireSelectionChanged(list); 314 309 } 315 310 316 311 /** … … 346 341 private void clearSelection(Collection<? extends OsmPrimitive> list) { 347 342 if (list == null) 348 343 return; 349 for (OsmPrimitive osm : list) { 350 osm.setSelected(false); 351 } 344 selectedPrimitives.removeAll(list); 352 345 } 353 346 354 347 /** … … 356 349 * @param list The collection from which the selected items are returned. 357 350 */ 358 351 private Collection<OsmPrimitive> getSelected(Collection<? extends OsmPrimitive> list) { 359 Collection<OsmPrimitive> sel = new HashSet<OsmPrimitive>();360 352 if (list == null) 361 return sel; 362 for (OsmPrimitive osm : list) 363 if (osm.isSelected() && !osm.isDeleted()) { 364 sel.add(osm); 365 } 353 return new LinkedList<OsmPrimitive>(); 354 // getSelected() is called with large lists, so 355 // creating the return list from the selection 356 // should be faster most of the time. 357 Collection<OsmPrimitive> sel = new LinkedHashSet<OsmPrimitive>(selectedPrimitives); 358 sel.retainAll(list); 366 359 return sel; 367 360 } 368 361 … … 603 596 } 604 597 return ret; 605 598 } 599 600 List<Way> waysUsingNode(Node n) 601 { 602 List<Way> possible_ways = ways.search(n.getCoor(), 0.0); 603 List<Way> result = new ArrayList<Way>(); 604 for (Way w : possible_ways) { 605 if (!w.containsNode(n)) 606 continue; 607 result.add(w); 608 } 609 return result; 610 } 611 612 void reIndex(Way w) 613 { 614 ways.remove(w); 615 ways.add(w); 616 } 617 618 void reIndex(Node n) 619 { 620 nodes.remove(n); 621 nodes.add(n); 622 } 623 624 void reIndexPrimitives(Collection<OsmPrimitive> modified) 625 { 626 for (OsmPrimitive o : modified) { 627 if (o instanceof Way) 628 reIndex((Way)o); 629 if (o instanceof Node) 630 reIndex((Node)o); 631 } 632 } 633 634 /* 635 * When nodes and ways get modified, their spatial properites may 636 * change. This means that their locations in the spatially-indexed 637 * QuadBuckets structures may change. When this happens, delete 638 * and reinsert them. 639 */ 640 public void notifyPrimitiveChange(Collection<OsmPrimitive> modified) 641 { 642 /* 643 * Make sure to reindex all the ways first. This will 644 * make sure that waysUsingNode() can find the ways 645 * if they got changed. 646 */ 647 reIndexPrimitives(modified); 648 HashSet<OsmPrimitive> waysTouchedByNodes = new HashSet<OsmPrimitive>(); 649 for (OsmPrimitive o : modified) { 650 if (!(o instanceof Node)) 651 continue; 652 Node n = (Node)o; 653 modified.addAll(waysUsingNode(n)); 654 } 655 reIndexPrimitives(waysTouchedByNodes); 656 } 606 657 } -
src/org/openstreetmap/josm/data/osm/OsmPrimitive.java
42 42 private static final int FLAG_DISABLED = 1 << 2; 43 43 private static final int FLAG_DELETED = 1 << 3; 44 44 private static final int FLAG_FILTERED = 1 << 4; 45 private static final int FLAG_SELECTED = 1 << 5; 46 private static final int FLAG_HAS_DIRECTIONS = 1 << 6; 47 private static final int FLAG_TAGGED = 1 << 7; 45 private static final int FLAG_HAS_DIRECTIONS = 1 << 5; 46 private static final int FLAG_TAGGED = 1 << 6; 48 47 49 48 /** 50 49 * Replies the sub-collection of {@see OsmPrimitive}s of type <code>type</code> present in … … 184 183 /** 185 184 * Sets whether this primitive is disabled or not. 186 185 * 187 * @param selectedtrue, if this primitive is disabled; false, otherwise186 * @param disabled true, if this primitive is disabled; false, otherwise 188 187 */ 189 188 public void setDisabled(boolean disabled) { 190 189 if (disabled) { … … 206 205 /** 207 206 * Sets whether this primitive is filtered out or not. 208 207 * 209 * @param selectedtrue, if this primitive is filtered out; false, otherwise208 * @param filtered true, if this primitive is filtered out; false, otherwise 210 209 */ 211 210 public void setFiltered(boolean filtered) { 212 211 if (filtered) { … … 225 224 } 226 225 227 226 /** 228 * Sets whether this primitive is selected or not.229 *230 * @param selected true, if this primitive is selected; false, otherwise231 * @since 1899232 */233 @Deprecated public void setSelected(boolean selected) {234 if (selected) {235 flags |= FLAG_SELECTED;236 } else {237 flags &= ~FLAG_SELECTED;238 }239 }240 /**241 * Replies true, if this primitive is selected.242 *243 * @return true, if this primitive is selected244 * @since 1899245 */246 @Deprecated public boolean isSelected() {247 return (flags & FLAG_SELECTED) != 0;248 }249 250 /**251 227 * Marks this primitive as being modified. 252 228 * 253 229 * @param modified true, if this primitive is to be modified … … 470 446 /** 471 447 * Sets whether this primitive is deleted or not. 472 448 * 473 * Also marks this primitive as modified if deleted is true and sets selected to false.449 * Also marks this primitive as modified if deleted is true. 474 450 * 475 451 * @param deleted true, if this primitive is deleted; false, otherwise 476 452 */ … … 481 457 flags &= ~FLAG_DELETED; 482 458 } 483 459 setModified(deleted); 484 setSelected(false);485 460 } 486 461 487 462 /**
