Hi Devs,

a plugin dev was discussing with me the fact he could not find the names
of the different Enumeration values in QGIS to use for python plugins.

As an example: if you want to test if your layers 'type':

iface.mapCanvas().currentLayer().type()
0

is a Vector layer, so you could go to:

https://qgis.org/api/classQgsMapLayer.html#adf3b0b576d7812c4359ece2142170308

Then to the maplayer.h file:
https://qgis.org/api/qgsmaplayer_8h_source.html#l00106

From where you can count that Vector = 1  etc...
and guess to use:

QgsMapLayer.VectorLayer

Another example: having a 2.x plugin with a test:
geom_type == QGis.WKBPolygon
=> 3

I found:

https://qgis.org/api/classQgsWkbTypes.html#a60e72c2f73cb07fdbcdbc2d5068b5d9c

and then:

https://qgis.org/api/qgswkbtypes_8h_source.html

BUT how can we make this easier for python devs?

Searching in https://qgis.org/pyqgis for example VectorLayer the
constant (as name) does not pop up.

So what would work:
- add comments in the header files? Would these show up in the python
docs then?
- create (automated?) lists of these constants in the pycookbook?
- do a lot of blogging about it :-)

Or: who has an idea (so somebody can maybe pick this up in A Coruna....
:-) )

Regards,

Richard Duivenvoorde

_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to