mirror of
https://github.com/qgis/QGIS.git
synced 2025-06-18 00:04:02 -04:00
added -cutline option to gdaltools warp tool, to fix #3066
git-svn-id: http://svn.osgeo.org/qgis/trunk@15476 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
fa9f66625f
commit
36fc12ad74
@ -22,7 +22,7 @@ def name():
|
||||
def description():
|
||||
return "Integrate gdal tools into qgis"
|
||||
def version():
|
||||
return "Version 1.2.22"
|
||||
return "Version 1.2.23"
|
||||
def qgisMinimumVersion():
|
||||
return "1.0"
|
||||
def icon():
|
||||
|
@ -40,7 +40,9 @@ class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
||||
(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.noDataEdit, SIGNAL( "textChanged( const QString & )" ), self.noDataCheck),
|
||||
(self.cutlineLayerCombo, [SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)")], self.cutlineCheck, "1.6.0"),
|
||||
(self.selectCutlineFileButton, None, self.cutlineCheck, "1.6.0")
|
||||
]
|
||||
)
|
||||
|
||||
@ -49,6 +51,7 @@ class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
||||
self.connect(self.selectOutputFileButton, SIGNAL("clicked()"), self.fillOutputFileEdit)
|
||||
self.connect(self.selectSourceSRSButton, SIGNAL("clicked()"), self.fillSourceSRSEdit)
|
||||
self.connect(self.selectTargetSRSButton, SIGNAL("clicked()"), self.fillTargetSRSEdit)
|
||||
self.connect(self.selectCutlineFileButton, SIGNAL("clicked()"), self.fillCutlineFile)
|
||||
self.connect( self.batchCheck, SIGNAL( "stateChanged( int )" ), self.switchToolMode )
|
||||
|
||||
|
||||
@ -90,12 +93,19 @@ class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
||||
|
||||
def onLayersChanged(self):
|
||||
self.fillInputLayerCombo()
|
||||
self.fillCutlineLayerCombo()
|
||||
|
||||
def fillInputLayerCombo(self):
|
||||
self.inputLayerCombo.clear()
|
||||
( self.layers, names ) = Utils.LayerRegistry.instance().getRasterLayers()
|
||||
( self.inputLayers, names ) = Utils.LayerRegistry.instance().getRasterLayers()
|
||||
self.inputLayerCombo.addItems( names )
|
||||
|
||||
def fillCutlineLayerCombo(self):
|
||||
self.cutlineLayerCombo.clear()
|
||||
( self.cutlineLayers, names ) = Utils.LayerRegistry.instance().getVectorLayers()
|
||||
self.cutlineLayerCombo.addItems( names )
|
||||
|
||||
|
||||
def fillInputFile(self):
|
||||
lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter()
|
||||
inputFile = Utils.FileDialog.getOpenFileName(self, self.tr( "Select the input file for Warp" ), Utils.FileFilter.allRastersFilter(), lastUsedFilter )
|
||||
@ -119,6 +129,17 @@ class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
||||
self.outputFormat = Utils.fillRasterOutputFormat( lastUsedFilter, outputFile )
|
||||
self.outputFileEdit.setText(outputFile)
|
||||
|
||||
def fillCutlineFile(self):
|
||||
lastUsedFilter = Utils.FileFilter.lastUsedVectorFilter()
|
||||
cutlineFile = Utils.FileDialog.getOpenFileName(self, self.tr( "Select the cutline file" ), Utils.FileFilter.allVectorsFilter(), lastUsedFilter )
|
||||
if cutlineFile.isEmpty():
|
||||
return
|
||||
Utils.FileFilter.setLastUsedVectorFilter(lastUsedFilter)
|
||||
|
||||
self.cutlineLayerCombo.setCurrentIndex(-1)
|
||||
self.cutlineLayerCombo.setEditText(cutlineFile)
|
||||
|
||||
|
||||
def fillInputDir( self ):
|
||||
inputDir = Utils.FileDialog.getExistingDirectory( self, self.tr( "Select the input directory with files to Warp" ))
|
||||
if inputDir.isEmpty():
|
||||
@ -187,6 +208,13 @@ class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
||||
if not nodata.isEmpty():
|
||||
arguments << "-dstnodata"
|
||||
arguments << nodata
|
||||
if self.cutlineCheck.isChecked():
|
||||
cutline = self.getCutlineFileName()
|
||||
if not cutline.isEmpty():
|
||||
arguments << "-q"
|
||||
arguments << "-cutline"
|
||||
arguments << cutline
|
||||
arguments << "-dstalpha"
|
||||
if self.isBatchEnabled():
|
||||
return arguments
|
||||
|
||||
@ -199,12 +227,17 @@ class GdalToolsDialog(QWidget, Ui_Widget, BaseBatchWidget):
|
||||
|
||||
def getInputFileName(self):
|
||||
if self.inputLayerCombo.currentIndex() >= 0:
|
||||
return self.layers[self.inputLayerCombo.currentIndex()].source()
|
||||
return self.inputLayers[self.inputLayerCombo.currentIndex()].source()
|
||||
return self.inputLayerCombo.currentText()
|
||||
|
||||
def getOutputFileName(self):
|
||||
return self.outputFileEdit.text()
|
||||
|
||||
def getCutlineFileName(self):
|
||||
if self.cutlineLayerCombo.currentIndex() >= 0:
|
||||
return self.cutlineLayers[self.cutlineLayerCombo.currentIndex()].source()
|
||||
return self.cutlineLayerCombo.currentText()
|
||||
|
||||
def addLayerIntoCanvas(self, fileInfo):
|
||||
self.iface.addRasterLayer(fileInfo.filePath())
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>415</width>
|
||||
<height>417</height>
|
||||
<height>453</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -19,15 +19,15 @@
|
||||
<property name="windowTitle">
|
||||
<string>Warp</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QCheckBox" name="batchCheck">
|
||||
<property name="text">
|
||||
<string>Batch mode (for processing whole directory)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="1" column="0">
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
@ -203,14 +203,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QCheckBox" name="cacheCheck">
|
||||
<property name="text">
|
||||
<string>&Memory used for caching</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="7" column="1">
|
||||
<widget class="QSpinBox" name="cacheSpin">
|
||||
<property name="suffix">
|
||||
<string>MB</string>
|
||||
@ -223,9 +223,43 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QCheckBox" name="cutlineCheck">
|
||||
<property name="text">
|
||||
<string>Cutline</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QComboBox" name="cutlineLayerCombo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="editable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="insertPolicy">
|
||||
<enum>QComboBox::NoInsert</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="selectCutlineFileButton">
|
||||
<property name="text">
|
||||
<string>Select...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QGroupBox" name="resizeGroupBox">
|
||||
<property name="title">
|
||||
<string>Resize</string>
|
||||
@ -283,10 +317,10 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QProgressBar" name="progressBar"/>
|
||||
</item>
|
||||
<item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="multithreadCheck">
|
||||
<property name="text">
|
||||
<string>Use m&ultithreaded warping implementation</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user