patch_for_ticket_2930.diff

Expanded dialog for Translate and correponding doTranslate.py. Version bump to 1.2.1. - dcarreira -, 2010-08-05 06:56 AM

Download (11.5 KB)

View differences:

python/plugins/GdalTools/__init__.py (working copy)
2 2
/***************************************************************************
3 3
Name			 	 : GdalTools
4 4
Description          : Integrate gdal tools into qgis
5
Date                 : 17/Sep/09 
5
Date                 : 17/Sep/09
6 6
copyright            : (C) 2009 by Lorenzo Masini and Giuseppe Sucameli (Faunalia)
7 7
email                : [email protected] - [email protected]
8 8
 ***************************************************************************/
......
17 17
 ***************************************************************************/
18 18
 This script initializes the plugin, making it known to QGIS.
19 19
"""
20
def name(): 
21
  return "GdalTools" 
20
def name():
21
  return "GdalTools"
22 22
def description():
23 23
  return "Integrate gdal tools into qgis"
24
def version(): 
25
  return "Version 1.2.0" 
24
def version():
25
  return "Version 1.2.1"
26 26
def qgisMinimumVersion():
27 27
  return "1.0"
28
def classFactory(iface): 
28
def classFactory(iface):
29 29
  # load GdalTools class from file GdalTools
30
  from GdalTools import GdalTools 
30
  from GdalTools import GdalTools
31 31
  return GdalTools(iface)
32 32

  
python/plugins/GdalTools/tools/doTranslate.py (working copy)
34 34
          (self.outputFileEdit, SIGNAL("textChanged(const QString &)")),
35 35
          (self.targetSRSEdit, SIGNAL("textChanged(const QString &)"), self.targetSRSCheck),
36 36
          (self.selectTargetSRSButton, None, self.targetSRSCheck),
37
          (self.creationOptionsTable, [SIGNAL("cellValueChanged(int, int)"), SIGNAL("rowRemoved()")], self.creationGroupBox)
37
          (self.creationOptionsTable, [SIGNAL("cellValueChanged(int, int)"), SIGNAL("rowRemoved()")], self.creationGroupBox),
38
          (self.outsizeSpin, SIGNAL("valueChanged (int)"), self.outsizeCheck),
39
          (self.nodataSpin, SIGNAL("valueChanged (int)"), self.nodataCheck),
40
          (self.sdsCheck, SIGNAL("stateChanged(int)")),
41
          (self.srcwinEdit, SIGNAL("textChanged(const QString &)"), self.srcwinCheck),
42
          (self.prjwinEdit, SIGNAL("textChanged(const QString &)"), self.prjwinCheck)
38 43
        ]
39 44
      )
40 45

  
......
160 165
        for opt in self.creationOptionsTable.options():
161 166
          arguments << "-co"
162 167
          arguments << opt
168
      if self.outsizeCheck.isChecked():
169
          if self.outsizeSpin.value() != 0 and self.outsizeSpin.value() != 100:
170
              arguments << "-outsize"
171
              arguments << str(self.outsizeSpin.value()) + '%'
172
              arguments << str(self.outsizeSpin.value()) + '%'
173
      if self.expandCheck.isChecked():
174
          arguments << "-expand"
175
          arguments << self.expandCombo.currentText()
176
      if self.nodataCheck.isChecked():
177
          arguments << "-a_nodata"
178
          arguments << str(self.nodataSpin.value())
179
      if self.sdsCheck.isChecked():
180
          arguments << "-sds"
181
      if self.srcwinCheck.isChecked() and not self.srcwinEdit.text().isEmpty():
182
          #coordList = []
183
          coordList = self.srcwinEdit.text().split(" ")
184
          if len(coordList) == 4 and not coordList[3].isEmpty():
185
              try:
186
                  for x in coordList:
187
                      test = int(x)
188
              except ValueError:
189
                  #print "Coordinates must be integer numbers."
190
                  QMessageBox.critical(self,"Translate - srcwin", "Image coordinates (pixels) must be integer numbers.")
191
              else:
192
                  arguments << "-srcwin"
193
                  for x in coordList:
194
                      arguments << x
195
      if self.prjwinCheck.isChecked() and not self.prjwinEdit.text().isEmpty():
196
          #coordList = []
197
          coordList = self.prjwinEdit.text().split(" ")
198
          if len(coordList) == 4 and not coordList[3].isEmpty():
199
              try:
200
                  for x in coordList:
201
                      test = float(x)
202
              except ValueError:
203
                  #print "Coordinates must be integer numbers."
204
                  QMessageBox.critical(self,"Translate - prjwin", "Image coordinates (geographic) must be numbers.")
205
              else:
206
                  arguments << "-projwin"
207
                  for x in coordList:
208
                    arguments << x
163 209
      if self.isBatchEnabled():
164 210
        if self.formatCombo.currentIndex() != 0:
165 211
          arguments << "-of"
python/plugins/GdalTools/tools/widgetTranslate.ui (working copy)
6 6
   <rect>
7 7
    <x>0</x>
8 8
    <y>0</y>
9
    <width>335</width>
10
    <height>259</height>
9
    <width>358</width>
10
    <height>436</height>
11 11
   </rect>
12 12
  </property>
13 13
  <property name="sizePolicy">
......
39 39
       </property>
40 40
      </widget>
41 41
     </item>
42
     <item row="0" column="1">
42
     <item row="0" column="4">
43 43
      <layout class="QHBoxLayout" name="horizontalLayout_5">
44 44
       <item>
45 45
        <widget class="QComboBox" name="inputLayerCombo">
......
76 76
       </property>
77 77
      </widget>
78 78
     </item>
79
     <item row="1" column="1">
79
     <item row="1" column="4">
80 80
      <layout class="QHBoxLayout" name="horizontalLayout_2">
81 81
       <item>
82 82
        <widget class="QLineEdit" name="outputFileEdit">
......
104 104
       </property>
105 105
      </widget>
106 106
     </item>
107
     <item row="2" column="1">
107
     <item row="2" column="4">
108 108
      <widget class="QComboBox" name="formatCombo">
109 109
       <property name="sizePolicy">
110 110
        <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
......
121 121
       </property>
122 122
      </widget>
123 123
     </item>
124
     <item row="3" column="1">
124
     <item row="3" column="4">
125 125
      <layout class="QHBoxLayout" name="horizontalLayout">
126 126
       <item>
127 127
        <widget class="QLineEdit" name="targetSRSEdit">
......
142 142
       </item>
143 143
      </layout>
144 144
     </item>
145
     <item row="4" column="0">
146
      <widget class="QCheckBox" name="outsizeCheck">
147
       <property name="maximumSize">
148
        <size>
149
         <width>100</width>
150
         <height>16777215</height>
151
        </size>
152
       </property>
153
       <property name="toolTip">
154
        <string>Percentage to resize image. This will change pixel size/image resolution accordingly: 25% will create an image with pixels 4x larger.</string>
155
       </property>
156
       <property name="text">
157
        <string>Outsize (%):</string>
158
       </property>
159
      </widget>
160
     </item>
161
     <item row="4" column="4">
162
      <widget class="QSpinBox" name="outsizeSpin">
163
       <property name="maximumSize">
164
        <size>
165
         <width>75</width>
166
         <height>16777215</height>
167
        </size>
168
       </property>
169
       <property name="toolTip">
170
        <string>Percentage to resize image. This will change pixel size/image resolution accordingly: 25% will create an image with pixels 4x larger.</string>
171
       </property>
172
       <property name="maximum">
173
        <number>1000</number>
174
       </property>
175
      </widget>
176
     </item>
177
     <item row="6" column="0">
178
      <widget class="QCheckBox" name="nodataCheck">
179
       <property name="toolTip">
180
        <string>Assign a specified nodata value to output bands.</string>
181
       </property>
182
       <property name="text">
183
        <string>No data:</string>
184
       </property>
185
      </widget>
186
     </item>
187
     <item row="6" column="4">
188
      <widget class="QSpinBox" name="nodataSpin">
189
       <property name="maximumSize">
190
        <size>
191
         <width>75</width>
192
         <height>16777215</height>
193
        </size>
194
       </property>
195
       <property name="toolTip">
196
        <string>Assign a specified nodata value to output bands.</string>
197
       </property>
198
       <property name="maximum">
199
        <number>255</number>
200
       </property>
201
      </widget>
202
     </item>
203
     <item row="8" column="0">
204
      <widget class="QCheckBox" name="expandCheck">
205
       <property name="statusTip">
206
        <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>
207
       </property>
208
       <property name="text">
209
        <string>Expand:</string>
210
       </property>
211
      </widget>
212
     </item>
213
     <item row="8" column="4">
214
      <widget class="QComboBox" name="expandCombo">
215
       <property name="toolTip">
216
        <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>
217
       </property>
218
       <item>
219
        <property name="text">
220
         <string>gray</string>
221
        </property>
222
       </item>
223
       <item>
224
        <property name="text">
225
         <string>rgb</string>
226
        </property>
227
       </item>
228
       <item>
229
        <property name="text">
230
         <string>rgba</string>
231
        </property>
232
       </item>
233
      </widget>
234
     </item>
235
     <item row="9" column="0">
236
      <widget class="QCheckBox" name="srcwinCheck">
237
       <property name="toolTip">
238
        <string>Selects a subwindow from the source image for copying based on pixel/line location. (Enter Xoff Yoff Xsize Ysize.)</string>
239
       </property>
240
       <property name="text">
241
        <string>Srcwin:</string>
242
       </property>
243
      </widget>
244
     </item>
245
     <item row="9" column="4">
246
      <widget class="QLineEdit" name="srcwinEdit">
247
       <property name="toolTip">
248
        <string>Selects a subwindow from the source image for copying based on pixel/line location. (Enter Xoff Yoff Xsize Ysize.)</string>
249
       </property>
250
      </widget>
251
     </item>
252
     <item row="10" column="0">
253
      <widget class="QCheckBox" name="prjwinCheck">
254
       <property name="toolTip">
255
        <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>
256
       </property>
257
       <property name="text">
258
        <string>Prjwin:</string>
259
       </property>
260
      </widget>
261
     </item>
262
     <item row="10" column="4">
263
      <widget class="QLineEdit" name="prjwinEdit">
264
       <property name="toolTip">
265
        <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>
266
       </property>
267
      </widget>
268
     </item>
269
     <item row="11" column="0">
270
      <widget class="QCheckBox" name="sdsCheck">
271
       <property name="toolTip">
272
        <string>Copy all subdatasets of this file to individual output files. Use with formats like HDF or OGDI that have subdatasets.</string>
273
       </property>
274
       <property name="text">
275
        <string>Sds</string>
276
       </property>
277
      </widget>
278
     </item>
145 279
    </layout>
146 280
   </item>
147 281
   <item>