Hi Jiri

> What do you think about that? Can you think of any problems this might
bring us?
I can only think of adavantages. The data classes I've added for managing
the history of primitives could possibly be replaced with *Prototype too.
 
The second approach (turning dataset into a factory for primitives) is fine
for me too. 
Dateset.addNode(node parameters..) wouldn't be a static method on DataSet,
but a method on "a Dataset", right? 

I'd be happy to help migrating core and plugins to this new approach.

Regards
Karl 


-----Ursprüngliche Nachricht-----
Von: josm-dev-boun...@openstreetmap.org
[mailto:josm-dev-boun...@openstreetmap.org] Im Auftrag von Jiri Klement
Gesendet: Samstag, 3. Oktober 2009 14:18
An: josm-dev
Betreff: [josm-dev] Problem with referrers

Hi,

I'm working on support for referrers and I run into a problem which I'm not
sure how to fix.  Currently JOSM quite often makes copies of primitive
(using for example cloneFrom or special constructors). It's not obvious
whether the copy is added to the dataset or is kept in case we need to get
back to old version of primitive (for example Command.cloneMap). That's a
bit problem because I don't want to have such copy in referrers list, I want
only primitives that are really used in an dataset.

To workaround this issues I'm thinking about introducing new classes -
PrimitivePrototype, NodePrototype, WayPrototype and RelationPrototype.
These classes will hold informations for one primitive, but it will not be
possible to add these objects to the dataset. That will allow to clearly
distinguish what's real primitive and whats just an backup copy for for
example Command.cloneMap or Main.pasteBuffer. Obviously it will be possible
to construct new primitive based on prototype.
Method cloneFrom() and constructoctors like Node(Node n) will be removed to
make sure everybody is using new system.

This will also fix another issue - for some features (most notably reliable
events when primitive is modified) I need for every primitive to be part of
exactly one dataset. This can be forced by making all primitive constructors
protected and allowing to create new primitives only using methods like
Dateset.addNode(node parameters..) or Dataset.addNode(NodePrototype).

What do you think about that? Can you think of any problems this might bring
us?

--
Jiri

_______________________________________________
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

Reply via email to