Skip to content

Commit aef7734

Browse files
author
julien.malik@gmail.com
committed
[otb] add options for saving dem options
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@98 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
1 parent b862f9e commit aef7734

File tree

3 files changed

+28
-4
lines changed

3 files changed

+28
-4
lines changed

src/sextante/otb/OTBAlgorithm.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,15 @@ def defineCharacteristicsFromFile(self):
4646
try:
4747
line = line.strip("\n").strip()
4848
if line.startswith("Parameter"):
49-
self.addParameter(ParameterFactory.getFromString(line))
49+
param = ParameterFactory.getFromString(line)
50+
51+
# Hack for initializing the elevation parameters from Sextante configuration
52+
if param.name == "-elev.dem.path":
53+
param.default = OTBUtils.otbSRTMPath()
54+
if param.name == "-elev.dem.geoid":
55+
param.default = OTBUtils.otbGeoidPath()
56+
57+
self.addParameter(param)
5058
else:
5159
self.addOutput(OutputFactory.getFromString(line))
5260
line = lines.readline().strip("\n").strip()

src/sextante/otb/OTBAlgorithmProvider.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ def createAlgsList(self):
3838

3939
def initializeSettings(self):
4040
AlgorithmProvider.initializeSettings(self)
41-
SextanteConfig.addSetting(Setting("OTB", OTBUtils.OTB_FOLDER, "OTB folder", OTBUtils.otbPath()))
42-
SextanteConfig.addSetting(Setting("OTB", OTBUtils.OTB_LIB_FOLDER, "OTB library folder", OTBUtils.otbLibPath()))
41+
SextanteConfig.addSetting(Setting("OTB", OTBUtils.OTB_FOLDER, "OTB command line tools folder", OTBUtils.otbPath()))
42+
SextanteConfig.addSetting(Setting("OTB", OTBUtils.OTB_LIB_FOLDER, "OTB applications folder", OTBUtils.otbLibPath()))
43+
SextanteConfig.addSetting(Setting("OTB", OTBUtils.OTB_SRTM_FOLDER, "SRTM tiles folder", OTBUtils.otbSRTMPath()))
44+
SextanteConfig.addSetting(Setting("OTB", OTBUtils.OTB_GEOID_FILE, "Geoid file", OTBUtils.otbGeoidPath()))
4345

4446
def unload(self):
4547
AlgorithmProvider.unload(self)

src/sextante/otb/OTBUtils.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,37 @@ class OTBUtils:
88

99
OTB_FOLDER = "OTB_FOLDER"
1010
OTB_LIB_FOLDER = "OTB_LIB_FOLDER"
11+
OTB_SRTM_FOLDER = "OTB_SRTM_FOLDER"
12+
OTB_GEOID_FILE = "OTB_GEOID_FILE"
1113

1214
@staticmethod
1315
def otbPath():
1416
folder = SextanteConfig.getSetting(OTBUtils.OTB_FOLDER)
1517
if folder == None:
1618
folder =""
17-
1819
return folder
1920

2021
@staticmethod
2122
def otbLibPath():
2223
folder = SextanteConfig.getSetting(OTBUtils.OTB_LIB_FOLDER)
2324
if folder == None:
2425
folder =""
26+
return folder
2527

28+
@staticmethod
29+
def otbSRTMPath():
30+
folder = SextanteConfig.getSetting(OTBUtils.OTB_SRTM_FOLDER)
31+
if folder == None:
32+
folder =""
2633
return folder
2734

35+
@staticmethod
36+
def otbGeoidPath():
37+
filepath = SextanteConfig.getSetting(OTBUtils.OTB_GEOID_FILE)
38+
if filepath == None:
39+
filepath =""
40+
return filepath
41+
2842
@staticmethod
2943
def otbDescriptionPath():
3044
return os.path.join(os.path.dirname(__file__), "description")

0 commit comments

Comments
 (0)