Skip to content
Permalink
Browse files

[processing] pendingFields() -> fields()

Does the same thing, but pendingFields() is ugly
  • Loading branch information
nyalldawson committed Aug 3, 2016
1 parent 06c4b07 commit c1649ebef475b7b37c978c614a0a416839fcc3d0
Showing with 42 additions and 42 deletions.
  1. +1 −1 python/plugins/processing/algs/qgis/ConvexHull.py
  2. +1 −1 python/plugins/processing/algs/qgis/DeleteColumn.py
  3. +1 −1 python/plugins/processing/algs/qgis/DeleteDuplicateGeometries.py
  4. +1 −1 python/plugins/processing/algs/qgis/DeleteHoles.py
  5. +1 −1 python/plugins/processing/algs/qgis/DensifyGeometries.py
  6. +1 −1 python/plugins/processing/algs/qgis/DensifyGeometriesInterval.py
  7. +1 −1 python/plugins/processing/algs/qgis/Difference.py
  8. +1 −1 python/plugins/processing/algs/qgis/ExecuteSQL.py
  9. +1 −1 python/plugins/processing/algs/qgis/ExportGeometryInfo.py
  10. +1 −1 python/plugins/processing/algs/qgis/ExtractByAttribute.py
  11. +1 −1 python/plugins/processing/algs/qgis/ExtractByLocation.py
  12. +1 −1 python/plugins/processing/algs/qgis/ExtractNodes.py
  13. +1 −1 python/plugins/processing/algs/qgis/FixedDistanceBuffer.py
  14. +1 −1 python/plugins/processing/algs/qgis/GeometryConvert.py
  15. +1 −1 python/plugins/processing/algs/qgis/Gridify.py
  16. +1 −1 python/plugins/processing/algs/qgis/HubDistance.py
  17. +1 −1 python/plugins/processing/algs/qgis/HubLines.py
  18. +2 −2 python/plugins/processing/algs/qgis/LinesIntersection.py
  19. +1 −1 python/plugins/processing/algs/qgis/LinesToPolygons.py
  20. +1 −1 python/plugins/processing/algs/qgis/MultipartToSingleparts.py
  21. +1 −1 python/plugins/processing/algs/qgis/PointsInPolygonUnique.py
  22. +1 −1 python/plugins/processing/algs/qgis/PolygonsToLines.py
  23. +1 −1 python/plugins/processing/algs/qgis/RandomExtract.py
  24. +1 −1 python/plugins/processing/algs/qgis/RandomExtractWithinSubsets.py
  25. +2 −2 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsFixed.py
  26. +3 −3 python/plugins/processing/algs/qgis/RectanglesOvalsDiamondsVariable.py
  27. +1 −1 python/plugins/processing/algs/qgis/ReprojectLayer.py
  28. +1 −1 python/plugins/processing/algs/qgis/SelectByAttribute.py
  29. +1 −1 python/plugins/processing/algs/qgis/SimplifyGeometries.py
  30. +1 −1 python/plugins/processing/algs/qgis/SinglePartsToMultiparts.py
  31. +1 −1 python/plugins/processing/algs/qgis/SplitLinesWithLines.py
  32. +1 −1 python/plugins/processing/algs/qgis/TextToFloat.py
  33. +1 −1 python/plugins/processing/algs/qgis/VariableDistanceBuffer.py
  34. +1 −1 python/plugins/processing/algs/qgis/VectorSplit.py
  35. +1 −1 python/plugins/processing/algs/qgis/VoronoiPolygons.py
  36. +1 −1 python/plugins/processing/algs/qgis/ZonalStatistics.py
  37. +1 −1 python/plugins/processing/algs/qgis/scripts/Frequency_analysis.py
  38. +1 −1 python/plugins/processing/algs/qgis/ui/FieldsCalculatorDialog.py
@@ -78,7 +78,7 @@ def processAlgorithm(self, progress):
f = QgsField('value', QVariant.String, '', 255)
if useField:
index = layer.fieldNameIndex(fieldName)
fType = layer.pendingFields()[index].type()
fType = layer.fields()[index].type()
if fType in [QVariant.Int, QVariant.UInt, QVariant.LongLong, QVariant.ULongLong]:
f.setType(fType)
f.setLength(20)
@@ -54,7 +54,7 @@ def processAlgorithm(self, progress):
self.getParameterValue(self.INPUT))
idx = layer.fieldNameIndex(self.getParameterValue(self.COLUMN))

fields = layer.pendingFields()
fields = layer.fields()
fields.remove(idx)

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields,
@@ -49,7 +49,7 @@ def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(
self.getParameterValue(self.INPUT))

fields = layer.pendingFields()
fields = layer.fields()

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields,
layer.wkbType(), layer.crs())
@@ -49,7 +49,7 @@ def processAlgorithm(self, progress):
self.getParameterValue(self.INPUT))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields(),
layer.fields(),
layer.wkbType(),
layer.crs())

@@ -65,7 +65,7 @@ def processAlgorithm(self, progress):
isPolygon = layer.geometryType() == QgsWkbTypes.PolygonGeometry

writer = self.getOutputFromName(
self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
self.OUTPUT).getVectorWriter(layer.fields().toList(),
layer.wkbType(), layer.crs())

features = vector.features(layer)
@@ -62,7 +62,7 @@ def processAlgorithm(self, progress):
isPolygon = layer.geometryType() == QgsWkbTypes.PolygonGeometry

writer = self.getOutputFromName(
self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
self.OUTPUT).getVectorWriter(layer.fields().toList(),
layer.wkbType(), layer.crs())

features = vector.features(layer)
@@ -70,7 +70,7 @@ def processAlgorithm(self, progress):

geomType = layerA.wkbType()
writer = self.getOutputFromName(
Difference.OUTPUT).getVectorWriter(layerA.pendingFields(),
Difference.OUTPUT).getVectorWriter(layerA.fields(),
geomType,
layerA.crs())

@@ -131,7 +131,7 @@ def processAlgorithm(self, progress):
raise GeoAlgorithmExecutionException(vLayer.dataProvider().error().message())

writer = self.getOutputFromName(self.OUTPUT_LAYER).getVectorWriter(
vLayer.pendingFields().toList(),
vLayer.fields().toList(),
# Create a point layer (without any points) if 'no geometry' is chosen
vLayer.wkbType() if geometry_type != 1 else 1,
vLayer.crs())
@@ -72,7 +72,7 @@ def processAlgorithm(self, progress):
method = self.getParameterValue(self.METHOD)

geometryType = layer.geometryType()
fields = layer.pendingFields()
fields = layer.fields()

if geometryType == QgsWkbTypes.PolygonGeometry:
areaName = vector.createUniqueFieldName('area', fields)
@@ -83,7 +83,7 @@ def processAlgorithm(self, progress):
operator = self.OPERATORS[self.getParameterValue(self.OPERATOR)]
value = self.getParameterValue(self.VALUE)

fields = layer.pendingFields()
fields = layer.fields()
writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields,
layer.wkbType(), layer.crs())

@@ -70,7 +70,7 @@ def processAlgorithm(self, progress):
index = vector.spatialindex(layer)

output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.pendingFields(),
writer = output.getVectorWriter(layer.fields(),
layer.wkbType(), layer.crs())

if 'disjoint' in predicates:
@@ -62,7 +62,7 @@ def processAlgorithm(self, progress):
self.getParameterValue(self.INPUT))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), QgsWkbTypes.Point, layer.crs())
layer.fields().toList(), QgsWkbTypes.Point, layer.crs())

outFeat = QgsFeature()
inGeom = QgsGeometry()
@@ -75,7 +75,7 @@ def processAlgorithm(self, progress):
segments = int(self.getParameterValue(self.SEGMENTS))

writer = self.getOutputFromName(
self.OUTPUT).getVectorWriter(layer.pendingFields().toList(),
self.OUTPUT).getVectorWriter(layer.fields().toList(),
QgsWkbTypes.Polygon, layer.crs())

buff.buffering(progress, writer, distance, None, False, layer,
@@ -78,7 +78,7 @@ def processAlgorithm(self, progress):
newType = QgsWkbTypes.Point

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields(), newType, layer.crs())
layer.fields(), newType, layer.crs())

features = vector.features(layer)
total = 100.0 / len(features)
@@ -65,7 +65,7 @@ def processAlgorithm(self, progress):
self.tr('Invalid grid spacing: %s/%s' % (hSpacing, vSpacing)))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields(), layer.wkbType(), layer.crs())
layer.fields(), layer.wkbType(), layer.crs())

features = vector.features(layer)
total = 100.0 / len(features)
@@ -99,7 +99,7 @@ def processAlgorithm(self, progress):
if addLines:
geomType = QgsWkbTypes.LineString

fields = layerPoints.pendingFields()
fields = layerPoints.fields()
fields.append(QgsField('HubName', QVariant.String))
fields.append(QgsField('HubDist', QVariant.Double))

@@ -71,7 +71,7 @@ def processAlgorithm(self, progress):
self.tr('Same layer given for both hubs and spokes'))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layerSpoke.pendingFields(), QgsWkbTypes.LineString, layerSpoke.crs())
layerSpoke.fields(), QgsWkbTypes.LineString, layerSpoke.crs())

spokes = vector.features(layerSpoke)
hubs = vector.features(layerHub)
@@ -82,8 +82,8 @@ def processAlgorithm(self, progress):
idxA = layerA.fieldNameIndex(fieldA)
idxB = layerB.fieldNameIndex(fieldB)

fieldList = [layerA.pendingFields()[idxA],
layerB.pendingFields()[idxB]]
fieldList = [layerA.fields()[idxA],
layerB.fields()[idxB]]

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fieldList,
QgsWkbTypes.Point, layerA.crs())
@@ -59,7 +59,7 @@ def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), QgsWkbTypes.Polygon, layer.crs()
layer.fields().toList(), QgsWkbTypes.Polygon, layer.crs()
)

outFeat = QgsFeature()
@@ -61,7 +61,7 @@ def processAlgorithm(self, progress):
geomType = self.multiToSingleGeom(layer.wkbType())

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), geomType, layer.crs())
layer.fields().toList(), geomType, layer.crs())

features = vector.features(layer)
total = 100.0 / len(features)
@@ -67,7 +67,7 @@ def processAlgorithm(self, progress):

classFieldIndex = pointLayer.fieldNameIndex(classFieldName)
(idxCount, fieldList) = vector.findOrCreateField(polyLayer,
polyLayer.pendingFields(), fieldName)
polyLayer.fields(), fieldName)

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
fields.toList(), polyLayer.wkbType(), polyLayer.crs())
@@ -60,7 +60,7 @@ def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), QgsWkbTypes.LineString, layer.crs())
layer.fields().toList(), QgsWkbTypes.LineString, layer.crs())

outFeat = QgsFeature()
inGeom = QgsGeometry()
@@ -83,7 +83,7 @@ def processAlgorithm(self, progress):
selran = random.sample(xrange(featureCount), value)

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), layer.wkbType(), layer.crs())
layer.fields().toList(), layer.wkbType(), layer.crs())

total = 100.0 / featureCount
for i, feat in enumerate(features):
@@ -89,7 +89,7 @@ def processAlgorithm(self, progress):
value = value / 100.0

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), layer.wkbType(), layer.crs())
layer.fields().toList(), layer.wkbType(), layer.crs())

selran = []
current = 0
@@ -30,7 +30,7 @@

from qgis.PyQt.QtGui import QIcon

from qgis.core import Qgis, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes, QgsWkbTypes
from qgis.core import Qgis, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.ProcessingLog import ProcessingLog
@@ -89,7 +89,7 @@ def processAlgorithm(self, progress):

writer = self.getOutputFromName(
self.OUTPUT_LAYER).getVectorWriter(
layer.pendingFields().toList(),
layer.fields().toList(),
QgsWkbTypes.Polygon,
layer.crs())

@@ -30,7 +30,7 @@

from qgis.PyQt.QtGui import QIcon

from qgis.core import Qgis, QgsFeature, QgsGeometry, QgsPoint, QgsWkbTypes
from qgis.core import Qgis, QgsFeature, QgsGeometry, QgsPoint

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.ProcessingLog import ProcessingLog
@@ -97,8 +97,8 @@ def processAlgorithm(self, progress):

writer = self.getOutputFromName(
self.OUTPUT_LAYER).getVectorWriter(
layer.pendingFields().toList(),
QgsWkbTypes.Polygon,
layer.fields().toList(),
Qgis.WKBPolygon,
layer.crs())

outFeat = QgsFeature()
@@ -57,7 +57,7 @@ def processAlgorithm(self, progress):
targetCrs.createFromUserInput(crsId)

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), layer.wkbType(), targetCrs)
layer.fields().toList(), layer.wkbType(), targetCrs)

layerCrs = layer.crs()
crsTransform = QgsCoordinateTransform(layerCrs, targetCrs)
@@ -84,7 +84,7 @@ def processAlgorithm(self, progress):
operator = self.OPERATORS[self.getParameterValue(self.OPERATOR)]
value = self.getParameterValue(self.VALUE)

fields = layer.pendingFields()
fields = layer.fields()

idx = layer.fieldNameIndex(fieldName)
fieldType = fields[idx].type()
@@ -70,7 +70,7 @@ def processAlgorithm(self, progress):
pointsAfter = 0

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), layer.wkbType(), layer.crs())
layer.fields().toList(), layer.wkbType(), layer.crs())

features = vector.features(layer)
total = 100.0 / len(features)
@@ -67,7 +67,7 @@ def processAlgorithm(self, progress):
geomType = self.singleToMultiGeom(layer.wkbType())

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), geomType, layer.crs())
layer.fields().toList(), geomType, layer.crs())

inFeat = QgsFeature()
outFeat = QgsFeature()
@@ -57,7 +57,7 @@ def processAlgorithm(self, progress):
layerB = dataobjects.getObjectFromUri(self.getParameterValue(self.INPUT_B))

sameLayer = self.getParameterValue(self.INPUT_A) == self.getParameterValue(self.INPUT_B)
fieldList = layerA.pendingFields()
fieldList = layerA.fields()

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fieldList,
QgsWkbTypes.LineString, layerA.crs())
@@ -55,7 +55,7 @@ def processAlgorithm(self, progress):
fieldName = self.getParameterValue(self.FIELD)
idx = layer.fieldNameIndex(fieldName)

fields = layer.pendingFields()
fields = layer.fields()
fields[idx] = QgsField(fieldName, QVariant.Double, '', 24, 15)

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(fields,
@@ -76,7 +76,7 @@ def processAlgorithm(self, progress):
segments = int(self.getParameterValue(self.SEGMENTS))

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), QgsWkbTypes.Polygon, layer.crs())
layer.fields().toList(), QgsWkbTypes.Polygon, layer.crs())

buff.buffering(progress, writer, 0, field, True, layer, dissolve,
segments)
@@ -70,7 +70,7 @@ def processAlgorithm(self, progress):
uniqueValues = vector.uniqueValues(layer, fieldIndex)
baseName = os.path.join(directory, '{0}_{1}'.format(layer.name(), fieldName))

fields = layer.pendingFields()
fields = layer.fields()
crs = layer.crs()
geomType = layer.wkbType()

@@ -69,7 +69,7 @@ def processAlgorithm(self, progress):
buf = self.getParameterValue(self.BUFFER)

writer = self.getOutputFromName(self.OUTPUT).getVectorWriter(
layer.pendingFields().toList(), QgsWkbTypes.Polygon, layer.crs())
layer.fields().toList(), QgsWkbTypes.Polygon, layer.crs())

outFeat = QgsFeature()
extent = layer.extent()
@@ -132,7 +132,7 @@ def processAlgorithm(self, progress):
memVectorDriver = ogr.GetDriverByName('Memory')
memRasterDriver = gdal.GetDriverByName('MEM')

fields = layer.pendingFields()
fields = layer.fields()
(idxMin, fields) = vector.findOrCreateField(layer, fields,
columnPrefix + 'min', 21, 6)
(idxMax, fields) = vector.findOrCreateField(layer, fields,
@@ -8,7 +8,7 @@
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException

layer = processing.getObject(Input)
inputFields = layer.pendingFields()
inputFields = layer.fields()
fieldIdxs = []
fields = Fields.split(',')
for f in fields:
@@ -172,7 +172,7 @@ def populateFields(self):
if self.layer is None:
return

fields = self.layer.pendingFields()
fields = self.layer.fields()
for f in fields:
self.mExistingFieldComboBox.addItem(f.name())

0 comments on commit c1649eb

Please sign in to comment.
You can’t perform that action at this time.