Skip to content

Commit af8905f

Browse files
authoredMar 23, 2017
Merge pull request #4297 from rldhont/release-2_14-processing-saga-230
[Processing] Add SAGA LTR support in 2.14
2 parents 58bd0e1 + b1ae883 commit af8905f

File tree

250 files changed

+2299
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

250 files changed

+2299
-1
lines changed
 

‎python/plugins/processing/algs/saga/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ FILE(GLOB DESCR214_FILES description/2.1.4/*.txt)
55
FILE(GLOB DESCR220_FILES description/2.2.0/*.txt)
66
FILE(GLOB DESCR222_FILES description/2.2.2/*.txt)
77
FILE(GLOB DESCR223_FILES description/2.2.3/*.txt)
8+
FILE(GLOB DESCR230_FILES description/2.3.0/*.txt)
89
FILE(GLOB HELP_FILES help/*.rst)
910

1011
ADD_SUBDIRECTORY(ext)
@@ -16,4 +17,5 @@ PLUGIN_INSTALL(processing algs/saga/description/2.1.4 ${DESCR214_FILES})
1617
PLUGIN_INSTALL(processing algs/saga/description/2.2.0 ${DESCR220_FILES})
1718
PLUGIN_INSTALL(processing algs/saga/description/2.2.2 ${DESCR222_FILES})
1819
PLUGIN_INSTALL(processing algs/saga/description/2.2.3 ${DESCR223_FILES})
20+
PLUGIN_INSTALL(processing algs/saga/description/2.3.0 ${DESCR230_FILES})
1921
PLUGIN_INSTALL(processing algs/saga/help ${HELP_FILES})
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
SagaAlgorithm230.py
6+
---------------------
7+
Date : March 2017
8+
Copyright : (C) 2017 by Victor Olaya
9+
Email : volayaf at gmail dot com
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Victor Olaya'
21+
__date__ = 'March 2017'
22+
__copyright__ = '(C) 2017, Victor Olaya'
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
import os
29+
from SagaAlgorithm214 import SagaAlgorithm214
30+
from processing.tools import dataobjects
31+
from processing.tools.system import getTempFilenameInTempFolder
32+
33+
sessionExportedLayers = {}
34+
35+
36+
class SagaAlgorithm230(SagaAlgorithm214):
37+
38+
def getCopy(self):
39+
newone = SagaAlgorithm230(self.descriptionFile)
40+
newone.provider = self.provider
41+
return newone
42+
43+
def exportRasterLayer(self, source):
44+
global sessionExportedLayers
45+
if source in sessionExportedLayers:
46+
exportedLayer = sessionExportedLayers[source]
47+
if os.path.exists(exportedLayer):
48+
self.exportedLayers[source] = exportedLayer
49+
return None
50+
else:
51+
del sessionExportedLayers[source]
52+
layer = dataobjects.getObjectFromUri(source, False)
53+
if layer:
54+
filename = layer.name()
55+
else:
56+
filename = os.path.basename(source)
57+
validChars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:'
58+
filename = ''.join(c for c in filename if c in validChars)
59+
if len(filename) == 0:
60+
filename = 'layer'
61+
destFilename = getTempFilenameInTempFolder(filename + '.sgrd')
62+
self.exportedLayers[source] = destFilename
63+
sessionExportedLayers[source] = destFilename
64+
return 'io_gdal 0 -TRANSFORM 1 -RESAMPLING 0 -GRIDS "' + destFilename + '" -FILES "' + source + '"'

0 commit comments

Comments
 (0)
Please sign in to comment.