Skip to content

Commit

Permalink
fixed #6221
Browse files Browse the repository at this point in the history
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 committed Aug 19, 2012
1 parent 5a0f357 commit 6629230
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
16 changes: 8 additions & 8 deletions src/sextante/ftools/ConvexHull.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 = []
Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/sextante/ftools/Dissolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion src/sextante/ftools/SimplifyGeometries.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/sextante/ftools/SinglePartsToMultiparts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6629230

Please sign in to comment.