[Qgis-developer] Re: question about location of providerregistry and pluginregistry

Marco Hugentobler marco.hugentobler at karto.baug.ethz.ch
Tue Feb 20 10:15:49 EST 2007


Hi Martin,

> provider registry is in core library as it's needed to lookup
> providers used for opening layers. But plugin registry isn't something
> that we want to give to users of the libs - at least I don't see any
> purpose. 

Ok, third party apps can do QLibrary::open themselves if they need the non-gui 
functionality of a plugin.  

> Moreover plugins are connected also with gui library - they 
> might need to access map canvas etc.

I agree with this. Maybe we should have GUI plugins and non-GUI plugins 
somewhen in future? But for the diagram plugin now, your suggestion below 
seems to be the best way. 

> In my opinion, accessing plugins directly from core library is not
> good. There must be other way how to do it. How to solve it - imagine
> that the functionality is implemented directly in core library and not
> in a plugin - that's also a possible case.
>
> What about creating an interface e.g. QgsMapLayerMetadata which would
> have methods readXML() and writeXML() and maybe some more. Some
> classes would implement this interface to enable reading/storing some
> data. Every layer could have a list of metadata - e.g. labeling
> information, diagram information etc. Vector layer would not need to
> care about what exactly they are, just call read/write XML function on
> layer load/save. Do you like this idea?

So the interface QgsMapLayerMetadata would be in core, but the implementation, 
let's say QgsDiagramMetadata would be in app and load the plugin in the 
method readXML()? This sounds good to me.

Thanks a lot,
Marco


> Martin
>
> On 2/19/07, Marco Hugentobler <marco.hugentobler at karto.baug.ethz.ch> wrote:
> > Hi,
> >
> > In svn head, qgsproviderregistry.h is in core/ directory and
> > qgspluginregistry.h in app/ directory. I wanted to ask what the reason
> > for this is.
> > Backgournd of my question is that I'm trying to restore the diagram
> > overlay from project file. For this, QgsVectorLayer needs to have a
> > pointer to the diagram plugin (in case it is loaded). From a pure
> > technical point of view this is similar to QgsVectorLayer using
> > QgsProviderRegistry to restore a data provider from project file. But
> > because plugin registry is in app, vector layer is not allowed to use it,
> > as code in core should not depend on code in app.
> > Is it possible that QgsPluginRegistry could be in core? Or is there a
> > more intelligent way of getting the plugin pointer?
> >
> > Thanks,
> > Marco



More information about the Qgis-developer mailing list