mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-11 00:09:04 -05:00
New warning when creating empty multipart layer; Ok button disabled on all functions while running; General bug fixes. Fixes #2260, #2057, and #1986. Another great patch from alexbruy :-)
git-svn-id: http://svn.osgeo.org/qgis/trunk@13481 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
7f7a5ac29c
commit
f4760f23bf
@ -19,6 +19,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.label_2.setVisible(False)
|
self.label_2.setVisible(False)
|
||||||
self.label_2.setEnabled(False)
|
self.label_2.setEnabled(False)
|
||||||
self.setWindowTitle(self.tr("Define current projection"))
|
self.setWindowTitle(self.tr("Define current projection"))
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
QObject.connect(self.btnProjection, SIGNAL("clicked()"), self.outProjFile)
|
QObject.connect(self.btnProjection, SIGNAL("clicked()"), self.outProjFile)
|
||||||
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.updateProj1)
|
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.updateProj1)
|
||||||
QObject.connect(self.cmbLayer, SIGNAL("currentIndexChanged(QString)"), self.updateProj2)
|
QObject.connect(self.cmbLayer, SIGNAL("currentIndexChanged(QString)"), self.updateProj2)
|
||||||
@ -42,6 +43,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.outRef.insert(unicode(crs))
|
self.outRef.insert(unicode(crs))
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Define current projection"), self.tr("No input shapefile specified"))
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("No input shapefile specified"))
|
||||||
elif self.txtProjection.text() == "" and self.rdoProjection.isChecked():
|
elif self.txtProjection.text() == "" and self.rdoProjection.isChecked():
|
||||||
@ -103,6 +105,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Defined Projection For:\n%1.shp").arg( inPath ) )
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Defined Projection For:\n%1.shp").arg( inPath ) )
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outProjFile(self):
|
def outProjFile(self):
|
||||||
format = QString( "<h2>%1</h2>%2 <br/> %3" )
|
format = QString( "<h2>%1</h2>%2 <br/> %3" )
|
||||||
|
|||||||
@ -14,6 +14,7 @@ class GeometryDialog(QDialog, Ui_Dialog):
|
|||||||
self.iface = iface
|
self.iface = iface
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.myFunction = function
|
self.myFunction = function
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
if self.myFunction == 1:
|
if self.myFunction == 1:
|
||||||
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
||||||
@ -151,6 +152,7 @@ class GeometryDialog(QDialog, Ui_Dialog):
|
|||||||
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
||||||
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Unable to delete existing shapefile." ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Unable to delete existing shapefile." ) )
|
||||||
return
|
return
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
self.testThread = geometryThread( self.iface.mainWindow(), self, self.myFunction, vlayer, myParam,
|
self.testThread = geometryThread( self.iface.mainWindow(), self, self.myFunction, vlayer, myParam,
|
||||||
myField, self.shapefileName, self.encoding )
|
myField, self.shapefileName, self.encoding )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runFinished(PyQt_PyObject)" ), self.runFinishedFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runFinished(PyQt_PyObject)" ), self.runFinishedFromThread )
|
||||||
@ -162,13 +164,19 @@ class GeometryDialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def cancelThread( self ):
|
def cancelThread( self ):
|
||||||
self.testThread.stop()
|
self.testThread.stop()
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def runFinishedFromThread( self, success ):
|
def runFinishedFromThread( self, success ):
|
||||||
self.testThread.stop()
|
self.testThread.stop()
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
if success == "math_error":
|
if success == "math_error":
|
||||||
QMessageBox.warning( self, self.tr("Geometry"), self.tr("Error processing specified tolerance!\nPlease choose larger tolerance...") )
|
QMessageBox.warning( self, self.tr("Geometry"), self.tr("Error processing specified tolerance!\nPlease choose larger tolerance...") )
|
||||||
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
||||||
QMessageBox.warning( self, self.tr("Geometry"), self.tr( "Unable to delete incomplete shapefile." ) )
|
QMessageBox.warning( self, self.tr("Geometry"), self.tr( "Unable to delete incomplete shapefile." ) )
|
||||||
|
elif success == "attr_error":
|
||||||
|
QMessageBox.warning( self, self.tr("Geometry"), self.tr("At least two features must have same attribute value!\nPlease choose another field...") )
|
||||||
|
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
||||||
|
QMessageBox.warning( self, self.tr("Geometry"), self.tr( "Unable to delete incomplete shapefile." ) )
|
||||||
else:
|
else:
|
||||||
self.cancel_close.setText( "Close" )
|
self.cancel_close.setText( "Close" )
|
||||||
QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
||||||
@ -267,6 +275,8 @@ class geometryThread( QThread ):
|
|||||||
outFeat.setGeometry( outGeom )
|
outFeat.setGeometry( outGeom )
|
||||||
writer.addFeature( outFeat )
|
writer.addFeature( outFeat )
|
||||||
del writer
|
del writer
|
||||||
|
else:
|
||||||
|
return "attr_error"
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def multi_to_single( self ):
|
def multi_to_single( self ):
|
||||||
|
|||||||
@ -22,6 +22,7 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
|||||||
self.manageGui()
|
self.manageGui()
|
||||||
self.success = False
|
self.success = False
|
||||||
self.cancel_close = self.buttonBox_2.button( QDialogButtonBox.Close )
|
self.cancel_close = self.buttonBox_2.button( QDialogButtonBox.Close )
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
self.progressBar.setValue (0 )
|
self.progressBar.setValue (0 )
|
||||||
|
|
||||||
def checkA( self ):
|
def checkA( self ):
|
||||||
@ -180,6 +181,7 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
|||||||
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
||||||
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Unable to delete existing shapefile." ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Unable to delete existing shapefile." ) )
|
||||||
return
|
return
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
self.testThread = geoprocessingThread( self.iface.mainWindow(), self, self.myFunction, myLayerA,
|
self.testThread = geoprocessingThread( self.iface.mainWindow(), self, self.myFunction, myLayerA,
|
||||||
myLayerB, myParam, myMerge, mySelectionA, mySelectionB, self.shapefileName, self.encoding )
|
myLayerB, myParam, myMerge, mySelectionA, mySelectionB, self.shapefileName, self.encoding )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runFinished(PyQt_PyObject)" ), self.runFinishedFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runFinished(PyQt_PyObject)" ), self.runFinishedFromThread )
|
||||||
@ -192,9 +194,11 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
|||||||
|
|
||||||
def cancelThread( self ):
|
def cancelThread( self ):
|
||||||
self.testThread.stop()
|
self.testThread.stop()
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def runFinishedFromThread( self, results ):
|
def runFinishedFromThread( self, results ):
|
||||||
self.testThread.stop()
|
self.testThread.stop()
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
self.cancel_close.setText( self.tr("Close") )
|
self.cancel_close.setText( self.tr("Close") )
|
||||||
QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
QObject.disconnect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
||||||
out_text = ""
|
out_text = ""
|
||||||
|
|||||||
@ -48,6 +48,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
QObject.connect(self.inLine1, SIGNAL("currentIndexChanged(QString)"), self.update1)
|
QObject.connect(self.inLine1, SIGNAL("currentIndexChanged(QString)"), self.update1)
|
||||||
QObject.connect(self.inLine2, SIGNAL("currentIndexChanged(QString)"), self.update2)
|
QObject.connect(self.inLine2, SIGNAL("currentIndexChanged(QString)"), self.update2)
|
||||||
self.setWindowTitle( self.tr("Line intersections") )
|
self.setWindowTitle( self.tr("Line intersections") )
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -70,6 +71,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.inField2.addItem(unicode(changedField[i].name()))
|
self.inField2.addItem(unicode(changedField[i].name()))
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inLine1.currentText() == "":
|
if self.inLine1.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Locate Line Intersections"), self.tr("Please specify input line layer") )
|
QMessageBox.information(self, self.tr("Locate Line Intersections"), self.tr("Please specify input line layer") )
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
@ -94,6 +96,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if not ftools_utils.addShapeToCanvas( unicode( outPath ) ):
|
if not ftools_utils.addShapeToCanvas( unicode( outPath ) ):
|
||||||
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Error loading output shapefile:\n%1" ).arg( unicode( outPath ) ))
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Error loading output shapefile:\n%1" ).arg( unicode( outPath ) ))
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outFile(self):
|
def outFile(self):
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
|
|||||||
@ -15,6 +15,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.updateUi()
|
self.updateUi()
|
||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
|
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
@ -44,6 +45,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.uniqueField.addItem(unicode(changedField[i].name()))
|
self.uniqueField.addItem(unicode(changedField[i].name()))
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Coordinate statistics"), self.tr("No input vector layer specified"))
|
QMessageBox.information(self, self.tr("Coordinate statistics"), self.tr("No input vector layer specified"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
@ -75,6 +77,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.vlayer.setRenderer(render)
|
self.vlayer.setRenderer(render)
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outFile(self):
|
def outFile(self):
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
@ -137,7 +140,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
else:
|
else:
|
||||||
weight = float(feat.attributeMap()[weightIndex].toDouble()[0])
|
weight = float(feat.attributeMap()[weightIndex].toDouble()[0])
|
||||||
geom = QgsGeometry(feat.geometry())
|
geom = QgsGeometry(feat.geometry())
|
||||||
geom = self.extract(geom)
|
geom = ftools_utils.extractPoints(geom)
|
||||||
for i in geom:
|
for i in geom:
|
||||||
cx += i.x()
|
cx += i.x()
|
||||||
cy += i.y()
|
cy += i.y()
|
||||||
@ -180,31 +183,3 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if single:
|
if single:
|
||||||
break
|
break
|
||||||
del writer
|
del writer
|
||||||
|
|
||||||
def extract(self, geom):
|
|
||||||
multi_geom = QgsGeometry()
|
|
||||||
temp_geom = []
|
|
||||||
if geom.type() == 0: # it's a point
|
|
||||||
if geom.isMultipart():
|
|
||||||
temp_geom = geom.asMultiPoint()
|
|
||||||
else:
|
|
||||||
temp_geom.append(geom.asPoint())
|
|
||||||
if geom.type() == 1: # it's a line
|
|
||||||
if geom.isMultipart():
|
|
||||||
multi_geom = geom.asMultiPolyline() #multi_geog is a multiline
|
|
||||||
for i in multi_geom: #i is a line
|
|
||||||
temp_geom.extend(i)
|
|
||||||
else:
|
|
||||||
temp_geom = geom.asPolyline()
|
|
||||||
elif geom.type() == 2: # it's a polygon
|
|
||||||
if geom.isMultipart():
|
|
||||||
multi_geom = geom.asMultiPolygon() #multi_geom is a multipolygon
|
|
||||||
for i in multi_geom: #i is a polygon
|
|
||||||
for j in i: #j is a line
|
|
||||||
temp_geom.extend(j)
|
|
||||||
else:
|
|
||||||
multi_geom = geom.asPolygon() #multi_geom is a polygon
|
|
||||||
for i in multi_geom: #i is a line
|
|
||||||
temp_geom.extend(i)
|
|
||||||
return temp_geom
|
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
self.setWindowTitle(self.tr("Count Points in Polygon"))
|
self.setWindowTitle(self.tr("Count Points in Polygon"))
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -55,6 +56,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.inPoint.addItems(layers)
|
self.inPoint.addItems(layers)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inPolygon.currentText() == "":
|
if self.inPolygon.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Count Points In Polygon"), self.tr("Please specify input polygon vector layer"))
|
QMessageBox.information(self, self.tr("Count Points In Polygon"), self.tr("Please specify input polygon vector layer"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
@ -81,6 +83,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outFile(self):
|
def outFile(self):
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
|
|||||||
@ -48,6 +48,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
self.setWindowTitle(self.tr("Random Points"))
|
self.setWindowTitle(self.tr("Random Points"))
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
self.mapCanvas = self.iface.mapCanvas()
|
self.mapCanvas = self.iface.mapCanvas()
|
||||||
layers = ftools_utils.getLayerNames([QGis.Polygon, "Raster"])
|
layers = ftools_utils.getLayerNames([QGis.Polygon, "Raster"])
|
||||||
self.inShape.addItems(layers)
|
self.inShape.addItems(layers)
|
||||||
@ -77,6 +78,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
# when 'OK' button is pressed, gather required inputs, and initiate random points generation
|
# when 'OK' button is pressed, gather required inputs, and initiate random points generation
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Random Points"), self.tr("No input layer specified"))
|
QMessageBox.information(self, self.tr("Random Points"), self.tr("No input layer specified"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
@ -128,6 +130,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outFile(self):
|
def outFile(self):
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
|
|||||||
@ -17,6 +17,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
layers = ftools_utils.getLayerNames([QGis.Point, QGis.Line, QGis.Polygon])
|
layers = ftools_utils.getLayerNames([QGis.Point, QGis.Line, QGis.Polygon])
|
||||||
self.inShape.addItems(layers)
|
self.inShape.addItems(layers)
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.spnNumber.setMaximum(upperVal)
|
self.spnNumber.setMaximum(upperVal)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Random Selection Tool"), self.tr("No input shapefile specified"))
|
QMessageBox.information(self, self.tr("Random Selection Tool"), self.tr("No input shapefile specified"))
|
||||||
else:
|
else:
|
||||||
@ -50,3 +52,4 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
layer.setSelectedFeatures(selran)
|
layer.setSelectedFeatures(selran)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|||||||
@ -18,6 +18,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.updateProj1)
|
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.updateProj1)
|
||||||
QObject.connect(self.cmbLayer, SIGNAL("currentIndexChanged(QString)"), self.updateProj2)
|
QObject.connect(self.cmbLayer, SIGNAL("currentIndexChanged(QString)"), self.updateProj2)
|
||||||
self.setWindowTitle( self.tr("Export to new projection") )
|
self.setWindowTitle( self.tr("Export to new projection") )
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
layers = ftools_utils.getLayerNames([QGis.Point, QGis.Line, QGis.Polygon])
|
layers = ftools_utils.getLayerNames([QGis.Point, QGis.Line, QGis.Polygon])
|
||||||
@ -37,6 +38,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.outRef.insert(unicode(crs))
|
self.outRef.insert(unicode(crs))
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Export to new projection"), self.tr("No input layer specified"))
|
QMessageBox.information(self, self.tr("Export to new projection"), self.tr("No input layer specified"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
@ -64,6 +66,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outProjFile(self):
|
def outProjFile(self):
|
||||||
format = QString( "<h2>%1</h2>%2 <br/> %3" )
|
format = QString( "<h2>%1</h2>%2 <br/> %3" )
|
||||||
|
|||||||
@ -50,12 +50,14 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.yMax.setValidator(QDoubleValidator(self.yMax))
|
self.yMax.setValidator(QDoubleValidator(self.yMax))
|
||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
self.setWindowTitle( self.tr("Regular points") )
|
self.setWindowTitle( self.tr("Regular points") )
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
self.mapCanvas = self.iface.mapCanvas()
|
self.mapCanvas = self.iface.mapCanvas()
|
||||||
layers = ftools_utils.getLayerNames("all")
|
layers = ftools_utils.getLayerNames("all")
|
||||||
self.inShape.addItems(layers)
|
self.inShape.addItems(layers)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if not self.rdoCoordinates.isChecked() and self.inShape.currentText() == "":
|
if not self.rdoCoordinates.isChecked() and self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Generate Regular Points"), self.tr("Please specify input layer"))
|
QMessageBox.information(self, self.tr("Generate Regular Points"), self.tr("Please specify input layer"))
|
||||||
elif self.rdoCoordinates.isChecked() and (self.xMin.text() == "" or self.xMax.text() == "" or self.yMin.text() == "" or self.yMax.text() == ""):
|
elif self.rdoCoordinates.isChecked() and (self.xMin.text() == "" or self.xMax.text() == "" or self.yMin.text() == "" or self.yMax.text() == ""):
|
||||||
@ -91,6 +93,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outFile(self):
|
def outFile(self):
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
|
|||||||
@ -12,6 +12,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.iface = iface
|
self.iface = iface
|
||||||
# Set up the user interface from Designer.
|
# Set up the user interface from Designer.
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
|
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
@ -41,6 +42,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.resize(381, 100)
|
self.resize(381, 100)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inPolygon.currentText() == "":
|
if self.inPolygon.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Select by location"), self.tr( "Please specify input layer"))
|
QMessageBox.information(self, self.tr("Select by location"), self.tr( "Please specify input layer"))
|
||||||
elif self.inPoint.currentText() == "":
|
elif self.inPoint.currentText() == "":
|
||||||
@ -50,6 +52,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
inPts = self.inPoint.currentText()
|
inPts = self.inPoint.currentText()
|
||||||
self.compute(inPoly, inPts, self.cmbModify.currentText())
|
self.compute(inPoly, inPts, self.cmbModify.currentText())
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def compute(self, inPoly, inPts, modify):
|
def compute(self, inPoly, inPts, modify):
|
||||||
inputLayer = ftools_utils.getVectorLayerByName(inPoly)
|
inputLayer = ftools_utils.getVectorLayerByName(inPoly)
|
||||||
|
|||||||
@ -48,6 +48,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
self.setWindowTitle( self.tr("Join attributes by location") )
|
self.setWindowTitle( self.tr("Join attributes by location") )
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -56,6 +57,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.joinShape.addItems(layers)
|
self.joinShape.addItems(layers)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Spatial Join"), self.tr("Please specify target vector layer") )
|
QMessageBox.information(self, self.tr("Spatial Join"), self.tr("Please specify target vector layer") )
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
@ -96,6 +98,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outFile(self):
|
def outFile(self):
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
|
|||||||
@ -45,6 +45,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
||||||
self.setWindowTitle(self.tr("Random selection within subsets"))
|
self.setWindowTitle(self.tr("Random selection within subsets"))
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -61,6 +62,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.spnNumber.setMaximum( maxFeatures )
|
self.spnNumber.setMaximum( maxFeatures )
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Random selection within subsets"), self.tr("Please specify input vector layer"))
|
QMessageBox.information(self, self.tr("Random selection within subsets"), self.tr("Please specify input vector layer"))
|
||||||
elif self.inField.currentText() == "":
|
elif self.inField.currentText() == "":
|
||||||
@ -77,26 +79,12 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.compute(inVect, uidField, value, perc, self.progressBar)
|
self.compute(inVect, uidField, value, perc, self.progressBar)
|
||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
def outFile(self):
|
|
||||||
self.outShape.clear()
|
|
||||||
fileDialog = QFileDialog()
|
|
||||||
fileDialog.setConfirmOverwrite(False)
|
|
||||||
outName = fileDialog.getSaveFileName(self, self.tr("Output Shapefile"),".", self.tr("Shapefiles (*.shp)"))
|
|
||||||
fileCheck = QFile(outName)
|
|
||||||
if fileCheck.exists():
|
|
||||||
QMessageBox.warning(self, self.tr("Random selection within subsets"), self.tr("Cannot overwrite existing shapefile..."))
|
|
||||||
else:
|
|
||||||
filePath = QFileInfo(outName).absoluteFilePath()
|
|
||||||
if filePath.right(4) != ".shp": filePath = filePath + ".shp"
|
|
||||||
if not outName.isEmpty():
|
|
||||||
self.outShape.clear()
|
|
||||||
self.outShape.insert(filePath)
|
|
||||||
|
|
||||||
def compute(self, inVect, inField, value, perc, progressBar):
|
def compute(self, inVect, inField, value, perc, progressBar):
|
||||||
vlayer = ftools_utils.getVectorLayerByName(inVect)
|
vlayer = ftools_utils.getVectorLayerByName(inVect)
|
||||||
vprovider = vlayer.dataProvider()
|
vprovider = vlayer.dataProvider()
|
||||||
mlayer = self.getMapLayerByName(inVect)
|
mlayer = ftools_utils.getMapLayerByName(inVect)
|
||||||
allAttrs = vprovider.attributeIndexes()
|
allAttrs = vprovider.attributeIndexes()
|
||||||
vprovider.select(allAttrs)
|
vprovider.select(allAttrs)
|
||||||
index = vprovider.fieldNameIndex(inField)
|
index = vprovider.fieldNameIndex(inField)
|
||||||
@ -129,11 +117,3 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
mlayer.setSelectedFeatures(selran)
|
mlayer.setSelectedFeatures(selran)
|
||||||
else:
|
else:
|
||||||
mlayer.setSelectedFeatures(range(0, mlayer.featureCount()))
|
mlayer.setSelectedFeatures(range(0, mlayer.featureCount()))
|
||||||
|
|
||||||
def getMapLayerByName(self, myName):
|
|
||||||
mc = self.iface.mapCanvas()
|
|
||||||
nLayers = mc.layerCount()
|
|
||||||
for l in range(nLayers):
|
|
||||||
layer = mc.layer(l)
|
|
||||||
if layer.name() == unicode(myName,'latin1'):
|
|
||||||
return layer
|
|
||||||
|
|||||||
@ -46,6 +46,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
self.setWindowTitle(self.tr("Sum line lengths"))
|
self.setWindowTitle(self.tr("Sum line lengths"))
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -55,6 +56,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.inPolygon.addItems(layers)
|
self.inPolygon.addItems(layers)
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.inPolygon.currentText() == "":
|
if self.inPolygon.currentText() == "":
|
||||||
QMessageBox.information(self, self.tr("Sum Line Lengths In Polyons"), self.tr("Please specify input polygon vector layer"))
|
QMessageBox.information(self, self.tr("Sum Line Lengths In Polyons"), self.tr("Please specify input polygon vector layer"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
@ -81,6 +83,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def outFile(self):
|
def outFile(self):
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
|
|||||||
@ -46,6 +46,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
#QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.updateInput)
|
#QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.updateInput)
|
||||||
QObject.connect(self.btnUpdate, SIGNAL("clicked()"), self.updateLayer)
|
QObject.connect(self.btnUpdate, SIGNAL("clicked()"), self.updateLayer)
|
||||||
QObject.connect(self.btnCanvas, SIGNAL("clicked()"), self.updateCanvas)
|
QObject.connect(self.btnCanvas, SIGNAL("clicked()"), self.updateCanvas)
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
self.setWindowTitle(self.tr("Vector grid"))
|
self.setWindowTitle(self.tr("Vector grid"))
|
||||||
self.xMin.setValidator(QDoubleValidator(self.xMin))
|
self.xMin.setValidator(QDoubleValidator(self.xMin))
|
||||||
self.xMax.setValidator(QDoubleValidator(self.xMax))
|
self.xMax.setValidator(QDoubleValidator(self.xMax))
|
||||||
@ -78,6 +79,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.yMax.setText( unicode( boundBox.yMaximum() ) )
|
self.yMax.setText( unicode( boundBox.yMaximum() ) )
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
if self.xMin.text() == "" or self.xMax.text() == "" or self.yMin.text() == "" or self.yMax.text() == "":
|
if self.xMin.text() == "" or self.xMax.text() == "" or self.yMin.text() == "" or self.yMax.text() == "":
|
||||||
QMessageBox.information(self, self.tr("Vector grid"), self.tr("Please specify valid extent coordinates"))
|
QMessageBox.information(self, self.tr("Vector grid"), self.tr("Please specify valid extent coordinates"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
@ -101,6 +103,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
ftools_utils.addShapeToCanvas( self.shapefileName )
|
ftools_utils.addShapeToCanvas( self.shapefileName )
|
||||||
self.progressBar.setValue( 0 )
|
self.progressBar.setValue( 0 )
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def compute( self, bound, xOffset, yOffset, polygon ):
|
def compute( self, bound, xOffset, yOffset, polygon ):
|
||||||
crs = self.iface.mapCanvas().mapRenderer().destinationSrs()
|
crs = self.iface.mapCanvas().mapRenderer().destinationSrs()
|
||||||
|
|||||||
@ -16,6 +16,7 @@ class VisualDialog( QDialog, Ui_Dialog ):
|
|||||||
QObject.connect( self.inShape, SIGNAL( "currentIndexChanged(QString)" ), self.update )
|
QObject.connect( self.inShape, SIGNAL( "currentIndexChanged(QString)" ), self.update )
|
||||||
self.manageGui()
|
self.manageGui()
|
||||||
self.cancel_close = self.buttonBox_2.button( QDialogButtonBox.Close )
|
self.cancel_close = self.buttonBox_2.button( QDialogButtonBox.Close )
|
||||||
|
self.buttonOk = self.buttonBox_2.button( QDialogButtonBox.Ok )
|
||||||
self.progressBar.setValue( 0 )
|
self.progressBar.setValue( 0 )
|
||||||
self.partProgressBar.setValue( 0 )
|
self.partProgressBar.setValue( 0 )
|
||||||
self.partProgressBar.setVisible( False )
|
self.partProgressBar.setVisible( False )
|
||||||
@ -110,6 +111,7 @@ class VisualDialog( QDialog, Ui_Dialog ):
|
|||||||
self.tblUnique.clearContents()
|
self.tblUnique.clearContents()
|
||||||
self.tblUnique.setRowCount( 0 )
|
self.tblUnique.setRowCount( 0 )
|
||||||
self.lstCount.clear()
|
self.lstCount.clear()
|
||||||
|
self.buttonOk.setEnabled( False )
|
||||||
self.testThread = visualThread( self.iface.mainWindow(), self, self.myFunction, vlayer, myField, mySelection )
|
self.testThread = visualThread( self.iface.mainWindow(), self, self.myFunction, vlayer, myField, mySelection )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runFinished(PyQt_PyObject)" ), self.runFinishedFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runFinished(PyQt_PyObject)" ), self.runFinishedFromThread )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runStatus(PyQt_PyObject)" ), self.runStatusFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runStatus(PyQt_PyObject)" ), self.runStatusFromThread )
|
||||||
@ -123,9 +125,11 @@ class VisualDialog( QDialog, Ui_Dialog ):
|
|||||||
|
|
||||||
def cancelThread( self ):
|
def cancelThread( self ):
|
||||||
self.testThread.stop()
|
self.testThread.stop()
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
|
|
||||||
def runFinishedFromThread( self, output ):
|
def runFinishedFromThread( self, output ):
|
||||||
self.testThread.stop()
|
self.testThread.stop()
|
||||||
|
self.buttonOk.setEnabled( True )
|
||||||
result = output[ 0 ]
|
result = output[ 0 ]
|
||||||
numRows = len( result )
|
numRows = len( result )
|
||||||
self.tblUnique.setRowCount( numRows )
|
self.tblUnique.setRowCount( numRows )
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user