Index: python/plugins/GdalTools/__init__.py =================================================================== --- python/plugins/GdalTools/__init__.py (revision 14009) +++ python/plugins/GdalTools/__init__.py (working copy) @@ -2,7 +2,7 @@ /*************************************************************************** Name : GdalTools Description : Integrate gdal tools into qgis -Date : 17/Sep/09 +Date : 17/Sep/09 copyright : (C) 2009 by Lorenzo Masini and Giuseppe Sucameli (Faunalia) email : lorenxo86@gmail.com - brush.tyler@gmail.com ***************************************************************************/ @@ -17,16 +17,16 @@ ***************************************************************************/ This script initializes the plugin, making it known to QGIS. """ -def name(): - return "GdalTools" +def name(): + return "GdalTools" def description(): return "Integrate gdal tools into qgis" -def version(): - return "Version 1.2.0" +def version(): + return "Version 1.2.1" def qgisMinimumVersion(): return "1.0" -def classFactory(iface): +def classFactory(iface): # load GdalTools class from file GdalTools - from GdalTools import GdalTools + from GdalTools import GdalTools return GdalTools(iface) Index: python/plugins/GdalTools/tools/doTranslate.py =================================================================== --- python/plugins/GdalTools/tools/doTranslate.py (revision 14009) +++ python/plugins/GdalTools/tools/doTranslate.py (working copy) @@ -34,7 +34,12 @@ (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 (int)"), self.outsizeCheck), + (self.nodataSpin, SIGNAL("valueChanged (int)"), self.nodataCheck), + (self.sdsCheck, SIGNAL("stateChanged(int)")), + (self.srcwinEdit, SIGNAL("textChanged(const QString &)"), self.srcwinCheck), + (self.prjwinEdit, SIGNAL("textChanged(const QString &)"), self.prjwinCheck) ] ) @@ -160,6 +165,47 @@ for opt in self.creationOptionsTable.options(): arguments << "-co" arguments << opt + if self.outsizeCheck.isChecked(): + if self.outsizeSpin.value() != 0 and self.outsizeSpin.value() != 100: + arguments << "-outsize" + arguments << str(self.outsizeSpin.value()) + '%' + arguments << str(self.outsizeSpin.value()) + '%' + if self.expandCheck.isChecked(): + arguments << "-expand" + arguments << self.expandCombo.currentText() + 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(" ") + 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(" ") + 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" Index: python/plugins/GdalTools/tools/widgetTranslate.ui =================================================================== --- python/plugins/GdalTools/tools/widgetTranslate.ui (revision 14009) +++ python/plugins/GdalTools/tools/widgetTranslate.ui (working copy) @@ -6,8 +6,8 @@ 0 0 - 335 - 259 + 358 + 436 @@ -39,7 +39,7 @@ - + @@ -76,7 +76,7 @@ - + @@ -104,7 +104,7 @@ - + @@ -121,7 +121,7 @@ - + @@ -142,6 +142,140 @@ + + + + + 100 + 16777215 + + + + Percentage to resize image. This will change pixel size/image resolution accordingly: 25% will create an image with pixels 4x larger. + + + Outsize (%): + + + + + + + + 75 + 16777215 + + + + Percentage to resize image. This will change pixel size/image resolution accordingly: 25% will create an image with pixels 4x larger. + + + 1000 + + + + + + + Assign a specified nodata value to output bands. + + + No data: + + + + + + + + 75 + 16777215 + + + + Assign a specified nodata value to output bands. + + + 255 + + + + + + + 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. + + + Expand: + + + + + + + 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. + + + + gray + + + + + rgb + + + + + rgba + + + + + + + + Selects a subwindow from the source image for copying based on pixel/line location. (Enter Xoff Yoff Xsize Ysize.) + + + Srcwin: + + + + + + + Selects a subwindow from the source image for copying based on pixel/line location. (Enter Xoff Yoff Xsize Ysize.) + + + + + + + Selects a subwindow from the source image for copying (like -srcwin) but with the corners given in georeferenced coordinates. (Enter ulx uly lrx lry.) + + + Prjwin: + + + + + + + Selects a subwindow from the source image for copying (like -srcwin) but with the corners given in georeferenced coordinates. (Enter ulx uly lrx lry.) + + + + + + + Copy all subdatasets of this file to individual output files. Use with formats like HDF or OGDI that have subdatasets. + + + Sds + + +