Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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
  • Loading branch information
brushtyler committed Dec 20, 2010
1 parent 96d75f8 commit 8ab9d1d
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 49 deletions.
4 changes: 2 additions & 2 deletions python/plugins/GdalTools/__init__.py
@@ -1,6 +1,6 @@
"""
/***************************************************************************
Name : GdalTools
Name : GdalTools
Description : Integrate gdal tools into qgis
Date : 17/Sep/09
copyright : (C) 2009 by Lorenzo Masini and Giuseppe Sucameli (Faunalia)
Expand All @@ -22,7 +22,7 @@ def name():
def description():
return "Integrate gdal tools into qgis"
def version():
return "Version 1.2.18"
return "Version 1.2.19"
def qgisMinimumVersion():
return "1.0"
def icon():
Expand Down
12 changes: 7 additions & 5 deletions python/plugins/GdalTools/tools/GdalTools_utils.py
Expand Up @@ -184,10 +184,12 @@ def getRasterSRS( parent, fileName ):
arr = processSRS.readAllStandardOutput()
processSRS.close()

if not arr.isEmpty():
info = QString( arr ).split( "\n" ).filter( "AUTHORITY" )
if info.count() == 0:
return QString()
if arr.isEmpty():
return QString()

info = QString( arr ).split( "\n" ).filter( "AUTHORITY" )
if info.count() == 0:
return QString()

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

# workaround for QGis < 1.5 (see #2376)
# separates multiple extensions that joined by a slash
if QGis.QGIS_VERSION[0:3] < "1.8":
if QGis.QGIS_VERSION[0:3] < "1.5":
formats = self.rastersFilter.split( ";;" )
self.rastersFilter = QString()
for f in formats:
Expand Down
8 changes: 5 additions & 3 deletions python/plugins/GdalTools/tools/doProximity.py
Expand Up @@ -26,7 +26,7 @@ def __init__(self, iface):
[
(self.inputLayerCombo, [SIGNAL("currentIndexChanged(int)"), SIGNAL("editTextChanged(const QString &)")] ),
(self.outputFileEdit, SIGNAL("textChanged(const QString &)")),
([self.valueSpin1, self.valueSpin2, self.valueSpin3], SIGNAL("valueChanged(int)"), self.valuesCheck),
(self.valuesEdit, SIGNAL("textChanged(const QString &)"), self.valuesCheck),
(self.distUnitsCombo, SIGNAL("currentIndexChanged(int)"), self.distUnitsCheck),
(self.maxDistSpin, SIGNAL("valueChanged(int)"), self.maxDistCheck),
(self.noDataSpin, SIGNAL("valueChanged(int)"), self.noDataCheck),
Expand Down Expand Up @@ -73,8 +73,10 @@ def getArguments(self):
arguments << self.inputLayerCombo.currentText()
arguments << self.outputFileEdit.text()
if self.valuesCheck.isChecked():
arguments << "-values"
arguments << ",".join([str(self.valueSpin1.value()), str(self.valueSpin2.value()), str(self.valueSpin3.value())])
values = self.valuesEdit.text().trimmed()
if not values.isEmpty():
arguments << "-values"
arguments << values.replace(' ', ',')
if self.distUnitsCheck.isChecked() and self.distUnitsCombo.currentIndex() >= 0:
arguments << "-distunits"
arguments << self.distUnitsCombo.currentText()
Expand Down
13 changes: 10 additions & 3 deletions python/plugins/GdalTools/tools/doTranslate.py
Expand Up @@ -132,9 +132,16 @@ def fillInputDir( self ):
workDir = QDir( inputDir )
workDir.setFilter( QDir.Files | QDir.NoSymLinks | QDir.NoDotAndDotDot )
workDir.setNameFilters( filter )
if workDir.entryList().count() > 0:
fl = inputDir + "/" + workDir.entryList()[ 0 ]
self.targetSRSEdit.setText( Utils.getRasterSRS( self, fl ) )

# search for a valid SRS, then use it as default target SRS
srs = QString()
for fname in workDir.entryList():
fl = inputDir + "/" + fname
srs = Utils.getRasterSRS( self, fl )
if not srs.isEmpty():
break
self.targetSRSEdit.setText( srs )


def fillOutputFileEdit(self):
lastUsedFilter = Utils.FileFilter.lastUsedRasterFilter()
Expand Down
12 changes: 5 additions & 7 deletions python/plugins/GdalTools/tools/doWarp.py
Expand Up @@ -180,13 +180,11 @@ def getArguments(self):
arguments << str( self.heightSpin.value() )
if self.multithreadCheck.isChecked():
arguments << "-multi"
if self.noDataCheck.isChecked() and not self.noDataEdit.text().isEmpty():
arguments << "-dstnodata"
nd = self.noDataEdit.text().simplified()
if nd.contains( " " ):
arguments << '"' + nd + '"'
else:
arguments << nd
if self.noDataCheck.isChecked():
nodata = self.noDataEdit.text().trimmed()
if not nodata.isEmpty():
arguments << "-dstnodata"
arguments << nodata
if self.isBatchEnabled():
return arguments

Expand Down
36 changes: 9 additions & 27 deletions python/plugins/GdalTools/tools/widgetProximity.ui
Expand Up @@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>356</width>
<height>257</height>
<width>327</width>
<height>253</height>
</rect>
</property>
<property name="sizePolicy">
Expand Down Expand Up @@ -90,31 +90,6 @@
</property>
</widget>
</item>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="valueSpin1">
<property name="maximum">
<number>65000</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="valueSpin2">
<property name="maximum">
<number>65000</number>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="valueSpin3">
<property name="maximum">
<number>65000</number>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="distUnitsCheck">
<property name="text">
Expand Down Expand Up @@ -181,6 +156,13 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="valuesEdit">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
Expand Down
8 changes: 6 additions & 2 deletions python/plugins/GdalTools/tools/widgetWarp.ui
Expand Up @@ -192,12 +192,16 @@
<item row="5" column="0">
<widget class="QCheckBox" name="noDataCheck">
<property name="text">
<string>Set no data value</string>
<string>No data values</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLineEdit" name="noDataEdit"/>
<widget class="QLineEdit" name="noDataEdit">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="cacheCheck">
Expand Down

0 comments on commit 8ab9d1d

Please sign in to comment.