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.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") 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 = [] 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_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 __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 ) 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 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) 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) 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.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.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 fillOutputFileEdit(self): lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter() outputFile = Utils.FileDialog.getSaveFileName(self, self.tr( "Select the raster file to save the results to" ), Utils.FileFilter.saveRastersFilter(), 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.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 outputFile.isEmpty(): return Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter) self.outputFormat = Utils.fillRasterOutputFormat( lastUsedFilter, outputFile ) self.outputFileEdit.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 outputFile == None: return Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter) self.outputFormat = Utils.fillRasterOutputFormat( lastUsedFilter, outputFile) self.inputLayerCombo3.setText(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.saveRastersFilter(), lastUsedFilter) if not outputFile: return Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter) self.outputFormat = Utils.fillRasterOutputFormat( lastUsedFilter, outputFile) self.outSelector.setFilename(outputFile)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.modes = ("hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "roughness") self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdaldem") self.outSelector.setType( self.outSelector.FILE ) self.configSelector.setType( self.configSelector.FILE ) # set the default QSpinBoxes and QProgressBar value self.bandSpin.setValue(1) self.hillshadeZFactorSpin.setValue(1) self.hillshadeScaleSpin.setValue(1) self.hillshadeAltitudeSpin.setValue(45.0) self.hillshadeAzimuthSpin.setValue(315.0) self.slopeScaleSpin.setValue(1) # set the default color configuration file to terrain import os.path colorConfigFile = os.path.join(os.path.dirname(__file__), "terrain.txt") self.configSelector.setFilename(colorConfigFile) self.outputFormat = Utils.fillRasterOutputFormat() self.creationOptionsWidget.setFormat(self.outputFormat) self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.computeEdgesCheck, SIGNAL("stateChanged(int)"), None, 1800), (self.bandSpin, SIGNAL("valueChanged(int)"), self.bandCheck), (self.algorithmCheck, SIGNAL("stateChanged(int)"), None, 1800), (self.creationOptionsWidget, SIGNAL("optionsChanged()")), (self.creationOptionsGroupBox, SIGNAL("toggled(bool)")), (self.modeCombo, SIGNAL("currentIndexChanged(int)")), ([self.hillshadeZFactorSpin, self.hillshadeScaleSpin, self.hillshadeAltitudeSpin, self.hillshadeAzimuthSpin], SIGNAL("valueChanged(double)")), (self.slopeScaleSpin, SIGNAL("valueChanged(double)")), (self.slopePercentCheck, SIGNAL("stateChanged(int)")), ([self.aspectTrigonometricCheck, self.aspectZeroForFlatCheck], SIGNAL("stateChanged(int)")), (self.configSelector, SIGNAL("filenameChanged()")), ([self.colorExactRadio, self.colorNearestRadio], SIGNAL("toggled(bool)"), self.colorMatchGroupBox), (self.colorAlphaCheck, SIGNAL("stateChanged(int)")) ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.configSelector, SIGNAL("selectClicked()"), self.fillColorConfigFileEdit) self.connect(self.modeCombo, SIGNAL("currentIndexChanged(int)"), self.showModeParams)
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 outputFile.isEmpty(): return Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter) self.outputFormat = Utils.fillRasterOutputFormat( lastUsedFilter, outputFile) self.outSelector.setFilename(outputFile) self.creationOptionsWidget.setFormat(self.outputFormat)
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 outputFile.isEmpty(): return Utils.FileFilter.setLastUsedRasterFilter(lastUsedFilter) self.outputFormat = Utils.fillRasterOutputFormat(lastUsedFilter, outputFile) # do not use the output file as input if self.inputFiles.contains(outputFile): self.inputFiles.removeAt( self.inputFiles.indexOf(outputFile) ) self.outputFileEdit.setText(outputFile)
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 __init__(self, iface): QWidget.__init__(self) self.iface = iface self.modes = ("hillshade", "slope", "aspect", "color-relief", "TRI", "TPI", "roughness") self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdaldem") self.outSelector.setType( self.outSelector.FILE ) self.configSelector.setType( self.configSelector.FILE ) # set the default QSpinBoxes and QProgressBar value self.bandSpin.setValue(1) self.hillshadeZFactorSpin.setValue(1) self.hillshadeScaleSpin.setValue(1) self.hillshadeAltitudeSpin.setValue(45.0) self.hillshadeAzimuthSpin.setValue(315.0) self.slopeScaleSpin.setValue(1) # set the default color configuration file to terrain import os.path colorConfigFile = os.path.join(os.path.dirname(__file__), "terrain.txt") self.configSelector.setFilename(colorConfigFile) self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.computeEdgesCheck, SIGNAL("stateChanged(int)"), None, "1.8.0"), (self.bandSpin, SIGNAL("valueChanged(int)"), self.bandCheck), (self.algorithmCheck, SIGNAL("stateChanged(int)"), None, "1.8.0"), (self.creationOptionsTable, [SIGNAL("cellValueChanged(int, int)"), SIGNAL("rowRemoved()")], self.creationGroupBox), (self.modeCombo, SIGNAL("currentIndexChanged(int)")), ([self.hillshadeZFactorSpin, self.hillshadeScaleSpin, self.hillshadeAltitudeSpin, self.hillshadeAzimuthSpin], SIGNAL("valueChanged(double)")), (self.slopeScaleSpin, SIGNAL("valueChanged(double)")), (self.slopePercentCheck, SIGNAL("stateChanged(int)")), ([self.aspectTrigonometricCheck, self.aspectZeroForFlatCheck], SIGNAL("stateChanged(int)")), (self.configSelector, SIGNAL("filenameChanged()")), ([self.colorExactRadio, self.colorNearestRadio], SIGNAL("toggled(bool)"), self.colorMatchGroupBox), (self.colorAlphaCheck, SIGNAL("stateChanged(int)")) ] ) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.configSelector, SIGNAL("selectClicked()"), self.fillColorConfigFileEdit) self.connect(self.modeCombo, SIGNAL("currentIndexChanged(int)"), self.showModeParams)
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() # set the default QDoubleSpinBoxes self.xRes.setValue(12.5) self.yRes.setValue(12.5) 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.cropToCutlineCheck, SIGNAL("stateChanged(int)")), ([self.xRes, self.yRes], SIGNAL("valueChanged(double)"), self.setResolutionRadio), (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) self.connect(self.keepResolutionRadio, SIGNAL("toggled(bool)"), self.switchResolutionMode)
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 __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_sieve.py") self.outSelector.setType(self.outSelector.FILE) self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.thresholdSpin, SIGNAL("valueChanged(int)"), self.thresholdCheck), (self.connectionsCombo, SIGNAL("currentIndexChanged(int)"), self.connectionsCheck) ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit)
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.resampling_method = ('near', 'bilinear', 'cubic', 'cubicspline', 'lanczos') self.setupUi(self) BaseBatchWidget.__init__(self, self.iface, "gdalwarp") self.outSelector.setType( self.outSelector.FILE ) # set the default QSpinBoxes and QProgressBar value self.widthSpin.setValue(3000) self.heightSpin.setValue(3000) self.progressBar.setValue(0) self.progressBar.hide() self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus( [ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.sourceSRSEdit, SIGNAL("textChanged(const QString &)"), self.sourceSRSCheck), (self.selectSourceSRSButton, None, self.sourceSRSCheck), (self.targetSRSEdit, SIGNAL("textChanged(const QString &)"), self.targetSRSCheck), (self.selectTargetSRSButton, None, self.targetSRSCheck), (self.resamplingCombo, SIGNAL("currentIndexChanged(int)"), self.resamplingCheck), (self.cacheSpin, SIGNAL("valueChanged(int)"), self.cacheCheck), ( [self.widthSpin, self.heightSpin], SIGNAL( "valueChanged(int)" ), self.resizeGroupBox ), (self.multithreadCheck, SIGNAL("stateChanged(int)")), (self.noDataEdit, SIGNAL( "textChanged( const QString & )" ), self.noDataCheck), (self.maskSelector, SIGNAL("filenameChanged()"), self.maskCheck, "1.6.0"), ] ) self.connect(self.inSelector, SIGNAL("layerChanged()"), self.fillSourceSRSEditDefault) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFile) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit) self.connect(self.selectSourceSRSButton, SIGNAL("clicked()"), self.fillSourceSRSEdit) self.connect(self.selectTargetSRSButton, SIGNAL("clicked()"), self.fillTargetSRSEdit) self.connect(self.maskSelector, SIGNAL("selectClicked()"), self.fillMaskFile) self.connect( self.batchCheck, SIGNAL( "stateChanged( int )" ), self.switchToolMode )
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_sieve.py") self.outSelector.setType( self.outSelector.FILE ) self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus([ (self.inSelector, SIGNAL("filenameChanged()")), (self.outSelector, SIGNAL("filenameChanged()")), (self.thresholdSpin, SIGNAL("valueChanged(int)"), self.thresholdCheck), (self.connectionsCombo, SIGNAL("currentIndexChanged(int)"), self.connectionsCheck) ]) self.connect(self.inSelector, SIGNAL("selectClicked()"), self.fillInputFileEdit) self.connect(self.outSelector, SIGNAL("selectClicked()"), self.fillOutputFileEdit)
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_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 __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.iface.mainWindow()) 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.checkRun) self.connect(self.extentSelector, SIGNAL("selectionStarted()"), self.checkRun) self.connect(self.extentModeRadio, SIGNAL("toggled(bool)"), self.switchClippingMode)
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 __init__(self, iface): QWidget.__init__(self) self.iface = iface self.algorithm = ('invdist', 'average', 'nearest', 'datametrics') self.datametrics = ('minimum', 'maximum', 'range') self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_grid") # set the default QSpinBoxes value self.invdistPowerSpin.setValue(2.0) self.outputFormat = Utils.fillRasterOutputFormat() self.lastEncoding = Utils.getLastUsedEncoding() self.setParamsStatus( [ (self.inputLayerCombo, [SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)")] ), (self.outputFileEdit, SIGNAL("textChanged(const QString &)")), (self.zfieldCombo, SIGNAL("currentIndexChanged(int)"), self.zfieldCheck), (self.algorithmCombo, SIGNAL("currentIndexChanged(int)"), self.algorithmCheck), (self.stackedWidget, SIGNAL("currentChanged(int)"), 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.connect(self.selectInputFileButton, SIGNAL("clicked()"), self.fillInputFileEdit) self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit) self.connect(self.inputLayerCombo, SIGNAL("currentIndexChanged(int)"), self.fillFieldsCombo) # fill layers combo self.fillInputLayerCombo()
def __init__(self, iface): QWidget.__init__(self) self.iface = iface self.setupUi(self) BasePluginWidget.__init__(self, self.iface, "gdal_sieve.py") self.outputFormat = Utils.fillRasterOutputFormat() self.setParamsStatus( [ (self.inputLayerCombo, [SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)")] ), (self.outputFileEdit, SIGNAL("textChanged(const QString &)")), (self.thresholdSpin, SIGNAL("valueChanged(int)"), self.thresholdCheck), (self.connectionsCombo, SIGNAL("currentIndexChanged(int)"), self.connectionsCheck) ] ) 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 = [] if self.targetSRSCheck.isChecked() and self.targetSRSEdit.text(): arguments.append("-a_srs") arguments.append(self.targetSRSEdit.text()) if self.creationOptionsGroupBox.isChecked(): for opt in self.creationOptionsWidget.options(): arguments.extend(["-co", opt]) if self.outsizeCheck.isChecked() and self.outsizeSpin.value() != 100: arguments.append("-outsize") arguments.append(self.outsizeSpin.text()) arguments.append(self.outsizeSpin.text()) if self.expandCheck.isChecked(): arguments.append("-expand") arguments.append( self.expand_method[self.expandCombo.currentIndex()]) if self.nodataCheck.isChecked(): arguments.append("-a_nodata") arguments.append(unicode(self.nodataSpin.value())) if self.sdsCheck.isChecked(): arguments.append("-sds") if self.srcwinCheck.isChecked() and self.srcwinEdit.text(): coordList = self.srcwinEdit.text().split( ) # split the string on whitespace(s) if len(coordList) == 4 and coordList[3]: try: for x in coordList: int(x) except ValueError: #print "Coordinates must be integer numbers." QMessageBox.critical( self, self.tr("Translate - srcwin"), self. tr("Image coordinates (pixels) must be integer numbers." )) else: arguments.append("-srcwin") for x in coordList: arguments.append(x) if self.prjwinCheck.isChecked() and self.prjwinEdit.text(): coordList = self.prjwinEdit.text().split( ) # split the string on whitespace(s) if len(coordList) == 4 and coordList[3]: try: for x in coordList: float(x) except ValueError: #print "Coordinates must be integer numbers." QMessageBox.critical( self, self.tr("Translate - prjwin"), self.tr( "Image coordinates (geographic) must be numbers.")) else: arguments.append("-projwin") for x in coordList: arguments.append(x) if self.isBatchEnabled(): if self.formatCombo.currentIndex() != 0: arguments.append("-of") arguments.append( Utils.fillRasterOutputFormat( self.formatCombo.currentText())) return arguments else: return arguments outputFn = self.getOutputFileName() if outputFn: arguments.append("-of") arguments.append(self.outputFormat) arguments.append(self.getInputFileName()) arguments.append(outputFn) # set creation options filename/layer for validation if self.inSelector.layer(): self.creationOptionsWidget.setRasterLayer(self.inSelector.layer()) else: self.creationOptionsWidget.setRasterFileName( self.getInputFileName()) return arguments
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.extentSelector.setCanvas(self.canvas) # self.extentSelector.stop() # set the default QSpinBoxes value self.invdistPowerSpin.setValue(2.0) self.outputFormat = Utils.fillRasterOutputFormat() self.lastEncoding = Utils.getLastUsedEncoding() self.setParamsStatus( [ ( self.inputLayerCombo, [SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)")], ), (self.outputFileEdit, SIGNAL("textChanged(const QString &)")), (self.zfieldCombo, SIGNAL("currentIndexChanged(int)"), self.zfieldCheck), (self.algorithmCombo, SIGNAL("currentIndexChanged(int)"), self.algorithmCheck), (self.stackedWidget, SIGNAL("currentChanged(int)"), 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.connect(self.selectInputFileButton, SIGNAL("clicked()"), self.fillInputFileEdit) self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit) self.connect(self.inputLayerCombo, SIGNAL("currentIndexChanged(int)"), self.fillFieldsCombo) self.connect(self.extentGroup, SIGNAL("toggled(bool)"), self.onExtentCheckedChenged) # fill layers combo self.fillInputLayerCombo()
def getArguments(self): arguments = QStringList() if self.targetSRSCheck.isChecked( ) and not self.targetSRSEdit.text().isEmpty(): arguments << "-a_srs" arguments << self.targetSRSEdit.text() if self.creationGroupBox.isChecked(): for opt in self.creationOptionsTable.options(): arguments << "-co" arguments << opt if self.outsizeCheck.isChecked() and self.outsizeSpin.value() != 100: arguments << "-outsize" arguments << self.outsizeSpin.text() arguments << self.outsizeSpin.text() if self.expandCheck.isChecked(): arguments << "-expand" arguments << self.expand_method[self.expandCombo.currentIndex()] if self.nodataCheck.isChecked(): arguments << "-a_nodata" arguments << str(self.nodataSpin.value()) if self.sdsCheck.isChecked(): arguments << "-sds" if self.srcwinCheck.isChecked( ) and not self.srcwinEdit.text().isEmpty(): coordList = self.srcwinEdit.text().split(' ', QString.SkipEmptyParts) if len(coordList) == 4 and not coordList[3].isEmpty(): try: for x in coordList: test = int(x) except ValueError: #print "Coordinates must be integer numbers." QMessageBox.critical( self, self.tr("Translate - srcwin"), self. tr("Image coordinates (pixels) must be integer numbers." )) else: arguments << "-srcwin" for x in coordList: arguments << x if self.prjwinCheck.isChecked( ) and not self.prjwinEdit.text().isEmpty(): coordList = self.prjwinEdit.text().split(' ', QString.SkipEmptyParts) if len(coordList) == 4 and not coordList[3].isEmpty(): try: for x in coordList: test = float(x) except ValueError: #print "Coordinates must be integer numbers." QMessageBox.critical( self, self.tr("Translate - prjwin"), self.tr( "Image coordinates (geographic) must be numbers.")) else: arguments << "-projwin" for x in coordList: arguments << x if self.isBatchEnabled(): if self.formatCombo.currentIndex() != 0: arguments << "-of" arguments << Utils.fillRasterOutputFormat( self.formatCombo.currentText()) return arguments else: return arguments outputFn = self.getOutputFileName() if not outputFn.isEmpty(): arguments << "-of" arguments << self.outputFormat arguments << self.getInputFileName() arguments << outputFn return arguments
def getArguments(self): arguments = QStringList() if self.targetSRSCheck.isChecked() and not self.targetSRSEdit.text().isEmpty(): arguments << "-a_srs" arguments << self.targetSRSEdit.text() if self.creationGroupBox.isChecked(): for opt in self.creationOptionsTable.options(): arguments << "-co" arguments << opt if self.outsizeCheck.isChecked() and self.outsizeSpin.value() != 100: arguments << "-outsize" arguments << self.outsizeSpin.text() arguments << self.outsizeSpin.text() if self.expandCheck.isChecked(): arguments << "-expand" arguments << self.expand_method[self.expandCombo.currentIndex()] if self.nodataCheck.isChecked(): arguments << "-a_nodata" arguments << str(self.nodataSpin.value()) if self.sdsCheck.isChecked(): arguments << "-sds" if self.srcwinCheck.isChecked() and not self.srcwinEdit.text().isEmpty(): coordList = self.srcwinEdit.text().split( ' ', QString.SkipEmptyParts ) if len(coordList) == 4 and not coordList[3].isEmpty(): try: for x in coordList: test = int(x) except ValueError: #print "Coordinates must be integer numbers." QMessageBox.critical(self, self.tr("Translate - srcwin"), self.tr("Image coordinates (pixels) must be integer numbers.")) else: arguments << "-srcwin" for x in coordList: arguments << x if self.prjwinCheck.isChecked() and not self.prjwinEdit.text().isEmpty(): coordList = self.prjwinEdit.text().split( ' ', QString.SkipEmptyParts ) if len(coordList) == 4 and not coordList[3].isEmpty(): try: for x in coordList: test = float(x) except ValueError: #print "Coordinates must be integer numbers." QMessageBox.critical(self, self.tr("Translate - prjwin"), self.tr("Image coordinates (geographic) must be numbers.")) else: arguments << "-projwin" for x in coordList: arguments << x if self.isBatchEnabled(): if self.formatCombo.currentIndex() != 0: arguments << "-of" arguments << Utils.fillRasterOutputFormat( self.formatCombo.currentText() ) return arguments else: return arguments outputFn = self.getOutputFileName() if not outputFn.isEmpty(): arguments << "-of" arguments << self.outputFormat arguments << self.getInputFileName() arguments << outputFn return arguments
def getArguments(self): arguments = [] if self.targetSRSCheck.isChecked() and self.targetSRSEdit.text(): arguments.append( "-a_srs") arguments.append( self.targetSRSEdit.text()) if self.creationOptionsGroupBox.isChecked(): for opt in self.creationOptionsWidget.options(): arguments.extend( [ "-co", opt ] ) if self.outsizeCheck.isChecked() and self.outsizeSpin.value() != 100: arguments.append( "-outsize") arguments.append( self.outsizeSpin.text()) arguments.append( self.outsizeSpin.text()) if self.expandCheck.isChecked(): arguments.append( "-expand") arguments.append( self.expand_method[self.expandCombo.currentIndex()]) if self.nodataCheck.isChecked(): arguments.append( "-a_nodata") arguments.append( unicode(self.nodataSpin.value())) if self.sdsCheck.isChecked(): arguments.append( "-sds") if self.srcwinCheck.isChecked() and self.srcwinEdit.text(): coordList = self.srcwinEdit.text().split() # split the string on whitespace(s) if len(coordList) == 4 and coordList[3]: try: for x in coordList: int(x) except ValueError: #print "Coordinates must be integer numbers." QMessageBox.critical(self, self.tr("Translate - srcwin"), self.tr("Image coordinates (pixels) must be integer numbers.")) else: arguments.append( "-srcwin") for x in coordList: arguments.append( x) if self.prjwinCheck.isChecked() and self.prjwinEdit.text(): coordList = self.prjwinEdit.text().split() # split the string on whitespace(s) if len(coordList) == 4 and coordList[3]: try: for x in coordList: float(x) except ValueError: #print "Coordinates must be integer numbers." QMessageBox.critical(self, self.tr("Translate - prjwin"), self.tr("Image coordinates (geographic) must be numbers.")) else: arguments.append( "-projwin") for x in coordList: arguments.append( x) if self.isBatchEnabled(): if self.formatCombo.currentIndex() != 0: arguments.append( "-of") arguments.append( Utils.fillRasterOutputFormat( self.formatCombo.currentText() )) return arguments else: return arguments outputFn = self.getOutputFileName() if outputFn: arguments.append( "-of") arguments.append( self.outputFormat) arguments.append( self.getInputFileName()) arguments.append( outputFn) # set creation options filename/layer for validation if self.inSelector.layer(): self.creationOptionsWidget.setRasterLayer(self.inSelector.layer()) else: self.creationOptionsWidget.setRasterFileName(self.getInputFileName()) return arguments