[Qgis-developer] QgsMapSettings: store layer pointers instead of layer ids?
Matthias Kuhn
matthias at opengis.ch
Wed Aug 3 06:49:39 PDT 2016
Hi Sandro,
I think it's a good idea to reduce the usage of the registry where
possible. Reducing dependency on this singleton will not only help
moving towards multi-canvas but also towards multi-project.
The main thing to watch out for is not to use map layer pointers outside
of the main thread and to clean them up when a layer is deleted.
Matthias
On 08/03/2016 03:25 PM, Sandro Mani wrote:
> Hi
>
> For a project I need independent QgsMapCanvas instances, in particular a
> child view which is unrelated to the main view (including its
> layertree). (Easy example: the main view displays a city, and if the
> user clicks on a "show building schema" button in the building feature
> attribute dialog, the schema of the building is opened in a secondary
> view. The layers of the building schema should not appear in the main
> layer tree however).
>
> Currently this is not possible: while one can set the layers
> individually for each QgsMapCanvas, the QgsMapSetting ends up storing
> the layer ids and hence they must be stored in the QgsMapLayerRegistry.
> Items which are stored in the QgsMapLayerRegistry will always be visible
> in the application legend tree.
>
> So I was thinking about whether it would make sense to store the actual
> QgsMapLayer pointers instead of the layerIds in QgsMapSettings, so that
> the whole rendering process is independent of QgsMapLayerRegistry.
>
> I haven't yet investigated extensively how invasive such a change would
> be, but are there some initial opinions?
>
> Thanks
> Sandro
>
>
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
More information about the Qgis-developer
mailing list