[Qgis-developer] Plugin specific maplayers

Marco Hugentobler marco at hugis.net
Mon Nov 23 03:42:46 EST 2009


Hi Borys

I had a discussion about that topic, together with Martin and Tim, at the 
hackfest (based upon a follow-up patch from Mathias):

Currently, it is possible to derive plugin specific maplayers from QgsMapLayer. 
However, there are two problems:
- A few places in core code where maplayer types 'vector' and 'raster' are 
hardcoded (but that can be removed easily)
- When reading from a project file, it is necessary to create the proper plugin 
maplayer type. Martin suggested to have a registry in core where plugins may 
register functions to create the plugin specific layer types. That way, it 
would also be assured that the plugin is loaded (or possibly it could be 
loaded dynamically). I think this is a very good solution.

So it would be very welcome if someone takes up this idea to add support for 
plugin specific layers.

Regards,
Marco 

Am Sonntag, 22. November 2009 09.44:37 schrieb Borys Jurgiel:
> I've just found this quite old email - why not to open a ticket on trac?
> Probably nobody has a spare time to work on it at the time, but it's worth
>  to save the idea. We could even implement a mapserver provider in the
>  future.
> 
> Dnia wtorek, 6 października 2009 o 11:05:13 Mathias Walker napisał(a):
> > Hello
> >
> > At the moment our mapfile plugin only works when adding a mapfile layer
> >  using the plugin dialog. This is done by creating a temporary image and
> >  adding it as a raster layer. This image is then rerendered on every
> > change of the map canvas extents.
> > But this layer will not be restored when saving it in a project, as the
> > temporary image no longer exists. Also the plugin can not detect which
> >  layer belonged to it or what parameters to use.
> >
> > To solve these issues it would be nice to have a new plugin specific
> >  maplayer type.
> >
> > Desired features:
> > - attach layer to corresponding plugin when loading a project
> >   - get plugin specific parameters to recreate the layer
> >   - handle layers with missing plugins
> > - save plugin specific parameters when saving a project
> > - detach from plugin when removing the layer
> > - create and add layer using the plugin
> > - get layer draw events for custom rendering based on current extents and
> > image size
> > - customizable layer properties dialog
> >
> > Several of these features can be solved with workarounds using the QGIS
> >  API. But especially the problem of restoring a layer when loading a
> >  project is still unsolved.
> >
> > What would be the best approach to integrate plugin specific maplayers
> > into QGIS?
> >
> > Some ideas:
> > - add a new class QgsPluginRasterDataProvider : QgsRasterDataProvider,
> >  though the QgsRasterDataProvider interface is rather WMS specific
> > - or add a new class QgsPluginLayer : QgsMapLayer and
> >  LayerType::PluginLayer which would cause a lot of adjustments all over
> > the place
> >
> > Best regards
> > Mathias Walker
> 
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
> 

-- 
Dr. Marco Hugentobler
HUGIS - GIS programming and consulting
Webereistrasse 66
CH-8134 Adliswil
marco at hugis.net
http://homepage.hispeed.ch/hugis
Technical Advisor QGIS Project Steering Committee


More information about the Qgis-developer mailing list