Skip to content

Commit 9da4554

Browse files
author
cfarmer
committed
Fixes error message for all Geoprocessing functions, now provides more useful information.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13040 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 75afa7e commit 9da4554

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

python/plugins/fTools/tools/doGeoprocessing.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ def runFinishedFromThread( self, results ):
196196
self.testThread.stop()
197197
self.cancel_close.setText( self.tr("Close") )
198198
QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
199+
out_text = ""
199200
if not results[2] or not results[1] or not results [0]:
200201
out_text = self.tr( "\nWarnings:" )
201202
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 ):
208209
out_text = out_text + self.tr( "\nFeature geometry error: One or more output features ignored due to invalid geometry.")
209210
if not results[0]:
210211
out_text = out_text + self.tr( "\nGEOS geoprocessing error: One or more input features have invalid geometry.")
211-
else:
212-
out_text = ""
213-
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 )
212+
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 )
214213
if addToTOC == QMessageBox.Yes:
215214
if not ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) ):
216215
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 ):
834833
vproviderB = self.vlayerB.dataProvider()
835834
allAttrsB = vproviderB.attributeIndexes()
836835
vproviderB.select( allAttrsB )
837-
if vproviderA.crs() == vproviderB.crs(): crs_match = True
838-
else: crs_match = False
836+
crs_match = vproviderA.crs() == vproviderB.crs()
839837
fields = ftools_utils.combineVectorFields( self.vlayerA, self.vlayerB )
840838
writer = QgsVectorFileWriter( self.myName, self.myEncoding,
841839
fields, vproviderA.geometryType(), vproviderA.crs() )
@@ -968,7 +966,9 @@ def intersect( self ):
968966
int_geom = QgsGeometry( int_com.difference( int_sym ) )
969967
try:
970968
outFeat.setGeometry( int_geom )
969+
print outFeat.isValid()
971970
outFeat.setAttributeMap( ftools_utils.combineVectorAttributes( atMapA, atMapB ) )
971+
print outFeat.isValid()
972972
writer.addFeature( outFeat )
973973
except:
974974
FEATURE_EXCEPT = False
@@ -977,6 +977,7 @@ def intersect( self ):
977977
GEOS_EXCEPT = False
978978
break
979979
del writer
980+
print crs_match
980981
return GEOS_EXCEPT, FEATURE_EXCEPT, crs_match
981982

982983
def union( self ):

0 commit comments

Comments
 (0)