示例#1
0
 def processAlgorithm(self, progress):
     gpfXml = self.toXml(forExecution=True)
     loglines = []
     loglines.append("GPF Graph")
     for line in gpfXml.splitlines():
         loglines.append(line)
     ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)
     GPFUtils.executeGpf(
         GPFUtils.getKeyFromProviderName(self.provider.getName()), gpfXml,
         progress)
示例#2
0
    def processAlgorithm(self, key, progress):
        # Create a GFP for execution with SNAP's GPT
        graph = ET.Element("graph", {'id':self.operator+'_gpf'})
        version = ET.SubElement(graph, "version")
        version.text = "1.0"

        # Add node with this algorithm's operator
        graph = self.addGPFNode(graph)

        # Add outputs as write nodes (except for Write operator)
        if self.operator != "Write" and len(self.outputs) >= 1:
            for output in self.outputs:
                graph = self.addWriteNode(graph, output, key)

        # Log the GPF
        loglines = []
        loglines.append("GPF Graph")
        GPFUtils.indentXML(graph)
        for line in ET.tostring(graph).splitlines():
            loglines.append(line)
        ProcessingLog.addToLog(ProcessingLog.LOG_INFO, loglines)

        # Execute the GPF
        GPFUtils.executeGpf(key, ET.tostring(graph), progress)