當前位置: 首頁>>代碼示例>>Python>>正文


Python OutputFactory.getFromString方法代碼示例

本文整理匯總了Python中sextante.outputs.OutputFactory.OutputFactory.getFromString方法的典型用法代碼示例。如果您正苦於以下問題:Python OutputFactory.getFromString方法的具體用法?Python OutputFactory.getFromString怎麽用?Python OutputFactory.getFromString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在sextante.outputs.OutputFactory.OutputFactory的用法示例。


在下文中一共展示了OutputFactory.getFromString方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: defineCharacteristicsFromFile

# 需要導入模塊: from sextante.outputs.OutputFactory import OutputFactory [as 別名]
# 或者: from sextante.outputs.OutputFactory.OutputFactory import getFromString [as 別名]
 def defineCharacteristicsFromFile(self):
     lines = open(self.descriptionFile)
     line = lines.readline().strip("\n").strip()
     self.grassName = line
     line = lines.readline().strip("\n").strip()
     self.name = line
     line = lines.readline().strip("\n").strip()
     self.group = line
     hasRasterOutput = False
     hasVectorOutput = False
     while line != "":
         try:
             line = line.strip("\n").strip()
             if line.startswith("Parameter"):
                 parameter = ParameterFactory.getFromString(line);
                 self.addParameter(parameter)
                 if isinstance(parameter, ParameterVector):
                    hasVectorOutput = True
                 if isinstance(parameter, ParameterMultipleInput) and parameter.datatype < 3:
                    hasVectorOutput = True                        
             elif line.startswith("*Parameter"):
                 param = ParameterFactory.getFromString(line[1:])
                 param.isAdvanced = True
                 self.addParameter(param)
             else:
                 output = OutputFactory.getFromString(line)
                 self.addOutput(output);
                 if isinstance(output, OutputRaster):
                     hasRasterOutput = True
             line = lines.readline().strip("\n").strip()
         except Exception,e:
             SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not open GRASS algorithm: " + self.descriptionFile + "\n" + line)
             raise e
開發者ID:tomyun,項目名稱:Quantum-GIS,代碼行數:35,代碼來源:GrassAlgorithm.py

示例2: defineCharacteristicsFromFile

# 需要導入模塊: from sextante.outputs.OutputFactory import OutputFactory [as 別名]
# 或者: from sextante.outputs.OutputFactory.OutputFactory import getFromString [as 別名]
 def defineCharacteristicsFromFile(self):
     lines = open(self.descriptionFile)
     line = lines.readline().strip("\n").strip()
     self.name = line
     if "|" in self.name:
         tokens = self.name.split("|")
         self.name = tokens[0]
         self.cmdname = tokens[1]
     else:
         self.cmdname = self.name
     line = lines.readline().strip("\n").strip()
     self.undecoratedGroup = line
     self.group = SagaGroupNameDecorator.getDecoratedName(self.undecoratedGroup)
     while line != "":
         line = line.strip("\n").strip()
         if line.startswith("Parameter"):
             self.addParameter(ParameterFactory.getFromString(line))
         elif line.startswith("DontResample"):
             self.resample = False
         elif line.startswith("Extent"): #An extent parameter that wraps 4 SAGA numerical parameters
             self.extentParamNames = line[6:].strip().split(" ")
             self.addParameter(ParameterExtent(self.OUTPUT_EXTENT, "Output extent", "0,1,0,1"))
         else:
             self.addOutput(OutputFactory.getFromString(line))
         line = lines.readline().strip("\n").strip()
     lines.close()
開發者ID:badcock4412,項目名稱:Quantum-GIS,代碼行數:28,代碼來源:SagaAlgorithm.py

示例3: defineCharacteristicsFromFile

# 需要導入模塊: from sextante.outputs.OutputFactory import OutputFactory [as 別名]
# 或者: from sextante.outputs.OutputFactory.OutputFactory import getFromString [as 別名]
    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
開發者ID:mokerjoke,項目名稱:Quantum-GIS,代碼行數:33,代碼來源:OTBAlgorithm.py

示例4: processDescriptionParameterLine

# 需要導入模塊: from sextante.outputs.OutputFactory import OutputFactory [as 別名]
# 或者: from sextante.outputs.OutputFactory.OutputFactory import getFromString [as 別名]
 def processDescriptionParameterLine(self, line):
     try:
         if line.startswith("Parameter"):
             self.addParameter(ParameterFactory.getFromString(line))
         elif line.startswith("*Parameter"):
             param = ParameterFactory.getFromString(line[1:])
             param.isAdvanced = True
             self.addParameter(param)
         else:
             self.addOutput(OutputFactory.getFromString(line))
     except Exception:
         raise WrongScriptException("Could not load script:" + self.descriptionFile + ".\n Problem with line \"" + line + "\"")
開發者ID:Adam-Brown,項目名稱:Quantum-GIS,代碼行數:14,代碼來源:ScriptAlgorithm.py

示例5: defineCharacteristicsFromFile

# 需要導入模塊: from sextante.outputs.OutputFactory import OutputFactory [as 別名]
# 或者: from sextante.outputs.OutputFactory.OutputFactory import getFromString [as 別名]
 def defineCharacteristicsFromFile(self):
     lines = open(self.descriptionFile)
     line = lines.readline().strip("\n").strip()
     self.name = line
     line = lines.readline().strip("\n").strip()
     self.cmdName = 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)
               self.addParameter(param)
           else:
               self.addOutput(OutputFactory.getFromString(line))
           line = lines.readline().strip("\n").strip()
       except Exception, e:
           SextanteLog.addToLog(SextanteLog.LOG_ERROR, "Could not load TauDEM algorithm: " + self.descriptionFile + "\n" + line)
           raise e
開發者ID:Adam-Brown,項目名稱:Quantum-GIS,代碼行數:22,代碼來源:TauDEMAlgorithm.py


注:本文中的sextante.outputs.OutputFactory.OutputFactory.getFromString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。