Skip to content
Permalink
Browse files

Fixes error message for all Geoprocessing functions, now provides mor…

…e useful information.

git-svn-id: http://svn.osgeo.org/qgis/trunk@13040 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
cfarmer
cfarmer committed Mar 10, 2010
1 parent 2033db1 commit 4e23117f6c9eedd80b20945c4d1e28333784f5b1
Showing with 6 additions and 5 deletions.
  1. +6 −5 python/plugins/fTools/tools/doGeoprocessing.py
@@ -196,6 +196,7 @@ def runFinishedFromThread( self, results ):
self.testThread.stop()
self.cancel_close.setText( self.tr("Close") )
QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
out_text = ""
if not results[2] or not results[1] or not results [0]:
out_text = self.tr( "\nWarnings:" )
end_text = self.tr( "\nSome output geometries may be missing or invalid.\n\nWould you like to add the new layer anyway?" )
@@ -208,9 +209,7 @@ def runFinishedFromThread( self, results ):
out_text = out_text + self.tr( "\nFeature geometry error: One or more output features ignored due to invalid geometry.")
if not results[0]:
out_text = out_text + self.tr( "\nGEOS geoprocessing error: One or more input features have invalid geometry.")
else:
out_text = ""
addToTOC = QMessageBox.question( self, self.tr("Geoprocessing"), self.tr( "Created output shapefile:\n%1\n\n%2%3" ).arg( unicode( self.shapefileName ) ).arg( out_text ).arg( end_text ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton )
addToTOC = QMessageBox.question( self, self.tr("Geoprocessing"), self.tr( "Created output shapefile:\n%1\n%2%3" ).arg( unicode( self.shapefileName ) ).arg( out_text ).arg( end_text ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton )
if addToTOC == QMessageBox.Yes:
if not ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) ):
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Error loading output shapefile:\n%1" ).arg( unicode( self.shapefileName ) ))
@@ -834,8 +833,7 @@ def intersect( self ):
vproviderB = self.vlayerB.dataProvider()
allAttrsB = vproviderB.attributeIndexes()
vproviderB.select( allAttrsB )
if vproviderA.crs() == vproviderB.crs(): crs_match = True
else: crs_match = False
crs_match = vproviderA.crs() == vproviderB.crs()
fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
fields, vproviderA.geometryType(), vproviderA.crs() )
@@ -968,7 +966,9 @@ def intersect( self ):
int_geom = QgsGeometry( int_com.difference( int_sym ) )
try:
outFeat.setGeometry( int_geom )
print outFeat.isValid()
outFeat.setAttributeMap( ftools_utils.combineVectorAttributes( atMapA, atMapB ) )
print outFeat.isValid()
writer.addFeature( outFeat )
except:
FEATURE_EXCEPT = False
@@ -977,6 +977,7 @@ def intersect( self ):
GEOS_EXCEPT = False
break
del writer
print crs_match
return GEOS_EXCEPT, FEATURE_EXCEPT, crs_match

def union( self ):

0 comments on commit 4e23117

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