[Qgis-developer] QgsLegendInterface implementation works only on top level items

Massimo massimo.endrighi at geopartner.it
Mon Sep 3 01:00:09 PDT 2012


Hi all,

I'm trying to read and write an xml file with an hierarchical set of groups
and layer. So I've decided to write a python plugin that uses
QgsLegendInterface but than I've discovered that QgsLegendInterface
implementation is limited to top level legend items.
a simple xml fragment like this:
<group A>
   <my first layer with style informations/>
   <group B>
      <my second layer with style informations/>
   </group B>
</group A>
it is impossible to re-create inside qgis just because
QgsLegendInterface.moveLayer only works with <group A>.

The plugin should also be able to write an xml file starting from a qgis set
of layer and groups. But this is also impossible because of the limited
information handled by the QgsLegendInterface implementation.

Someone could say that I can directly manage qgis project files (.qgs) but
I've already done a lot of work to load layers and applaying the specified
style.

The goal for this plugin is to substitute a custom application for a
commercial gis viewer and continue to use the same xml file as
workset/project.

For these reason I did the following pull request 
https://github.com/qgis/Quantum-GIS/pull/217
https://github.com/qgis/Quantum-GIS/pull/217  that solves the group indexing
problem.
Then I would like to add a groupLayerHierarchy method to obtain a true
group<->layer relationship that will be very usefull to produce an output
xml file.

I'm looking forward to see some feedback/approvation before to go on with my
project.
Thanks everybody and best regards.

Massimo






--
View this message in context: http://osgeo-org.1560.n6.nabble.com/QgsLegendInterface-implementation-works-only-on-top-level-items-tp4999348.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list