Legend layers vs. Legend layer files

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Legend layers vs. Legend layer files

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

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

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

I could probably add some more questions but I hope you have the basic
idea what kind of help I'm asking.

Bye,
Martin
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Legend layers vs. Legend layer files

Marco Hugentobler-2
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
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Legend layers vs. Legend layer files

Martin Dobias
Marco,

thank you very much for your replies!

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

I'm asking because I'd like to move layer file's popup menu to legend.
It's really a question what option makes more sense - first layer or
all. To keep it clear I would suggest that when layer has only one
layer file, editing can be turned on/of (or attribute table can be
shown). With more (or zero) layer files, this menu item will be
visible but disabled for layers and the user must decide which layer
file to edit...

Martin
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: Legend layers vs. Legend layer files

Hugentobler  Marco
Am Mittwoch 19 April 2006 11:55 schrieb Martin Dobias:

> I'm asking because I'd like to move layer file's popup menu to legend.

The only drawback i see here is that the popup may differ depending on the
layer type (e.g. raster layers have no 'show attribute table'). So there
might be an if in the legend. If now someone decides to add a completely new
layer type which is not raster and not vector, he needs to go to the legend
class and extend the if-clause.
But the advantages of having no gui dependencies in the maplayers are clearly
bigger (and it is very rare that people add new layer types).


> It's really a question what option makes more sense - first layer or
> all. To keep it clear I would suggest that when layer has only one
> layer file, editing can be turned on/of (or attribute table can be
> shown). With more (or zero) layer files, this menu item will be
> visible but disabled for layers and the user must decide which layer
> file to edit...

This sounds good. Most of the times people use only one layer file anyway so
they should not be bothered by the multilayer thing.

Marco
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.qgis.org/cgi-bin/mailman/listinfo/qgis-developer