[Qgis-developer] Legend layers vs. Legend layer files

nhugent at hispeed.ch nhugent at hispeed.ch
Wed Apr 19 02:58:06 EDT 2006


Hi Martin,

>Hi,
>
>currently I'm trying to remove stuff from QgsMapLayer which is
>dependent on the legend. However more things are not clear to me...
>
>- I'm interested in general concept of layers and layer files in the
>legend, what are the main differences between them, what types of
>layer files can a layer contain, what features should I expect from
>them etc.

A QgsLegendLayerFile represents a datasource (or a qgis maplayer). A QgsLegendLayer has a symbology and one or more datasources. The idea is that several datasources may share one symbology.

>
>- there's always only one file in layer file group, without
>possibility to move layer file to another layer file group - is this
>an intention, bug or not finished feature?

If you add a layer, there is one QgsLegendLayerFile in a QgsLegendLayer. It is possible to drag several files into one layer, but the files have to be symbology compatible. Qgis checks this during dragging (QgsMapLayer::isSymbologyCompatible()) and denies the drag if the two maplayers cannot share symbology. For vector layers, symbology compatibility means that two layers need to have the same attributes (because otherwise, there will be problems when using graduated/continuous/unique value renderers). Perhaps there are better definitions (e.g. it could be good that two layers share single symbol symbology), but that's just the current implementation i'm describing. Ah, and this is not (yet) implemented for raster layers. isSymbologyCompatible() always returns false with rasters.


>- popup menus differ greatly in organization, content and
>implementation between the legend layers and legend layer files -
>which operations should be possible for them?
>

Currently, the popups for the legend layer files come from the QgMapLayer instances, the ones for the other item types from the legend.
In the legend layer item, zoom to extent calculates a bounding box for all the layer files it contains. Add to overview/remove from overview should also consider all the layer files. At the moment, allow editing is not in the legend layer popup, because i'm not sure if it should just make the first layer file editable or all.

Greetings,
Marco



More information about the Qgis-developer mailing list