mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
[processing]fixed issue with temporal filename
(was previously solved but reverted)
This commit is contained in:
parent
4987f4ab4e
commit
1882bbc301
@ -95,6 +95,29 @@ def getTables():
|
||||
tables.append(layer)
|
||||
return tables
|
||||
|
||||
def extent(layers):
|
||||
first = True
|
||||
for layer in layers:
|
||||
if not isinstance(layer, (QgsRasterLayer, QgsVectorLayer)):
|
||||
layer = getObjectFromUri(layer)
|
||||
if layer is None:
|
||||
continue
|
||||
if first:
|
||||
xmin = layer.extent().xMinimum()
|
||||
xmax = layer.extent().xMaximum()
|
||||
ymin = layer.extent().yMinimum()
|
||||
ymax = layer.extent().yMaximum()
|
||||
else:
|
||||
xmin = min(xmin, layer.extent().xMinimum())
|
||||
xmax = max(xmax, layer.extent().xMaximum())
|
||||
ymin = min(ymin, layer.extent().yMinimum())
|
||||
ymax = max(ymax, layer.extent().yMaximum())
|
||||
first = False
|
||||
if first:
|
||||
return "0,0,0,0"
|
||||
else:
|
||||
return str(xmin) + "," + str(xmax) + "," + str(ymin) + "," + str(ymax)
|
||||
|
||||
|
||||
def loadList(layers):
|
||||
for layer in layers:
|
||||
|
@ -25,7 +25,6 @@ __copyright__ = '(C) 2013, Victor Olaya'
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
from qgis.core import *
|
||||
from processing.tools import dataobjects
|
||||
from processing.core.Processing import Processing
|
||||
from processing.parameters.ParameterSelection import ParameterSelection
|
||||
from processing.gui.Postprocessing import Postprocessing
|
||||
@ -70,28 +69,5 @@ def runalg(algOrName, *args):
|
||||
def runandload(name, *args):
|
||||
return Processing.runAlgorithm(name, Postprocessing.handleAlgorithmResults, *args)
|
||||
|
||||
def extent(layers):
|
||||
first = True
|
||||
for layer in layers:
|
||||
if not isinstance(layer, (QgsRasterLayer, QgsVectorLayer)):
|
||||
layer = dataobjects.getObjectFromUri(layer)
|
||||
if layer is None:
|
||||
continue
|
||||
if first:
|
||||
xmin = layer.extent().xMinimum()
|
||||
xmax = layer.extent().xMaximum()
|
||||
ymin = layer.extent().yMinimum()
|
||||
ymax = layer.extent().yMaximum()
|
||||
else:
|
||||
xmin = min(xmin, layer.extent().xMinimum())
|
||||
xmax = max(xmax, layer.extent().xMaximum())
|
||||
ymin = min(ymin, layer.extent().yMinimum())
|
||||
ymax = max(ymax, layer.extent().yMaximum())
|
||||
first = False
|
||||
if first:
|
||||
return "0,0,0,0"
|
||||
else:
|
||||
return str(xmin) + "," + str(xmax) + "," + str(ymin) + "," + str(ymax)
|
||||
|
||||
|
||||
|
||||
|
@ -68,9 +68,16 @@ def getTempFilenameInTempFolder(basename):
|
||||
path = tempFolder()
|
||||
path = os.path.join(path, str(uuid.uuid4()).replace("-",""))
|
||||
mkdir(path)
|
||||
basename = removeInvalidChars(basename)
|
||||
filename = os.path.join(path, basename)
|
||||
return filename
|
||||
|
||||
def removeInvalidChars(string):
|
||||
validChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:"
|
||||
string = ''.join(c for c in string if c in validChars)
|
||||
return string
|
||||
|
||||
|
||||
NUM_EXPORTED = 1
|
||||
|
||||
def getNumExportedLayers():
|
||||
|
Loading…
x
Reference in New Issue
Block a user