@@ -24,6 +24,8 @@ __copyright__ = '(C) 2014, Nathan Woodrow'
24
24
from qgis.PyQt.QtCore import NULL
25
25
from qgis._core import *
26
26
27
+ from enum import IntEnum
28
+
27
29
@MONKEYPATCH_INJECTIONS@
28
30
29
31
from .additions.edit import edit, QgsEditError
@@ -159,3 +161,24 @@ PROJECT_SCALES = Qgis.defaultProjectScales()
159
161
GEOPROJ4 = geoProj4()
160
162
GEO_EPSG_CRS_AUTHID = geoEpsgCrsAuthId()
161
163
GEO_NONE = geoNone()
164
+
165
+ # manually patch this in -- it's not referenced anywhere in the sip bindings
166
+ # and we need it to have negative values, which aren't supported by sip
167
+ class _FeatureCountState(IntEnum):
168
+ Uncounted = -2
169
+ UnknownCount = -1
170
+
171
+
172
+ Qgis.FeatureCountState = _FeatureCountState
173
+ Qgis.FeatureCountState.Uncounted.__doc__ = "Feature count not yet computed"
174
+ Qgis.FeatureCountState.UnknownCount.__doc__ = "Provider returned an unknown feature count"
175
+ QgsVectorDataProvider.FeatureCountState = Qgis.FeatureCountState
176
+ QgsVectorDataProvider.Uncounted = Qgis.FeatureCountState.Uncounted
177
+ QgsVectorDataProvider.Uncounted.is_monkey_patched = True
178
+ QgsVectorDataProvider.Uncounted.__doc__ = "Feature count not yet computed"
179
+ QgsVectorDataProvider.UnknownCount = Qgis.FeatureCountState.UnknownCount
180
+ QgsVectorDataProvider.UnknownCount.is_monkey_patched = True
181
+ QgsVectorDataProvider.UnknownCount.__doc__ = "Provider returned an unknown feature count"
182
+ Qgis.FeatureCountState.__doc__ = "Enumeration of feature count states\n\n.. versionadded:: 3.20\n\n" + '* ``Uncounted``: ' + Qgis.FeatureCountState.Uncounted.__doc__ + '\n' + '* ``UnknownCount``: ' + Qgis.FeatureCountState.UnknownCount.__doc__
183
+ Qgis.FeatureCountState.baseClass = Qgis
184
+
0 commit comments