Skip to content

Commit 8ab9d1d

Browse files
author
brushtyler
committed
allow multiple values in proximity tool,
allow multiple no-data values in warp tool, fixed error in retrieving srs git-svn-id: http://svn.osgeo.org/qgis/trunk@14938 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 96d75f8 commit 8ab9d1d

File tree

7 files changed

+44
-49
lines changed

7 files changed

+44
-49
lines changed

python/plugins/GdalTools/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
/***************************************************************************
3-
Name : GdalTools
3+
Name : GdalTools
44
Description : Integrate gdal tools into qgis
55
Date : 17/Sep/09
66
copyright : (C) 2009 by Lorenzo Masini and Giuseppe Sucameli (Faunalia)
@@ -22,7 +22,7 @@ def name():
2222
def description():
2323
return "Integrate gdal tools into qgis"
2424
def version():
25-
return "Version 1.2.18"
25+
return "Version 1.2.19"
2626
def qgisMinimumVersion():
2727
return "1.0"
2828
def icon():

python/plugins/GdalTools/tools/GdalTools_utils.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -184,10 +184,12 @@ def getRasterSRS( parent, fileName ):
184184
arr = processSRS.readAllStandardOutput()
185185
processSRS.close()
186186

187-
if not arr.isEmpty():
188-
info = QString( arr ).split( "\n" ).filter( "AUTHORITY" )
189-
if info.count() == 0:
190-
return QString()
187+
if arr.isEmpty():
188+
return QString()
189+
190+
info = QString( arr ).split( "\n" ).filter( "AUTHORITY" )
191+
if info.count() == 0:
192+
return QString()
191193

192194
srs = info[ info.count() - 1 ]
193195
srs = srs.simplified().remove( "AUTHORITY[" )
@@ -294,7 +296,7 @@ def allRastersFilter(self):
294296

295297
# workaround for QGis < 1.5 (see #2376)
296298
# separates multiple extensions that joined by a slash
297-
if QGis.QGIS_VERSION[0:3] < "1.8":
299+
if QGis.QGIS_VERSION[0:3] < "1.5":
298300
formats = self.rastersFilter.split( ";;" )
299301
self.rastersFilter = QString()
300302
for f in formats:

python/plugins/GdalTools/tools/doProximity.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def __init__(self, iface):
2626
[
2727
(self.inputLayerCombo, [SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)")] ),
2828
(self.outputFileEdit, SIGNAL("textChanged(const QString &)")),
29-
([self.valueSpin1, self.valueSpin2, self.valueSpin3], SIGNAL("valueChanged(int)"), self.valuesCheck),
29+
(self.valuesEdit, SIGNAL("textChanged(const QString &)"), self.valuesCheck),
3030
(self.distUnitsCombo, SIGNAL("currentIndexChanged(int)"), self.distUnitsCheck),
3131
(self.maxDistSpin, SIGNAL("valueChanged(int)"), self.maxDistCheck),
3232
(self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck),
@@ -73,8 +73,10 @@ def getArguments(self):
7373
arguments << self.inputLayerCombo.currentText()
7474
arguments << self.outputFileEdit.text()
7575
if self.valuesCheck.isChecked():
76-
arguments << "-values"
77-
arguments << ",".join([str(self.valueSpin1.value()), str(self.valueSpin2.value()), str(self.valueSpin3.value())])
76+
values = self.valuesEdit.text().trimmed()
77+
if not values.isEmpty():
78+
arguments << "-values"
79+
arguments << values.replace(' ', ',')
7880
if self.distUnitsCheck.isChecked() and self.distUnitsCombo.currentIndex() >= 0:
7981
arguments << "-distunits"
8082
arguments << self.distUnitsCombo.currentText()

python/plugins/GdalTools/tools/doTranslate.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,16 @@ def fillInputDir( self ):
132132
workDir = QDir( inputDir )
133133
workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot )
134134
workDir.setNameFilters( filter )
135-
if workDir.entryList().count() > 0:
136-
fl = inputDir + "/" + workDir.entryList()[ 0 ]
137-
self.targetSRSEdit.setText( Utils.getRasterSRS( self, fl ) )
135+
136+
# search for a valid SRS, then use it as default target SRS
137+
srs = QString()
138+
for fname in workDir.entryList():
139+
fl = inputDir + "/" + fname
140+
srs = Utils.getRasterSRS( self, fl )
141+
if not srs.isEmpty():
142+
break
143+
self.targetSRSEdit.setText( srs )
144+
138145

139146
def fillOutputFileEdit(self):
140147
lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter()

python/plugins/GdalTools/tools/doWarp.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -180,13 +180,11 @@ def getArguments(self):
180180
arguments << str( self.heightSpin.value() )
181181
if self.multithreadCheck.isChecked():
182182
arguments << "-multi"
183-
if self.noDataCheck.isChecked() and not self.noDataEdit.text().isEmpty():
184-
arguments << "-dstnodata"
185-
nd = self.noDataEdit.text().simplified()
186-
if nd.contains( " " ):
187-
arguments << '"' + nd + '"'
188-
else:
189-
arguments << nd
183+
if self.noDataCheck.isChecked():
184+
nodata = self.noDataEdit.text().trimmed()
185+
if not nodata.isEmpty():
186+
arguments << "-dstnodata"
187+
arguments << nodata
190188
if self.isBatchEnabled():
191189
return arguments
192190

python/plugins/GdalTools/tools/widgetProximity.ui

+9-27
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
<rect>
77
<x>0</x>
88
<y>0</y>
9-
<width>356</width>
10-
<height>257</height>
9+
<width>327</width>
10+
<height>253</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -90,31 +90,6 @@
9090
</property>
9191
</widget>
9292
</item>
93-
<item row="2" column="1">
94-
<layout class="QHBoxLayout" name="horizontalLayout">
95-
<item>
96-
<widget class="QSpinBox" name="valueSpin1">
97-
<property name="maximum">
98-
<number>65000</number>
99-
</property>
100-
</widget>
101-
</item>
102-
<item>
103-
<widget class="QSpinBox" name="valueSpin2">
104-
<property name="maximum">
105-
<number>65000</number>
106-
</property>
107-
</widget>
108-
</item>
109-
<item>
110-
<widget class="QSpinBox" name="valueSpin3">
111-
<property name="maximum">
112-
<number>65000</number>
113-
</property>
114-
</widget>
115-
</item>
116-
</layout>
117-
</item>
11893
<item row="3" column="0">
11994
<widget class="QCheckBox" name="distUnitsCheck">
12095
<property name="text">
@@ -181,6 +156,13 @@
181156
</property>
182157
</widget>
183158
</item>
159+
<item row="2" column="1">
160+
<widget class="QLineEdit" name="valuesEdit">
161+
<property name="text">
162+
<string>0</string>
163+
</property>
164+
</widget>
165+
</item>
184166
</layout>
185167
</item>
186168
</layout>

python/plugins/GdalTools/tools/widgetWarp.ui

+6-2
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,16 @@
192192
<item row="5" column="0">
193193
<widget class="QCheckBox" name="noDataCheck">
194194
<property name="text">
195-
<string>Set no data value</string>
195+
<string>No data values</string>
196196
</property>
197197
</widget>
198198
</item>
199199
<item row="5" column="1">
200-
<widget class="QLineEdit" name="noDataEdit"/>
200+
<widget class="QLineEdit" name="noDataEdit">
201+
<property name="text">
202+
<string>0</string>
203+
</property>
204+
</widget>
201205
</item>
202206
<item row="6" column="0">
203207
<widget class="QCheckBox" name="cacheCheck">

0 commit comments

Comments
 (0)