def __init__(self, parent, iface, pluginBase, pluginName, pluginCommand): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) self.iface = iface self.process = QProcess(self) Utils.setProcessEnvironment(self.process) self.connect(self.process, SIGNAL("error(QProcess::ProcessError)"), self.processError) self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"), self.processFinished) self.setupUi(self) self.arguments = [] self.editCmdBtn.setIcon(QIcon(":/icons/edit.png")) self.connect(self.editCmdBtn, SIGNAL("toggled(bool)"), self.editCommand) self.resetCmdBtn.setIcon(QIcon(":/icons/reset.png")) self.connect(self.resetCmdBtn, SIGNAL("clicked()"), self.resetCommand) self.editCommand(False) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept) self.connect(self.buttonBox, SIGNAL("helpRequested()"), self.help) self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True) self.plugin = pluginBase self.connect(self.plugin, SIGNAL("valuesChanged(PyQt_PyObject)"), self.refreshArgs) self.pluginLayout.addWidget(self.plugin) self.plugin.setFocus() self.setWindowTitle(pluginName) self.setPluginCommand(pluginCommand)
def __init__(self, parent, iface, pluginBase, pluginName, pluginCommand): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) self.iface = iface self.process = QProcess(self) Utils.setProcessEnvironment(self.process) self.connect(self.process, SIGNAL("error(QProcess::ProcessError)"), self.processError) self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"), self.processFinished) self.setupUi(self) self.arguments = QStringList() self.editCmdBtn.setIcon( QIcon(":/icons/edit.png") ) self.connect(self.editCmdBtn, SIGNAL("toggled(bool)"), self.editCommand) self.resetCmdBtn.setIcon( QIcon(":/icons/reset.png") ) self.connect(self.resetCmdBtn, SIGNAL("clicked()"), self.resetCommand) self.editCommand( False ) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept) self.connect(self.buttonBox, SIGNAL("helpRequested()"), self.help) self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True) self.plugin = pluginBase self.connect(self.plugin, SIGNAL("valuesChanged(const QStringList &)"), self.refreshArgs) self.pluginLayout.addWidget(self.plugin) self.plugin.setFocus() self.setWindowTitle(pluginName) self.setPluginCommand(pluginCommand)
def __init__(self, iface): QDialog.__init__(self, iface.mainWindow()) self.setAttribute(Qt.WA_DeleteOnClose) self.iface = iface self.setupUi(self) # binaries self.leGdalBinPath.setText(Utils.getGdalBinPath()) QObject.connect(self.btnSetBinPath, SIGNAL("clicked()"), self.setBinPath) self.bin_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png')) self.bin_tooltip_label.setToolTip( self.tr( u"""\ A list of colon-separated (Linux and MacOS) or semicolon-separated (Windows) paths to both binaries and python executables. MacOS users usually need to set it to something like /Library/Frameworks/GDAL.framework/Versions/1.8/Programs""") ) # python modules self.leGdalPymodPath.setText(Utils.getGdalPymodPath()) QObject.connect(self.btnSetPymodPath, SIGNAL("clicked()"), self.setPymodPath) self.pymod_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png')) self.pymod_tooltip_label.setToolTip( self.tr( u"""\ A list of colon-separated (Linux and MacOS) or semicolon-separated (Windows) paths to python modules.""") ) # help self.leGdalHelpPath.setText(Utils.getHelpPath()) QObject.connect(self.btnSetHelpPath, SIGNAL("clicked()"), self.setHelpPath) self.help_tooltip_label.setPixmap(QPixmap(':/icons/tooltip.png')) self.help_tooltip_label.setToolTip( self.tr( u"""\ Useful to open local GDAL documentation instead of online help when pressing on the tool dialog's Help button.""") )
def __init__( self, iface ): QDialog.__init__( self, iface.mainWindow() ) self.iface = iface self.setupUi( self ) self.leGdalBinPath.setText( Utils.getGdalPath() ) self.leGdalHelpPath.setText( Utils.getHelpPath() ) QObject.connect( self.btnSetBinPath, SIGNAL( "clicked()" ), self.setBinPath ) QObject.connect( self.btnSetHelpPath, SIGNAL( "clicked()" ), self.setHelpPath )
def __init__(self, iface): QDialog.__init__(self, iface.mainWindow()) self.setAttribute(Qt.WA_DeleteOnClose) self.iface = iface self.setupUi(self) self.leGdalBinPath.setText(Utils.getGdalPath()) self.leGdalHelpPath.setText(Utils.getHelpPath()) QObject.connect(self.btnSetBinPath, SIGNAL("clicked()"), self.setBinPath) QObject.connect(self.btnSetHelpPath, SIGNAL("clicked()"), self.setHelpPath)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.canvas = self.iface.mapCanvas() self.expand_method = ( 'gray', 'rgb', 'rgba' ) self.setupUi(self) BaseBatchWidget.__init__(self, self.iface, "gdal_translate") self.outSelector.setType( self.outSelector.FILE ) # set the default QSpinBoxes and QProgressBar value self.outsizeSpin.setValue(25) self.progressBar.setValue(0) self.progressBar.hide() self.formatLabel.hide() self.formatCombo.hide() if Utils.Version( Utils.GdalConfig.version() ) < "1.7": index = self.expandCombo.findText('gray', Qt.MatchFixedString) if index >= 0: self.expandCombo.removeItem(index) self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.targetSRSEdit, SIGNAL("textChanged(const QString &)"), self.targetSRSCheck), (self.selectTargetSRSButton, None, self.targetSRSCheck), (self.creationOptionsTable, [SIGNAL("cellValueChanged(int, int)"), SIGNAL("rowRemoved()")], self.creationGroupBox), (self.outsizeSpin, SIGNAL("valueChanged(const QString &)"), self.outsizeCheck), (self.nodataSpin, SIGNAL("valueChanged(int)"), self.nodataCheck), (self.expandCombo, SIGNAL("currentIndexChanged(int)"), self.expandCheck, "1.6.0"), (self.sdsCheck, SIGNAL("stateChanged(int)")), (self.srcwinEdit, SIGNAL("textChanged(const QString &)"), self.srcwinCheck), (self.prjwinEdit, SIGNAL("textChanged(const QString &)"), self.prjwinCheck) ] ) #self.connect(self.canvas, SIGNAL("layersChanged()"), self.fillInputLayerCombo) self.connect(self.inSelector, SIGNAL("layerChanged()"), self.fillTargetSRSEditDefault) self.connect( self.inSelector, SIGNAL( "selectClicked()" ), self.fillInputFile ) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.selectTargetSRSButton, SIGNAL("clicked()"), self.fillTargetSRSEdit) self.connect( self.batchCheck, SIGNAL( "stateChanged( int )" ), self.switchToolMode ) # add raster filters to combo self.formatCombo.addItems( Utils.FileFilter.allRastersFilter().split( ";;" ) )
def fillInputDir( self ): inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select the input directory with files to Warp" )) if inputDir.isEmpty(): return self.inSelector.setFilename( inputDir ) filter = Utils.getRasterExtensions() workDir = QDir( inputDir ) workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot ) workDir.setNameFilters( filter ) if workDir.entryList().count() > 0: fl = inputDir + "/" + workDir.entryList()[ 0 ] self.sourceSRSEdit.setText( Utils.getRasterSRS( self, fl ) )
def fillInputDir( self ): inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select the input directory with files to Translate" )) if inputDir.isEmpty(): return self.inputLayerCombo.setCurrentIndex(-1) self.inputLayerCombo.setEditText( inputDir ) filter = Utils.getRasterExtensions() workDir = QDir( inputDir ) workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot ) workDir.setNameFilters( filter ) if workDir.entryList().count() > 0: fl = inputDir + "/" + workDir.entryList()[ 0 ] self.targetSRSEdit.setText( Utils.getRasterSRS( self, fl ) )
def getExtent( self ): files = self.getInputFileName() i = 0 res = rect2 = None for fileName in files: if res == None: res = Utils.getRasterExtent( self, fileName ) continue rect2 = Utils.getRasterExtent( self, fileName ) if rect2 == None: continue res = res.intersect( rect2 ) return res
def getExtent(self): files = self.getInputFileName() i = 0 res = rect2 = None for fileName in files: if res == None: res = Utils.getRasterExtent(self, fileName) continue rect2 = Utils.getRasterExtent(self, fileName) if rect2 == None: continue res = res.intersect(rect2) return res
def getArguments(self): arguments = [] if self.resolutionCheck.isChecked( ) and self.resolutionComboBox.currentIndex() >= 0: arguments.append("-resolution") arguments.append( self.resolutions[self.resolutionComboBox.currentIndex()]) if self.separateCheck.isChecked(): arguments.append("-separate") if self.srcNoDataCheck.isChecked(): nodata = self.noDataEdit.text().strip() if nodata: arguments.append("-srcnodata") arguments.append(nodata) if self.targetSRSCheck.isChecked() and self.targetSRSEdit.text(): arguments.append("-a_srs") arguments.append(self.targetSRSEdit.text()) if self.allowProjDiffCheck.isChecked(): arguments.append("-allow_projection_difference") arguments.append(self.getOutputFileName()) if self.inputSelLayersCheck.isChecked(): arguments.extend(self.visibleRasterLayers) elif self.inputDirCheck.isChecked(): arguments.extend( Utils.getRasterFiles(self.getInputFileName(), self.recurseCheck.isChecked())) else: arguments.extend(self.getInputFileName()) return arguments
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BaseBatchWidget.__init__(self, self.iface, "pct2rgb.py") # we use one widget for two tools self.base.setWindowTitle( self.tr( "Convert paletted image to RGB" ) ) self.outSelector.setType( self.outSelector.FILE ) # set the default QSpinBoxes and QProgressBar value self.bandSpin.setValue(1) self.progressBar.setValue(0) self.progressBar.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.colorsSpin, SIGNAL("valueChanged(int)"), self.colorsCheck, "-1"), # hide this option (self.bandSpin, SIGNAL("valueChanged(int)"), self.bandCheck) ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFile) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect( self.batchCheck, SIGNAL( "stateChanged( int )" ), self.switchToolMode )
def getIntersectedExtent(self, files): res = None for fileName in files: if res == None: res = Utils.getRasterExtent(self, fileName) continue rect2 = Utils.getRasterExtent(self, fileName) if rect2 == None: continue res = res.intersect(rect2) if res.isEmpty(): break return res
def getArgsModeMask(self): self.base.setPluginCommand("gdalwarp") inputFn = self.getInputFileName() arguments = [] if self.noDataCheck.isChecked(): arguments.append("-dstnodata") arguments.append(unicode(self.noDataSpin.value())) if self.maskModeRadio.isChecked(): mask = self.maskSelector.filename() if not mask == '' and not inputFn == '': arguments.append("-q") arguments.append("-cutline") arguments.append(mask) if Utils.GdalConfig.versionNum() >= 1800: if self.cropToCutlineCheck.isChecked(): arguments.append("-crop_to_cutline") if self.alphaBandCheck.isChecked(): arguments.append("-dstalpha") if self.keepResolutionRadio.isChecked(): resolution = Utils.getRasterResolution(inputFn) if resolution is not None: arguments.append("-tr") arguments.append(resolution[0]) arguments.append(resolution[1]) else: arguments.append("-tr") arguments.append(unicode(self.xRes.value())) arguments.append(unicode(self.yRes.value())) outputFn = self.getOutputFileName() if not outputFn == '': arguments.append("-of") arguments.append(self.outputFormat) arguments.append(inputFn) arguments.append(outputFn) return arguments
def __init__( self, iface ): QWidget.__init__( self ) self.iface = iface self.setupUi( self ) BaseBatchWidget.__init__( self, self.iface, "gdal_fillnodata.py" ) self.inSelector.setType( self.inSelector.FILE_LAYER ) self.outSelector.setType( self.outSelector.FILE ) self.maskSelector.setType( self.maskSelector.FILE ) self.progressBar.setValue(0) self.progressBar.hide() self.formatLabel.hide() self.formatCombo.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ ( self.inSelector, SIGNAL( "filenameChanged()" ) ), ( self.outSelector, SIGNAL( "filenameChanged()" ) ), ( self.maskSelector, SIGNAL( "filenameChanged()" ), self.maskCheck ), ( self.distanceSpin, SIGNAL( "valueChanged( int )" ), self.distanceCheck ), ( self.smoothSpin, SIGNAL( "valueChanged( int )" ), self.smoothCheck ), ( self.bandSpin, SIGNAL( "valueChanged( int )" ), self.bandCheck ), ( self.nomaskCheck, SIGNAL( "stateChanged( int )" ) ) ]) self.connect( self.inSelector, SIGNAL( "selectClicked()" ), self.fillInputFile ) self.connect( self.outSelector, SIGNAL( "selectClicked()" ), self.fillOutputFile) self.connect( self.maskSelector, SIGNAL( "selectClicked()" ), self.fillMaskFile) self.connect( self.batchCheck, SIGNAL( "stateChanged( int )" ), self.switchToolMode ) # add raster filters to combo self.formatCombo.addItems( Utils.FileFilter.allRastersFilter().split( ";;" ) )
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_proximity.py") self.outSelector.setType(self.outSelector.FILE) self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.valuesEdit, SIGNAL("textChanged(const QString &)"), self.valuesCheck), (self.distUnitsCombo, SIGNAL("currentIndexChanged(int)"), self.distUnitsCheck), (self.maxDistSpin, SIGNAL("valueChanged(int)"), self.maxDistCheck), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck), (self.fixedBufValSpin, SIGNAL("valueChanged(int)"), self.fixedBufValCheck) ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit)
def refreshArgs(self, args): self.arguments = args if not self.textEditCommand.isEnabled(): self.textEditCommand.setText(self.command) else: self.textEditCommand.setText(self.command + " " + Utils.escapeAndJoin(self.arguments))
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.canvas = self.iface.mapCanvas() self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_translate") self.outSelector.setType( self.outSelector.FILE ) self.extentSelector.setCanvas(self.canvas) self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()") ), (self.outSelector, SIGNAL("filenameChanged()") ), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck, 1700), (self.maskSelector, SIGNAL("filenameChanged()"), self.maskModeRadio, 1600), (self.alphaBandCheck, SIGNAL( "stateChanged( int )") ), (self.extentSelector, [SIGNAL("selectionStarted()"), SIGNAL("newExtentDefined()")], self.extentModeRadio), (self.modeStackedWidget, SIGNAL("currentIndexChanged(int)")) ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.maskSelector, SIGNAL("selectClicked()"), self.fillMaskFileEdit) self.connect(self.extentSelector, SIGNAL("newExtentDefined()"), self.extentChanged) self.connect(self.extentSelector, SIGNAL("selectionStarted()"), self.checkRun) self.connect(self.extentModeRadio, SIGNAL("toggled(bool)"), self.switchClippingMode)
def getArguments(self): arguments = [] maskFile = self.maskSelector.filename() if self.distanceCheck.isChecked() and self.distanceSpin.value() != 0: arguments.append( "-md") arguments.append( self.distanceSpin.text()) if self.smoothCheck.isChecked() and self.smoothSpin.value() != 0: arguments.append( "-si") arguments.append( unicode( self.smoothSpin.value() )) if self.bandCheck.isChecked() and self.bandSpin.value() != 0: arguments.append( "-b") arguments.append( unicode( self.bandSpin.value() )) if self.maskCheck.isChecked() and maskFile: arguments.append( "-mask") arguments.append( maskFile) if self.nomaskCheck.isChecked(): arguments.append( "-nomask") if self.isBatchEnabled(): if self.formatCombo.currentIndex() != 0: arguments.append( "-of") arguments.append( Utils.fillRasterOutputFormat( self.formatCombo.currentText() )) return arguments else: outputFn = self.getOutputFileName() if outputFn: arguments.append( "-of") arguments.append( self.outputFormat) arguments.append( self.getInputFileName()) arguments.append( outputFn) return arguments
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.canvas = self.iface.mapCanvas() self.clipper = ClipperSelector(self.canvas) self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_merge.py", None, self.iface.mainWindow()) self.outputFormat = Utils.fillRasterOutputFormat() self.inputFiles = QStringList() self.warningDialog = QErrorMessage(self) self.setParamsStatus( [ (self.outputFileEdit, SIGNAL("textChanged(const QString &)")), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck), (self.pctCheck, SIGNAL("stateChanged(int)")) ] ) self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit) self.connect(self.clipper, SIGNAL("clippingRectangleCreated()"), self.fillCoords) self.connect(self.x1CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged) self.connect(self.x2CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged) self.connect(self.y1CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged) self.connect(self.y2CoordEdit, SIGNAL("textChanged(const QString &)"), self.coordsChanged) self.connect(self.clipper, SIGNAL("deactivated()"), self.pauseClipping) self.connect(self.btnEnableClip, SIGNAL("clicked()"), self.startClipping)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BaseBatchWidget.__init__(self, self.iface, "pct2rgb.py") # we use one widget for two tools self.base.setWindowTitle(self.tr("Convert paletted image to RGB")) self.outSelector.setType(self.outSelector.FILE) # set the default QSpinBoxes and QProgressBar value self.bandSpin.setValue(1) self.progressBar.setValue(0) self.progressBar.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.colorsSpin, SIGNAL("valueChanged(int)"), self.colorsCheck, "-1"), # hide this option (self.bandSpin, SIGNAL("valueChanged(int)"), self.bandCheck) ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFile) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.batchCheck, SIGNAL("stateChanged( int )"), self.switchToolMode)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BaseBatchWidget.__init__(self, self.iface, "rgb2pct.py") # set the default QSpinBoxes and QProgressBar value self.colorsSpin.setValue(2) self.progressBar.setValue(0) self.progressBar.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus( [ (self.inputLayerCombo, [ SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)") ] ), (self.outputFileEdit, SIGNAL("textChanged(const QString &)")), (self.colorsSpin, SIGNAL("valueChanged(int)"), self.colorsCheck), ] ) self.connect(self.selectInputFileButton, SIGNAL("clicked()"), self.fillInputFile) self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit) self.connect( self.batchCheck, SIGNAL( "stateChanged( int )" ), self.switchToolMode ) self.fillInputLayerCombo()
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_proximity.py") self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus( [ (self.inputLayerCombo, [SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)")] ), (self.outputFileEdit, SIGNAL("textChanged(const QString &)")), (self.valuesEdit, SIGNAL("textChanged(const QString &)"), self.valuesCheck), (self.distUnitsCombo, SIGNAL("currentIndexChanged(int)"), self.distUnitsCheck), (self.maxDistSpin, SIGNAL("valueChanged(int)"), self.maxDistCheck), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck), (self.fixedBufValSpin, SIGNAL("valueChanged(int)"), self.fixedBufValCheck) ] ) self.connect(self.selectInputFileButton, SIGNAL("clicked()"), self.fillInputFileEdit) self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit) # fill layers combo self.fillInputLayerCombo()
def getArguments(self): arguments = QStringList() maskFile = self.maskSelector.filename() if self.distanceCheck.isChecked() and self.distanceSpin.value() != 0: arguments << "-md" arguments << self.distanceSpin.text() if self.smoothCheck.isChecked() and self.smoothSpin.value() != 0: arguments << "-si" arguments << str( self.smoothSpin.value() ) if self.bandCheck.isChecked() and self.bandSpin.value() != 0: arguments << "-b" arguments << str( self.bandSpin.value() ) if self.maskCheck.isChecked() and not maskFile.isEmpty(): arguments << "-mask" arguments << maskFile if self.nomaskCheck.isChecked(): arguments << "-nomask" if self.isBatchEnabled(): if self.formatCombo.currentIndex() != 0: arguments << "-of" arguments << Utils.fillRasterOutputFormat( self.formatCombo.currentText() ) return arguments else: outputFn = self.getOutputFileName() if not outputFn.isEmpty(): arguments << "-of" arguments << self.outputFormat arguments << self.getInputFileName() arguments << outputFn return arguments
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BaseBatchWidget.__init__(self, self.iface, "pct2rgb.py") # we use one widget for two tools, so change control labels self.base.setWindowTitle( self.tr( "Convert paletted image to RGB" ) ) self.colorsCheck.setText( self.tr( "Band to convert:" ) ) self.colorsSpin.setRange( 1, 256 ) self.colorsSpin.setValue( 1 ) self.progressBar.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus( [ (self.inputLayerCombo, [ SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)") ] ), (self.outputFileEdit, SIGNAL("textChanged(const QString &)")), (self.colorsSpin, SIGNAL("valueChanged(int)"), self.colorsCheck), ] ) self.connect(self.selectInputFileButton, SIGNAL("clicked()"), self.fillInputFile) self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit) self.connect( self.batchCheck, SIGNAL( "stateChanged( int )" ), self.switchToolMode ) self.fillInputLayerCombo()
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_merge.py") self.inSelector.setType(self.inSelector.FILE) self.outSelector.setType(self.outSelector.FILE) self.recurseCheck.hide() # use this for approx. previous UI #self.creationOptionsWidget.setType(QgsRasterFormatSaveOptionsWidget.Table) self.outputFormat = Utils.fillRasterOutputFormat() self.extent = None self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck), (self.inputDirCheck, SIGNAL("stateChanged(int)")), (self.recurseCheck, SIGNAL("stateChanged(int)"), self.inputDirCheck), (self.separateCheck, SIGNAL("stateChanged( int )")), (self.pctCheck, SIGNAL("stateChanged( int )")), (self.intersectCheck, SIGNAL("stateChanged( int )")), (self.creationOptionsWidget, SIGNAL("optionsChanged()")), (self.creationOptionsGroupBox, SIGNAL("toggled(bool)")) ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFilesEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.intersectCheck, SIGNAL("toggled(bool)"), self.refreshExtent) self.connect(self.inputDirCheck, SIGNAL("stateChanged( int )"), self.switchToolMode) self.connect(self.inSelector, SIGNAL("filenameChanged()"), self.refreshExtent)
def refreshArgs(self, args): self.arguments = [unicode(a) for a in args] if not self.commandIsEnabled(): self.textEditCommand.setPlainText(self.command) else: self.textEditCommand.setPlainText(self.command + " " + Utils.escapeAndJoin(self.arguments))
def batchRun(self): exts = self.formatCombo.currentText().remove(QRegExp('^.*\(')).remove( QRegExp('\).*$')).split(" ") if not exts.isEmpty() and exts != "*" and exts != "*.*": outExt = exts[0].remove("*") else: outExt = ".tif" self.base.enableRun(False) self.base.setCursor(Qt.WaitCursor) inDir = self.getInputFileName() outDir = self.getOutputFileName() extensions = Utils.getRasterExtensions() workDir = QDir(inDir) workDir.setFilter(QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot) workDir.setNameFilters(extensions) files = workDir.entryList() self.inFiles = [] self.outFiles = [] for f in files: self.inFiles.append(inDir + "/" + f) if outDir != None: outFile = f.replace(QRegExp("\.[a-zA-Z0-9]{2,4}"), outExt) self.outFiles.append(outDir + "/" + outFile) self.errors = QStringList() self.batchIndex = 0 self.batchTotal = len(self.inFiles) self.setProgressRange(self.batchTotal) self.runItem(self.batchIndex, self.batchTotal)
def onHelp(self): helpPath = Utils.getHelpPath() if helpPath.isEmpty(): url = QUrl("http://www.gdal.org/" + self.helpFileName) else: url = QUrl.fromLocalFile(helpPath + '/' + self.helpFileName) QDesktopServices.openUrl(url)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_rasterize") self.outSelector.setType( self.outSelector.FILE ) # set the default QSpinBoxes and QProgressBar value self.widthSpin.setValue(3000) self.heightSpin.setValue(3000) self.lastEncoding = Utils.getLastUsedEncoding() self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.attributeComboBox, SIGNAL("currentIndexChanged(int)")), ( [self.widthSpin, self.heightSpin], SIGNAL( "valueChanged(int)" ), self.resizeGroupBox, "1.8.0" ), ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.inSelector, SIGNAL("layerChanged()"), self.fillFieldsCombo)
def loadFields(self, vectorFile = QString()): if vectorFile == None: return try: (fields, names) = Utils.getVectorFields(vectorFile) except Exception, e: QErrorMessage(self).showMessage( str(e) )
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BaseBatchWidget.__init__(self, self.iface, "rgb2pct.py") self.outSelector.setType(self.outSelector.FILE) # set the default QSpinBoxes and QProgressBar value self.colorsSpin.setValue(2) self.progressBar.setValue(0) self.progressBar.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.colorsSpin, SIGNAL("valueChanged(int)"), self.colorsCheck), (self.bandSpin, SIGNAL("valueChanged(int)"), self.bandCheck, "-1" ) # hide this option ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFile) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.batchCheck, SIGNAL("stateChanged( int )"), self.switchToolMode)
def getArguments(self): arguments = QStringList() maskFile = self.maskSelector.filename() if self.distanceCheck.isChecked() and self.distanceSpin.value() != 0: arguments << "-md" arguments << self.distanceSpin.text() if self.smoothCheck.isChecked() and self.smoothSpin.value() != 0: arguments << "-si" arguments << str(self.smoothSpin.value()) if self.bandCheck.isChecked() and self.bandSpin.value() != 0: arguments << "-b" arguments << str(self.bandSpin.value()) if self.maskCheck.isChecked() and not maskFile.isEmpty(): arguments << "-mask" arguments << maskFile if self.nomaskCheck.isChecked(): arguments << "-nomask" if self.isBatchEnabled(): if self.formatCombo.currentIndex() != 0: arguments << "-of" arguments << Utils.fillRasterOutputFormat( self.formatCombo.currentText()) return arguments else: outputFn = self.getOutputFileName() if not outputFn.isEmpty(): arguments << "-of" arguments << self.outputFormat arguments << self.getInputFileName() arguments << outputFn return arguments
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.resolutions = ("highest", "average", "lowest") self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_polygonize.py") self.outSelector.setType(self.outSelector.FILE) self.outputFormat = Utils.fillVectorOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.maskSelector, SIGNAL("filenameChanged()"), self.maskCheck), (self.fieldEdit, SIGNAL("textChanged(const QString &)"), self.fieldCheck) ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.maskSelector, SIGNAL("selectClicked()"), self.fillMaskFileEdit)
def accept(self): self.inFiles = None if self.batchCheck.isChecked(): self.inFiles = Utils.getRasterFiles(self.inSelector.filename(), self.recurseCheck.isChecked()) else: self.inFiles = [self.inSelector.filename()] self.progressBar.setRange(0, len(self.inFiles)) QApplication.setOverrideCursor(QCursor(Qt.WaitCursor)) self.okButton.setEnabled(False) self.extractor = ExtractThread(self.inFiles, self.prjCheck.isChecked()) QObject.connect(self.extractor, SIGNAL("fileProcessed()"), self.updateProgress) QObject.connect(self.extractor, SIGNAL("processFinished()"), self.processingFinished) QObject.connect(self.extractor, SIGNAL("processInterrupted()"), self.processingInterrupted) QObject.disconnect(self.buttonBox, SIGNAL("rejected()"), self.reject) QObject.connect(self.buttonBox, SIGNAL("rejected()"), self.stopProcessing) self.extractor.start()
def getArguments(self): arguments = [] maskFile = self.maskSelector.filename() if self.distanceCheck.isChecked() and self.distanceSpin.value() != 0: arguments.append( "-md") arguments.append( self.distanceSpin.text()) if self.smoothCheck.isChecked() and self.smoothSpin.value() != 0: arguments.append( "-si") arguments.append( str( self.smoothSpin.value() )) if self.bandCheck.isChecked() and self.bandSpin.value() != 0: arguments.append( "-b") arguments.append( str( self.bandSpin.value() )) if self.maskCheck.isChecked() and maskFile: arguments.append( "-mask") arguments.append( maskFile) if self.nomaskCheck.isChecked(): arguments.append( "-nomask") if self.isBatchEnabled(): if self.formatCombo.currentIndex() != 0: arguments.append( "-of") arguments.append( Utils.fillRasterOutputFormat( self.formatCombo.currentText() )) return arguments else: outputFn = self.getOutputFileName() if outputFn: arguments.append( "-of") arguments.append( self.outputFormat) arguments.append( self.getInputFileName()) arguments.append( outputFn) return arguments
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_merge.py") self.inSelector.setType( self.inSelector.FILE ) self.outSelector.setType( self.outSelector.FILE ) self.outputFormat = Utils.fillRasterOutputFormat() self.extent = None self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck), ( self.separateCheck, SIGNAL( "stateChanged( int )" ) ), ( self.pctCheck, SIGNAL( "stateChanged( int )" ) ), ( self.intersectCheck, SIGNAL( "stateChanged( int )" ) ), (self.creationOptionsTable, [SIGNAL("cellValueChanged(int, int)"), SIGNAL("rowRemoved()")], self.creationGroupBox) ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFilesEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.intersectCheck, SIGNAL("stateChanged(int)"), self.refreshExtent)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_merge.py") self.inSelector.setType( self.inSelector.FILE ) self.outSelector.setType( self.outSelector.FILE ) self.recurseCheck.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.extent = None self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck), (self.inputDirCheck, SIGNAL("stateChanged(int)")), (self.recurseCheck, SIGNAL("stateChanged(int)"), self.inputDirCheck), ( self.separateCheck, SIGNAL( "stateChanged( int )" ) ), ( self.pctCheck, SIGNAL( "stateChanged( int )" ) ), ( self.intersectCheck, SIGNAL( "stateChanged( int )" ) ), (self.creationOptionsTable, [SIGNAL("cellValueChanged(int, int)"), SIGNAL("rowRemoved()")], self.creationGroupBox) ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFilesEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.intersectCheck, SIGNAL("toggled(bool)"), self.refreshExtent) self.connect(self.inputDirCheck, SIGNAL("stateChanged( int )"), self.switchToolMode) self.connect(self.inSelector, SIGNAL("filenameChanged()"), self.refreshExtent)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_merge.py") self.inSelector.setType( self.inSelector.FILE ) self.outSelector.setType( self.outSelector.FILE ) self.recurseCheck.hide() # use this for approx. previous UI #self.creationOptionsTable.setType(QgsRasterFormatSaveOptionsWidget.Table) self.outputFormat = Utils.fillRasterOutputFormat() self.extent = None self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck), (self.inputDirCheck, SIGNAL("stateChanged(int)")), (self.recurseCheck, SIGNAL("stateChanged(int)"), self.inputDirCheck), ( self.separateCheck, SIGNAL( "stateChanged( int )" ) ), ( self.pctCheck, SIGNAL( "stateChanged( int )" ) ), ( self.intersectCheck, SIGNAL( "stateChanged( int )" ) ) ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFilesEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.intersectCheck, SIGNAL("toggled(bool)"), self.refreshExtent) self.connect(self.inputDirCheck, SIGNAL("stateChanged( int )"), self.switchToolMode) self.connect(self.inSelector, SIGNAL("filenameChanged()"), self.refreshExtent)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.canvas = self.iface.mapCanvas() self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_merge.py", None, self.iface.mainWindow()) self.extentSelector.setCanvas(self.canvas) self.outputFormat = Utils.fillRasterOutputFormat() self.inputFiles = QStringList() self.warningDialog = QErrorMessage(self) self.setParamsStatus( [ (self.outputFileEdit, SIGNAL("textChanged(const QString &)")), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck), (self.pctCheck, SIGNAL("stateChanged(int)")), ( self.extentSelector, [SIGNAL("selectionStarted()"), SIGNAL("newExtentDefined()")] ) ] ) self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit) self.connect(self.extentSelector, SIGNAL("newExtentDefined()"), self.checkRun) self.connect(self.extentSelector, SIGNAL("selectionStarted()"), self.checkRun)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.canvas = self.iface.mapCanvas() self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_translate") self.outSelector.setType( self.outSelector.FILE ) self.extentSelector.setCanvas(self.canvas) self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()") ), (self.outSelector, SIGNAL("filenameChanged()") ), (self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck, "1.7.0"), (self.maskSelector, SIGNAL("filenameChanged()"), self.maskModeRadio, "1.6.0"), (self.alphaBandCheck, SIGNAL( "stateChanged( int )") ), (self.extentSelector, [SIGNAL("selectionStarted()"), SIGNAL("newExtentDefined()")], self.extentModeRadio), (self.modeStackedWidget, SIGNAL("currentIndexChanged(int)")) ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.maskSelector, SIGNAL("selectClicked()"), self.fillMaskFileEdit) self.connect(self.extentSelector, SIGNAL("newExtentDefined()"), self.extentChanged) self.connect(self.extentSelector, SIGNAL("selectionStarted()"), self.checkRun) self.connect(self.extentModeRadio, SIGNAL("toggled(bool)"), self.switchClippingMode)
def getIntersectedExtent(self, files): res = None for fileName in files: if res == None: res = Utils.getRasterExtent( self, fileName ) continue rect2 = Utils.getRasterExtent( self, fileName ) if rect2 == None: continue res = res.intersect( rect2 ) if res.isEmpty(): break return res
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BaseBatchWidget.__init__(self, self.iface, "rgb2pct.py") self.outSelector.setType( self.outSelector.FILE ) # set the default QSpinBoxes and QProgressBar value self.colorsSpin.setValue(2) self.progressBar.setValue(0) self.progressBar.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.colorsSpin, SIGNAL("valueChanged(int)"), self.colorsCheck), (self.bandSpin, SIGNAL("valueChanged(int)"), self.bandCheck, "-1") # hide this option ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFile) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect( self.batchCheck, SIGNAL( "stateChanged( int )" ), self.switchToolMode )
def batchRun(self): exts = self.formatCombo.currentText().remove( QRegExp('^.*\(') ).remove( QRegExp('\).*$') ).split( " " ) if not exts.isEmpty() and exts != "*" and exts != "*.*": outExt = exts[ 0 ].remove( "*" ) else: outExt = ".tif" self.base.enableRun( False ) self.base.setCursor( Qt.WaitCursor ) inDir = self.getInputFileName() outDir = self.getOutputFileName() filter = Utils.getRasterExtensions() workDir = QDir( inDir ) workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot ) workDir.setNameFilters( filter ) files = workDir.entryList() self.inFiles = [] self.outFiles = [] for f in files: self.inFiles.append( inDir + "/" + f ) if outDir != None: outFile = f.replace( QRegExp( "\.[a-zA-Z0-9]{2,4}" ), outExt ) self.outFiles.append( outDir + "/" + outFile ) self.errors = QStringList() self.batchIndex = 0 self.batchTotal = len( self.inFiles ) self.setProgressRange( self.batchTotal ) self.runItem( self.batchIndex, self.batchTotal )
def batchRun(self): exts = re.sub('\).*$', '', re.sub('^.*\(', '', self.formatCombo.currentText())).split(" ") if len(exts) > 0 and exts[0] != "*" and exts[0] != "*.*": outExt = exts[0].replace( "*", "" ) else: outExt = ".tif" self.base.enableRun( False ) self.base.setCursor( Qt.WaitCursor ) inDir = self.getInputFileName() outDir = self.getOutputFileName() filter = Utils.getRasterExtensions() workDir = QDir( inDir ) workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot ) workDir.setNameFilters( filter ) files = workDir.entryList() self.inFiles = [] self.outFiles = [] for f in files: self.inFiles.append( inDir + "/" + f ) if outDir is not None: outFile = re.sub( "\.[a-zA-Z0-9]{2,4}", outExt, f ) self.outFiles.append( outDir + "/" + outFile ) self.errors = [] self.batchIndex = 0 self.batchTotal = len( self.inFiles ) self.setProgressRange( self.batchTotal ) self.runItem( self.batchIndex, self.batchTotal )
def getArguments(self): arguments = [] if self.resolutionCheck.isChecked() and self.resolutionComboBox.currentIndex() >= 0: arguments.append("-resolution") arguments.append(self.resolutions[self.resolutionComboBox.currentIndex()]) if self.separateCheck.isChecked(): arguments.append("-separate") if self.srcNoDataCheck.isChecked(): nodata = self.noDataEdit.text().strip() if nodata: arguments.append("-srcnodata") arguments.append(nodata) if self.targetSRSCheck.isChecked() and self.targetSRSEdit.text(): arguments.append("-a_srs") arguments.append(self.targetSRSEdit.text()) if self.allowProjDiffCheck.isChecked(): arguments.append("-allow_projection_difference") arguments.append(self.getOutputFileName()) if self.inputSelLayersCheck.isChecked(): arguments.extend(self.visibleRasterLayers) elif self.inputDirCheck.isChecked(): arguments.extend(Utils.getRasterFiles(self.getInputFileName(), self.recurseCheck.isChecked())) else: arguments.extend(self.getInputFileName()) return arguments
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_rasterize") self.outSelector.setType( self.outSelector.FILE ) # set the default QSpinBoxes and QProgressBar value self.widthSpin.setValue(3000) self.heightSpin.setValue(3000) self.horizresSpin.setValue(1) self.vertresSpin.setValue(1) self.lastEncoding = Utils.getLastUsedEncoding() self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.attributeComboBox, SIGNAL("currentIndexChanged(int)")), ( [self.widthSpin, self.heightSpin], SIGNAL( "valueChanged(int)" )), ( [self.horizresSpin, self.vertresSpin], SIGNAL( "valueChanged(double)" )) ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.inSelector, SIGNAL("layerChanged()"), self.fillFieldsCombo) self.connect(self.radioSetSize, SIGNAL("toggled(bool)"), self.someValueChanged) self.connect(self.radioSetResolution, SIGNAL("toggled(bool)"), self.someValueChanged)
def onHelp(self): helpPath = Utils.getHelpPath() if helpPath == '': url = QUrl("http://www.gdal.org/" + self.helpFileName) else: url = QUrl.fromLocalFile(helpPath + '/' + self.helpFileName) QDesktopServices.openUrl(url)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.canvas = self.iface.mapCanvas() self.algorithm = ('invdist', 'average', 'nearest', 'datametrics') self.datametrics = ('minimum', 'maximum', 'range') self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_grid") self.outSelector.setType( self.outSelector.FILE ) self.extentSelector.setCanvas(self.canvas) #self.extentSelector.stop() # set the default QSpinBoxes and QProgressBar value self.widthSpin.setValue(3000) self.heightSpin.setValue(3000) self.invdistPowerSpin.setValue(2.0) self.outputFormat = Utils.fillRasterOutputFormat() self.lastEncoding = Utils.getLastUsedEncoding() self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.zfieldCombo, SIGNAL("currentIndexChanged(int)"), self.zfieldCheck), (self.algorithmCombo, SIGNAL("currentIndexChanged(int)"), self.algorithmCheck), (self.stackedWidget, None, self.algorithmCheck), ([self.invdistPowerSpin, self.invdistSmothingSpin, self.invdistRadius1Spin, self.invdistRadius2Spin, self.invdistAngleSpin, self.invdistNoDataSpin], SIGNAL("valueChanged(double)")), ([self.invdistMaxPointsSpin, self.invdistMinPointsSpin], SIGNAL("valueChanged(int)")), ([self.averageRadius1Spin, self.averageRadius2Spin, self.averageAngleSpin, self.averageNoDataSpin], SIGNAL("valueChanged(double)")), (self.averageMinPointsSpin, SIGNAL("valueChanged(int)")), ([self.nearestRadius1Spin, self.nearestRadius2Spin, self.nearestAngleSpin, self.nearestNoDataSpin], SIGNAL("valueChanged(double)")), (self.datametricsCombo, SIGNAL("currentIndexChanged(int)")), ([self.datametricsRadius1Spin, self.datametricsRadius2Spin, self.datametricsAngleSpin, self.datametricsNoDataSpin], SIGNAL("valueChanged(double)")), (self.datametricsMinPointsSpin, SIGNAL("valueChanged(int)")), (self.extentSelector, [SIGNAL("selectionStarted()"), SIGNAL("newExtentDefined()")], self.extentGroup), ( [self.widthSpin, self.heightSpin], SIGNAL( "valueChanged(int)" ), self.resizeGroupBox ) ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.inSelector, SIGNAL("layerChanged()"), self.fillFieldsCombo) self.connect(self.extentGroup, SIGNAL("toggled(bool)"), self.onExtentCheckedChanged)
def fillOutputFileEdit_color(self): lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter() outputFile = Utils.FileDialog.getSaveFileName(self, self.tr( "Select the raster file to save the results to" ), Utils.FileFilter.allRastersFilter(), lastUsedFilter ) if outputFile==None: return Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter) self.outputFormat = Utils.fillRasterOutputFormat( lastUsedFilter, outputFile ) self.outputLayerCombo_color.setText(outputFile)
def fillOutputFileEdit(self): lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter() outputFile = Utils.FileDialog.getSaveFileName(self, self.tr( "Select where to save the Merge output" ), Utils.FileFilter.allRastersFilter(), lastUsedFilter ) if outputFile.isEmpty(): return Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter) self.outputFormat = Utils.fillRasterOutputFormat( lastUsedFilter, outputFile ) self.outSelector.setFilename( outputFile )
def fillOutputFileEdit(self): lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter() outputFile = Utils.FileDialog.getSaveFileName(self, self.tr( "Select the raster file to save the results to" ), Utils.FileFilter.allRastersFilter(), lastUsedFilter ) if not outputFile: return Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter) self.outputFormat = Utils.fillRasterOutputFormat( lastUsedFilter, outputFile ) self.outSelector.setFilename(outputFile)
def fillOutputFileEdit( self ): lastUsedFilter = Utils.FileFilter.lastUsedVectorFilter() outputFile, encoding = Utils.FileDialog.getSaveFileName( self, self.tr( "Select where to save the TileIndex output" ), Utils.FileFilter.allVectorsFilter(), lastUsedFilter, True ) if not outputFile: return Utils.FileFilter.setLastUsedVectorFilter(lastUsedFilter) self.outputFormat = Utils.fillVectorOutputFormat( lastUsedFilter, outputFile ) self.outSelector.setFilename( outputFile ) self.lastEncoding = encoding