Before, we had node.selected = true or if 'way.selected then' everywhere. The plan was, 1. to migrate to node.setSelected(..) and way.isSelected() 2. to change the behaviour behind OsmPrimitive:setSelected()/isSelected(), possibly using a reference from the primitive to it's "parent" dataset (see recent dicussion about backreference in this list) 3. to provide a more efficient getSelected() on the DataSet
We've done step 1, it looks like Jiri is working on the reference step 2, and then it will be easy to do step 3. > Do you have a better suggestion on where to stick the "selection cache" > or whatever we want to call it than in the DataSet? I think the "selection cache" (a collection of the currently selected primitives) should be maintained for each data layer (either by the layer or by some global selection cache which keeps a selection state per layer). If the dataset wasn't attached to a data layer why would you want to select/unselect objects? What I never liked is that there is a boolean field 'selected' on OsmPrimitive - this looks weired. Regards Karl -----Ursprüngliche Nachricht----- Von: josm-dev-boun...@openstreetmap.org [mailto:josm-dev-boun...@openstreetmap.org] Im Auftrag von Dave Hansen Gesendet: Donnerstag, 8. Oktober 2009 17:59 An: Petr Nejedlý Cc: josm-dev Betreff: Re: [josm-dev] Selection Performance On Thu, 2009-10-08 at 10:18 +0200, Petr Nejedlý wrote: > First and foremost, selection status is not a property of the data. > Changing the data set just because the user have selected something is > plain wrong. Having a per-dataset selection is quite disturbing too - > there should be only one, system-wide. OK, so you're saying that because selecting things is not a property of the data that it shouldn't be a part of the data set? Uh, ok. Aren't ways and nodes part of the data set? Check out OsmPrimitive.setSelected(). Sure seems to *ME* like selections are part of the data set. In any case, there's code cleanliness and order, and then there's the ugly fact that it takes a full *SECOND* to process a mouse click. I'd rather have fast ugly code than slow clean code. :) Do you have a better suggestion on where to stick the "selection cache" or whatever we want to call it than in the DataSet? -- Dave _______________________________________________ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev _______________________________________________ josm-dev mailing list josm-dev@openstreetmap.org http://lists.openstreetmap.org/listinfo/josm-dev