Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
improved handeling of postGIS layers
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10095 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
cfarmer committed Feb 2, 2009
1 parent 4becbc3 commit ded8497
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions python/plugins/fTools/tools/doGeoprocessing.py
Expand Up @@ -276,7 +276,6 @@ def buffering( self, useField ):
def convex_hull(self, useField ):
vproviderA = self.vlayerA.dataProvider()
allAttrsA = vproviderA.attributeIndexes()
vproviderA.select( allAttrsA )
fields = vproviderA.fields()
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
fields, QGis.WKBPolygon, vproviderA.crs() )
Expand All @@ -291,10 +290,11 @@ def convex_hull(self, useField ):
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0)
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
for i in unique:
vproviderA.rewind()
hull = []
first = True
outID = 0
vproviderA.select( allAttrsA )
vproviderA.rewind()
while vproviderA.nextFeature( inFeat ):
nElement += 1
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
Expand Down Expand Up @@ -339,7 +339,6 @@ def convex_hull(self, useField ):
def dissolve( self, useField ):
vproviderA = self.vlayerA.dataProvider()
allAttrsA = vproviderA.attributeIndexes()
vproviderA.select( allAttrsA )
fields = vproviderA.fields()
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
fields, vproviderA.geometryType(), vproviderA.crs() )
Expand Down Expand Up @@ -368,17 +367,20 @@ def dissolve( self, useField ):
outFeat.setAttributeMap( attrs )
writer.addFeature( outFeat )
else:
unique = ftools_utils.getUniqueValues( vproviderA, int( self.myParam ) )
unique = vproviderA.uniqueValues( int( self.myParam ) )
nFeat = nFeat * len( unique )
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), 0)
self.emit( SIGNAL( "runRange(PyQt_PyObject)" ), ( 0, nFeat ) )
for item in unique:
first = True
vproviderA.select( allAttrsA )
vproviderA.rewind()
while vproviderA.nextFeature( inFeat ):
nElement += 1
self.emit( SIGNAL( "runStatus(PyQt_PyObject)" ), nElement )
if inFeat.attributeMap()[ self.myParam ].toString().trimmed() == item.toString().trimmed():
atMap = inFeat.attributeMap()
tempItem = atMap[ self.myParam ]
if tempItem.toString().trimmed() == item.toString().trimmed():
if first:
QgsGeometry( inFeat.geometry() )
tmpInGeom = QgsGeometry( inFeat.geometry() )
Expand Down

0 comments on commit ded8497

Please sign in to comment.