mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-24 00:05:18 -05:00
[processing] support more field types
This commit is contained in:
parent
7b1ee07f92
commit
1b60b088a2
@ -79,8 +79,8 @@ class ConvexHull(GeoAlgorithm):
|
||||
if useField:
|
||||
index = layer.fieldNameIndex(fieldName)
|
||||
fType = layer.pendingFields()[index].type()
|
||||
if fType == QVariant.Int:
|
||||
f.setType(QVariant.Int)
|
||||
if fType in [QVariant.Int, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
|
||||
f.setType(fType)
|
||||
f.setLength(20)
|
||||
elif fType == QVariant.Double:
|
||||
f.setType(QVariant.Double)
|
||||
|
||||
@ -95,7 +95,7 @@ class ExtractByAttribute(GeoAlgorithm):
|
||||
raise GeoAlgorithmExecutionException(
|
||||
self.tr('Operators %s can be used only with string fields.' % op))
|
||||
|
||||
if fieldType in [QVariant.Int, QVariant.Double]:
|
||||
if fieldType in [QVariant.Int, QVariant.Double, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
|
||||
expr = '"%s" %s %s' % (fieldName, operator, value)
|
||||
elif fieldType == QVariant.String:
|
||||
if operator not in self.OPERATORS[-2:]:
|
||||
|
||||
@ -97,7 +97,7 @@ class Merge(GeoAlgorithm):
|
||||
sattributes = feature.attributes()
|
||||
dattributes = []
|
||||
for dindex, dfield in enumerate(fields):
|
||||
if (dfield.type() == QVariant.Int):
|
||||
if (dfield.type() == QVariant.Int, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong):
|
||||
dattribute = 0
|
||||
elif (dfield.type() == QVariant.Double):
|
||||
dattribute = 0.0
|
||||
|
||||
@ -94,7 +94,7 @@ class SelectByAttribute(GeoAlgorithm):
|
||||
raise GeoAlgorithmExecutionException(
|
||||
self.tr('Operators %s can be used only with string fields.' % op))
|
||||
|
||||
if fieldType in [QVariant.Int, QVariant.Double]:
|
||||
if fieldType in [QVariant.Int, QVariant.Double, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
|
||||
expr = '"%s" %s %s' % (fieldName, operator, value)
|
||||
elif fieldType == QVariant.String:
|
||||
if operator not in self.OPERATORS[-2:]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user