Ticket #3690: speed-up-selections.big.patch

File speed-up-selections.big.patch, 27.1 KB (added by hansendc, 16 years ago)
  • src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

     
    349349     * cursor to movement.
    350350     */
    351351    @Override public void mousePressed(MouseEvent e) {
     352        //Main.debug("mousePressed() 0" + " time: " + System.currentTimeMillis());
    352353        if(!Main.map.mapView.isActiveLayerVisible())
    353354            return;
    354355        // request focus in order to enable the expected keyboard shortcuts
     
    362363        boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
    363364        boolean alt = (e.getModifiers() & (ActionEvent.ALT_MASK|InputEvent.ALT_GRAPH_MASK)) != 0;
    364365        boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
     366        //Main.debug("mousePressed() 1" + " time: " + System.currentTimeMillis());
    365367
    366368        // We don't want to change to draw tool if the user tries to (de)select
    367369        // stuff but accidentally clicks in an empty area when selection is empty
     
    373375        didMove = false;
    374376        initialMoveThresholdExceeded = false;
    375377
     378        //Main.debug("mousePressed() 2" + " time: " + System.currentTimeMillis());
    376379        Collection<OsmPrimitive> osmColl = getNearestCollectionVirtual(e.getPoint(), alt);
     380        //Main.debug("mousePressed() 3" + " time: " + System.currentTimeMillis());
    377381
    378382        if (ctrl && shift) {
    379383            if (getCurrentDataSet().getSelected().isEmpty()) {
     
    382386            mode = Mode.rotate;
    383387            setCursor(ImageProvider.getCursor("rotate", null));
    384388        } else if (!osmColl.isEmpty()) {
     389            //Main.debug("mousePressed() 4" + " time: " + System.currentTimeMillis());
    385390            // Don't replace the selection now if the user clicked on a
    386391            // selected object (this would break moving of selected groups).
    387392            // We'll do that later in mouseReleased if the user didn't try to
     
    390395                    shift || getCurrentDataSet().getSelected().containsAll(osmColl),
    391396                    ctrl, false, false);
    392397            mode = Mode.move;
     398            //Main.debug("mousePressed() 5" + " time: " + System.currentTimeMillis());
    393399        } else {
    394400            mode = Mode.select;
    395401            oldCursor = Main.map.mapView.getCursor();
    396402            selectionManager.register(Main.map.mapView);
    397403            selectionManager.mousePressed(e);
    398404        }
     405        //Main.debug("mousePressed() 6" + " time: " + System.currentTimeMillis());
    399406        if(mode != Mode.move || shift || ctrl)
    400407        {
    401408            virtualNode = null;
    402409            virtualWays.clear();
    403410        }
     411        //Main.debug("mousePressed() 7 time: " + System.currentTimeMillis());
    404412
    405413        updateStatusLine();
    406414        // Mode.select redraws when selectPrims is called
     
    411419        }
    412420
    413421        mousePos = e.getPoint();
     422        //Main.debug("mousePressed() e" + " time: " + System.currentTimeMillis());
    414423    }
    415424
    416425    /**
    417426     * Restore the old mouse cursor.
    418427     */
    419428    @Override public void mouseReleased(MouseEvent e) {
     429        //Main.debug("mouseReleasd() 0" + " time: " + System.currentTimeMillis());
    420430        if(!Main.map.mapView.isActiveLayerVisible())
    421431            return;
    422432
     
    430440            }
    431441        }
    432442        restoreCursor();
     443        //Main.debug("mouseReleasd() 1" + " time: " + System.currentTimeMillis());
    433444
    434445        if (mode == Mode.move) {
     446            //Main.debug("mouseReleasd() 1.1" + " time: " + System.currentTimeMillis());
    435447            boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
    436448            boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0;
    437449            if (!didMove) {
     450                //Main.debug("mouseReleasd() 1.2" + " time: " + System.currentTimeMillis());
    438451                selectPrims(
    439452                        Main.map.mapView.getNearestCollection(e.getPoint()),
    440453                        shift, ctrl, true, false);
     454                //Main.debug("mouseReleasd() 1.3" + " time: " + System.currentTimeMillis());
    441455
    442456                // If the user double-clicked a node, change to draw mode
    443457                List<OsmPrimitive> sel = new ArrayList<OsmPrimitive>(getCurrentDataSet().getSelected());
     
    449463                            Main.map.selectDrawTool(true);
    450464                        }
    451465                    });
     466                    //Main.debug("mouseReleasd() 1.4" + " time: " + System.currentTimeMillis());
    452467                    return;
    453468                }
     469                //Main.debug("mouseReleasd() 1.5" + " time: " + System.currentTimeMillis());
    454470            } else {
     471        //Main.debug("mouseReleasd() 2" + " time: " + System.currentTimeMillis());
    455472                Collection<OsmPrimitive> selection = getCurrentDataSet().getSelected();
    456473                Collection<OsmPrimitive> s = new TreeSet<OsmPrimitive>();
    457474                int max = Main.pref.getInteger("warn.move.maxelements", 20);
     
    484501                        }
    485502                        break;
    486503                    }
     504        //Main.debug("mouseReleasd() 3" + " time: " + System.currentTimeMillis());
    487505                }
    488506                if (ctrl) {
    489507                    Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection);
     
    499517                        }
    500518                    }
    501519                }
     520                //Main.debug("mouseReleasd() 4" + " time: " + System.currentTimeMillis());
    502521                DataSet.fireSelectionChanged(selection);
     522                //Main.debug("mouseReleasd() 5" + " time: " + System.currentTimeMillis());
    503523            }
    504524        }
    505525
     
    507527        //updateStatusLine();
    508528        mode = null;
    509529        updateStatusLine();
     530        //Main.debug("mouseReleasd() end" + " time: " + System.currentTimeMillis());
    510531    }
    511532
    512533    public void selectionEnded(Rectangle r, boolean alt, boolean shift, boolean ctrl) {
     
    518539        if ((shift && ctrl) || (ctrl && !released))
    519540            return; // not allowed together
    520541
     542        //Main.debug("selectPrims() 0 time: " + System.currentTimeMillis());
    521543        Collection<OsmPrimitive> curSel;
    522544        if (!ctrl && !shift) {
     545            //Main.debug("selectPrims() 1 time: " + System.currentTimeMillis());
    523546            curSel = new LinkedList<OsmPrimitive>(); // new selection will replace the old.
    524547        } else {
     548            //Main.debug("selectPrims() 2 time: " + System.currentTimeMillis());
    525549            curSel = getCurrentDataSet().getSelected();
    526550        }
     551        //Main.debug("selectPrims() 3 time: " + System.currentTimeMillis());
    527552
    528553        for (OsmPrimitive osm : selectionList)
    529554        {
     
    538563                curSel.add(osm);
    539564            }
    540565        }
     566        //Main.debug("selectPrims() 4 time: " + System.currentTimeMillis());
    541567        getCurrentDataSet().setSelected(curSel);
     568        //Main.debug("selectPrims() 5 time: " + System.currentTimeMillis());
    542569        Main.map.mapView.repaint();
     570        //Main.debug("selectPrims() 6 time: " + System.currentTimeMillis());
    543571    }
    544572
    545573    @Override public String getModeHelpText() {
  • src/org/openstreetmap/josm/actions/CombineWayAction.java

     
    210210        for (OsmPrimitive osm : selection)
    211211            if (osm instanceof Way) {
    212212                numWays++;
     213                if (numWays >= 2)
     214                    break;
    213215            }
    214216        setEnabled(numWays >= 2);
    215217    }
  • src/org/openstreetmap/josm/gui/SelectionManager.java

     
    1717
    1818import org.openstreetmap.josm.data.osm.Node;
    1919import org.openstreetmap.josm.data.osm.OsmPrimitive;
     20import org.openstreetmap.josm.data.osm.DataSet;
     21import org.openstreetmap.josm.data.osm.QuadBuckets;
    2022import org.openstreetmap.josm.data.osm.Way;
    2123
    2224/**
     
    272274     */
    273275    public Collection<OsmPrimitive> getObjectsInRectangle(Rectangle r, boolean alt) {
    274276        Collection<OsmPrimitive> selection = new LinkedList<OsmPrimitive>();
     277        DataSet ds = nc.getCurrentDataSet();
    275278
    276279        // whether user only clicked, not dragged.
    277280        boolean clicked = r.width <= 2 && r.height <= 2;
     
    284287            }
    285288        } else {
    286289            // nodes
    287             for (Node n : nc.getCurrentDataSet().nodes) {
     290            for (Node n : ds.nodes) {
    288291                if (n.isUsable() && r.contains(nc.getPoint(n))) {
    289292                    selection.add(n);
    290293                }
    291294            }
    292295
    293296            // ways
    294             for (Way w : nc.getCurrentDataSet().ways) {
     297            QuadBuckets<Way> qbw = ds.ways;
     298            for (Way w : qbw) {
    295299                if (!w.isUsable() || w.getNodesCount() == 0){
    296300                    continue;
    297301                }
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

     
    305305        DataSet ds = getCurrentDataSet();
    306306        if(ds == null)
    307307            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)) {
    309311            if (!n.isUsable()) {
    310312                continue;
    311313            }
     
    322324                minPrimitive = n;
    323325            }
    324326        }
     327        //Main.debug("getNearestNode() done");
    325328        return minPrimitive;
    326329    }
    327330
     
    336339        DataSet ds = getCurrentDataSet();
    337340        if(ds == null)
    338341            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)) {
    340345            if (!w.isUsable()) {
    341346                continue;
    342347            }
     
    379384        for (List<WaySegment> wss : nearest.values()) {
    380385            nearestList.addAll(wss);
    381386        }
     387        //Main.debug("getNearestWaySegments() done");
    382388        return nearestList;
    383389    }
    384390
  • src/org/openstreetmap/josm/data/UndoRedoHandler.java

     
    88import org.openstreetmap.josm.Main;
    99import org.openstreetmap.josm.command.Command;
    1010import org.openstreetmap.josm.data.osm.DataSet;
     11import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1112import org.openstreetmap.josm.gui.layer.Layer;
    1213import org.openstreetmap.josm.gui.layer.OsmDataLayer;
    1314import org.openstreetmap.josm.gui.layer.Layer.LayerChangeListener;
     
    4142        redoCommands.clear();
    4243    }
    4344
    44     public void afterAdd() {
     45    public void sendNotifications(Command c)
     46    {
    4547        if (Main.map != null && Main.map.mapView.getActiveLayer() instanceof OsmDataLayer) {
    4648            OsmDataLayer data = (OsmDataLayer)Main.map.mapView.getActiveLayer();
    4749            data.fireDataChange();
    4850        }
     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);
    4956        fireCommandsChanged();
     57    }
    5058
     59    public void afterAdd(Command c) {
     60        sendNotifications(c);
    5161        // the command may have changed the selection so tell the listeners about the current situation
    5262        DataSet.fireSelectionChanged(Main.main.getCurrentDataSet().getSelected());
    5363    }
     
    5767     */
    5868    public void add(final Command c) {
    5969        addNoRedraw(c);
    60         afterAdd();
     70        afterAdd(c);
    6171    }
    6272
    6373    /**
     
    6979        final Command c = commands.removeLast();
    7080        c.undoCommand();
    7181        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);
    7783        Main.main.getCurrentDataSet().setSelected();
    7884    }
    7985
     
    8793        final Command c = redoCommands.pop();
    8894        c.executeCommand();
    8995        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);
    9597    }
    9698
    9799    public void fireCommandsChanged() {
  • src/org/openstreetmap/josm/data/osm/QuadBuckets.java

     
    212212            return ret;
    213213        }
    214214    }
     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
    215238    class QBLevel
    216239    {
    217240        int level;
     
    364387                return;
    365388            }
    366389        }
    367         /*
    368          * This is a quick hack.  The problem is that we need the
    369          * way's bounding box a *bunch* of times when it gets
    370          * inserted.  It gets expensive if we have to recreate
    371          * them each time.
    372          *
    373          * An alternative would be to calculate it at .add() time
    374          * 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         }
    389390
    390391        boolean matches(T o, BBox search_bbox)
    391392        {
     
    559560        }
    560561        QBLevel find_exact(T n)
    561562        {
    562             if (isLeaf())
    563                 return find_exact_leaf(n);
     563            if (hasContent())
     564                return find_exact_content(n);
    564565            return find_exact_branch(n);
    565566        }
    566         QBLevel find_exact_leaf(T n)
     567        QBLevel find_exact_content(T n)
    567568        {
    568569            QBLevel ret = null;
    569570            if (content != null && content.contains(n))
     
    883884        check_type(o);
    884885        return this.remove(convert(o));
    885886    }
     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    }
    886902    public boolean remove(T n)
    887903    {
     904        /*
     905         * We first try a locational search
     906         */
    888907        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         */
    889915        if (bucket == null)
    890             return false;
     916            return remove_slow(n);
    891917        boolean ret = bucket.remove_content(n);
     918        out("qb remove result: " + ret);
    892919        return ret;
    893920    }
    894921    public boolean contains(Object o)
     
    10781105            // search spot can not cover the current
    10791106            // search
    10801107            while (!search_cache.bbox().bounds(search_bbox)) {
    1081                 out("bbox: " + search_bbox);
     1108                if (debug)
     1109                    out("bbox: " + search_bbox);
    10821110                if (debug) {
    10831111                    out("search_cache: " + search_cache + " level: " + search_cache.level);
    10841112                    out("search_cache.bbox(): " + search_cache.bbox());
  • src/org/openstreetmap/josm/data/osm/DataSet.java

     
    66import java.util.ArrayList;
    77import java.util.Arrays;
    88import java.util.Collection;
     9import java.util.Collections;
    910import java.util.Comparator;
    1011import java.util.HashMap;
     12import java.util.LinkedHashSet;
    1113import java.util.HashSet;
    1214import java.util.Iterator;
    1315import java.util.LinkedList;
     
    1618
    1719import org.openstreetmap.josm.data.SelectionChangedListener;
    1820import org.openstreetmap.josm.data.osm.QuadBuckets;
     21import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1922
    2023/**
    2124 * DataSet is the data behind the application. It can consists of only a few points up to the whole
     
    142145        } else if (primitive instanceof Relation) {
    143146            relations.remove(primitive);
    144147        }
     148        selectedPrimitives.remove(primitive);
    145149    }
    146150
    147151    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        }
    150158        return sel;
    151159    }
    152160
     
    156164     * @return List of all selected objects.
    157165     */
    158166    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);
    163172    }
    164173
    165174    /**
     
    215224        }
    216225    }
    217226
    218     public boolean addSelected(OsmPrimitive osm) {
    219         osm.setSelected(true);
    220         return true;
    221     }
     227    LinkedHashSet<OsmPrimitive> selectedPrimitives = new LinkedHashSet<OsmPrimitive>();
    222228
    223229    public boolean toggleSelected(OsmPrimitive osm) {
    224         osm.setSelected(!osm.isSelected());
     230        if (!selectedPrimitives.remove(osm))
     231            selectedPrimitives.add(osm);
    225232        return true;
    226233    }
    227234    public boolean isSelected(OsmPrimitive osm) {
    228         return osm.isSelected();
     235        return selectedPrimitives.contains(osm);
    229236    }
    230237
    231238    public void setDisabled(OsmPrimitive... osm) {
     
    250257     * @param fireSelectionChangeEvent true, if the selection change listeners are to be notified; false, otherwise
    251258     */
    252259    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);
    259261        if (fireSelectionChangeEvent) {
    260262            fireSelectionChanged(selection);
    261263        }
     
    289291     * @param fireSelectionChangeEvent true, if the selection change listeners are to be notified; false, otherwise
    290292     */
    291293    public void addSelected(Collection<? extends OsmPrimitive> selection, boolean fireSelectionChangeEvent) {
    292         for (OsmPrimitive osm : selection) {
    293             osm.setSelected(true);
    294         }
     294        selectedPrimitives.addAll(selection);
    295295        if (fireSelectionChangeEvent) {
    296296            fireSelectionChanged(selection);
    297297        }
     
    303303            setSelected();
    304304            return;
    305305        }
    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);
    314309    }
    315310
    316311    /**
     
    346341    private void clearSelection(Collection<? extends OsmPrimitive> list) {
    347342        if (list == null)
    348343            return;
    349         for (OsmPrimitive osm : list) {
    350             osm.setSelected(false);
    351         }
     344        selectedPrimitives.removeAll(list);
    352345    }
    353346
    354347    /**
     
    356349     * @param list The collection from which the selected items are returned.
    357350     */
    358351    private Collection<OsmPrimitive> getSelected(Collection<? extends OsmPrimitive> list) {
    359         Collection<OsmPrimitive> sel = new HashSet<OsmPrimitive>();
    360352        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);
    366359        return sel;
    367360    }
    368361
     
    603596        }
    604597        return ret;
    605598    }
     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    }
    606657}
  • src/org/openstreetmap/josm/data/osm/OsmPrimitive.java

     
    4242    private static final int FLAG_DISABLED = 1 << 2;
    4343    private static final int FLAG_DELETED  = 1 << 3;
    4444    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;
    4847
    4948    /**
    5049     * Replies the sub-collection of {@see OsmPrimitive}s of type <code>type</code> present in
     
    184183    /**
    185184     * Sets whether this primitive is disabled or not.
    186185     *
    187      * @param selected true, if this primitive is disabled; false, otherwise
     186     * @param disabled true, if this primitive is disabled; false, otherwise
    188187     */
    189188    public void setDisabled(boolean disabled) {
    190189        if (disabled) {
     
    206205    /**
    207206     * Sets whether this primitive is filtered out or not.
    208207     *
    209      * @param selected true, if this primitive is filtered out; false, otherwise
     208     * @param filtered true, if this primitive is filtered out; false, otherwise
    210209     */
    211210    public void setFiltered(boolean filtered) {
    212211        if (filtered) {
     
    225224    }
    226225
    227226    /**
    228      * Sets whether this primitive is selected or not.
    229      *
    230      * @param selected  true, if this primitive is selected; false, otherwise
    231      * @since 1899
    232      */
    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 selected
    244      * @since 1899
    245      */
    246     @Deprecated public boolean isSelected() {
    247         return (flags & FLAG_SELECTED) != 0;
    248     }
    249 
    250     /**
    251227     * Marks this primitive as being modified.
    252228     *
    253229     * @param modified true, if this primitive is to be modified
     
    470446    /**
    471447     * Sets whether this primitive is deleted or not.
    472448     *
    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.
    474450     *
    475451     * @param deleted  true, if this primitive is deleted; false, otherwise
    476452     */
     
    481457            flags &= ~FLAG_DELETED;
    482458        }
    483459        setModified(deleted);
    484         setSelected(false);
    485460    }
    486461
    487462    /**