[Qgis-developer] Plugin specific maplayers

Mathias Walker mwa at sourcepole.ch
Tue Oct 6 05:05:13 EDT 2009


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

-- 
Sourcepole -  Linux & Open Source Solutions
Elestastr. 18   7310 Bad Ragaz  Switzerland
Tel: 081 330 77 11       Fax: 081 330 77 12
mwa at sourcepole.ch  http://www.sourcepole.ch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.osgeo.org/pipermail/qgis-developer/attachments/20091006/cf771770/attachment.bin


More information about the Qgis-developer mailing list