Skip to content
Permalink
Browse files

[processing]fixed issue with temporal filename

(was previously solved but reverted)
  • Loading branch information
volaya committed Sep 14, 2013
1 parent 4987f4a commit 1882bbc30117fef8aafc6ffeab0ab61518db292c
@@ -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 @@
__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():

0 comments on commit 1882bbc

Please sign in to comment.
You can’t perform that action at this time.