Skip to content

Commit

Permalink
make Dissolve tool work with SpatiaLite (addresses #4571)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed May 23, 2012
1 parent c367a35 commit 53cd1d4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions python/plugins/fTools/tools/doGeoprocessing.py
Expand Up @@ -599,14 +599,16 @@ def dissolve( self, useField ):
vproviderA = self.vlayerA.dataProvider()
allAttrsA = vproviderA.attributeIndexes()
fields = vproviderA.fields()
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
fields, vproviderA.geometryType(), vproviderA.crs() )
writer = QgsVectorFileWriter( self.myName, self.myEncoding, fields,
vproviderA.geometryType(), vproviderA.crs() )
if writer.hasError():
return GEOS_EXCEPT, FEATURE_EXCEPT, True, writer.errorMessage()
inFeat = QgsFeature()
outFeat = QgsFeature()
vproviderA.rewind()
vproviderA.select( allAttrsA )
nElement = 0
attrs = None
# there is selection in input layer
if self.mySelectionA:
nFeat = self.vlayerA.selectedFeatureCount()
Expand Down Expand Up @@ -642,8 +644,8 @@ def dissolve( self, useField ):
for item in unique:
first = True
add = False
vproviderA.select( allAttrsA )
vproviderA.rewind()
vproviderA.select( allAttrsA )
for inFeat in selectionA:
nElement += 1
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
Expand Down Expand Up @@ -703,13 +705,14 @@ def dissolve( self, useField ):
for item in unique:
first = True
add = True
vproviderA.select( allAttrsA )
vproviderA.rewind()
vproviderA.select( allAttrsA )
while vproviderA.nextFeature( inFeat ):
nElement += 1
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
atMap = inFeat.attributeMap()
tempItem = atMap[ self.myParam ]

if tempItem.toString().trimmed() == item.toString().trimmed():
if first:
QgsGeometry( inFeat.geometry() )
Expand Down

0 comments on commit 53cd1d4

Please sign in to comment.