예제 #1
0
    def accept(self):
        AlgorithmDialog.accept(self)
        # handling output when to be loaded
        for out in self.alg.outputs:
            if isinstance(out, (OutputRaster)) and out.open:
                layer = dataobjects.getObjectFromUri(out.value)
                if layer:
                    # test if an explicite name has been given for the layer
                    name = self.alg.name
                    if (out.name in self.alg.namedOutputs):
                      name = self.alg.namedOutputs[out.name]
                    layer.setName(name)
                    ChloeUtils.setLayerSymbology(layer, 'continuous.qml')
                    iface.legendInterface().refreshLayerSymbology(layer)
            elif isinstance(out, (OutputTable)) and out.open:
              table = dataobjects.getObjectFromUri(out.value)
              if table:
                name = self.alg.name + '_csv'
                if (out.name in self.alg.namedOutputs):
                  name = self.alg.namedOutputs[out.name]
                table.setName(name)
            
            if isinstance(out, OutputDirectory):

                # === import all asc for multi algorithm
                open_all_asc = self.alg.getParameterValue('OPEN_ALL_ASC')
                output_dir = self.alg.getOutputValue('OUTPUT_DIR').encode('utf-8')
                if self.alg.open_all_asc:
                    for file in glob.glob(output_dir+"/*.asc"):
                        load_it = QgsRasterLayer(file, os.path.splitext(os.path.basename(file))[0])
                        QgsMapLayerRegistry.instance().addMapLayer(load_it)
                        ChloeUtils.setLayerSymbology(load_it, 'continuous.qml')

        self.close()
예제 #2
0
    def runalg_parameters(self):
        dlg = self.alg.getCustomParametersDialog()
        if not dlg:
            dlg = AlgorithmDialog(self.alg)

        # Hack to handle that hacky code...
        dlg.setParamValues = lambda: True
        dlg.show()
        dlg.accept()
        while not dlg.executed:
            time.sleep(.5)
예제 #3
0
파일: test.py 프로젝트: HeatherHillers/QGIS
    def runalg_parameters(self):
        dlg = self.alg.getCustomParametersDialog()
        if not dlg:
            dlg = AlgorithmDialog(self.alg)

        # Hack to handle that hacky code...
        dlg.setParamValues = lambda: True
        dlg.show()
        dlg.accept()
        while not dlg.executed:
            time.sleep(.5)