[Qgis-developer] mapserver plugin, qgs project xml and label-elements

Martin Dobias wonder.sk at gmail.com
Fri Mar 26 06:15:34 EDT 2010


Hi Richard

On Wed, Mar 24, 2010 at 10:59 PM, Richard Duivenvoorde
<rdmailings at duif.net> wrote:
> Hi Devs,
>
> trying to fix the label part of the mapserver plugin I find different
> 'label'-elements in a 'maplayer'-element in the qgs project xml.
>
> -1- There is the one holding a 1 or 0 to indicate if this layer has labels.
> -2- There is one in every symbol element (for the 'labels' in the legend, at
> least for a uniquevalue classification)
> -3- There is one in the labelattributes-element, having the
> fieldname-attribute and text-attribute indicating the label-text
>
> as the plugin is using xml-minidom/getElementsByTagName it would be easier
> to make those elements more distinguishable (is that english :-) ), for
> example by making the first one 'labels' or 'haslabels', the second one
> 'legendlabel' and the last one ... 'labeltext' or so?

you need to distinguish the context of the "label" tag. I know it's a
bit unfortunate that it's used with various meanings, but changing the
tag name would only bring additional incompatibility in project files
(and the plugin would still work only with only the new ones).

> somebody problems with that, or a better/easier way to find out using the
> parsed qgs-file if a layer has labels or not? Or should we stop using the
> projectfile as leading for the plugin anyway, and use the loaded project to
> determine this kind of information by just 'asking' the layerobjects etc?

I would recommend you to work with currently loaded project file. The
access to the data should be more natural as you would work directly
with the instances of classes of QGIS API. And you don't need to care
about the xml format...


Cheers
Martin


More information about the Qgis-developer mailing list