def defineCharacteristicsFromFile(self): lines = open(self.descriptionFile) line = lines.readline().strip("\n").strip() self.appkey = line line = lines.readline().strip("\n").strip() self.cliName = line line = lines.readline().strip("\n").strip() self.name = line line = lines.readline().strip("\n").strip() self.group = line while line != "": try: line = line.strip("\n").strip() if line.startswith("Parameter"): param = ParameterFactory.getFromString(line) # Hack for initializing the elevation parameters from Sextante configuration if param.name == "-elev.dem.path": param.default = OTBUtils.otbSRTMPath() if param.name == "-elev.dem.geoid": param.default = OTBUtils.otbGeoidPath() self.addParameter(param) elif line.startswith("Extent"): self.addParameter( ParameterExtent(self.REGION_OF_INTEREST, "Region of interest", "0,1,0,1")) self.hasROI = True else: self.addOutput(OutputFactory.getFromString(line)) line = lines.readline().strip("\n").strip() except Exception, e: SextanteLog.addToLog( SextanteLog.LOG_ERROR, "Could not open OTB algorithm: " + self.descriptionFile + "\n" + line) raise e
def defineCharacteristicsFromFile(self): lines = open(self.descriptionFile) line = lines.readline().strip("\n").strip() self.appkey = line line = lines.readline().strip("\n").strip() self.cliName = line line = lines.readline().strip("\n").strip() self.name = line line = lines.readline().strip("\n").strip() self.group = line while line != "": try: line = line.strip("\n").strip() if line.startswith("Parameter"): param = ParameterFactory.getFromString(line) # Hack for initializing the elevation parameters from Sextante configuration if param.name == "-elev.dem.path": param.default = OTBUtils.otbSRTMPath() if param.name == "-elev.dem.geoid": param.default = OTBUtils.otbGeoidPath() self.addParameter(param) elif line.startswith("Extent"): self.addParameter(ParameterExtent(self.REGION_OF_INTEREST, "Region of interest", "0,1,0,1")) self.hasROI = True else: self.addOutput(OutputFactory.getFromString(line)) line = lines.readline().strip("\n").strip() except Exception,e: SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open OTB algorithm: " + self.descriptionFile + "\n" + line) raise e
def initializeSettings(self): AlgorithmProvider.initializeSettings(self) SextanteConfig.addSetting( Setting(self.getDescription(), OTBUtils.OTB_FOLDER, "OTB command line tools folder", OTBUtils.otbPath())) SextanteConfig.addSetting( Setting(self.getDescription(), OTBUtils.OTB_LIB_FOLDER, "OTB applications folder", OTBUtils.otbLibPath())) SextanteConfig.addSetting( Setting(self.getDescription(), OTBUtils.OTB_SRTM_FOLDER, "SRTM tiles folder", OTBUtils.otbSRTMPath())) SextanteConfig.addSetting( Setting(self.getDescription(), OTBUtils.OTB_GEOID_FILE, "Geoid file", OTBUtils.otbGeoidPath()))
def initializeSettings(self): AlgorithmProvider.initializeSettings(self) SextanteConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_FOLDER, "OTB command line tools folder", OTBUtils.otbPath())) SextanteConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_LIB_FOLDER, "OTB applications folder", OTBUtils.otbLibPath())) SextanteConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_SRTM_FOLDER, "SRTM tiles folder", OTBUtils.otbSRTMPath())) SextanteConfig.addSetting(Setting(self.getDescription(), OTBUtils.OTB_GEOID_FILE, "Geoid file", OTBUtils.otbGeoidPath()))