mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-26 00:02:08 -05:00
fixed #6221
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@352 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
This commit is contained in:
parent
5a0f357633
commit
6629230e6b
@ -36,22 +36,22 @@ class ConvexHull(GeoAlgorithm):
|
||||
vproviderA = vlayerA.dataProvider()
|
||||
allAttrsA = vproviderA.attributeIndexes()
|
||||
vproviderA.select(allAttrsA)
|
||||
#fields = vproviderA.fields()
|
||||
fields = [ QgsField("ID", QVariant.Int),
|
||||
QgsField("Area", QVariant.Double),
|
||||
QgsField("Perim", QVariant.Double) ]
|
||||
fields = { 0 : QgsField("ID", QVariant.Int),
|
||||
1 : QgsField("Area", QVariant.Double),
|
||||
2 : QgsField("Perim", QVariant.Double) }
|
||||
writer = self.getOutputFromName(ConvexHull.OUTPUT).getVectorWriter(fields, QGis.WKBPolygon, vproviderA.crs())
|
||||
inFeat = QgsFeature()
|
||||
outFeat = QgsFeature()
|
||||
inGeom = QgsGeometry()
|
||||
outGeom = QgsGeometry()
|
||||
nElement = 0
|
||||
index = vproviderA.fieldNameIndex(field)
|
||||
# there is selection in input layer
|
||||
if useSelection:
|
||||
nFeat = vlayerA.selectedFeatureCount()
|
||||
selectionA = vlayerA.selectedFeatures()
|
||||
if useField:
|
||||
unique = ftools_utils.getUniqueValues( vproviderA, field )
|
||||
unique = ftools_utils.getUniqueValues( vproviderA, index )
|
||||
nFeat = nFeat * len( unique )
|
||||
for i in unique:
|
||||
hull = []
|
||||
@ -59,7 +59,7 @@ class ConvexHull(GeoAlgorithm):
|
||||
outID = 0
|
||||
for inFeat in selectionA:
|
||||
atMap = inFeat.attributeMap()
|
||||
idVar = atMap[ self.myParam ]
|
||||
idVar = atMap[ index ]
|
||||
if idVar.toString().trimmed() == i.toString().trimmed():
|
||||
if first:
|
||||
outID = idVar
|
||||
@ -102,7 +102,7 @@ class ConvexHull(GeoAlgorithm):
|
||||
rect = vlayerA.extent()
|
||||
nFeat = vproviderA.featureCount()
|
||||
if useField:
|
||||
unique = ftools_utils.getUniqueValues( vproviderA, self.myParam )
|
||||
unique = ftools_utils.getUniqueValues( vproviderA, index )
|
||||
nFeat = nFeat * len( unique )
|
||||
for i in unique:
|
||||
hull = []
|
||||
@ -112,7 +112,7 @@ class ConvexHull(GeoAlgorithm):
|
||||
#vproviderA.rewind()
|
||||
while vproviderA.nextFeature( inFeat ):
|
||||
atMap = inFeat.attributeMap()
|
||||
idVar = atMap[ self.myParam ]
|
||||
idVar = atMap[ index ]
|
||||
if idVar.toString().trimmed() == i.toString().trimmed():
|
||||
if first:
|
||||
outID = idVar
|
||||
|
@ -35,8 +35,6 @@ class Dissolve(GeoAlgorithm):
|
||||
allAttrsA = vproviderA.attributeIndexes()
|
||||
fields = vproviderA.fields()
|
||||
writer = self.getOutputFromName(Dissolve.OUTPUT).getVectorWriter(fields, vproviderA.geometryType(), vproviderA.crs() )
|
||||
if writer.hasError():
|
||||
raise GeoAlgorithmExecutionException("Could not create output file");
|
||||
inFeat = QgsFeature()
|
||||
outFeat = QgsFeature()
|
||||
vproviderA.rewind()
|
||||
|
@ -53,7 +53,7 @@ class SimplifyGeometries(GeoAlgorithm):
|
||||
else:
|
||||
return None
|
||||
|
||||
def generalize( self, inputLayer, useSelection, tolerance, shapePath, shapeEncoding ):
|
||||
def generalize( self, inputLayer, useSelection, tolerance):
|
||||
self.inputLayer = inputLayer
|
||||
self.useSelection = useSelection
|
||||
self.tolerance = tolerance
|
||||
|
@ -32,7 +32,8 @@ class SinglePartsToMultiparts(GeoAlgorithm):
|
||||
outFeat = QgsFeature()
|
||||
inGeom = QgsGeometry()
|
||||
outGeom = QgsGeometry()
|
||||
index = int(self.getParameterValue(SinglePartsToMultiparts.FIELD))
|
||||
field = self.getParameterValue(SinglePartsToMultiparts.FIELD)
|
||||
index = vprovider.fieldNameIndex(field)
|
||||
unique = ftools_utils.getUniqueValues( vprovider, int( index ) )
|
||||
nFeat = vprovider.featureCount() * len( unique )
|
||||
nElement = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user