[Potlatch-dev] Potlatch 2.1 and 2.x...
Richard Fairhurst
richard at systemeD.net
Wed May 25 08:35:24 BST 2011
Andy Allan wrote:
> I've been doing a lot of the refactoring of the VBL stuff, so most
> things are working again (including bug layers, MyGPX, public traces
> etc).
Excellent.
> This comes to a head with what I just worked on- Trace.as[1] -
> downloading private traces from the server via an authenticated
> Connection, and then storing the data in a per-trace "empty
> connection" just for nodes and ways storage. That involves the Trace
> having two "connections", and also the delights of "new
> Connection(filename, null, null, null);" - perhaps if a connection
> doesn't even need a URL it's something else entirely? Some kind of
> EntityStore? It just feels a little strange.
I'd be tempted to put as much of this as possible in a specialised Connection. In other words, have a TraceConnection that does it all - does the auth, downloads the traces, stores the entities. You can extend the Connection as much as you like for the particular application, e.g. storing the raw trace data.
That way, when we have a Connection that needs to come back for more (because the user has panned, say), you don't need to instantiate it all over again: the MapPaint object just says to the Connection "oy, I need some more", just as it does for the main editableLayer.
I think the trick is going to be getting the inheritance right. Possible methods you might want to inherit for different types of GPX would include:
- OAuth functionality (currently in XMLConnection)
- remote file loading
- local file loading (FP10)
- loading data for the current bbox on panning
and all of this is in different places.
Similarly, the OSMFileConnection (what we currently call OSMConnection ;) ) will need the XML parsing (currently in XMLBaseConnection), and tiled file loading (somewhere else). And so on.
You could in theory put all the functionality in a monolithic Connection, and each specialised Connection would only call the methods it needed. But that'd be a bit horrid.
AS3 doesn't do mixins or multiple inheritance out of the box, sadly: there are solutions (http://flexonrails.net/?p=79 - I knew all that AS1 prototype knowledge would come in handy one day ;) - or https://github.com/stickupkid/as3-mixins); or we could sometimes use static methods for stuff that needs to be shared (ConnectionHelper.parseOSMXML); or we could have little 'ConnectionLoader' and 'OAuth' classes which the Connections used; or interfaces... I'm not fussed; whatever works.
cheers
Richard
More information about the Potlatch-dev
mailing list