[QGIS Commit] r14020 - in trunk/qgis: . python/plugins/GdalTools
python/plugins/GdalTools/tools
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Aug 6 12:43:14 EDT 2010
Author: brushtyler
Date: 2010-08-06 16:43:14 +0000 (Fri, 06 Aug 2010)
New Revision: 14020
Modified:
trunk/qgis/CONTRIBUTORS
trunk/qgis/python/plugins/GdalTools/__init__.py
trunk/qgis/python/plugins/GdalTools/tools/doTranslate.py
trunk/qgis/python/plugins/GdalTools/tools/widgetTranslate.ui
Log:
Applied patch from #2930: improve GdalTools Translate dialog.
Contributed by Duarte Carreira, thanks!
Modified: trunk/qgis/CONTRIBUTORS
===================================================================
--- trunk/qgis/CONTRIBUTORS 2010-08-06 16:15:15 UTC (rev 14019)
+++ trunk/qgis/CONTRIBUTORS 2010-08-06 16:43:14 UTC (rev 14020)
@@ -15,6 +15,7 @@
Carlos Dávila
Christian Ferreira
Diego Moreira
+Duarte Carreira
Faunalia (http://www.faunalia.it)
Fernando Pacheco
Florian El Ahdab
Modified: trunk/qgis/python/plugins/GdalTools/__init__.py
===================================================================
--- trunk/qgis/python/plugins/GdalTools/__init__.py 2010-08-06 16:15:15 UTC (rev 14019)
+++ trunk/qgis/python/plugins/GdalTools/__init__.py 2010-08-06 16:43:14 UTC (rev 14020)
@@ -22,7 +22,7 @@
def description():
return "Integrate gdal tools into qgis"
def version():
- return "Version 1.2.8"
+ return "Version 1.2.9"
def qgisMinimumVersion():
return "1.0"
def classFactory(iface):
Modified: trunk/qgis/python/plugins/GdalTools/tools/doTranslate.py
===================================================================
--- trunk/qgis/python/plugins/GdalTools/tools/doTranslate.py 2010-08-06 16:15:15 UTC (rev 14019)
+++ trunk/qgis/python/plugins/GdalTools/tools/doTranslate.py 2010-08-06 16:43:14 UTC (rev 14020)
@@ -20,12 +20,18 @@
BaseBatchWidget.__init__(self, self.iface, "gdal_translate")
# 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(
@@ -34,7 +40,13 @@
(self.outputFileEdit, SIGNAL("textChanged(const QString &)")),
(self.targetSRSEdit, SIGNAL("textChanged(const QString &)"), self.targetSRSCheck),
(self.selectTargetSRSButton, None, self.targetSRSCheck),
- (self.creationOptionsTable, [SIGNAL("cellValueChanged(int, int)"), SIGNAL("rowRemoved()")], self.creationGroupBox)
+ (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)
]
)
@@ -160,6 +172,46 @@
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.expandCombo.currentText().toLower()
+ 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 = []
+ 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, "Translate - srcwin", "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 = []
+ 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, "Translate - prjwin", "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"
Modified: trunk/qgis/python/plugins/GdalTools/tools/widgetTranslate.ui
===================================================================
--- trunk/qgis/python/plugins/GdalTools/tools/widgetTranslate.ui 2010-08-06 16:15:15 UTC (rev 14019)
+++ trunk/qgis/python/plugins/GdalTools/tools/widgetTranslate.ui 2010-08-06 16:43:14 UTC (rev 14020)
@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>335</width>
- <height>259</height>
+ <height>453</height>
</rect>
</property>
<property name="sizePolicy">
@@ -142,6 +142,150 @@
</item>
</layout>
</item>
+ <item row="4" column="0">
+ <widget class="QCheckBox" name="outsizeCheck">
+ <property name="maximumSize">
+ <size>
+ <width>100</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Percentage to resize image. This will change pixel size/image resolution accordingly: 25% will create an image with pixels 4x larger.</string>
+ </property>
+ <property name="text">
+ <string>Outsize:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="1">
+ <widget class="QSpinBox" name="outsizeSpin">
+ <property name="maximumSize">
+ <size>
+ <width>75</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Percentage to resize image. This will change pixel size/image resolution accordingly: 25% will create an image with pixels 4x larger.</string>
+ </property>
+ <property name="suffix">
+ <string>%</string>
+ </property>
+ <property name="minimum">
+ <number>1</number>
+ </property>
+ <property name="maximum">
+ <number>1000</number>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0">
+ <widget class="QCheckBox" name="nodataCheck">
+ <property name="toolTip">
+ <string>Assign a specified nodata value to output bands.</string>
+ </property>
+ <property name="text">
+ <string>No data:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="1">
+ <widget class="QSpinBox" name="nodataSpin">
+ <property name="maximumSize">
+ <size>
+ <width>75</width>
+ <height>16777215</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Assign a specified nodata value to output bands.</string>
+ </property>
+ <property name="maximum">
+ <number>255</number>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="0">
+ <widget class="QCheckBox" name="expandCheck">
+ <property name="toolTip">
+ <string>To expose a dataset with 1 band with a color table as a dataset with 3 (RGB) or 4 (RGBA) bands.
+Usefull for output drivers such as JPEG, JPEG2000, MrSID, ECW that don't support color indexed datasets.
+The 'gray' value (from GDAL 1.7.0) enables to expand a dataset with a color table that only contains gray levels to a gray indexed dataset.</string>
+ </property>
+ <property name="text">
+ <string>Expand:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QComboBox" name="expandCombo">
+ <property name="toolTip">
+ <string>To expose a dataset with 1 band with a color table as a dataset with 3 (RGB) or 4 (RGBA) bands.
+Usefull for output drivers such as JPEG, JPEG2000, MrSID, ECW that don't support color indexed datasets.
+The 'gray' value (from GDAL 1.7.0) enables to expand a dataset with a color table that only contains gray levels to a gray indexed dataset.</string>
+ </property>
+ <item>
+ <property name="text">
+ <string>Gray</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RGB</string>
+ </property>
+ </item>
+ <item>
+ <property name="text">
+ <string>RGBA</string>
+ </property>
+ </item>
+ </widget>
+ </item>
+ <item row="7" column="0">
+ <widget class="QCheckBox" name="srcwinCheck">
+ <property name="toolTip">
+ <string>Selects a subwindow from the source image for copying based on pixel/line location. (Enter Xoff Yoff Xsize Ysize)</string>
+ </property>
+ <property name="text">
+ <string>Srcwin:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="7" column="1">
+ <widget class="QLineEdit" name="srcwinEdit">
+ <property name="toolTip">
+ <string>Selects a subwindow from the source image for copying based on pixel/line location. (Enter Xoff Yoff Xsize Ysize)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="0">
+ <widget class="QCheckBox" name="prjwinCheck">
+ <property name="toolTip">
+ <string>Selects a subwindow from the source image for copying (like -srcwin) but with the corners given in georeferenced coordinates. (Enter ulx uly lrx lry)</string>
+ </property>
+ <property name="text">
+ <string>Prjwin:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="8" column="1">
+ <widget class="QLineEdit" name="prjwinEdit">
+ <property name="toolTip">
+ <string>Selects a subwindow from the source image for copying (like -srcwin) but with the corners given in georeferenced coordinates. (Enter ulx uly lrx lry)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="9" column="0">
+ <widget class="QCheckBox" name="sdsCheck">
+ <property name="toolTip">
+ <string>Copy all subdatasets of this file to individual output files. Use with formats like HDF or OGDI that have subdatasets.</string>
+ </property>
+ <property name="text">
+ <string>Sds</string>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item>
More information about the QGIS-commit
mailing list