Skip to content
Permalink
Browse files

fixed #6221

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@352 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
  • Loading branch information
volayaf@gmail.com
volayaf@gmail.com committed Aug 19, 2012
1 parent 5a0f357 commit 6629230e6bbc21d4229b972c43ae6819e90ec301
@@ -36,30 +36,30 @@ def processAlgorithm(self, progress):
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 = []
first = True
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 @@ def processAlgorithm(self, progress):
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 @@ def processAlgorithm(self, progress):
#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 @@ def processAlgorithm(self, progress):
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 @@ def geomVertexCount(self, geometry):
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 @@ def processAlgorithm(self, progress):
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

0 comments on commit 6629230

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