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

Martin Dobias wonder.sk at gmail.com
Fri Nov 23 12:26:46 EST 2007


Hi again,

I've found out that this is quite interesting topic as also for
purposes of labeling we should be able to store labeling settings
per-layer (and not only in project), so I have some more questions :)

Btw. do you have already an idea how the xml file will look like?
- will it have the same structure for layer properties as in .qgs project files?
- will it support multiple styles for one layer (e.g. style 1: red
color, style 2: blue color) or for every style you would need another
style file?
- will it support additional data stored for layer by plugins?

And how will users use it? When layer will use the default symbology
and he will change it, will be the change be saved in project file or
style file? Moreover will project use just link to the style file in
case of default style or will it copy the settings always? (that could
lead to some unpleasant behaviour like: 1. user saves project, 2. user
changes default style for one of that layers, 3. user opens the
project again - with old style)

On Nov 19, 2007 2:39 AM, Tim Sutton <tim at linfiniti.com> wrote:
> 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.

I think this would be OK (other two solutions seem to be worse).
I guess vector layer should get also functions to load and save style
file, right?

> 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.

For layers that are not represented as files (postgis or other
databases) we should support styling by default too - otherwise it
would be just a half-solution. I can imagine that every provider would
be able to pick a .qml file for every layer it can load - for
shapefiles provider would return the same file just with .qml
extension instead of .shp, for database layers we could use e.g.
~/.qgis/qml/ directory to store styles in format e.g.:
dbtype-hostname-port-dbname-table.

What do you think of it?

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

Just a small change in .sip file for vector layers...

Martin



More information about the Qgis-developer mailing list