[Qgis-developer] A trip down memory lane - .avl style support in QGIS

Tim Sutton tim at linfiniti.com
Sun Nov 18 20:39:52 EST 2007


Hi Martin

Well as I see it there are three ways I can go here - one which will
impact the api of qgis_core, the others not. I'm planning to use the
existing readXML and writeXML implementations so in comparison to avl
you will get a bit more bang for the buck since all properties of the
layer will be applied by default if the qml exists, not just
symbology.

Way 1) Add an extra bool parameter to the vector ctor with default to
true. When loading layers from qgsproject set this flag to false to
prevent having to parse the xml once during layer initialisation
(using qml mechanism) and once when project overrides it with its own
deserialised xml for the layer.

Way 2) NO extra bool parameter to the vector ctor. When loading layers
from qgsproject  parse the xml once during layer initialisation (using
qml mechanism) and once when project overrides it with its own xml.
Obviously I dont like this option too much since it entails a double
initialisation of layer props.

Way 3) No change to vector layer api and manage everything from in the
addLayer function in qgisapp. This is the least invasive API wise but
does not transport well to apps built using libqgis_core. Since I want
this functionality in an application built using libqgis_core I dont
like this option much either.

As you can see my preferred way is to simply ad a flag to the ctor
that will determine whether we should look for the existance of a qml
or not. Obviously for some vector types e.g. PostGIS this flag will
currently be ignored though I am thinking that in these type of non
file based situations we could also be doing a layer URI match in the
users qgis.db and pull the qml out of a table there. This latter is
not something I will try to address in my first version yet though.

Assumming I go with way 1 above, how will that affect python bindings?

Regards

Tim

2007/11/15, Martin Dobias <wonder.sk at gmail.com>:
> On Nov 15, 2007 2:46 PM, Tim Sutton <tim at linfiniti.com> wrote:
> > Hi All
> >
> > Over the next week or so I plan to work on adding support for
> > autoproperties of vector layers. If you ever used ArcView 3.x I'm
> > talking about a feature similar to .avl support. The idea is that for
> > supported vector layers when the layer (e;g; layerfoo.shp) is first
> > loaded, QGIS will look for an associated layerfoo.qml file and if it
> > exists and we are not loading a project file, the symbology and other
> > settings in the qml file will be applied to the layer as it is loaded.
> > The .qml format will be exactly the same as the xml serilised layer
> > properties.
>
> Hi Tim,
>
> will these changes have some impact on QGIS core/gui libraries?
> (e.g. some API changes or additions?)
>
> Bye
> Martin
>


-- 
Tim Sutton
QGIS Project Steering Committee Member - Release  Manager
Visit http://qgis.org for a great open source GIS
openModeller Desktop Developer
Visit http://openModeller.sf.net for a great open source ecological
niche modelling tool
Home Page: http://tim.linfiniti.com
Skype: timlinux
Irc: timlinux on #qgis at freenode.net



More information about the Qgis-developer mailing list