Feature request #575
API Feature Request: Concrete subclass of QgsVectorDataProvider with generic data storage inside
|Pull Request or Patch supplied:||Resolution:||fixed|
|Easy fix?:||No||Copied to github as #:||10634|
Implementing a new QgsDataProvider class can be difficult.
So I would like to suggest adding a new class to the QGIS library: a subclass of QgsVectorDataProvider (maybe also a companion for Raster?) that implements all pure virtual functions and can be instantiated by the plugin as is. Inside it would have a simple, generic, data store for the vector data to provide to QGIS. A plugin could then, whenever it needs to, add and remove stuff from that internal data store, and not have to worry about how to store or provide it to QGIS.
This would be a big help in developing plugins that provide a small but changing set of data.
Example: Say I have some sensors that I want to represent in QGIS. My plugin gets updates from the sensors (over a network or something) and moves or changes visible features representing the sensed data, and QGIS becomes a near-real-time display for that data, and I can have that dynamic data visible while working with other map layers, or save a snapshot of for later work. This would be a really cool use of QGIS, in my opinion.
Does this make sense?
An ideal way to do it would be for it to actually be a template class and have the ability to use any STL container object to store the data, if this is possible. It would probably also need hooks called while QGIS accesses the data that the user could use to lock/unlock mutexes etc.