mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-17 00:04:02 -04:00
ftools i18n update
git-svn-id: http://svn.osgeo.org/qgis/trunk@12655 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
d5066cc5f4
commit
90fe58308b
@ -36,51 +36,42 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.textEdit.setText(self.getText())
|
self.textEdit.setText(self.getText())
|
||||||
|
|
||||||
def getText(self):
|
def getText(self):
|
||||||
aboutText = QString("The goal of fTools is to provide a one-stop resource for many common vector-based GIS tasks, ")
|
return self.tr("""
|
||||||
aboutText.append("without the need for additional software, libraries, or complex workarounds.\n\n")
|
The goal of fTools is to provide a one-stop resource for many common vector-based GIS tasks, without the need for additional software, libraries, or complex workarounds.
|
||||||
aboutText.append("fTools is designed to extend the functionality of Quantum GIS using only core QGIS and python ")
|
|
||||||
aboutText.append("libraries. It provides a growing suite of spatial data management and analysis functions that are ")
|
fTools is designed to extend the functionality of Quantum GIS using only core QGIS and python libraries. It provides a growing suite of spatial data management and analysis functions that are both quick and functional. In addition, the geoprocessing functions of Dr. Horst Duester and Stefan Ziegler have been incorporated to futher facilitate and streamline GIS based research and analysis.
|
||||||
aboutText.append("both quick and functional. In addition, the geoprocessing functions of Dr. Horst Duester and ")
|
|
||||||
aboutText.append("Stefan Ziegler have been incorporated to futher facilitate and streamline GIS based research and analysis.\n\n")
|
If you would like to report a bug, make suggestions for improving fTools, or have a question about the tools, please email me: carson.farmer@gmail.com
|
||||||
aboutText.append("If you would like to report a bug, make suggestions for improving fTools, or have a question about ")
|
|
||||||
aboutText.append("the tools, please email me: carson.farmer@gmail.com\n\n")
|
LICENSING INFORMATION:
|
||||||
licenceString = QString("LICENSING INFORMATION:\n")
|
fTools is copyright (C) 2009 Carson J.Q. Farmer
|
||||||
licenceString.append("fTools is copyright (C) 2009 Carson J.Q. Farmer\n")
|
Geoprocessing functions adapted from 'Geoprocessing Plugin',
|
||||||
licenceString.append("Geoprocessing functions adapted from 'Geoprocessing Plugin',\n")
|
(C) 2008 by Dr. Horst Duester, Stefan Ziegler
|
||||||
licenceString.append("(C) 2008 by Dr. Horst Duester, Stefan Ziegler\n\n")
|
|
||||||
licenceString.append("licensed under the terms of GNU GPL 2\n")
|
licensed under the terms of GNU GPL 2
|
||||||
licenceString.append("This program is free software; you can redistribute it and/or modify")
|
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
|
||||||
licenceString.append("it under the terms of the GNU General Public License as published by")
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
licenceString.append("the Free Software Foundation; either version 2 of the License, or")
|
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
licenceString.append("(at your option) any later version.\n")
|
|
||||||
licenceString.append("This program is distributed in the hope that it will be useful,")
|
ACKNOWLEDGEMENTS:
|
||||||
licenceString.append("but WITHOUT ANY WARRANTY; without even the implied warranty of")
|
The following individuals (whether they know it or not) have contributed ideas, help, testing, code, and guidence towards this project, and I thank them.
|
||||||
licenceString.append("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the")
|
Hawthorn Beyer
|
||||||
licenceString.append("GNU General Public License for more details.\n")
|
Borys Jurgiel
|
||||||
licenceString.append("You should have received a copy of the GNU General Public License along")
|
Tim Sutton
|
||||||
licenceString.append("with this program; if not, write to the Free Software Foundation, Inc.,")
|
Barry Rowlingson
|
||||||
licenceString.append("51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\n")
|
Horst Duester and Stefan Ziegler
|
||||||
aknowledgeString = QString("AKNOWLEDGEMENTS:\n")
|
Paolo Cavallini
|
||||||
aknowledgeString.append("The following individuals (whether they know it or not) have contributed ")
|
Aaron Racicot
|
||||||
aknowledgeString.append("ideas, help, testing, code, and guidence towards this project, and I thank them.\n")
|
Colin Robertson
|
||||||
aknowledgeString.append("Hawthorn Beyer\n")
|
Agustin Lobo
|
||||||
aknowledgeString.append("Borys Jurgiel\n")
|
Jurgen E. Fischer
|
||||||
aknowledgeString.append("Tim Sutton\n")
|
QGis developer and user communities
|
||||||
aknowledgeString.append("Barry Rowlingson\n")
|
Folks on #qgis at freenode.net
|
||||||
aknowledgeString.append("Horst Duester and Stefan Ziegler\n")
|
All those who have reported bugs/fixes/suggestions/comments/etc.
|
||||||
aknowledgeString.append("Paolo Cavallini\n")
|
""")
|
||||||
aknowledgeString.append("Aaron Racicot\n")
|
|
||||||
aknowledgeString.append("Colin Robertson\n")
|
|
||||||
aknowledgeString.append("Agustin Lobo\n")
|
|
||||||
aknowledgeString.append("Jurgen E. Fischer\n")
|
|
||||||
aknowledgeString.append("QGis developer and user communities\n")
|
|
||||||
aknowledgeString.append("Folks on #qgis at freenode.net\n")
|
|
||||||
aknowledgeString.append("All those who have reported bugs/fixes/suggestions/comments/etc.")
|
|
||||||
return QString(aboutText.append(licenceString.append(aknowledgeString)))
|
|
||||||
|
|
||||||
def openWeb(self):
|
def openWeb(self):
|
||||||
webbrowser.open("http://www.ftools.ca/")
|
webbrowser.open("http://www.ftools.ca/")
|
||||||
|
|
||||||
def openHelp(self):
|
def openHelp(self):
|
||||||
webbrowser.open(currentPath + "/ftools_help.xml")
|
webbrowser.open(currentPath + "/ftools_help.xml")
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.outShape.setVisible(False)
|
self.outShape.setVisible(False)
|
||||||
self.label_2.setVisible(False)
|
self.label_2.setVisible(False)
|
||||||
self.label_2.setEnabled(False)
|
self.label_2.setEnabled(False)
|
||||||
self.setWindowTitle("Define current projection")
|
self.setWindowTitle(self.tr("Define current projection"))
|
||||||
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,11 +42,11 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Define current projection", "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():
|
||||||
QMessageBox.information(self, "Define current projection", "Please specify spatial reference system")
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Please specify spatial reference system"))
|
||||||
elif self.cmbLayer.currentText() == "" and self.rdoLayer.isChecked():
|
elif self.cmbLayer.currentText() == "" and self.rdoLayer.isChecked():
|
||||||
QMessageBox.information(self, "Define current projection", "Please specify spatial reference system")
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Please specify spatial reference system"))
|
||||||
else:
|
else:
|
||||||
self.progressBar.setValue(5)
|
self.progressBar.setValue(5)
|
||||||
inName = self.inShape.currentText()
|
inName = self.inShape.currentText()
|
||||||
@ -54,7 +54,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
vLayer = self.getVectorLayerByName(inName)
|
vLayer = self.getVectorLayerByName(inName)
|
||||||
self.progressBar.setValue(30)
|
self.progressBar.setValue(30)
|
||||||
if vLayer == "Error":
|
if vLayer == "Error":
|
||||||
QMessageBox.information(self, "Define current projection", "Cannot define projection for PostGIS data...yet!")
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Cannot define projection for PostGIS data...yet!"))
|
||||||
else:
|
else:
|
||||||
srsDefine = QgsCoordinateReferenceSystem()
|
srsDefine = QgsCoordinateReferenceSystem()
|
||||||
if self.rdoProjection.isChecked():
|
if self.rdoProjection.isChecked():
|
||||||
@ -64,7 +64,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
destLayer = self.getVectorLayerByName(self.cmbLayer.currentText())
|
destLayer = self.getVectorLayerByName(self.cmbLayer.currentText())
|
||||||
srsDefine = destLayer.srs()
|
srsDefine = destLayer.srs()
|
||||||
if srsDefine == vLayer.srs():
|
if srsDefine == vLayer.srs():
|
||||||
QMessageBox.information(self, "Define current projection", "Identical output spatial reference system chosen")
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Identical output spatial reference system chosen"))
|
||||||
else:
|
else:
|
||||||
provider = vLayer.dataProvider()
|
provider = vLayer.dataProvider()
|
||||||
self.progressBar.setValue(35)
|
self.progressBar.setValue(35)
|
||||||
@ -74,7 +74,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
inPath = inPath.left(inPath.length() - 4)
|
inPath = inPath.left(inPath.length() - 4)
|
||||||
self.progressBar.setValue(55)
|
self.progressBar.setValue(55)
|
||||||
if not srsDefine.isValid():
|
if not srsDefine.isValid():
|
||||||
QMessageBox.information(self, "Define current projection", "Output spatial reference system is not valid")
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Output spatial reference system is not valid"))
|
||||||
else:
|
else:
|
||||||
self.progressBar.setValue(60)
|
self.progressBar.setValue(60)
|
||||||
outputWkt = srsDefine.toWkt()
|
outputWkt = srsDefine.toWkt()
|
||||||
@ -87,26 +87,25 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
mLayer = self.getMapLayerByName(inName)
|
mLayer = self.getMapLayerByName(inName)
|
||||||
self.progressBar.setValue(90)
|
self.progressBar.setValue(90)
|
||||||
if not mLayer.isValid():
|
if not mLayer.isValid():
|
||||||
QMessageBox.information(self, "Define current projection", "Unable to dynamically define projection.\n"
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Unable to dynamically define projection.\nPlease reload layer manually for projection definition to take effect."))
|
||||||
+ "Please reload layer manually for projection definition to take effect.")
|
|
||||||
else:
|
else:
|
||||||
self.progressBar.setValue(95)
|
self.progressBar.setValue(95)
|
||||||
mLayer.setCrs(srsDefine)
|
mLayer.setCrs(srsDefine)
|
||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
QMessageBox.information(self, "Define current projection", "Defined Projection For:\n" + inPath + ".shp")
|
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)
|
||||||
|
|
||||||
def outProjFile(self):
|
def outProjFile(self):
|
||||||
format = QString( "<h2>%1</h2>%2 <br/> %3" )
|
format = QString( "<h2>%1</h2>%2 <br/> %3" )
|
||||||
header = QString( "Define layer CRS:" )
|
header = QString( "Define layer CRS:" )
|
||||||
sentence1 = QString( "Please select the projection system that defines the current layer." )
|
sentence1 = self.tr( "Please select the projection system that defines the current layer." )
|
||||||
sentence2 = QString( "Layer CRS information will be updated to the selected CRS." )
|
sentence2 = self.tr( "Layer CRS information will be updated to the selected CRS." )
|
||||||
self.projSelect = QgsGenericProjectionSelector(self, Qt.Widget)
|
self.projSelect = QgsGenericProjectionSelector(self, Qt.Widget)
|
||||||
self.projSelect.setMessage( format.arg( header ).arg( sentence1 ).arg( sentence2 ))
|
self.projSelect.setMessage( format.arg( header ).arg( sentence1 ).arg( sentence2 ))
|
||||||
if self.projSelect.exec_():
|
if self.projSelect.exec_():
|
||||||
projString = self.projSelect.selectedProj4String()
|
projString = self.projSelect.selectedProj4String()
|
||||||
if projString == "":
|
if projString == "":
|
||||||
QMessageBox.information(self, "Export to new projection", "No Valid CRS selected")
|
QMessageBox.information(self, self.tr("Export to new projection"), self.tr("No Valid CRS selected"))
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.txtProjection.clear()
|
self.txtProjection.clear()
|
||||||
|
@ -33,13 +33,13 @@ class GeometryDialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Geometry", self.tr( "Please specify input vector layer" ) )
|
QMessageBox.information(self, self.tr("Geometry"), self.tr( "Please specify input vector layer" ) )
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
QMessageBox.information(self, "Geometry", self.tr( "Please specify output shapefile" ) )
|
QMessageBox.information(self, self.tr("Geometry"), self.tr( "Please specify output shapefile" ) )
|
||||||
elif self.lineEdit.isVisible() and self.lineEdit.value() <= 0.00:
|
elif self.lineEdit.isVisible() and self.lineEdit.value() <= 0.00:
|
||||||
QMessageBox.information(self, "Geometry", self.tr( "Please specify valid tolerance value" ) )
|
QMessageBox.information(self, self.tr("Geometry"), self.tr( "Please specify valid tolerance value" ) )
|
||||||
elif self.cmbField.isVisible() and self.cmbField.currentText() == "":
|
elif self.cmbField.isVisible() and self.cmbField.currentText() == "":
|
||||||
QMessageBox.information(self, "Geometry", self.tr( "Please specify valid UID field" ) )
|
QMessageBox.information(self, self.tr("Geometry"), self.tr( "Please specify valid UID field" ) )
|
||||||
else:
|
else:
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
self.geometry( self.inShape.currentText(), self.lineEdit.value(), self.cmbField.currentText() )
|
self.geometry( self.inShape.currentText(), self.lineEdit.value(), self.cmbField.currentText() )
|
||||||
@ -148,14 +148,14 @@ class GeometryDialog(QDialog, Ui_Dialog):
|
|||||||
check = QFile( self.shapefileName )
|
check = QFile( self.shapefileName )
|
||||||
if check.exists():
|
if check.exists():
|
||||||
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "Unable to delete existing shapefile." ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Unable to delete existing shapefile." ) )
|
||||||
return
|
return
|
||||||
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 )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runStatus(PyQt_PyObject)" ), self.runStatusFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runStatus(PyQt_PyObject)" ), self.runStatusFromThread )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runRange(PyQt_PyObject)" ), self.runRangeFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runRange(PyQt_PyObject)" ), self.runRangeFromThread )
|
||||||
self.cancel_close.setText( "Cancel" )
|
self.cancel_close.setText( self.tr("Cancel") )
|
||||||
QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
||||||
self.testThread.start()
|
self.testThread.start()
|
||||||
|
|
||||||
@ -165,21 +165,18 @@ class GeometryDialog(QDialog, Ui_Dialog):
|
|||||||
def runFinishedFromThread( self, success ):
|
def runFinishedFromThread( self, success ):
|
||||||
self.testThread.stop()
|
self.testThread.stop()
|
||||||
if success == "math_error":
|
if success == "math_error":
|
||||||
QMessageBox.warning( self, "Geometry", self.tr( "Error processing specified tolerance!" ) + "\n"
|
QMessageBox.warning( self, self.tr("Geometry"), self.tr("Error processing specified tolerance!\nPlease choose larger tolerance...") )
|
||||||
+ self.tr( "Please choose larger tolerance..." ) )
|
|
||||||
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
||||||
QMessageBox.warning( self, "Geometry", self.tr( "Unable to delete incomplete shapefile." ) )
|
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 )
|
||||||
if success:
|
if success:
|
||||||
addToTOC = QMessageBox.question( self, "Geometry", self.tr( "Created output shapefile:" ) + "\n" +
|
addToTOC = QMessageBox.question( self, self.tr("Geometry"), self.tr( "Created output shapefile:\n%1\n\nWould you like to add the new layer to the TOC?" ).arg( unicode( self.shapefileName ) ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton )
|
||||||
unicode( self.shapefileName ) + "\n\n" + self.tr( "Would you like to add the new layer to the TOC?" ),
|
|
||||||
QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton )
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) )
|
ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) )
|
||||||
else:
|
else:
|
||||||
QMessageBox.warning( self, "Geometry", self.tr( "Error writing output shapefile." ) )
|
QMessageBox.warning( self, self.tr("Geometry"), self.tr( "Error writing output shapefile." ) )
|
||||||
|
|
||||||
def runStatusFromThread( self, status ):
|
def runStatusFromThread( self, status ):
|
||||||
self.progressBar.setValue( status )
|
self.progressBar.setValue( status )
|
||||||
@ -755,20 +752,20 @@ class geometryThread( QThread ):
|
|||||||
plp = "Poly"
|
plp = "Poly"
|
||||||
( found, index1 ) = self.checkForField( nameList, "AREA" )
|
( found, index1 ) = self.checkForField( nameList, "AREA" )
|
||||||
if not found:
|
if not found:
|
||||||
field = QgsField( "AREA", QVariant.Double, "double", 10, 6, "Polygon area" )
|
field = QgsField( "AREA", QVariant.Double, "double", 10, 6, self.tr("Polygon area") )
|
||||||
index1 = len( fieldList.keys() )
|
index1 = len( fieldList.keys() )
|
||||||
fieldList[ index1 ] = field
|
fieldList[ index1 ] = field
|
||||||
( found, index2 ) = self.checkForField( nameList, "PERIMETER" )
|
( found, index2 ) = self.checkForField( nameList, "PERIMETER" )
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
field = QgsField( "PERIMETER", QVariant.Double, "double", 10, 6, "Polygon perimeter" )
|
field = QgsField( "PERIMETER", QVariant.Double, "double", 10, 6, self.tr("Polygon perimeter") )
|
||||||
index2 = len( fieldList.keys() )
|
index2 = len( fieldList.keys() )
|
||||||
fieldList[ index2 ] = field
|
fieldList[ index2 ] = field
|
||||||
elif geomType == QGis.Line:
|
elif geomType == QGis.Line:
|
||||||
plp = "Line"
|
plp = "Line"
|
||||||
(found, index1) = self.checkForField(nameList, "LENGTH")
|
(found, index1) = self.checkForField(nameList, "LENGTH")
|
||||||
if not found:
|
if not found:
|
||||||
field = QgsField("LENGTH", QVariant.Double, "double", 10, 6, "Line length")
|
field = QgsField("LENGTH", QVariant.Double, "double", 10, 6, self.tr("Line length") )
|
||||||
index1 = len(fieldList.keys())
|
index1 = len(fieldList.keys())
|
||||||
fieldList[index1] = field
|
fieldList[index1] = field
|
||||||
index2 = index1
|
index2 = index1
|
||||||
@ -776,12 +773,12 @@ class geometryThread( QThread ):
|
|||||||
plp = "Point"
|
plp = "Point"
|
||||||
(found, index1) = self.checkForField(nameList, "XCOORD")
|
(found, index1) = self.checkForField(nameList, "XCOORD")
|
||||||
if not found:
|
if not found:
|
||||||
field = QgsField("XCOORD", QVariant.Double, "double", 10, 6, "Point x coordinate")
|
field = QgsField("XCOORD", QVariant.Double, "double", 10, 6, self.tr("Point x coordinate") )
|
||||||
index1 = len(fieldList.keys())
|
index1 = len(fieldList.keys())
|
||||||
fieldList[index1] = field
|
fieldList[index1] = field
|
||||||
(found, index2) = self.checkForField(nameList, "YCOORD")
|
(found, index2) = self.checkForField(nameList, "YCOORD")
|
||||||
if not found:
|
if not found:
|
||||||
field = QgsField("YCOORD", QVariant.Double, "double", 10, 6, "Point y coordinate")
|
field = QgsField("YCOORD", QVariant.Double, "double", 10, 6, self.tr("Point y coordinate") )
|
||||||
index2 = len(fieldList.keys())
|
index2 = len(fieldList.keys())
|
||||||
fieldList[index2] = field
|
fieldList[index2] = field
|
||||||
return (fieldList, index1, index2)
|
return (fieldList, index1, index2)
|
||||||
|
@ -54,24 +54,24 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
|||||||
|
|
||||||
def accept( self ):
|
def accept( self ):
|
||||||
if self.inShapeA.currentText() == "":
|
if self.inShapeA.currentText() == "":
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "Please specify an input layer" ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Please specify an input layer" ) )
|
||||||
elif self.inShapeB.isVisible() and self.inShapeB.currentText() == "":
|
elif self.inShapeB.isVisible() and self.inShapeB.currentText() == "":
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "Please specify a difference/intersect/union layer" ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Please specify a difference/intersect/union layer" ) )
|
||||||
elif self.param.isEnabled() and self.param.isVisible() and self.param.text() == "":
|
elif self.param.isEnabled() and self.param.isVisible() and self.param.text() == "":
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "Please specify valid buffer value" ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Please specify valid buffer value" ) )
|
||||||
elif self.attrib.isEnabled() and self.attrib.isVisible() and self.attrib.currentText() == "":
|
elif self.attrib.isEnabled() and self.attrib.isVisible() and self.attrib.currentText() == "":
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "Please specify dissolve field" ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Please specify dissolve field" ) )
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "Please specify output shapefile" ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Please specify output shapefile" ) )
|
||||||
else:
|
else:
|
||||||
changedLayerA = ftools_utils.getVectorLayerByName( self.inShapeA.currentText() )
|
changedLayerA = ftools_utils.getVectorLayerByName( self.inShapeA.currentText() )
|
||||||
changedLayerB = ftools_utils.getVectorLayerByName( self.inShapeB.currentText() )
|
changedLayerB = ftools_utils.getVectorLayerByName( self.inShapeB.currentText() )
|
||||||
# check for selection in layer A
|
# check for selection in layer A
|
||||||
if self.useSelectedA.isChecked() and changedLayerA.selectedFeatureCount() == 0:
|
if self.useSelectedA.isChecked() and changedLayerA.selectedFeatureCount() == 0:
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "No features selected, please uncheck 'Use selected' or make a selection" ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "No features selected, please uncheck 'Use selected' or make a selection" ) )
|
||||||
# check for selection in layer B
|
# check for selection in layer B
|
||||||
elif self.inShapeB.isVisible() and self.useSelectedB.isChecked() and changedLayerB.selectedFeatureCount() == 0:
|
elif self.inShapeB.isVisible() and self.useSelectedB.isChecked() and changedLayerB.selectedFeatureCount() == 0:
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "No features selected, please uncheck 'Use selected' or make a selection" ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "No features selected, please uncheck 'Use selected' or make a selection" ) )
|
||||||
else:
|
else:
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
if self.attrib.isEnabled():
|
if self.attrib.isEnabled():
|
||||||
@ -177,14 +177,14 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
|||||||
check = QFile( self.shapefileName )
|
check = QFile( self.shapefileName )
|
||||||
if check.exists():
|
if check.exists():
|
||||||
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
if not QgsVectorFileWriter.deleteShapeFile( self.shapefileName ):
|
||||||
QMessageBox.warning( self, "Geoprocessing", self.tr( "Unable to delete existing shapefile." ) )
|
QMessageBox.warning( self, self.tr("Geoprocessing"), self.tr( "Unable to delete existing shapefile." ) )
|
||||||
return
|
return
|
||||||
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 )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runStatus(PyQt_PyObject)" ), self.runStatusFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runStatus(PyQt_PyObject)" ), self.runStatusFromThread )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runRange(PyQt_PyObject)" ), self.runRangeFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runRange(PyQt_PyObject)" ), self.runRangeFromThread )
|
||||||
self.cancel_close.setText( "Cancel" )
|
self.cancel_close.setText( self.tr("Cancel") )
|
||||||
QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
||||||
self.testThread.start()
|
self.testThread.start()
|
||||||
return True
|
return True
|
||||||
@ -194,7 +194,7 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
|||||||
|
|
||||||
def runFinishedFromThread( self, results ):
|
def runFinishedFromThread( self, results ):
|
||||||
self.testThread.stop()
|
self.testThread.stop()
|
||||||
self.cancel_close.setText( "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 )
|
||||||
if not results[2] or not results[1] or not results [0]:
|
if not results[2] or not results[1] or not results [0]:
|
||||||
out_text = self.tr( "\nWarnings:" )
|
out_text = self.tr( "\nWarnings:" )
|
||||||
@ -210,8 +210,7 @@ class GeoprocessingDialog( QDialog, Ui_Dialog ):
|
|||||||
out_text = out_text + self.tr( "\nGEOS geoprocessing error: One or more input features have invalid geometry.")
|
out_text = out_text + self.tr( "\nGEOS geoprocessing error: One or more input features have invalid geometry.")
|
||||||
else:
|
else:
|
||||||
out_text = ""
|
out_text = ""
|
||||||
addToTOC = QMessageBox.question( self, "Geoprocessing", self.tr( "Created output shapefile:" ) + "\n"
|
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 )
|
||||||
+ unicode( self.shapefileName ) + out_text + end_text, QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton )
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) )
|
ftools_utils.addShapeToCanvas( unicode( self.shapefileName ) )
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
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("Line intersections")
|
self.setWindowTitle( self.tr("Line intersections") )
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -74,15 +74,15 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inLine1.currentText() == "":
|
if self.inLine1.currentText() == "":
|
||||||
QMessageBox.information(self, "Locate Line Intersections", "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() == "":
|
||||||
QMessageBox.information(self, "Locate Line Intersections", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Locate Line Intersections"), self.tr("Please specify output shapefile") )
|
||||||
elif self.inLine2.currentText() == "":
|
elif self.inLine2.currentText() == "":
|
||||||
QMessageBox.information(self, "Locate Line Intersections", "Please specify line intersect layer")
|
QMessageBox.information(self, self.tr("Locate Line Intersections"), self.tr("Please specify line intersect layer") )
|
||||||
elif self.inField1.currentText() == "":
|
elif self.inField1.currentText() == "":
|
||||||
QMessageBox.information(self, "Locate Line Intersections", "Please specify input unique ID field")
|
QMessageBox.information(self, self.tr("Locate Line Intersections"), self.tr("Please specify input unique ID field") )
|
||||||
elif self.inField2.currentText() == "":
|
elif self.inField2.currentText() == "":
|
||||||
QMessageBox.information(self, "Locate Line Intersections", "Please specify intersect unique ID field")
|
QMessageBox.information(self, self.tr("Locate Line Intersections"), self.tr("Please specify intersect unique ID field") )
|
||||||
else:
|
else:
|
||||||
line1 = self.inLine1.currentText()
|
line1 = self.inLine1.currentText()
|
||||||
line2 = self.inLine2.currentText()
|
line2 = self.inLine2.currentText()
|
||||||
@ -98,8 +98,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
self.compute(line1, line2, field1, field2, outPath, self.progressBar)
|
self.compute(line1, line2, field1, field2, outPath, self.progressBar)
|
||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
addToTOC = QMessageBox.question(self, "Generate Centroids", "Created output point Shapefile:\n" + outPath
|
addToTOC = QMessageBox.question(self, self.tr("Generate Centroids"), self.tr("Created output point shapefile:\n%1\n\nWould you like to add the new layer to the TOC?").arg( outPath ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
@ -185,7 +184,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Locate Line Intersections", "Vector layer is not valid")
|
QMessageBox.information(self, self.tr("Locate Line Intersections"), self.tr("Vector layer is not valid") )
|
||||||
|
|
||||||
def getFieldList(self, vlayer):
|
def getFieldList(self, vlayer):
|
||||||
fProvider = vlayer.dataProvider()
|
fProvider = vlayer.dataProvider()
|
||||||
|
@ -51,7 +51,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
QObject.connect(self.toolTable, SIGNAL("clicked()"), self.inFile)
|
QObject.connect(self.toolTable, SIGNAL("clicked()"), self.inFile)
|
||||||
QObject.connect(self.rdoTable, SIGNAL("clicked()"), self.updateTableFields)
|
QObject.connect(self.rdoTable, SIGNAL("clicked()"), self.updateTableFields)
|
||||||
QObject.connect(self.rdoVector, SIGNAL("clicked()"), self.jupdate)
|
QObject.connect(self.rdoVector, SIGNAL("clicked()"), self.jupdate)
|
||||||
self.setWindowTitle("Join attributes")
|
self.setWindowTitle( self.tr("Join attributes") )
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -77,17 +77,17 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Join Attributes", "Please specify target vector layer")
|
QMessageBox.information(self, self.tr("Join Attributes"), self.tr("Please specify target vector layer"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
QMessageBox.information(self, "Join Attributes", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Join Attributes"), self.tr("Please specify output shapefile"))
|
||||||
elif self.joinShape.currentText() == "" and self.rdoVector.isChecked():
|
elif self.joinShape.currentText() == "" and self.rdoVector.isChecked():
|
||||||
QMessageBox.information(self, "Join Attributes", "Please specify join vector layer")
|
QMessageBox.information(self, self.tr("Join Attributes"), self.tr("Please specify join vector layer"))
|
||||||
elif self.inField.currentText() == "":
|
elif self.inField.currentText() == "":
|
||||||
QMessageBox.information(self, "Join Attributes", "Please specify target join field")
|
QMessageBox.information(self, self.tr("Join Attributes"), self.tr("Please specify target join field"))
|
||||||
elif self.joinField.currentText() == "":
|
elif self.joinField.currentText() == "":
|
||||||
QMessageBox.information(self, "Join Attributes", "Please specify join field")
|
QMessageBox.information(self, self.tr("Join Attributes"), self.tr("Please specify join field"))
|
||||||
elif self.inTable.text() == "" and self.rdoTable.isChecked():
|
elif self.inTable.text() == "" and self.rdoTable.isChecked():
|
||||||
QMessageBox.information(self, "Join Attributes", "Please specify input table")
|
QMessageBox.information(self, self.tr("Join Attributes"), self.tr("Please specify input table"))
|
||||||
else:
|
else:
|
||||||
keep = self.rdoKeep.isChecked()
|
keep = self.rdoKeep.isChecked()
|
||||||
inName = self.inShape.currentText()
|
inName = self.inShape.currentText()
|
||||||
@ -108,8 +108,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
outName = outName.left(outName.length() - 4)
|
outName = outName.left(outName.length() - 4)
|
||||||
self.compute(inName, inField, joinName, joinField, outPath, keep, useTable, self.progressBar)
|
self.compute(inName, inField, joinName, joinField, outPath, keep, useTable, self.progressBar)
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
addToTOC = QMessageBox.question(self, "Join Attributes", "Created output Shapefile:\n" + self.shapefileName
|
addToTOC = QMessageBox.question(self, self.tr("Join Attributes"), self.tr("Created output shapefile:\n%1\n\nWould you like to add the new layer to the TOC?").arg( unicode(self.shapefileName) ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
vlayer = QgsVectorLayer(self.shapefileName, outName, "ogr")
|
vlayer = QgsVectorLayer(self.shapefileName, outName, "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(vlayer)
|
||||||
@ -126,7 +125,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
fileDialog = QFileDialog()
|
fileDialog = QFileDialog()
|
||||||
fileDialog.setConfirmOverwrite(False)
|
fileDialog.setConfirmOverwrite(False)
|
||||||
outName = fileDialog.getOpenFileName(self, "Join Table",".", "DBase Files (*.dbf)")
|
outName = fileDialog.getOpenFileName(self, self.tr("Join Table"), ".", "DBase Files (*.dbf)")
|
||||||
fileCheck = QFile(outName)
|
fileCheck = QFile(outName)
|
||||||
if fileCheck.exists():
|
if fileCheck.exists():
|
||||||
filePath = QFileInfo(outName).absoluteFilePath()
|
filePath = QFileInfo(outName).absoluteFilePath()
|
||||||
@ -136,7 +135,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.inTable.insert(filePath)
|
self.inTable.insert(filePath)
|
||||||
self.updateTableFields()
|
self.updateTableFields()
|
||||||
else:
|
else:
|
||||||
QMessageBox.warning(self, "Join Attributes", "Input table does not exist")
|
QMessageBox.warning(self, self.tr("Join Attributes"), self.tr("Input table does not exist"))
|
||||||
|
|
||||||
def updateTableFields(self):
|
def updateTableFields(self):
|
||||||
if self.inTable.text() != "":
|
if self.inTable.text() != "":
|
||||||
@ -250,7 +249,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
qtype = QVariant.Double
|
qtype = QVariant.Double
|
||||||
length = info[1]
|
length = info[1]
|
||||||
prec = info[2]
|
prec = info[2]
|
||||||
field = QgsField(name, qtype, ntype, length, prec, "joined fields")
|
field = QgsField(name, qtype, ntype, length, prec, self.tr("joined fields"))
|
||||||
fieldList[item] = field
|
fieldList[item] = field
|
||||||
item = item + 1
|
item = item + 1
|
||||||
return (fieldList, index2)
|
return (fieldList, index2)
|
||||||
@ -292,7 +291,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Join Attributes", "Vector layer is not valid")
|
QMessageBox.information(self, self.tr("Join Attributes"), self.tr("Vector layer is not valid"))
|
||||||
|
|
||||||
def getFieldList(self, vlayer):
|
def getFieldList(self, vlayer):
|
||||||
fProvider = vlayer.dataProvider()
|
fProvider = vlayer.dataProvider()
|
||||||
|
@ -25,18 +25,18 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def updateUi(self):
|
def updateUi(self):
|
||||||
if self.function == 1:
|
if self.function == 1:
|
||||||
self.setWindowTitle("Mean coordinates")
|
self.setWindowTitle( self.tr("Mean coordinates") )
|
||||||
self.sizeValue.setVisible(False)
|
self.sizeValue.setVisible(False)
|
||||||
self.label_size.setVisible(False)
|
self.label_size.setVisible(False)
|
||||||
elif self.function == 2:
|
elif self.function == 2:
|
||||||
self.setWindowTitle("Standard distance")
|
self.setWindowTitle( self.tr("Standard distance") )
|
||||||
self.resize(381, 100)
|
self.resize(381, 100)
|
||||||
|
|
||||||
def update(self, inputLayer):
|
def update(self, inputLayer):
|
||||||
self.weightField.clear()
|
self.weightField.clear()
|
||||||
self.uniqueField.clear()
|
self.uniqueField.clear()
|
||||||
self.weightField.addItem("(Optional) Weight field")
|
self.weightField.addItem( self.tr("(Optional) Weight field") )
|
||||||
self.uniqueField.addItem("(Optional) Unique ID field")
|
self.uniqueField.addItem( self.tr("(Optional) Unique ID field") )
|
||||||
self.changedLayer = self.getVectorLayerByName(inputLayer)
|
self.changedLayer = self.getVectorLayerByName(inputLayer)
|
||||||
changedField = self.getFieldList(self.changedLayer)
|
changedField = self.getFieldList(self.changedLayer)
|
||||||
for i in changedField:
|
for i in changedField:
|
||||||
@ -46,9 +46,9 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Coordinate statistics", "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() == "":
|
||||||
QMessageBox.information(self, "Coordinate statistics", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Coordinate statistics"), self.tr("Please specify output shapefile"))
|
||||||
else:
|
else:
|
||||||
inName = self.inShape.currentText()
|
inName = self.inShape.currentText()
|
||||||
outPath = self.outShape.text()
|
outPath = self.outShape.text()
|
||||||
@ -62,8 +62,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.compute(inName, outPath, self.weightField.currentText(), self.sizeValue.value(), self.uniqueField.currentText())
|
self.compute(inName, outPath, self.weightField.currentText(), self.sizeValue.value(), self.uniqueField.currentText())
|
||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
addToTOC = QMessageBox.question(self, "Coordinate statistics", "Created output point Shapefile:\n" + outPath
|
addToTOC = QMessageBox.question(self, self.tr("Coordinate statistics"), self.tr("Created output point shapefile:\n%1\n\nWould you like to add the new layer to the TOC?").arg( outPath ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
if self.vlayer.geometryType() == QGis.Point:
|
if self.vlayer.geometryType() == QGis.Point:
|
||||||
|
@ -75,15 +75,15 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inPoint1.currentText() == "":
|
if self.inPoint1.currentText() == "":
|
||||||
QMessageBox.information(self, "Create Point Distance Matrix", "Please specify input point layer")
|
QMessageBox.information(self, self.tr("Create Point Distance Matrix"), self.tr("Please specify input point layer"))
|
||||||
elif self.outFile.text() == "":
|
elif self.outFile.text() == "":
|
||||||
QMessageBox.information(self, "Create Point Distance Matrix", "Please specify output file")
|
QMessageBox.information(self, self.tr("Create Point Distance Matrix"), self.tr("Please specify output file"))
|
||||||
elif self.inPoint2.currentText() == "":
|
elif self.inPoint2.currentText() == "":
|
||||||
QMessageBox.information(self, "Create Point Distance Matrix", "Please specify target point layer")
|
QMessageBox.information(self, self.tr("Create Point Distance Matrix"), self.tr("Please specify target point layer"))
|
||||||
elif self.inField1.currentText() == "":
|
elif self.inField1.currentText() == "":
|
||||||
QMessageBox.information(self, "Create Point Distance Matrix", "Please specify input unique ID field")
|
QMessageBox.information(self, self.tr("Create Point Distance Matrix"), self.tr("Please specify input unique ID field"))
|
||||||
elif self.inField2.currentText() == "":
|
elif self.inField2.currentText() == "":
|
||||||
QMessageBox.information(self, "Create Point Distance Matrix", "Please specify target unique ID field")
|
QMessageBox.information(self, self.tr("Create Point Distance Matrix"), self.tr("Please specify target unique ID field"))
|
||||||
else:
|
else:
|
||||||
point1 = self.inPoint1.currentText()
|
point1 = self.inPoint1.currentText()
|
||||||
point2 = self.inPoint2.currentText()
|
point2 = self.inPoint2.currentText()
|
||||||
@ -223,7 +223,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Locate Line Intersections", "Vector layer is not valid")
|
QMessageBox.information(self, self.tr("Locate Line Intersections"), self.tr("Vector layer is not valid"))
|
||||||
|
|
||||||
def getFieldList(self, vlayer):
|
def getFieldList(self, vlayer):
|
||||||
fProvider = vlayer.dataProvider()
|
fProvider = vlayer.dataProvider()
|
||||||
|
@ -44,7 +44,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
# Set up the user interface from Designer.
|
# Set up the user interface from Designer.
|
||||||
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("Points in polygon"))
|
self.setWindowTitle(self.tr("Count Points in Polygon"))
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -58,13 +58,13 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inPolygon.currentText() == "":
|
if self.inPolygon.currentText() == "":
|
||||||
QMessageBox.information(self, "Count Points In Polyon", "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() == "":
|
||||||
QMessageBox.information(self, "Count Points In Polygon", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Count Points In Polygon"), self.tr("Please specify output shapefile"))
|
||||||
elif self.inPoint.currentText() == "":
|
elif self.inPoint.currentText() == "":
|
||||||
QMessageBox.information(self, "Count Points In Polygon", "Please specify input point vector layer")
|
QMessageBox.information(self, self.tr("Count Points In Polygon"), self.tr("Please specify input point vector layer"))
|
||||||
elif self.lnField.text() == "":
|
elif self.lnField.text() == "":
|
||||||
QMessageBox.information(self, "Count Points In Polygon", "Please specify output count field")
|
QMessageBox.information(self, self.tr("Count Points In Polygon"), self.tr("Please specify output count field"))
|
||||||
else:
|
else:
|
||||||
inPoly = self.inPolygon.currentText()
|
inPoly = self.inPolygon.currentText()
|
||||||
inPts = self.inPoint.currentText()
|
inPts = self.inPoint.currentText()
|
||||||
@ -78,8 +78,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
outName = outName.left(outName.length() - 4)
|
outName = outName.left(outName.length() - 4)
|
||||||
self.compute(inPoly, inPts, inField, outPath, self.progressBar)
|
self.compute(inPoly, inPts, inField, outPath, self.progressBar)
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
addToTOC = QMessageBox.question(self, "Count Points in Polygons", self.tr("Created output Shapefile:\n") + outPath
|
addToTOC = QMessageBox.question(self, self.tr("Count Points in Polygon"), self.tr("Created output shapefile:\n%1\n\nWould you like to add the new layer to the TOC?").arg(unicode(outPath)), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
@ -98,7 +97,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
polyProvider = polyLayer.dataProvider()
|
polyProvider = polyLayer.dataProvider()
|
||||||
pointProvider = pointLayer.dataProvider()
|
pointProvider = pointLayer.dataProvider()
|
||||||
if polyProvider.crs() <> pointProvider.crs():
|
if polyProvider.crs() <> pointProvider.crs():
|
||||||
QMessageBox.warning(self, "CRS warning!", "Warning: Input layers have non-matching CRS.\nThis may cause unexpected results.")
|
QMessageBox.warning(self, self.tr("CRS warning!"), self.tr("Warning: Input layers have non-matching CRS.\nThis may cause unexpected results."))
|
||||||
allAttrs = polyProvider.attributeIndexes()
|
allAttrs = polyProvider.attributeIndexes()
|
||||||
polyProvider.select(allAttrs)
|
polyProvider.select(allAttrs)
|
||||||
allAttrs = pointProvider.attributeIndexes()
|
allAttrs = pointProvider.attributeIndexes()
|
||||||
@ -107,7 +106,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
index = polyProvider.fieldNameIndex(unicode(inField))
|
index = polyProvider.fieldNameIndex(unicode(inField))
|
||||||
if index == -1:
|
if index == -1:
|
||||||
index = polyProvider.fieldCount()
|
index = polyProvider.fieldCount()
|
||||||
field = QgsField(unicode(inField), QVariant.Int, "real", 24, 15, "point count field")
|
field = QgsField(unicode(inField), QVariant.Int, "real", 24, 15, self.tr("point count field"))
|
||||||
fieldList[index] = field
|
fieldList[index] = field
|
||||||
sRs = polyProvider.crs()
|
sRs = polyProvider.crs()
|
||||||
check = QFile(self.shapefileName)
|
check = QFile(self.shapefileName)
|
||||||
@ -154,7 +153,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Counts Points In Polygons", self.tr("Vector layer is not valid"))
|
QMessageBox.information(self, self.tr("Counts Points In Polygon"), self.tr("Vector layer is not valid"))
|
||||||
|
|
||||||
def getFieldList(self, vlayer):
|
def getFieldList(self, vlayer):
|
||||||
fProvider = vlayer.dataProvider()
|
fProvider = vlayer.dataProvider()
|
||||||
|
@ -46,7 +46,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
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.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
self.setWindowTitle("Random points")
|
self.setWindowTitle(self.tr("Random Points"))
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
for i in range(mapCanvas.layerCount()):
|
for i in range(mapCanvas.layerCount()):
|
||||||
layer = mapCanvas.layer(i)
|
layer = mapCanvas.layer(i)
|
||||||
@ -79,9 +79,9 @@ 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):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Random Points", "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() == "":
|
||||||
QMessageBox.information(self, "Random Points", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Random Points"), self.tr("Please specify output shapefile"))
|
||||||
else:
|
else:
|
||||||
inName = self.inShape.currentText()
|
inName = self.inShape.currentText()
|
||||||
self.progressBar.setValue(1)
|
self.progressBar.setValue(1)
|
||||||
@ -98,23 +98,23 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if mLayer.type() == mLayer.VectorLayer:
|
if mLayer.type() == mLayer.VectorLayer:
|
||||||
inLayer = QgsVectorLayer(unicode(mLayer.source(),'latin1'), unicode(mLayer.name(),'latin1'), unicode(mLayer.dataProvider().name()))
|
inLayer = QgsVectorLayer(unicode(mLayer.source(),'latin1'), unicode(mLayer.name(),'latin1'), unicode(mLayer.dataProvider().name()))
|
||||||
if self.rdoUnstratified.isChecked():
|
if self.rdoUnstratified.isChecked():
|
||||||
design = "unstratified"
|
design = self.tr("unstratified")
|
||||||
value = self.spnUnstratified.value()
|
value = self.spnUnstratified.value()
|
||||||
elif self.rdoStratified.isChecked():
|
elif self.rdoStratified.isChecked():
|
||||||
design = "stratified"
|
design = self.tr("stratified")
|
||||||
value = self.spnStratified.value()
|
value = self.spnStratified.value()
|
||||||
elif self.rdoDensity.isChecked():
|
elif self.rdoDensity.isChecked():
|
||||||
design = "density"
|
design = self.tr("density")
|
||||||
value = self.spnDensity.value()
|
value = self.spnDensity.value()
|
||||||
else:
|
else:
|
||||||
design = "field"
|
design = self.tr("field")
|
||||||
value = unicode(self.cmbField.currentText())
|
value = unicode(self.cmbField.currentText())
|
||||||
elif mLayer.type() == mLayer.RasterLayer:
|
elif mLayer.type() == mLayer.RasterLayer:
|
||||||
inLayer = QgsRasterLayer(unicode(mLayer.source(),'latin1'), unicode(mLayer.name(),'latin1'))
|
inLayer = QgsRasterLayer(unicode(mLayer.source(),'latin1'), unicode(mLayer.name(),'latin1'))
|
||||||
design = "unstratified"
|
design = self.tr("unstratified")
|
||||||
value = self.spnUnstratified.value()
|
value = self.spnUnstratified.value()
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Random Points", "Unknown layer type...")
|
QMessageBox.information(self, self.tr("Random Points"), self.tr("Unknown layer type..."))
|
||||||
if self.chkMinimum.isChecked():
|
if self.chkMinimum.isChecked():
|
||||||
minimum = self.spnMinimum.value()
|
minimum = self.spnMinimum.value()
|
||||||
else:
|
else:
|
||||||
@ -123,8 +123,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.randomize(inLayer, outPath, minimum, design, value, self.progressBar)
|
self.randomize(inLayer, outPath, minimum, design, value, self.progressBar)
|
||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
addToTOC = QMessageBox.question(self, "Random Points", "Created output point Shapefile:\n" + outPath
|
addToTOC = QMessageBox.question(self, self.tr("Random Points"), self.tr("Created output point shapefile:\n%1\n\nWould you like to add the new layer to the TOC?").arg(outPath), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
@ -181,7 +180,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Generate Centroids", "Vector layer is not valid")
|
QMessageBox.information(self, self.tr("Generate Centroids"), self.tr("Vector layer is not valid"))
|
||||||
|
|
||||||
# Get map layer by name from TOC
|
# Get map layer by name from TOC
|
||||||
def getMapLayerByName(self, myName):
|
def getMapLayerByName(self, myName):
|
||||||
@ -204,7 +203,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def randomize(self, inLayer, outPath, minimum, design, value, progressBar):
|
def randomize(self, inLayer, outPath, minimum, design, value, progressBar):
|
||||||
outFeat = QgsFeature()
|
outFeat = QgsFeature()
|
||||||
if design == "unstratified":
|
if design == self.tr("unstratified"):
|
||||||
ext = inLayer.extent()
|
ext = inLayer.extent()
|
||||||
if inLayer.type() == inLayer.RasterLayer: bound = ext
|
if inLayer.type() == inLayer.RasterLayer: bound = ext
|
||||||
else: bound = self.createSinglePolygon(inLayer, progressBar)
|
else: bound = self.createSinglePolygon(inLayer, progressBar)
|
||||||
@ -245,10 +244,10 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
add = 60.00 / sProvider.featureCount()
|
add = 60.00 / sProvider.featureCount()
|
||||||
while sProvider.nextFeature(sFeat):
|
while sProvider.nextFeature(sFeat):
|
||||||
sGeom = sFeat.geometry()
|
sGeom = sFeat.geometry()
|
||||||
if design == "density":
|
if design == self.tr("density"):
|
||||||
sDistArea = QgsDistanceArea()
|
sDistArea = QgsDistanceArea()
|
||||||
value = int(round(numRand * sDistArea.measure(sGeom)))
|
value = int(round(numRand * sDistArea.measure(sGeom)))
|
||||||
elif design == "field":
|
elif design == self.tr("field"):
|
||||||
sAtMap = sFeat.attributeMap()
|
sAtMap = sFeat.attributeMap()
|
||||||
value = sAtMap[index].toInt()[0]
|
value = sAtMap[index].toInt()[0]
|
||||||
else:
|
else:
|
||||||
|
@ -12,7 +12,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
# Set up the user interface from Designer.
|
# Set up the user interface from Designer.
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.changed)
|
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.changed)
|
||||||
self.setWindowTitle("Random selection")
|
self.setWindowTitle(self.tr("Random selection"))
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -29,7 +29,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Random Selection Tool", "No input shapefile specified")
|
QMessageBox.information(self, self.tr("Random Selection Tool"), self.tr("No input shapefile specified"))
|
||||||
else:
|
else:
|
||||||
self.progressBar.setValue(10)
|
self.progressBar.setValue(10)
|
||||||
inName = self.inShape.currentText()
|
inName = self.inShape.currentText()
|
||||||
|
@ -16,7 +16,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
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)
|
||||||
self.setWindowTitle("Export to new projection")
|
self.setWindowTitle( self.tr("Export to new projection") )
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
for i in range(mapCanvas.layerCount()):
|
for i in range(mapCanvas.layerCount()):
|
||||||
@ -37,13 +37,13 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Export to new projection", "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() == "":
|
||||||
QMessageBox.information(self, "Export to new projection", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Export to new projection"), self.tr("Please specify output shapefile"))
|
||||||
elif self.txtProjection.text() == "" and self.rdoProjection.isChecked():
|
elif self.txtProjection.text() == "" and self.rdoProjection.isChecked():
|
||||||
QMessageBox.information(self, "Define current projection", "Please specify spatial reference system")
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Please specify spatial reference system"))
|
||||||
elif self.cmbLayer.currentText() == "" and self.rdoLayer.isChecked():
|
elif self.cmbLayer.currentText() == "" and self.rdoLayer.isChecked():
|
||||||
QMessageBox.information(self, "Define current projection", "Please specify spatial reference system")
|
QMessageBox.information(self, self.tr("Define current projection"), self.tr("Please specify spatial reference system"))
|
||||||
else:
|
else:
|
||||||
inName = self.inShape.currentText()
|
inName = self.inShape.currentText()
|
||||||
self.progressBar.setValue(5)
|
self.progressBar.setValue(5)
|
||||||
@ -58,8 +58,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if self.reProject(inName, unicode(outPath), unicode(outProj), self.rdoProjection.isChecked(), self.progressBar):
|
if self.reProject(inName, unicode(outPath), unicode(outProj), self.rdoProjection.isChecked(), self.progressBar):
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
addToTOC = QMessageBox.question(self, "Export to new projection", "Created projected shapefile:\n" + outPath
|
addToTOC = QMessageBox.question(self, self.tr("Export to new projection"), self.tr("Created projected shapefile:\n%1\n\nWould you like to add the new layer to the TOC?").arg( outPath ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
@ -67,15 +66,15 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def outProjFile(self):
|
def outProjFile(self):
|
||||||
format = QString( "<h2>%1</h2>%2 <br/> %3" )
|
format = QString( "<h2>%1</h2>%2 <br/> %3" )
|
||||||
header = QString( "Choose output CRS:" )
|
header = self.tr( "Choose output CRS:" )
|
||||||
sentence1 = QString( "Please select the projection system to be used by the output layer." )
|
sentence1 = self.tr( "Please select the projection system to be used by the output layer." )
|
||||||
sentence2 = QString( "Output layer will be projected from it's current CRS to the output CRS." )
|
sentence2 = self.tr( "Output layer will be projected from it's current CRS to the output CRS." )
|
||||||
self.projSelect = QgsGenericProjectionSelector(self, Qt.Widget)
|
self.projSelect = QgsGenericProjectionSelector(self, Qt.Widget)
|
||||||
self.projSelect.setMessage( format.arg( header ).arg( sentence1 ).arg( sentence2 ))
|
self.projSelect.setMessage( format.arg( header ).arg( sentence1 ).arg( sentence2 ))
|
||||||
if self.projSelect.exec_():
|
if self.projSelect.exec_():
|
||||||
projString = self.projSelect.selectedProj4String()
|
projString = self.projSelect.selectedProj4String()
|
||||||
if projString == "":
|
if projString == "":
|
||||||
QMessageBox.information(self, "Export to new projection", "No Valid CRS selected")
|
QMessageBox.information(self, self.tr("Export to new projection"), self.tr("No Valid CRS selected"))
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
self.txtProjection.clear()
|
self.txtProjection.clear()
|
||||||
@ -105,7 +104,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
destLayer = self.getVectorLayerByName(outProj)
|
destLayer = self.getVectorLayerByName(outProj)
|
||||||
crsDest = destLayer.dataProvider().crs()
|
crsDest = destLayer.dataProvider().crs()
|
||||||
if not crsDest.isValid():
|
if not crsDest.isValid():
|
||||||
QMessageBox.information(self, "Export to new projection", "Output spatial reference system is not valid")
|
QMessageBox.information(self, self.tr("Export to new projection"), self.tr("Output spatial reference system is not valid"))
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
progressBar.setValue(5)
|
progressBar.setValue(5)
|
||||||
@ -122,7 +121,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if self.pointReproject(vlayer, xform, writer, progressBar): return True
|
if self.pointReproject(vlayer, xform, writer, progressBar): return True
|
||||||
else: return False
|
else: return False
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Export to new projection", "Identical output spatial reference system chosen")
|
QMessageBox.information(self, self.tr("Export to new projection"), self.tr("Identical output spatial reference system chosen"))
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Gets vector layer by layername in canvas
|
# Gets vector layer by layername in canvas
|
||||||
|
@ -44,7 +44,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.iface = iface
|
self.iface = iface
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
self.setWindowTitle("Regular points")
|
self.setWindowTitle( self.tr("Regular points") )
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
for i in range(mapCanvas.layerCount()):
|
for i in range(mapCanvas.layerCount()):
|
||||||
@ -53,11 +53,11 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if not self.rdoCoordinates.isChecked() and self.inShape.currentText() == "":
|
if not self.rdoCoordinates.isChecked() and self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Generate Regular Points", "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() == ""):
|
||||||
QMessageBox.information(self, "Generate Regular Points", "Please properly specify extent coordinates")
|
QMessageBox.information(self, self.tr("Generate Regular Points"), self.tr("Please properly specify extent coordinates"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
QMessageBox.information(self, "Generate Regular Points", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Generate Regular Points"), self.tr("Please specify output shapefile"))
|
||||||
else:
|
else:
|
||||||
inName = self.inShape.currentText()
|
inName = self.inShape.currentText()
|
||||||
outPath = self.outShape.text()
|
outPath = self.outShape.text()
|
||||||
@ -78,9 +78,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
else:
|
else:
|
||||||
boundBox = QgsRect(float(self.xMin.text()), float(self.yMin.text()), float(self.xMax.text()), float(self.yMax.text()))
|
boundBox = QgsRect(float(self.xMin.text()), float(self.yMin.text()), float(self.xMax.text()), float(self.yMax.text()))
|
||||||
self.regularize(boundBox, outPath, offset, value, self.rdoSpacing.isChecked(), self.spnInset.value(), self.progressBar)
|
self.regularize(boundBox, outPath, offset, value, self.rdoSpacing.isChecked(), self.spnInset.value(), self.progressBar)
|
||||||
addToTOC = QMessageBox.question(self, "Generate Regular Points", "Created output point Shapefile:\n" + outPath
|
addToTOC = QMessageBox.question(self, self.tr("Generate Regular Points"), self.tr("Created output point shapefile:\n%1\n\nNote: Layer has no associated coordinate system, please use the Projection Management Tool to specify spatial reference system.\n\nWould you like to add the new layer to the TOC?").arg( outPath ), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\nNote: Layer has no associated coordinate system, please use the Projection Management Tool to specify spatial reference system."
|
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
@ -116,7 +114,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Generate Regular Points", "Vector layer is not valid")
|
QMessageBox.information(self, self.tr("Generate Regular Points"), self.tr("Vector layer is not valid"))
|
||||||
|
|
||||||
# Get map layer by name from TOC
|
# Get map layer by name from TOC
|
||||||
def getMapLayerByName(self, myName):
|
def getMapLayerByName(self, myName):
|
||||||
|
@ -43,9 +43,9 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inPolygon.currentText() == "":
|
if self.inPolygon.currentText() == "":
|
||||||
QMessageBox.information(self, "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() == "":
|
||||||
QMessageBox.information(self, "Select by location", self.tr("Please specify select layer"))
|
QMessageBox.information(self, self.tr("Select by location"), self.tr("Please specify select layer"))
|
||||||
else:
|
else:
|
||||||
inPoly = self.inPolygon.currentText()
|
inPoly = self.inPolygon.currentText()
|
||||||
inPts = self.inPoint.currentText()
|
inPts = self.inPoint.currentText()
|
||||||
@ -68,9 +68,9 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
geom = QgsGeometry(feat.geometry())
|
geom = QgsGeometry(feat.geometry())
|
||||||
if geom.intersects(geomLayer):
|
if geom.intersects(geomLayer):
|
||||||
selectedSet.append(feat.id())
|
selectedSet.append(feat.id())
|
||||||
if modify == "adding to current selection":
|
if modify == self.tr("adding to current selection"):
|
||||||
selectedSet = list(set(inputLayer.selectedFeaturesIds()).union(selectedSet))
|
selectedSet = list(set(inputLayer.selectedFeaturesIds()).union(selectedSet))
|
||||||
elif modify == "removing from current selection":
|
elif modify == self.tr("removing from current selection"):
|
||||||
selectedSet = list(set(inputLayer.selectedFeaturesIds()).difference(selectedSet))
|
selectedSet = list(set(inputLayer.selectedFeaturesIds()).difference(selectedSet))
|
||||||
inputLayer.setSelectedFeatures(selectedSet)
|
inputLayer.setSelectedFeatures(selectedSet)
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
# Set up the user interface from Designer.
|
# Set up the user interface from Designer.
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
QObject.connect(self.toolOut, SIGNAL("clicked()"), self.outFile)
|
||||||
self.setWindowTitle("Join attributes by location")
|
self.setWindowTitle( self.tr("Join attributes by location") )
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -58,13 +58,13 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Spatial Join", "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() == "":
|
||||||
QMessageBox.information(self, "Spatial Join", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Spatial Join"), self.tr("Please specify output shapefile") )
|
||||||
elif self.joinShape.currentText() == "":
|
elif self.joinShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Spatial Join", "Please specify join vector layer")
|
QMessageBox.information(self, self.tr("Spatial Join"), self.tr("Please specify join vector layer") )
|
||||||
elif self.rdoSummary.isChecked() and not (self.chkMean.isChecked() or self.chkSum.isChecked() or self.chkMin.isChecked() or self.chkMax.isChecked() or self.chkMean.isChecked()):
|
elif self.rdoSummary.isChecked() and not (self.chkMean.isChecked() or self.chkSum.isChecked() or self.chkMin.isChecked() or self.chkMax.isChecked() or self.chkMean.isChecked()):
|
||||||
QMessageBox.information(self, "Spatial Join", "Please specify at least one summary statistic")
|
QMessageBox.information(self, self.tr("Spatial Join"), self.tr("Please specify at least one summary statistic") )
|
||||||
else:
|
else:
|
||||||
inName = self.inShape.currentText()
|
inName = self.inShape.currentText()
|
||||||
joinName = self.joinShape.currentText()
|
joinName = self.joinShape.currentText()
|
||||||
@ -89,8 +89,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
outName = outName.left(outName.length() - 4)
|
outName = outName.left(outName.length() - 4)
|
||||||
self.compute(inName, joinName, outPath, summary, sumList, keep, self.progressBar)
|
self.compute(inName, joinName, outPath, summary, sumList, keep, self.progressBar)
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
addToTOC = QMessageBox.question(self, "Spatial Join", "Created output Shapefile:\n" + outPath
|
addToTOC = QMessageBox.question(self, self.tr("Spatial Join"), self.tr("Created output shapefile:\n%1\n\nWould you like to add the new layer to the TOC?").arg(unicode(outPath)), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
@ -117,7 +116,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
fieldList2 = self.getFieldList(layer2)
|
fieldList2 = self.getFieldList(layer2)
|
||||||
fieldList = []
|
fieldList = []
|
||||||
if provider1.crs() <> provider2.crs():
|
if provider1.crs() <> provider2.crs():
|
||||||
QMessageBox.warning(self, "CRS warning!", "Warning: Input layers have non-matching CRS.\nThis may cause unexpected results.")
|
QMessageBox.warning(self, self.tr("CRS warning!"), self.tr("Warning: Input layers have non-matching CRS.\nThis may cause unexpected results."))
|
||||||
if not summary:
|
if not summary:
|
||||||
fieldList2 = self.testForUniqueness(fieldList1, fieldList2.values())
|
fieldList2 = self.testForUniqueness(fieldList1, fieldList2.values())
|
||||||
seq = range(0, len(fieldList1) + len(fieldList2))
|
seq = range(0, len(fieldList1) + len(fieldList2))
|
||||||
@ -129,9 +128,9 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if fieldList2[j].type() == QVariant.Int or fieldList2[j].type() == QVariant.Double:
|
if fieldList2[j].type() == QVariant.Int or fieldList2[j].type() == QVariant.Double:
|
||||||
numFields[j] = []
|
numFields[j] = []
|
||||||
for i in sumList:
|
for i in sumList:
|
||||||
field = QgsField(i + unicode(fieldList2[j].name()), QVariant.Double, "real", 24, 16, "Summary field")
|
field = QgsField(i + unicode(fieldList2[j].name()), QVariant.Double, "real", 24, 16, self.tr("Summary field") )
|
||||||
fieldList.append(field)
|
fieldList.append(field)
|
||||||
field = QgsField("COUNT", QVariant.Double, "real", 24, 16, "Summary field")
|
field = QgsField("COUNT", QVariant.Double, "real", 24, 16, self.tr("Summary field") )
|
||||||
fieldList.append(field)
|
fieldList.append(field)
|
||||||
fieldList2 = self.testForUniqueness(fieldList1, fieldList)
|
fieldList2 = self.testForUniqueness(fieldList1, fieldList)
|
||||||
fieldList1.extend(fieldList)
|
fieldList1.extend(fieldList)
|
||||||
@ -251,7 +250,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Spatial Join", "Vector layer is not valid")
|
QMessageBox.information(self, self.tr("Spatial Join"), self.tr("Vector layer is not valid"))
|
||||||
|
|
||||||
def getFieldList(self, vlayer):
|
def getFieldList(self, vlayer):
|
||||||
fProvider = vlayer.dataProvider()
|
fProvider = vlayer.dataProvider()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#-----------------------------------------------------------
|
#-----------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Random Selection Within Subsets
|
# Random selection within subsets
|
||||||
#
|
#
|
||||||
# A QGIS plugin for randomly selecting features from
|
# A QGIS plugin for randomly selecting features from
|
||||||
# within multiple user defined subsets based on an input field.
|
# within multiple user defined subsets based on an input field.
|
||||||
@ -43,7 +43,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
# Set up the user interface from Designer.
|
# Set up the user interface from Designer.
|
||||||
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("Random selection within subsets")
|
self.setWindowTitle(self.tr("Random selection within subsets"))
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -61,9 +61,9 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Random Selection Within Subsets", "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() == "":
|
||||||
QMessageBox.information(self, "Random Selection Within Subsets", "Please specify an input field")
|
QMessageBox.information(self, self.tr("Random selection within subsets"), self.tr("Please specify an input field"))
|
||||||
else:
|
else:
|
||||||
inVect = self.inShape.currentText()
|
inVect = self.inShape.currentText()
|
||||||
uidField = self.inField.currentText()
|
uidField = self.inField.currentText()
|
||||||
@ -81,10 +81,10 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
fileDialog = QFileDialog()
|
fileDialog = QFileDialog()
|
||||||
fileDialog.setConfirmOverwrite(False)
|
fileDialog.setConfirmOverwrite(False)
|
||||||
outName = fileDialog.getSaveFileName(self, "Output Shapefile",".", "Shapefiles (*.shp)")
|
outName = fileDialog.getSaveFileName(self, self.tr("Output Shapefile"),".", self.tr("Shapefiles (*.shp)"))
|
||||||
fileCheck = QFile(outName)
|
fileCheck = QFile(outName)
|
||||||
if fileCheck.exists():
|
if fileCheck.exists():
|
||||||
QMessageBox.warning(self, "Random Selection Within Subsets", "Cannot overwrite existing shapefile...")
|
QMessageBox.warning(self, self.tr("Random selection within subsets"), self.tr("Cannot overwrite existing shapefile..."))
|
||||||
else:
|
else:
|
||||||
filePath = QFileInfo(outName).absoluteFilePath()
|
filePath = QFileInfo(outName).absoluteFilePath()
|
||||||
if filePath.right(4) != ".shp": filePath = filePath + ".shp"
|
if filePath.right(4) != ".shp": filePath = filePath + ".shp"
|
||||||
@ -139,7 +139,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Random Selection Within Subsets", "Vector layer is not valid")
|
QMessageBox.information(self, self.tr("Random selection within subsets"), self.tr("Vector layer is not valid"))
|
||||||
|
|
||||||
def getMapLayerByName(self, myName):
|
def getMapLayerByName(self, myName):
|
||||||
mc = self.iface.mapCanvas()
|
mc = self.iface.mapCanvas()
|
||||||
|
@ -58,13 +58,13 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inPolygon.currentText() == "":
|
if self.inPolygon.currentText() == "":
|
||||||
QMessageBox.information(self, "Sum Line Lengths In Polyons", "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() == "":
|
||||||
QMessageBox.information(self, "Sum Line Lengths In Polyons", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Sum Line Lengths In Polyons"), self.tr("Please specify output shapefile"))
|
||||||
elif self.inPoint.currentText() == "":
|
elif self.inPoint.currentText() == "":
|
||||||
QMessageBox.information(self, "Sum Line Lengths In Polyons", "Please specify input line vector layer")
|
QMessageBox.information(self, self.tr("Sum Line Lengths In Polyons"), self.tr("Please specify input line vector layer"))
|
||||||
elif self.lnField.text() == "":
|
elif self.lnField.text() == "":
|
||||||
QMessageBox.information(self, "Sum Line Lengths In Polyons", "Please specify output length field")
|
QMessageBox.information(self, self.tr("Sum Line Lengths In Polyons"), self.tr("Please specify output length field"))
|
||||||
else:
|
else:
|
||||||
inPoly = self.inPolygon.currentText()
|
inPoly = self.inPolygon.currentText()
|
||||||
inLns = self.inPoint.currentText()
|
inLns = self.inPoint.currentText()
|
||||||
@ -78,8 +78,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
outName = outName.left(outName.length() - 4)
|
outName = outName.left(outName.length() - 4)
|
||||||
self.compute(inPoly, inLns, inField, outPath, self.progressBar)
|
self.compute(inPoly, inLns, inField, outPath, self.progressBar)
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
addToTOC = QMessageBox.question(self, "Sum line lengths", "Created output shapefile:\n" + outPath
|
addToTOC = QMessageBox.question(self, self.tr("Sum line lengths"), self.tr("Created output shapefile:\n%1\n\nWould you like to add the new layer to the TOC?").arg(unicode(outPath)), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?", QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
if addToTOC == QMessageBox.Yes:
|
if addToTOC == QMessageBox.Yes:
|
||||||
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
self.vlayer = QgsVectorLayer(outPath, unicode(outName), "ogr")
|
||||||
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
QgsMapLayerRegistry.instance().addMapLayer(self.vlayer)
|
||||||
@ -98,7 +97,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
polyProvider = polyLayer.dataProvider()
|
polyProvider = polyLayer.dataProvider()
|
||||||
lineProvider = lineLayer.dataProvider()
|
lineProvider = lineLayer.dataProvider()
|
||||||
if polyProvider.crs() <> lineProvider.crs():
|
if polyProvider.crs() <> lineProvider.crs():
|
||||||
QMessageBox.warning(self, "CRS warning!", "Warning: Input layers have non-matching CRS.\nThis may cause unexpected results.")
|
QMessageBox.warning(self, self.tr("CRS warning!"), self.tr("Warning: Input layers have non-matching CRS.\nThis may cause unexpected results."))
|
||||||
allAttrs = polyProvider.attributeIndexes()
|
allAttrs = polyProvider.attributeIndexes()
|
||||||
polyProvider.select(allAttrs)
|
polyProvider.select(allAttrs)
|
||||||
allAttrs = lineProvider.attributeIndexes()
|
allAttrs = lineProvider.attributeIndexes()
|
||||||
@ -107,7 +106,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
index = polyProvider.fieldNameIndex(unicode(inField))
|
index = polyProvider.fieldNameIndex(unicode(inField))
|
||||||
if index == -1:
|
if index == -1:
|
||||||
index = polyProvider.fieldCount()
|
index = polyProvider.fieldCount()
|
||||||
field = QgsField(unicode(inField), QVariant.Int, "real", 24, 15, "length field")
|
field = QgsField(unicode(inField), QVariant.Int, "real", 24, 15, self.tr("length field"))
|
||||||
fieldList[index] = field
|
fieldList[index] = field
|
||||||
sRs = polyProvider.crs()
|
sRs = polyProvider.crs()
|
||||||
inFeat = QgsFeature()
|
inFeat = QgsFeature()
|
||||||
@ -157,7 +156,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
if vlayer.isValid():
|
if vlayer.isValid():
|
||||||
return vlayer
|
return vlayer
|
||||||
else:
|
else:
|
||||||
QMessageBox.information(self, "Sum Line Lengths In Polyons", "Vector layer is not valid")
|
QMessageBox.information(self, self.tr("Sum Line Lengths In Polyons"), self.tr("Vector layer is not valid"))
|
||||||
|
|
||||||
def getFieldList(self, vlayer):
|
def getFieldList(self, vlayer):
|
||||||
fProvider = vlayer.dataProvider()
|
fProvider = vlayer.dataProvider()
|
||||||
|
@ -45,7 +45,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.setWindowTitle("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))
|
||||||
self.yMin.setValidator(QDoubleValidator(self.yMin))
|
self.yMin.setValidator(QDoubleValidator(self.yMin))
|
||||||
@ -78,9 +78,9 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
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, "Vector grid", "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() == "":
|
||||||
QMessageBox.information(self, "Vector grid", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Vector grid"), self.tr("Please specify output shapefile"))
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
boundBox = QgsRectangle(
|
boundBox = QgsRectangle(
|
||||||
@ -89,19 +89,14 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
float( self.xMax.text() ),
|
float( self.xMax.text() ),
|
||||||
float( self.yMax.text() ) )
|
float( self.yMax.text() ) )
|
||||||
except:
|
except:
|
||||||
QMessageBox.information(self, "Vector grid", "Invalid extent coordinates entered")
|
QMessageBox.information(self, self.tr("Vector grid"), self.tr("Invalid extent coordinates entered"))
|
||||||
xSpace = self.spnX.value()
|
xSpace = self.spnX.value()
|
||||||
ySpace = self.spnY.value()
|
ySpace = self.spnY.value()
|
||||||
if self.rdoPolygons.isChecked(): polygon = True
|
if self.rdoPolygons.isChecked(): polygon = True
|
||||||
else: polygon = False
|
else: polygon = False
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
self.compute( boundBox, xSpace, ySpace, polygon )
|
self.compute( boundBox, xSpace, ySpace, polygon )
|
||||||
addToTOC = QMessageBox.question(self,
|
addToTOC = QMessageBox.question(self, self.tr("Generate Vector Grid"), self.tr("Created output shapefile:\n%1\n\nNote: Layer has no associated coordinate system, please use the Projection Management Tool to specify spatial reference system.\n\nWould you like to add the new layer to the TOC?").arg(unicode(self.shapefileName)), QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
||||||
"Generate Vector Grid", "Created output Shapefile:\n" + self.shapefileName
|
|
||||||
+ "\nNote: Layer has no associated coordinate system, please use "
|
|
||||||
+ "the Projection Management Tool to specify spatial reference system."
|
|
||||||
+ "\n\nWould you like to add the new layer to the TOC?",
|
|
||||||
QMessageBox.Yes, QMessageBox.No, QMessageBox.NoButton)
|
|
||||||
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 )
|
||||||
|
@ -42,7 +42,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)
|
||||||
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
QObject.connect(self.inShape, SIGNAL("currentIndexChanged(QString)"), self.update)
|
||||||
self.setWindowTitle("Split vector layer")
|
self.setWindowTitle(self.tr("Split vector layer"))
|
||||||
# populate layer list
|
# populate layer list
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
mapCanvas = self.iface.mapCanvas()
|
mapCanvas = self.iface.mapCanvas()
|
||||||
@ -60,9 +60,9 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information(self, "Vector Split", "No input shapefile specified")
|
QMessageBox.information(self, self.tr("Vector Split"), self.tr("No input shapefile specified"))
|
||||||
elif self.outShape.text() == "":
|
elif self.outShape.text() == "":
|
||||||
QMessageBox.information(self, "Vector Split", "Please specify output shapefile")
|
QMessageBox.information(self, self.tr("Vector Split"), self.tr("Please specify output shapefile"))
|
||||||
else:
|
else:
|
||||||
inField = self.inField.currentText()
|
inField = self.inField.currentText()
|
||||||
inLayer = self.getVectorLayerByName(unicode(self.inShape.currentText()))
|
inLayer = self.getVectorLayerByName(unicode(self.inShape.currentText()))
|
||||||
@ -76,7 +76,7 @@ class Dialog(QDialog, Ui_Dialog):
|
|||||||
self.split(inLayer, unicode(outPath), unicode(inField), self.progressBar)
|
self.split(inLayer, unicode(outPath), unicode(inField), self.progressBar)
|
||||||
self.progressBar.setValue(100)
|
self.progressBar.setValue(100)
|
||||||
self.outShape.clear()
|
self.outShape.clear()
|
||||||
QMessageBox.information(self, "Vector Split", "Created output shapefiles in folder:\n" + unicode(outPath))
|
QMessageBox.information(self, self.tr("Vector Split"), self.tr("Created output shapefiles in folder:\n%1").arg( outPath))
|
||||||
self.progressBar.setValue(0)
|
self.progressBar.setValue(0)
|
||||||
|
|
||||||
def outFile(self):
|
def outFile(self):
|
||||||
|
@ -56,9 +56,9 @@ class VisualDialog( QDialog, Ui_Dialog ):
|
|||||||
|
|
||||||
def accept( self ):
|
def accept( self ):
|
||||||
if self.inShape.currentText() == "":
|
if self.inShape.currentText() == "":
|
||||||
QMessageBox.information( self, "Error!", self.tr( "Please specify input vector layer" ) )
|
QMessageBox.information( self, self.tr("Error!"), self.tr( "Please specify input vector layer" ) )
|
||||||
elif self.cmbField.isVisible() and self.cmbField.currentText() == "":
|
elif self.cmbField.isVisible() and self.cmbField.currentText() == "":
|
||||||
QMessageBox.information( self, "Error!", self.tr( "Please specify input field" ) )
|
QMessageBox.information( self, self.tr("Error!"), self.tr( "Please specify input field" ) )
|
||||||
else:
|
else:
|
||||||
self.visual( self.inShape.currentText(), self.cmbField.currentText(), self.useSelected.checkState() )
|
self.visual( self.inShape.currentText(), self.cmbField.currentText(), self.useSelected.checkState() )
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ class VisualDialog( QDialog, Ui_Dialog ):
|
|||||||
QObject.connect( self.testThread, SIGNAL( "runRange(PyQt_PyObject)" ), self.runRangeFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runRange(PyQt_PyObject)" ), self.runRangeFromThread )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runPartRange(PyQt_PyObject)" ), self.runPartRangeFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runPartRange(PyQt_PyObject)" ), self.runPartRangeFromThread )
|
||||||
QObject.connect( self.testThread, SIGNAL( "runPartStatus(PyQt_PyObject)" ), self.runPartStatusFromThread )
|
QObject.connect( self.testThread, SIGNAL( "runPartStatus(PyQt_PyObject)" ), self.runPartStatusFromThread )
|
||||||
self.cancel_close.setText( "Cancel" )
|
self.cancel_close.setText( self.tr("Cancel") )
|
||||||
QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
QObject.connect( self.cancel_close, SIGNAL( "clicked()" ), self.cancelThread )
|
||||||
self.testThread.start()
|
self.testThread.start()
|
||||||
return True
|
return True
|
||||||
@ -142,7 +142,7 @@ class VisualDialog( QDialog, Ui_Dialog ):
|
|||||||
self.tblUnique.setItem( rec, 0, item )
|
self.tblUnique.setItem( rec, 0, item )
|
||||||
item = QTableWidgetItem( tmp[ 1 ] )
|
item = QTableWidgetItem( tmp[ 1 ] )
|
||||||
self.tblUnique.setItem( rec, 1, item )
|
self.tblUnique.setItem( rec, 1, item )
|
||||||
self.tblUnique.setHorizontalHeaderLabels( [ "Parameter", "Value" ] )
|
self.tblUnique.setHorizontalHeaderLabels( [ self.tr("Parameter"), self.tr("Value") ] )
|
||||||
self.tblUnique.horizontalHeader().setResizeMode( 1, QHeaderView.ResizeToContents )
|
self.tblUnique.horizontalHeader().setResizeMode( 1, QHeaderView.ResizeToContents )
|
||||||
self.tblUnique.horizontalHeader().show()
|
self.tblUnique.horizontalHeader().show()
|
||||||
self.tblUnique.horizontalHeader().setResizeMode( 0, QHeaderView.Stretch )
|
self.tblUnique.horizontalHeader().setResizeMode( 0, QHeaderView.Stretch )
|
||||||
|
Loading…
x
Reference in New Issue
Block a user