Example #1
0
 def __init__(self, descriptionfile):
     GeoAlgorithm.__init__(self)
     self.descriptionFile = descriptionfile
     self.defineCharacteristicsFromFile()
     self.numExportedLayers = 0
     #GRASS console output, needed to do postprocessing in case GRASS dumps results to the console
     self.consoleOutput = []
Example #2
0
 def __init__(self, descriptionfile):
     GeoAlgorithm.__init__(self)
     self.roiFile = None
     self.descriptionFile = descriptionfile
     self.defineCharacteristicsFromFile()
     self.numExportedLayers = 0
     self.hasROI = None;
Example #3
0
 def __init__(self, descriptionfile):
     GeoAlgorithm.__init__(self)
     self.hardcodedStrings = []
     self.descriptionFile = descriptionfile
     self.defineCharacteristicsFromFile()
     self.numExportedLayers = 0
     self._icon = None
Example #4
0
 def __init__(self, descriptionfile):
     GeoAlgorithm.__init__(self)
     self.hardcodedStrings = []
     self.allowUnmatchingGridExtents = False
     self.descriptionFile = descriptionfile
     self.defineCharacteristicsFromFile()
     self._icon = None
 def __init__(self, descriptionFile):
     self.descriptionFile = descriptionFile
     with open(self.descriptionFile) as f:
         self.description = json.load(f)
     GeoAlgorithm.__init__(self)
     self._group = ''
     self._name = ''
    def __init__(self):
        self.slotOsmParser = SLOT("osmParser()")

        self.FILE = 'FILE'
        self.TABLE = 'TABLE'

        GeoAlgorithm.__init__(self)
Example #7
0
    def __init__(self):
        self.NAME_FILE = 'NAME'
        self.OUTPUT_INI = 'INI'

        self.__queries = {}
        self.__names = []

        GeoAlgorithm.__init__(self)
Example #8
0
 def __init__(self, descriptionFile, script=None):
     GeoAlgorithm.__init__(self)
     self.script = script
     self.descriptionFile = descriptionFile
     if script is not None:
         self.defineCharacteristicsFromScript()
     if descriptionFile is not None:
         self.defineCharacteristicsFromFile()
Example #9
0
 def __init__(self):
     self.FIELD_KEY = 'FIELD_KEY'
     self.FIELD_VALUE = 'FIELD_VALUE'
     self.FIELD_EXTENT = 'FIELD_EXTENT'
     self.FIELD_NOMINATIM = 'FIELD_NOMINATIM'
     self.FIELD_OSM_OBJECTS = 'FIELD_OSM_OBJECTS'
     self.FIELD_TIMEOUT = 'FIELD_TIMEOUT'
     self.OUTPUT_QUERY = 'OUTPUT_QUERY'
     GeoAlgorithm.__init__(self)
 def __init__(self):
     GeoAlgorithm.__init__(self)
     # holds the algorithm object, the mode (normal or batch) and instructions
     self._steps = list()
     self.name = ''
     self.group = ''
     self.descriptionFile = None
     self.parameters = [ParameterString("Info", "Workflow can not be run as a batch process. Please close this dialog and execute as a normal process.", "", False)]
     self.showInModeler = False
Example #11
0
 def __init__(self, descriptionfile):
     self.resample = True #True if it should resample
                          #in case several non-matching raster layers are used as input
     GeoAlgorithm.__init__(self)
     self.descriptionFile = descriptionfile
     self.defineCharacteristicsFromFile()
     if self.resample:
         #reconsider resampling policy now that we know the input parameters
         self.resample = self.setResamplingPolicy()
Example #12
0
    def __init__(self):
        self.INI_FILE_PATH = 'QUERY_FILE'
        self.LAYERS = ['multipolygons', 'multilinestrings', 'lines', 'points']
        self.WHITE_LIST = {}

        for layer in self.LAYERS:
            self.WHITE_LIST[layer] = 'WHITE_LIST_' + layer

        GeoAlgorithm.__init__(self)
Example #13
0
 def __init__(self, descriptionFile, script=None):
     '''The script parameter can be used to directly pass the code of the script without a file.
     This is to be used from the script edition dialog, but should not be used in other cases'''
     GeoAlgorithm.__init__(self)
     self.script = script
     self.descriptionFile = descriptionFile
     if script is not None:
         self.defineCharacteristicsFromScript()
     if descriptionFile is not None:
         self.defineCharacteristicsFromFile()
Example #14
0
    def __init__(self):
        self.name = self.tr('Model', 'ModelerAlgorithm')
        # The dialog where this model is being edited
        self.modelerdialog = None
        self.descriptionFile = None
        self.helpContent = {}

        # Geoalgorithms in this model. A dict of Algorithm objects, with names as keys
        self.algs = {}

        # Input parameters. A dict of Input objects, with names as keys
        self.inputs = {}
        GeoAlgorithm.__init__(self)
Example #15
0
    def __init__(self, descriptionfile):
        GeoAlgorithm.__init__(self)
        self.hardcodedStrings = []
        self.descriptionFile = descriptionfile
        self.defineCharacteristicsFromFile()
        self.numExportedLayers = 0
        self.uniqueSufix = unicode(uuid.uuid4()).replace('-', '')

        # Use the ext mechanism
        name = self.commandLineName().replace('.', '_')[len('grass7:'):]
        try:
            self.module = importlib.import_module('processing.algs.grass7.ext.' + name)
        except ImportError:
            self.module = None
Example #16
0
    def __init__(self):
        self.slotOsmParser = SLOT("osmParser()")

        self.FILE = 'FILE'

        self.LAYERS = ['multipolygons', 'multilinestrings', 'lines', 'points']
        self.WHITE_LIST = {}
        self.OUTPUT_LAYERS = {}
        for layer in self.LAYERS:
            self.WHITE_LIST[layer] = 'WHITE_LIST_' + layer
            self.OUTPUT_LAYERS[layer] = layer + "_LAYER"

        self.progress = None

        GeoAlgorithm.__init__(self)
Example #17
0
    def __init__(self, descriptionFile, script=None):
        """The script parameter can be used to directly pass the code
        of the script without a file.

        This is to be used from the script edition dialog, but should
        not be used in other cases.
        """

        GeoAlgorithm.__init__(self)
        self._icon = QIcon(os.path.join(pluginPath, 'images', 'script.png'))

        self.script = script
        self.allowEdit = True
        self.noCRSWarning = False
        self.descriptionFile = descriptionFile
        if script is not None:
            self.defineCharacteristicsFromScript()
        if descriptionFile is not None:
            self.defineCharacteristicsFromFile()
Example #18
0
    def __init__(self, descriptionFile, script=None):
        """The script parameter can be used to directly pass the code
        of the script without a file.

        This is to be used from the script edition dialog, but should
        not be used in other cases.
        """

        GeoAlgorithm.__init__(self)
        self._icon = QgsApplication.getThemeIcon("/processingScript.svg")

        self.script = script
        self.allowEdit = True
        self.noCRSWarning = False
        self.descriptionFile = descriptionFile
        if script is not None:
            self.defineCharacteristicsFromScript()
        if descriptionFile is not None:
            self.defineCharacteristicsFromFile()
Example #19
0
 def __init__(self, alg):
     settings = QSettings()
     useCategories = settings.value(ModelerDialog.USE_CATEGORIES, type=bool)
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.getIcon()
     if useCategories:
         icon = GeoAlgorithm.getDefaultIcon()
     name = AlgorithmClassification.getDisplayName(alg)
     self.setIcon(0, icon)
     self.setToolTip(0, name)
     self.setText(0, name)
Example #20
0
    def getPostProcessingErrorMessage(self, wrongLayers):
        html = GeoAlgorithm.getPostProcessingErrorMessage(self, wrongLayers)
        msg = SagaUtils.checkSagaIsInstalled(True)
        html += ("<p>This algorithm requires SAGA to be run. A test to check if SAGA is correctly installed "
                "and configured in your system has been performed, with the following result:</p><ul><i>")
        if msg is None:
            html += "SAGA seems to be correctly installed and configured</li></ul>"
        else:
            html += msg + "</i></li></ul>"
            html += '<p><a href= "http://docs.qgis.org/2.0/html/en/docs/user_manual/processing/3rdParty.html">Click here</a> to know more about how to install and configure SAGA to be used with QGIS</p>'

        return html
Example #21
0
 def __init__(self, alg):
     settings = QSettings()
     useCategories = settings.value(ProcessingToolbox.USE_CATEGORIES, type=bool)
     QTreeWidgetItem.__init__(self)
     self.alg = alg
     icon = alg.getIcon()
     name = alg.name
     if useCategories:
         icon = GeoAlgorithm.getDefaultIcon()
         (group, subgroup, name) = AlgorithmDecorator.getGroupsAndName(alg)
     self.setIcon(0, icon)
     self.setToolTip(0, name)
     self.setText(0, name)
Example #22
0
    def __init__(self):
        GeoAlgorithm.__init__(self)

        # The dialog where this model is being edited
        self.modelerdialog = None
        self.descriptionFile = None

        # Geoalgorithms in this model
        self.algs = []

        # Parameters of Geoalgorithms in self.algs. Each entry is a
        # map with (paramname, paramvalue) values for algs[i].
        # paramvalues are instances of AlgorithmAndParameter.
        self.algParameters = []

        # Algorithms that each algorithm depends on. This is just a
        # list of dependencies not set by outputs and inputs but
        # explicitly entered instead, meaning that an algorithm must
        # 'wait' for another to finish. Each entry is a list with
        # algorithm indexes
        self.dependencies = []

        # Outputs of Geoalgorithms in self.algs. Each entry is a map
        # with (output, outputvalue) values for algs[i]. outputvalue
        # is the name of the output if final. None if is an
        # intermediate output
        self.algOutputs = []

        # Hardcoded parameter values entered by the user when defining
        # the model. Keys are value names.
        self.paramValues = {}

        # Position of items in canvas
        self.algPos = []
        self.paramPos = []
        self.outputPos = []  # same structure as algOutputs

        # Deactivated algorithms that should not be executed
        self.deactivated = []
Example #23
0
    def __init__(self):
        self._name = self.tr('Model', 'ModelerAlgorithm')
        # The dialog where this model is being edited
        self.modelerdialog = None
        self.descriptionFile = None
        self.helpContent = {}
        self._group = ''

        # Geoalgorithms in this model. A dict of Algorithm objects, with names as keys
        self.algs = {}

        # Input parameters. A dict of Input objects, with names as keys
        self.inputs = {}
        GeoAlgorithm.__init__(self)

        classes = [ParameterRaster, ParameterVector, ParameterTable, ParameterTableField,
                   ParameterBoolean, ParameterString, ParameterNumber]
        self.parameters = []
        for c in classes:
            for inp in list(self.inputs.values()):
                if isinstance(inp.param, c):
                    self.parameters.append(inp.param)
        for inp in list(self.inputs.values()):
            if inp.param not in self.parameters:
                self.parameters.append(inp.param)
        self.parameters.sort(key=attrgetter("description"))

        self.outputs = []
        for alg in list(self.algs.values()):
            if alg.active:
                for out in alg.outputs:
                    modelOutput = copy.deepcopy(alg.algorithm.getOutputFromName(out))
                    modelOutput.name = self.getSafeNameForOutput(alg.modeler_name, out)
                    modelOutput.description = alg.outputs[out].description()
                    self.outputs.append(modelOutput)
        self.outputs.sort(key=attrgetter("description"))
Example #24
0
    def getPostProcessingErrorMessage(self, wrongLayers):
        html = GeoAlgorithm.getPostProcessingErrorMessage(self, wrongLayers)
        msg = GrassUtils.checkGrassIsInstalled(True)
        html += '<p>This algorithm requires GRASS to be run. A test \
            to check if GRASS is correctly installed and configured in \
            your system has been performed, with the following \
            result:</p><ul><i>'
        if msg is None:
            html += 'GRASS seems to be correctly installed and \
                configured</i></li></ul>'
        else:
            html += msg + '</i></li></ul>'
            html += '<p><a href= "http://docs.qgis.org/2.0/html/en/docs/user_manual/processing/3rdParty.html">Click here</a> to know more about how to install and configure GRASS to be used with QGIS</p>'

        return html
Example #25
0
    def getPostProcessingErrorMessage(self, wrongLayers):
        html = GeoAlgorithm.getPostProcessingErrorMessage(self, wrongLayers)
        msg = RUtils.checkRIsInstalled(True)
        html += ("<p>This algorithm requires R to be run. A test to check if R is correctly installed "
                "and configured in your system has been performed, with the following result:</p><ul><i>")
        if msg is None:
            html += "GRASS seems to be correctly installed and configured</i></li></ul>"
            html += "<p>The script you have executed needs the following packages:</p><ul>"
            packages = RUtils.getRequiredPackages(self.script)
            for p in packages:
                html += '<li>' + p + '</li>'
            html += "</ul><p>Make sure they are installed in your R environment before trying to execute this script.</p>"
        else:
            html += msg + "</i></li></ul>"
            html += '<p><a href= "http://docs.qgis.org/2.0/html/en/docs/user_manual/processing/3rdParty.html">Click here</a> to know more about how to install and configure R to be used with QGIS</p>'

        return html
Example #26
0
    def fillTreeUsingCategories(self):
        providersToExclude = ['model', 'script']
        self.algorithmTree.clear()
        text = unicode(self.searchBox.text())
        groups = {}
        for providerName in Processing.algs.keys():
            provider = Processing.algs[providerName]
            name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
            if not ProcessingConfig.getSetting(name):
                continue
            if providerName in providersToExclude or \
                    len(ModelerUtils.providers[providerName].actions) != 0:
                continue
            algs = provider.values()

            # add algorithms

            for alg in algs:
                if not alg.showInToolbox:
                    continue
                altgroup, altsubgroup = AlgorithmClassification.getClassification(
                    alg)
                if altgroup is None:
                    continue
                algName = AlgorithmClassification.getDisplayName(alg)
                if text == '' or text.lower() in algName.lower():
                    if altgroup not in groups:
                        groups[altgroup] = {}
                    group = groups[altgroup]
                    if altsubgroup not in group:
                        groups[altgroup][altsubgroup] = []
                    subgroup = groups[altgroup][altsubgroup]
                    subgroup.append(alg)

        if len(groups) > 0:
            mainItem = QTreeWidgetItem()
            mainItem.setText(0, 'Geoalgorithms')
            mainItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
            mainItem.setToolTip(0, mainItem.text(0))
            for (groupname, group) in groups.items():
                groupItem = QTreeWidgetItem()
                groupItem.setText(0, groupname)
                groupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
                groupItem.setToolTip(0, groupItem.text(0))
                mainItem.addChild(groupItem)
                for (subgroupname, subgroup) in group.items():
                    subgroupItem = QTreeWidgetItem()
                    subgroupItem.setText(0, subgroupname)
                    subgroupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
                    subgroupItem.setToolTip(0, subgroupItem.text(0))
                    groupItem.addChild(subgroupItem)
                    for alg in subgroup:
                        algItem = TreeAlgorithmItem(alg)
                        subgroupItem.addChild(algItem)

            self.algorithmTree.addTopLevelItem(mainItem)

        for providerName in Processing.algs.keys():
            if providerName not in providersToExclude:
                continue
            name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
            if not ProcessingConfig.getSetting(name):
                continue
            providerItem = TreeProviderItem(providerName)
            self.algorithmTree.addTopLevelItem(providerItem)
Example #27
0
 def getAsCommand(self):
     if self.descriptionFile:
         return GeoAlgorithm.getAsCommand(self)
     else:
         return None
Example #28
0
 def __init__(self):
     GeoAlgorithm.__init__(self)
     self.mapping = None
Example #29
0
    def fillTreeUsingCategories(self):
        providersToExclude = ['model', 'script']
        self.algorithmTree.clear()
        text = unicode(self.searchBox.text())
        groups = {}
        for providerName in Processing.algs.keys():
            provider = Processing.algs[providerName]
            name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
            if not ProcessingConfig.getSetting(name):
                continue
            if providerName in providersToExclude \
                        or len(Providers.providers[providerName].actions) != 0:
                continue
            algs = provider.values()

            # add algorithms

            for alg in algs:
                if not alg.showInToolbox:
                    continue
                (altgroup, altsubgroup, altname) = \
                    AlgorithmDecorator.getGroupsAndName(alg)
                if altgroup is None:
                    continue
                if text == '' or text.lower() in altname.lower():
                    if altgroup not in groups:
                        groups[altgroup] = {}
                    group = groups[altgroup]
                    if altsubgroup not in group:
                        groups[altgroup][altsubgroup] = []
                    subgroup = groups[altgroup][altsubgroup]
                    subgroup.append(alg)

        if len(groups) > 0:
            mainItem = QTreeWidgetItem()
            mainItem.setText(0, 'Geoalgorithms')
            mainItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
            mainItem.setToolTip(0, mainItem.text(0))
            for (groupname, group) in groups.items():
                groupItem = QTreeWidgetItem()
                groupItem.setText(0, groupname)
                groupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
                groupItem.setToolTip(0, groupItem.text(0))
                mainItem.addChild(groupItem)
                for (subgroupname, subgroup) in group.items():
                    subgroupItem = QTreeWidgetItem()
                    subgroupItem.setText(0, subgroupname)
                    subgroupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
                    subgroupItem.setToolTip(0, subgroupItem.text(0))
                    groupItem.addChild(subgroupItem)
                    for alg in subgroup:
                        algItem = TreeAlgorithmItem(alg)
                        subgroupItem.addChild(algItem)

            self.algorithmTree.addTopLevelItem(mainItem)

        for providerName in Processing.algs.keys():
            groups = {}
            provider = Processing.algs[providerName]
            name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
            if not ProcessingConfig.getSetting(name):
                continue
            if providerName not in providersToExclude:
                continue
            algs = provider.values()

            # add algorithms

            for alg in algs:
                if not alg.showInToolbox:
                    continue
                if text == '' or text.lower() in alg.name.lower():
                    if alg.group in groups:
                        groupItem = groups[alg.group]
                    else:
                        groupItem = QTreeWidgetItem()
                        groupItem.setText(0, alg.group)
                        groupItem.setToolTip(0, alg.group)
                        groups[alg.group] = groupItem
                    algItem = TreeAlgorithmItem(alg)
                    groupItem.addChild(algItem)

            actions = Processing.actions[providerName]
            for action in actions:
                if text == '' or text.lower() in action.name.lower():
                    if action.group in groups:
                        groupItem = groups[action.group]
                    else:
                        groupItem = QTreeWidgetItem()
                        groupItem.setText(0, action.group)
                        groups[action.group] = groupItem
                    algItem = TreeActionItem(action)
                    groupItem.addChild(algItem)

            if len(groups) > 0:
                providerItem = QTreeWidgetItem()
                providerItem.setText(
                    0,
                    Processing.getProviderFromName(
                        providerName).getDescription())
                providerItem.setIcon(
                    0,
                    Processing.getProviderFromName(providerName).getIcon())
                providerItem.setToolTip(0, providerItem.text(0))
                for groupItem in groups.values():
                    providerItem.addChild(groupItem)
                self.algorithmTree.addTopLevelItem(providerItem)

        if text != '':
            self.algorithmTree.expandAll()
Example #30
0
 def __init__(self):
     GeoAlgorithm.__init__(self)
     # this algorithm is deprecated - use GridLine instead
     self.showInToolbox = False
Example #31
0
 def __init__(self, descriptionfile):
     GeoAlgorithm.__init__(self)
     self.hardcodedStrings = []
     self.allowUnmatchingGridExtents = False
     self.descriptionFile = descriptionfile
     self.defineCharacteristicsFromFile()
Example #32
0
 def __init__(self):
     self.allowUnmatchingGridExtents = True
     self.hardcodedStrings = []
     GeoAlgorithm.__init__(self)
Example #33
0
 def __init__(self, descriptionfile):
     GeoAlgorithm.__init__(self)
     self.hardcodedStrings = []
     self.descriptionFile = descriptionfile
     self.defineCharacteristicsFromFile()
     self.numExportedLayers = 0
Example #34
0
    def fillAlgorithmTreeUsingCategories(self):
        providersToExclude = ['model', 'script']
        self.algorithmTree.clear()
        text = unicode(self.searchBox.text())
        groups = {}
        allAlgs = ModelerUtils.allAlgs
        for providerName in allAlgs.keys():
            provider = allAlgs[providerName]
            name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
            if not ProcessingConfig.getSetting(name):
                continue
            if providerName in providersToExclude \
                    or len(ModelerUtils.providers[providerName].actions) != 0:
                continue
            algs = provider.values()

            # Add algorithms
            for alg in algs:
                if not alg.showInModeler or alg.allowOnlyOpenedLayers:
                    continue
                altgroup, altsubgroup = AlgorithmClassification.getClassification(
                    alg)
                if altgroup is None:
                    continue
                algName = AlgorithmClassification.getDisplayName(alg)
                if text == '' or text.lower() in algName.lower():
                    if altgroup not in groups:
                        groups[altgroup] = {}
                    group = groups[altgroup]
                    if altsubgroup not in group:
                        groups[altgroup][altsubgroup] = []
                    subgroup = groups[altgroup][altsubgroup]
                    subgroup.append(alg)

        if len(groups) > 0:
            mainItem = QTreeWidgetItem()
            mainItem.setText(0, self.tr('Geoalgorithms'))
            mainItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
            mainItem.setToolTip(0, mainItem.text(0))
            for (groupname, group) in groups.items():
                groupItem = QTreeWidgetItem()
                groupItem.setText(0, groupname)
                groupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
                groupItem.setToolTip(0, groupItem.text(0))
                mainItem.addChild(groupItem)
                for (subgroupname, subgroup) in group.items():
                    subgroupItem = QTreeWidgetItem()
                    subgroupItem.setText(0, subgroupname)
                    subgroupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
                    subgroupItem.setToolTip(0, subgroupItem.text(0))
                    groupItem.addChild(subgroupItem)
                    for alg in subgroup:
                        algItem = TreeAlgorithmItem(alg)
                        subgroupItem.addChild(algItem)
            self.algorithmTree.addTopLevelItem(mainItem)

        for providerName in allAlgs.keys():
            groups = {}
            provider = allAlgs[providerName]
            name = 'ACTIVATE_' + providerName.upper().replace(' ', '_')
            if not ProcessingConfig.getSetting(name):
                continue
            if providerName not in providersToExclude:
                continue
            algs = provider.values()

            # Add algorithms
            for alg in algs:
                if not alg.showInModeler or alg.allowOnlyOpenedLayers:
                    continue
                if text == '' or text.lower() in alg.name.lower():
                    if alg.group in groups:
                        groupItem = groups[alg.group]
                    else:
                        groupItem = QTreeWidgetItem()
                        name = alg.i18n_group
                        groupItem.setText(0, name)
                        groupItem.setToolTip(0, name)
                        groups[alg.group] = groupItem
                    algItem = TreeAlgorithmItem(alg)
                    groupItem.addChild(algItem)

            if len(groups) > 0:
                providerItem = QTreeWidgetItem()
                providerItem.setText(
                    0, ModelerUtils.providers[providerName].getDescription())
                providerItem.setIcon(
                    0, ModelerUtils.providers[providerName].getIcon())
                providerItem.setToolTip(0, providerItem.text(0))
                for groupItem in groups.values():
                    providerItem.addChild(groupItem)
                self.algorithmTree.addTopLevelItem(providerItem)
                providerItem.setExpanded(text != '')
                for groupItem in groups.values():
                    if text != '':
                        groupItem.setExpanded(True)
Example #35
0
File: nviz.py Project: gidsil/QGIS
 def __init__(self):
     GeoAlgorithm.__init__(self)
     self.showInModeler = False
Example #36
0
    def __init__(self, tablename, groupname):
        self.tablename = tablename
        self.groupname = groupname

        GeoAlgorithm.__init__(self)
Example #37
0
 def execute(self, progress=SilentProgress(), model=None):
     self.collectNonTemporaryOutputs()
     GeoAlgorithm.execute(self, progress, model)
Example #38
0
 def getAsCommand(self):
     if self.descriptionFile:
         return GeoAlgorithm.getAsCommand(self)
     else:
         return None
Example #39
0
 def __init__(self):
     GeoAlgorithm.__init__(self)
Example #40
0
 def __init__(self):
     GeoAlgorithm.__init__(self)
     self._icon = None
Example #41
0
 def __init__(self):
     GeoAlgorithm.__init__(self)
     # this algorithm is deprecated - use Centroids instead
     self.showInToolbox = False
Example #42
0
 def checkInputCRS(self):
     if self.noCRSWarning:
         return True
     else:
         return GeoAlgorithm.checkInputCRS(self)
Example #43
0
 def __init__(self):
     self.configParser = ConfigParser()
     self.configParser.read(os.path.dirname(__file__) + "/COLOR_SCHEMA.ini")
     self.availableColorSchemas = self.configParser.sections()
     GeoAlgorithm.__init__(self)
Example #44
0
    def fillTreeUsingCategories(self):
        providersToExclude = ["model", "script"]
        self.algorithmTree.clear()
        text = unicode(self.searchBox.text())
        groups = {}
        for providerName in Processing.algs.keys():
            provider = Processing.algs[providerName]
            name = "ACTIVATE_" + providerName.upper().replace(" ", "_")
            if not ProcessingConfig.getSetting(name):
                continue
            if providerName in providersToExclude or len(ModelerUtils.providers[providerName].actions) != 0:
                continue
            algs = provider.values()

            # add algorithms

            for alg in algs:
                if not alg.showInToolbox:
                    continue
                (altgroup, altsubgroup, altname) = AlgorithmDecorator.getGroupsAndName(alg)
                if altgroup is None:
                    continue
                if text == "" or text.lower() in altname.lower():
                    if altgroup not in groups:
                        groups[altgroup] = {}
                    group = groups[altgroup]
                    if altsubgroup not in group:
                        groups[altgroup][altsubgroup] = []
                    subgroup = groups[altgroup][altsubgroup]
                    subgroup.append(alg)

        if len(groups) > 0:
            mainItem = QTreeWidgetItem()
            mainItem.setText(0, "Geoalgorithms")
            mainItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
            mainItem.setToolTip(0, mainItem.text(0))
            for (groupname, group) in groups.items():
                groupItem = QTreeWidgetItem()
                groupItem.setText(0, groupname)
                groupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
                groupItem.setToolTip(0, groupItem.text(0))
                mainItem.addChild(groupItem)
                for (subgroupname, subgroup) in group.items():
                    subgroupItem = QTreeWidgetItem()
                    subgroupItem.setText(0, subgroupname)
                    subgroupItem.setIcon(0, GeoAlgorithm.getDefaultIcon())
                    subgroupItem.setToolTip(0, subgroupItem.text(0))
                    groupItem.addChild(subgroupItem)
                    for alg in subgroup:
                        algItem = TreeAlgorithmItem(alg)
                        subgroupItem.addChild(algItem)

            self.algorithmTree.addTopLevelItem(mainItem)

        for providerName in Processing.algs.keys():
            if providerName not in providersToExclude:
                continue
            name = "ACTIVATE_" + providerName.upper().replace(" ", "_")
            if not ProcessingConfig.getSetting(name):
                continue
            providerItem = TreeProviderItem(providerName)
            self.algorithmTree.addTopLevelItem(providerItem)
Example #45
0
 def __init__(self, process, bookmark=False):
     self.process = process
     self.bookmark = bookmark
     GeoAlgorithm.__init__(self)  #calls defineCharacteristics
Example #46
0
 def __init__(self):
     GeoAlgorithm.__init__(self)
     # this algorithm is deprecated - use BasicStatistics instead
     self.showInToolbox = False
Example #47
0
 def __init__(self, descriptionfile):
     GeoAlgorithm.__init__(self)
     self.descriptionFile = descriptionfile
     self.defineCharacteristicsFromFile()
Example #48
0
 def __init__(self, descriptionFile):
     self.descriptionFile = descriptionFile
     with open(self.descriptionFile) as f:
         self.description = json.load(f)
     GeoAlgorithm.__init__(self)
Example #49
0
 def checkInputCRS(self):
     if self.noCRSWarning:
         return True
     else:
         return GeoAlgorithm.checkInputCRS(self)
Example #50
0
 def __init__(self):
     GeoAlgorithm.__init__(self)
     self._icon = None
Example #51
0
 def __init__(self):
     GeoAlgorithm.__init__(self)
     # this algorithm is deprecated - use BasicStatistics instead
     self.showInToolbox = False