mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Make Extent and Extent CRS GDAL parameters optional
Specify what the default is when extent CRS is not specified. Allow using "auto" to have extent automatically set to min covering extent. Fixes #15685
This commit is contained in:
parent
ea0ad5dd21
commit
06976a2e87
@ -92,7 +92,8 @@ class warp(GdalAlgorithm):
|
||||
|
||||
if GdalUtils.version() >= 2000000:
|
||||
self.addParameter(ParameterCrs(self.EXT_CRS,
|
||||
self.tr('CRS of the raster extent'), ''))
|
||||
self.tr('CRS of the raster extent, leave blank for using Destination SRS'),
|
||||
optional=True))
|
||||
|
||||
params = []
|
||||
params.append(ParameterSelection(self.RTYPE,
|
||||
@ -136,7 +137,7 @@ class warp(GdalAlgorithm):
|
||||
compress = self.COMPRESSTYPE[self.getParameterValue(self.COMPRESS)]
|
||||
bigtiff = self.BIGTIFFTYPE[self.getParameterValue(self.BIGTIFF)]
|
||||
tfw = str(self.getParameterValue(self.TFW))
|
||||
rastext = str(self.getParameterValue(self.RAST_EXT))
|
||||
rastext = self.getParameterValue(self.RAST_EXT)
|
||||
rastext_crs = self.getParameterValue(self.EXT_CRS)
|
||||
|
||||
arguments = []
|
||||
@ -174,11 +175,9 @@ class warp(GdalAlgorithm):
|
||||
rastext.append(regionCoords[3])
|
||||
except IndexError:
|
||||
rastext = []
|
||||
if rastext:
|
||||
arguments.extend(rastext)
|
||||
|
||||
if GdalUtils.version() >= 2000000:
|
||||
if rastext and rastext_crs is not None:
|
||||
if rastext and rastext_crs:
|
||||
arguments.append('-te_srs')
|
||||
arguments.append(rastext_crs)
|
||||
|
||||
|
@ -348,7 +348,7 @@ class ParameterExtent(Parameter):
|
||||
# The value is a string in the form "xmin, xmax, ymin, ymax"
|
||||
|
||||
def setValue(self, value):
|
||||
if value is None:
|
||||
if not value:
|
||||
if not self.optional:
|
||||
return False
|
||||
self.value = None
|
||||
|
@ -59,7 +59,7 @@ class ExtentSelectionPanel(BASE, WIDGET):
|
||||
if self.param.optional:
|
||||
if hasattr(self.leText, 'setPlaceholderText'):
|
||||
self.leText.setPlaceholderText(
|
||||
self.tr('[Leave blank to use min covering extent]'))
|
||||
self.tr('[Use "auto" to use min covering extent]'))
|
||||
|
||||
self.btnSelect.clicked.connect(self.selectExtent)
|
||||
|
||||
@ -104,7 +104,7 @@ class ExtentSelectionPanel(BASE, WIDGET):
|
||||
popupmenu.exec_(QCursor.pos())
|
||||
|
||||
def useMinCoveringExtent(self):
|
||||
self.leText.setText('')
|
||||
self.leText.setText('auto')
|
||||
|
||||
def useLayerExtent(self):
|
||||
CANVAS_KEY = 'Use canvas extent'
|
||||
@ -153,7 +153,7 @@ class ExtentSelectionPanel(BASE, WIDGET):
|
||||
self.dialog.activateWindow()
|
||||
|
||||
def getValue(self):
|
||||
if str(self.leText.text()).strip() != '':
|
||||
if str(self.leText.text()).strip() == '':
|
||||
return str(self.leText.text())
|
||||
else:
|
||||
return None
|
||||
|
Loading…
x
Reference in New Issue
Block a user