Exemplo n.º 1
0
 def loadAlgorithms(self):
     self.algs = []
     folders = ScriptUtils.scriptsFolders()
     for f in folders:
         self.algs.extend(ScriptUtils.loadFromFolder(f))
     self.algs.extend(self.folder_algorithms)
     for a in self.algs:
         self.addAlgorithm(a)
Exemplo n.º 2
0
    def openScript(self):
        if self.hasChanged:
            ret = QMessageBox.warning(self, self.tr('Unsaved changes'),
                                      self.tr('There are unsaved changes in script. Continue?'),
                                      QMessageBox.Yes | QMessageBox.No, QMessageBox.No)
            if ret == QMessageBox.No:
                return

        if self.algType == self.SCRIPT_PYTHON:
            scriptDir = ScriptUtils.scriptsFolders()[0]
            filterName = self.tr('Python scripts (*.py)')
        elif self.algType == self.SCRIPT_R:
            scriptDir = RUtils.RScriptsFolders()[0]
            filterName = self.tr('Processing R script (*.rsx)')

        self.filename, fileFilter = QFileDialog.getOpenFileName(
            self, self.tr('Open script'), scriptDir, filterName)

        if self.filename == '':
            return

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        with codecs.open(self.filename, 'r', encoding='utf-8') as f:
            txt = f.read()

        self.editor.setText(txt)
        self.hasChanged = False
        self.editor.setModified(False)
        self.editor.recolor()
        QApplication.restoreOverrideCursor()
Exemplo n.º 3
0
    def __init__(self):
        AlgorithmProvider.__init__(self)
        self.alglist = [SumLines(), PointsInPolygon(),
                        PointsInPolygonWeighted(), PointsInPolygonUnique(),
                        BasicStatisticsStrings(), BasicStatisticsNumbers(),
                        NearestNeighbourAnalysis(), MeanCoords(),
                        LinesIntersection(), UniqueValues(), PointDistance(),
                        ReprojectLayer(), ExportGeometryInfo(), Centroids(),
                        Delaunay(), VoronoiPolygons(), SimplifyGeometries(),
                        DensifyGeometries(), DensifyGeometriesInterval(),
                        MultipartToSingleparts(), SinglePartsToMultiparts(),
                        PolygonsToLines(), LinesToPolygons(), ExtractNodes(),
                        Eliminate(), ConvexHull(), FixedDistanceBuffer(),
                        VariableDistanceBuffer(), Dissolve(), Difference(),
                        Intersection(), Union(), Clip(), ExtentFromLayer(),
                        RandomSelection(), RandomSelectionWithinSubsets(),
                        SelectByLocation(), RandomExtract(),
                        RandomExtractWithinSubsets(), ExtractByLocation(),
                        SpatialJoin(),
                        # ------ mmqgisx ------
                        mmqgisx_delete_columns_algorithm(),
                        mmqgisx_delete_duplicate_geometries_algorithm(),
                        mmqgisx_geometry_convert_algorithm(),
                        mmqgisx_grid_algorithm(),
                        mmqgisx_gridify_algorithm(),
                        mmqgisx_hub_distance_algorithm(),
                        mmqgisx_hub_lines_algorithm(),
                        mmqgisx_merge_algorithm(),
                        mmqgisx_select_algorithm(),
                        mmqgisx_extract_algorithm(),
                        mmqgisx_text_to_float_algorithm(),
                        # ------ native algs ------
                        AddTableField(), FieldsCalculator(),
                        SaveSelectedFeatures(), JoinAttributes(),
                        AutoincrementalField(), Explode(), FieldsPyculator(),
                        EquivalentNumField(), PointsLayerFromTable(),
                        StatisticsByCategories(), ConcaveHull(), Polygonize(),
                        RasterLayerStatistics(), PointsDisplacement(),
                        ZonalStatistics(), PointsFromPolygons(),
                        PointsFromLines(), RandomPointsExtent(),
                        RandomPointsLayer(), RandomPointsPolygonsFixed(),
                        RandomPointsPolygonsVariable(),
                        RandomPointsAlongLines(), PointsToPaths(),
                        PostGISExecuteSQL(), ImportIntoPostGIS(),
                        SetVectorStyle(), SetRasterStyle(), SelectByExpression()
                        # ------ raster ------
                        # CreateConstantRaster(),
                        # ------ graphics ------
                        # VectorLayerHistogram(), VectorLayerScatterplot(),
                        # RasterLayerHistogram(), MeanAndStdDevPlot(),
                        # BarPlot(), PolarPlot()
                       ]

        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        self.alglist.extend(scripts)
        for alg in self.alglist:
            alg._icon = self._icon
    def __init__(self, resourceType):
        super(GetScriptsAndModelsDialog, self).__init__(iface.mainWindow())
        self.setupUi(self)
        self.manager = QgsNetworkAccessManager.instance()

        repoUrl = ProcessingConfig.getSetting(ProcessingConfig.MODELS_SCRIPTS_REPO)

        self.resourceType = resourceType
        if self.resourceType == self.MODELS:
            self.folder = ModelerUtils.modelsFolders()[0]
            self.urlBase = '{}/models/'.format(repoUrl)
            self.icon = QIcon(os.path.join(pluginPath, 'images', 'model.png'))
        elif self.resourceType == self.SCRIPTS:
            self.folder = ScriptUtils.scriptsFolders()[0]
            self.urlBase = '{}/scripts/'.format(repoUrl)
            self.icon = QIcon(os.path.join(pluginPath, 'images', 'script.png'))
        else:
            self.folder = RUtils.RScriptsFolders()[0]
            self.urlBase = '{}/rscripts/'.format(repoUrl)
            self.icon = QIcon(os.path.join(pluginPath, 'images', 'r.svg'))

        self.lastSelectedItem = None
        self.updateProvider = False
        self.populateTree()
        self.buttonBox.accepted.connect(self.okPressed)
        self.buttonBox.rejected.connect(self.cancelPressed)
        self.tree.currentItemChanged.connect(self.currentItemChanged)
Exemplo n.º 5
0
    def __init__(self, resourceType):
        super(GetScriptsAndModelsDialog, self).__init__(iface.mainWindow())
        self.setupUi(self)
        self.manager = QgsNetworkAccessManager.instance()

        self.resourceType = resourceType
        if self.resourceType == self.MODELS:
            self.folder = ModelerUtils.modelsFolder()
            self.urlBase = 'https://raw.githubusercontent.com/qgis/QGIS-Processing/master/models/'
            self.icon = QIcon(os.path.join(pluginPath, 'images', 'model.png'))
        elif self.resourceType == self.SCRIPTS:
            self.folder = ScriptUtils.scriptsFolder()
            self.urlBase = 'https://raw.githubusercontent.com/qgis/QGIS-Processing/master/scripts/'
            self.icon = QIcon(os.path.join(pluginPath, 'images', 'script.png'))
        else:
            self.folder = RUtils.RScriptsFolder()
            self.urlBase = 'https://raw.githubusercontent.com/qgis/QGIS-Processing/master/rscripts/'
            self.icon = QIcon(os.path.join(pluginPath, 'images', 'r.png'))

        self.lastSelectedItem = None
        self.updateToolbox = False
        self.populateTree()
        self.buttonBox.accepted.connect(self.okPressed)
        self.buttonBox.rejected.connect(self.cancelPressed)
        self.tree.currentItemChanged.connect(self.currentItemChanged)
Exemplo n.º 6
0
 def execute(self):
     settings = QSettings()
     lastDir = settings.value('Processing/lastScriptsDir', '')
     filenames, selected_filter = QFileDialog.getOpenFileNames(self.toolbox,
                                                             self.tr('Script files', 'AddScriptFromFileAction'), lastDir,
                                                             self.tr('Script files (*.py *.PY)', 'AddScriptFromFileAction'))
     if filenames:
         validAlgs = 0
         wrongAlgs = []
         for filename in filenames:
             try:
                 settings.setValue('Processing/lastScriptsDir',
                                   QFileInfo(filename).absoluteDir().absolutePath())
                 script = ScriptAlgorithm(filename)
                 destFilename = os.path.join(ScriptUtils.scriptsFolders()[0], os.path.basename(filename))
                 with open(destFilename, 'w') as f:
                     f.write(script.script)
                 validAlgs += 1
             except WrongScriptException:
                 wrongAlgs.append(os.path.basename(filename))
         if validAlgs:
             algList.reloadProvider('script')
         if wrongAlgs:
             QMessageBox.warning(self.toolbox,
                                     self.tr('Error reading scripts', 'AddScriptFromFileAction'),
                                     self.tr('The following files do not contain a valid script:\n-', 'AddScriptFromFileAction')
                                     + "\n-".join(wrongAlgs))
Exemplo n.º 7
0
    def __init__(self, resourceType):
        super(GetScriptsAndModelsDialog, self).__init__(iface.mainWindow())
        self.setupUi(self)

        if hasattr(self.leFilter, "setPlaceholderText"):
            self.leFilter.setPlaceholderText(self.tr("Search..."))

        self.manager = QgsNetworkAccessManager.instance()

        self.resourceType = resourceType
        if self.resourceType == self.MODELS:
            self.folder = ModelerUtils.modelsFolders()[0]
            self.urlBase = "https://raw.githubusercontent.com/qgis/QGIS-Processing/master/models/"
            self.icon = QIcon(os.path.join(pluginPath, "images", "model.png"))
        elif self.resourceType == self.SCRIPTS:
            self.folder = ScriptUtils.scriptsFolders()[0]
            self.urlBase = "https://raw.githubusercontent.com/qgis/QGIS-Processing/master/scripts/"
            self.icon = QIcon(os.path.join(pluginPath, "images", "script.png"))
        else:
            self.folder = RUtils.RScriptsFolders()[0]
            self.urlBase = "https://raw.githubusercontent.com/qgis/QGIS-Processing/master/rscripts/"
            self.icon = QIcon(os.path.join(pluginPath, "images", "r.svg"))

        self.lastSelectedItem = None
        self.updateProvider = False
        self.data = None

        self.populateTree()
        self.buttonBox.accepted.connect(self.okPressed)
        self.buttonBox.rejected.connect(self.cancelPressed)
        self.tree.currentItemChanged.connect(self.currentItemChanged)
        self.leFilter.textChanged.connect(self.fillTree)
Exemplo n.º 8
0
    def __init__(self, resourceType):
        super(GetScriptsAndModelsDialog, self).__init__(iface.mainWindow())
        self.setupUi(self)

        if hasattr(self.leFilter, 'setPlaceholderText'):
            self.leFilter.setPlaceholderText(self.tr('Search...'))

        self.manager = QgsNetworkAccessManager.instance()

        repoUrl = ProcessingConfig.getSetting(ProcessingConfig.MODELS_SCRIPTS_REPO)

        self.resourceType = resourceType
        if self.resourceType == self.MODELS:
            self.folder = ModelerUtils.modelsFolders()[0]
            self.urlBase = '{}/models/'.format(repoUrl)
            self.icon = QgsApplication.getThemeIcon("/processingModel.svg")
        elif self.resourceType == self.SCRIPTS:
            self.folder = ScriptUtils.scriptsFolders()[0]
            self.urlBase = '{}/scripts/'.format(repoUrl)
            self.icon = QgsApplication.getThemeIcon("/processingScript.svg")

        self.lastSelectedItem = None
        self.updateProvider = False
        self.data = None

        self.populateTree()
        self.buttonBox.accepted.connect(self.okPressed)
        self.buttonBox.rejected.connect(self.cancelPressed)
        self.tree.currentItemChanged.connect(self.currentItemChanged)
        self.leFilter.textChanged.connect(self.fillTree)
Exemplo n.º 9
0
    def execute(self):
        filename = str(QFileDialog.getSaveFileName(None, "Save Script", ScriptUtils.scriptsFolder(), "Python scripts (*.py)"))

        if filename:
            if not filename.endswith(".py"):
                filename += ".py"
            text = self.translateToPythonCode(self.alg)
            try:
                fout = open(filename, "w")
                fout.write(text)
                fout.close()
                if filename.replace("\\","/").startswith(ScriptUtils.scriptsFolder().replace("\\","/")):
                    self.toolbox.updateTree()
            except:
                QMessageBox.warning(self,
                                    self.tr("I/O error"),
                                    self.tr("Unable to save edits. Reason:\n %1").arg(unicode(sys.exc_info()[1]))
                                   )
Exemplo n.º 10
0
    def execute(self):
        filename = str(QFileDialog.getSaveFileName(None, 'Save Script',
                       ScriptUtils.scriptsFolder(), 'Python scripts (*.py)'))

        if filename:
            if not filename.endswith('.py'):
                filename += '.py'
            text = self.translateToPythonCode(self.alg)
            try:
                fout = open(filename, 'w')
                fout.write(text)
                fout.close()
                if filename.replace('\\', '/').startswith(
                        ScriptUtils.scriptsFolder().replace('\\', '/')):
                    self.toolbox.updateProvider('script')
            except:
                QMessageBox.warning(self, self.tr('I/O error'),
                        self.tr('Unable to save edits. Reason:\n %s')
                        % unicode(sys.exc_info()[1]))
Exemplo n.º 11
0
 def load(self):
     ProcessingConfig.settingIcons[self.name()] = self.icon()
     ProcessingConfig.addSetting(Setting(self.name(),
                                         ScriptUtils.SCRIPTS_FOLDER,
                                         self.tr('Scripts folder', 'ScriptAlgorithmProvider'),
                                         ScriptUtils.defaultScriptsFolder(), valuetype=Setting.MULTIPLE_FOLDERS))
     ProviderActions.registerProviderActions(self, self.actions)
     ProviderContextMenuActions.registerProviderContextMenuActions(self.contextMenuActions)
     ProcessingConfig.readSettings()
     self.refreshAlgorithms()
     return True
Exemplo n.º 12
0
 def addScripts(folder):
     Processing.initialize()
     provider = Processing.getProviderFromName("qgis")
     scripts = ScriptUtils.loadFromFolder(folder)
     print scripts
     for script in scripts:
         script.allowEdit = False
         script._icon = provider._icon
         script.provider = provider
     provider.externalAlgs.extend(scripts)
     Processing.reloadProvider("qgis")
Exemplo n.º 13
0
 def addScripts(folder):
     Processing.initialize()
     provider = QgsApplication.processingRegistry().providerById("qgis")
     scripts = ScriptUtils.loadFromFolder(folder)
     # fix_print_with_import
     print(scripts)
     for script in scripts:
         script.allowEdit = False
         script._icon = provider._icon
     provider.externalAlgs.extend(scripts)
     provider.refreshAlgorithms()
Exemplo n.º 14
0
 def execute(self):
     filename = QtGui.QFileDialog.getOpenFileName(self.toolbox, 'Script files', None,
             '*.py')
     if filename:
         try:
             script = ScriptAlgorithm(filename)
         except WrongScriptException:
             QtGui.QMessageBox.warning(self.toolbox, "Error reading script", "The selected file does not contain a valid script")
             return
         destFilename = os.path.join(ScriptUtils.scriptsFolder(), os.path.basename(filename))
         with open(destFilename) as f:
             f.write(script.script)
         self.toolbox.updateProvider('script')
Exemplo n.º 15
0
    def saveScript(self, saveAs):
        if self.filename is None or saveAs:
            if self.algType == self.SCRIPT_PYTHON:
                scriptDir = ScriptUtils.scriptsFolder()
                filterName = self.tr("Python scripts (*.py)")
            elif self.algType == self.SCRIPT_R:
                scriptDir = RUtils.RScriptsFolder()
                filterName = self.tr("Processing R script (*.rsx)")

            self.filename = unicode(QFileDialog.getSaveFileName(self,
                                                                self.tr("Save script"),
                                                                scriptDir,
                                                                filterName
                                                               ))

        if self.filename:
            if self.algType == self.SCRIPT_PYTHON and not self.filename.lower().endswith(".py"):
                self.filename += ".py"
            if self.algType == self.SCRIPT_R and not self.filename.lower().endswith(".rsx"):
                self.filename += ".rsx"

            text = unicode(self.editor.text())
            if self.alg is not None:
                self.alg.script = text
            try:
                fout = open(self.filename, "w")
                fout.write(text)
                fout.close()
            except IOError:
                QMessageBox.warning(self,
                                    self.tr("I/O error"),
                                    self.tr("Unable to save edits. Reason:\n %1").arg(unicode(sys.exc_info()[1]))
                                   )
                return
            self.update = True

            # if help strings were defined before saving the script for the first
            # time, we do it here
            if self.help:
                f = open(self.filename + ".help", "wb")
                pickle.dump(self.help, f)
                f.close()
                self.help = None
            QMessageBox.information(self,
                                    self.tr("Script saving"),
                                    self.tr("Script was correctly saved.")
                                   )
        else:
            self.filename = None
Exemplo n.º 16
0
    def saveScript(self, saveAs):
        if self.filename is None or saveAs:
            if self.algType == self.SCRIPT_PYTHON:
                scriptDir = ScriptUtils.scriptsFolder()
                filterName = self.tr('Python scripts (*.py)')
            elif self.algType == self.SCRIPT_R:
                scriptDir = RUtils.RScriptsFolder()
                filterName = self.tr('Processing R script (*.rsx)')

            self.filename = unicode(QFileDialog.getSaveFileName(self,
                                    self.tr('Save script'), scriptDir,
                                    filterName))

        if self.filename:
            if self.algType == self.SCRIPT_PYTHON \
                        and not self.filename.lower().endswith('.py'):
                self.filename += '.py'
            if self.algType == self.SCRIPT_R \
                        and not self.filename.lower().endswith('.rsx'):
                self.filename += '.rsx'

            text = unicode(self.editor.text())
            if self.alg is not None:
                self.alg.script = text
            try:
                fout = open(self.filename, 'w')
                fout.write(text)
                fout.close()
            except IOError:
                QMessageBox.warning(self, self.tr('I/O error'),
                        self.tr('Unable to save edits. Reason:\n %1')
                        % unicode(sys.exc_info()[1]))
                return
            self.update = True

            # If help strings were defined before saving the script for
            # the first time, we do it here
            if self.help:
                f = open(self.filename + '.help', 'wb')
                pickle.dump(self.help, f)
                f.close()
                self.help = None
            QMessageBox.information(self, self.tr('Script saving'),
                                    self.tr('Script was correctly saved.'))
        else:
            self.filename = None
Exemplo n.º 17
0
 def __init__(self, resourceType):
     QDialog.__init__(self, iface.mainWindow())
     self.resourceType = resourceType
     if self.resourceType == self.MODELS:
         self.folder = ModelerUtils.modelsFolder()
         self.urlBase = "https://raw.githubusercontent.com/qgis/QGIS-Processing/master/models/"
         self.icon = QtGui.QIcon(os.path.dirname(__file__) + '/../images/model.png')
     else:
         self.folder = ScriptUtils.scriptsFolder()
         self.urlBase = "https://raw.githubusercontent.com/qgis/QGIS-Processing/master/scripts/"
         self.icon = QtGui.QIcon(os.path.dirname(__file__) + '/../images/script.png')
     self.lastSelectedItem = None
     self.setupUi(self)
     self.populateTree()
     self.updateToolbox = False
     self.buttonBox.accepted.connect(self.okPressed)
     self.buttonBox.rejected.connect(self.cancelPressed)
     self.tree.currentItemChanged .connect(self.currentItemChanged)
Exemplo n.º 18
0
    def saveScript(self, saveAs):
        if self.filename is None or saveAs:
            if self.algType == self.SCRIPT_PYTHON:
                scriptDir = ScriptUtils.scriptsFolder()
                filterName = self.tr('Python scripts (*.py)')
            elif self.algType == self.SCRIPT_R:
                scriptDir = RUtils.RScriptsFolder()
                filterName = self.tr('Processing R script (*.rsx)')

            self.filename = unicode(QFileDialog.getSaveFileName(self,
                                    self.tr('Save script'), scriptDir,
                                    filterName))

        if self.filename:
            if self.algType == self.SCRIPT_PYTHON and \
                    not self.filename.lower().endswith('.py'):
                self.filename += '.py'
            if self.algType == self.SCRIPT_R and \
                    not self.filename.lower().endswith('.rsx'):
                self.filename += '.rsx'

            text = unicode(self.editor.text())
            if self.alg is not None:
                self.alg.script = text
            try:
                with codecs.open(self.filename, 'w', encoding='utf-8') as fout:
                    fout.write(text)
            except IOError:
                QMessageBox.warning(self, self.tr('I/O error'),
                                    self.tr('Unable to save edits. Reason:\n %s')
                                    % unicode(sys.exc_info()[1])
                                    )
                return
            self.update = True

            # If help strings were defined before saving the script for
            # the first time, we do it here
            if self.help:
                with open(self.filename + '.help', 'w') as f:
                    json.dump(self.help, f)
                self.help = None
            self.setHasChanged(False)
        else:
            self.filename = None
Exemplo n.º 19
0
    def saveScript(self, saveAs):
        if self.filename is None or saveAs:
            if self.algType == self.SCRIPT_PYTHON:
                scriptDir = ScriptUtils.scriptsFolder()
                filterName = self.tr("Python scripts (*.py)")
            elif self.algType == self.SCRIPT_R:
                scriptDir = RUtils.RScriptsFolder()
                filterName = self.tr("Processing R script (*.rsx)")

            self.filename = unicode(QFileDialog.getSaveFileName(self, self.tr("Save script"), scriptDir, filterName))

        if self.filename:
            if self.algType == self.SCRIPT_PYTHON and not self.filename.lower().endswith(".py"):
                self.filename += ".py"
            if self.algType == self.SCRIPT_R and not self.filename.lower().endswith(".rsx"):
                self.filename += ".rsx"

            text = unicode(self.editor.text())
            if self.alg is not None:
                self.alg.script = text
            try:
                with codecs.open(self.filename, "w", encoding="utf-8") as fout:
                    fout.write(text)
            except IOError:
                QMessageBox.warning(
                    self,
                    self.tr("I/O error"),
                    self.tr("Unable to save edits. Reason:\n %s") % unicode(sys.exc_info()[1]),
                )
                return
            self.update = True

            # If help strings were defined before saving the script for
            # the first time, we do it here
            if self.help:
                f = open(self.filename + ".help", "wb")
                pickle.dump(self.help, f)
                f.close()
                self.help = None
            self.setHasChanged(False)
        else:
            self.filename = None
Exemplo n.º 20
0
 def execute(self):
     settings = QSettings()
     lastDir = settings.value('Processing/lastScriptsDir', '')
     filename = QFileDialog.getOpenFileName(self.toolbox,
                                            self.tr('Script files', 'AddScriptFromFileAction'), lastDir,
                                            self.tr('Script files (*.py *.PY)', 'AddScriptFromFileAction'))
     if filename:
         try:
             settings.setValue('Processing/lastScriptsDir',
                               QFileInfo(filename).absoluteDir().absolutePath())
             script = ScriptAlgorithm(filename)
         except WrongScriptException:
             QMessageBox.warning(self.toolbox,
                                 self.tr('Error reading script', 'AddScriptFromFileAction'),
                                 self.tr('The selected file does not contain a valid script', 'AddScriptFromFileAction'))
             return
         destFilename = os.path.join(ScriptUtils.scriptsFolder(), os.path.basename(filename))
         with open(destFilename, 'w') as f:
             f.write(script.script)
         self.toolbox.updateProvider('script')
Exemplo n.º 21
0
 def execute(self):
     filename = QFileDialog.getOpenFileName(
         self.toolbox,
         self.tr("Script files", "AddScriptFromFileAction"),
         None,
         self.tr("Script files (*.py *.PY)", "AddScriptFromFileAction"),
     )
     if filename:
         try:
             script = ScriptAlgorithm(filename)
         except WrongScriptException:
             QMessageBox.warning(
                 self.toolbox,
                 self.tr("Error reading script", "AddScriptFromFileAction"),
                 self.tr("The selected file does not contain a valid script", "AddScriptFromFileAction"),
             )
             return
         destFilename = os.path.join(ScriptUtils.scriptsFolder(), os.path.basename(filename))
         with open(destFilename, "w") as f:
             f.write(script.script)
         self.toolbox.updateProvider("script")
Exemplo n.º 22
0
 def _loadAlgorithms(self):
     folder = ScriptUtils.scriptsFolder()
     self.algs = ScriptUtils.loadFromFolder(folder)
Exemplo n.º 23
0
 def _loadAlgorithms(self):
     folders = ScriptUtils.scriptsFolders()
     self.algs = []
     for f in folders:
         self.algs.extend(ScriptUtils.loadFromFolder(f))
Exemplo n.º 24
0
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     ProcessingConfig.addSetting(Setting(self.getDescription(),
                                         ScriptUtils.SCRIPTS_FOLDER,
                                         self.tr('Scripts folder', 'ScriptAlgorithmProvider'),
                                         ScriptUtils.scriptsFolder(), valuetype=Setting.FOLDER))
Exemplo n.º 25
0
    def getAlgs(self):
        # algs = [SumLines(), PointsInPolygon(),
        #         PointsInPolygonWeighted(), PointsInPolygonUnique(),
        #         BasicStatisticsStrings(), BasicStatisticsNumbers(),
        #         NearestNeighbourAnalysis(), MeanCoords(),
        #         LinesIntersection(), UniqueValues(), PointDistance(),
        #         ReprojectLayer(), ExportGeometryInfo(), Centroids(),
        #         Delaunay(), VoronoiPolygons(), SimplifyGeometries(),
        #         DensifyGeometries(), DensifyGeometriesInterval(),
        #         MultipartToSingleparts(), SinglePartsToMultiparts(),
        #         PolygonsToLines(), LinesToPolygons(), ExtractNodes(),
        #         ConvexHull(), FixedDistanceBuffer(),
        #         VariableDistanceBuffer(), Dissolve(), Difference(),
        #         Intersection(), Union(),
        #         RandomSelection(), RandomSelectionWithinSubsets(),
        #         SelectByLocation(), RandomExtract(), DeleteHoles(),
        #         RandomExtractWithinSubsets(), ExtractByLocation(),
        #         SpatialJoin(), RegularPoints(), SymmetricalDifference(),
        #         VectorSplit(), VectorGridLines(), VectorGridPolygons(),
        #         DeleteDuplicateGeometries(), TextToFloat(),
        #         ExtractByAttribute(), SelectByAttribute(),
        #         GridLine(), Gridify(), HubDistancePoints(),
        #         HubDistanceLines(), HubLines(),
        #         GeometryConvert(), FieldsCalculator(),
        #         SaveSelectedFeatures(), JoinAttributes(),
        #         Explode(), FieldsPyculator(),
        #         EquivalentNumField(), PointsLayerFromTable(),
        #         StatisticsByCategories(), ConcaveHull(),
        #         RasterLayerStatistics(), PointsDisplacement(),
        #         ZonalStatistics(), PointsFromPolygons(),
        #         PointsFromLines(), RandomPointsExtent(),
        #         RandomPointsLayer(), RandomPointsPolygonsFixed(),
        #         RandomPointsPolygonsVariable(),
        #         RandomPointsAlongLines(), PointsToPaths(),
        #         SpatialiteExecuteSQL(), ImportIntoSpatialite(),
        #         PostGISExecuteSQL(), ImportIntoPostGIS(),
        #         SetVectorStyle(), SetRasterStyle(),
        #         SelectByExpression(), HypsometricCurves(),
        #         SplitWithLines(), SplitLinesWithLines(), CreateConstantRaster(),
        #         FieldsMapper(), SelectByAttributeSum(), Datasources2Vrt(),
        #         OrientedMinimumBoundingBox(), Smooth(),
        #         ReverseLineDirection(), SpatialIndex(), DefineProjection(),
        #         RectanglesOvalsDiamondsVariable(),
        #         RectanglesOvalsDiamondsFixed(), MergeLines(),
        #         PointOnSurface(),
        #         OffsetLine(), PolygonCentroids(), Translate(),
        #         SingleSidedBuffer(), PointsAlongGeometry(),
        #          Slope(), Ruggedness(), Hillshade(),
        #         Relief(), ZonalStatisticsQgis(),
        #         IdwInterpolation(), TinInterpolation(),
        #         RemoveNullGeometry(),
        #         ExtendLines(), ExtractSpecificNodes(),
        #         GeometryByExpression(), SnapGeometriesToLayer(),
        #         PoleOfInaccessibility(), CreateAttributeIndex(),
        #         DropGeometry(),
        #         RasterCalculator(), Heatmap(), Orthogonalize(),
        #         ShortestPathPointToPoint(), ShortestPathPointToLayer(),
        #         ShortestPathLayerToPoint(), ServiceAreaFromPoint(),
        #         ServiceAreaFromLayer(), TruncateTable(), Polygonize(),
        #         FixGeometry(), ExecuteSQL(), FindProjection(),
        #         TopoColor(), EliminateSelection()
        #         ]
        algs = [
            AddTableField(),
            Aspect(),
            AutoincrementalField(),
            BasicStatisticsForField(),
            Boundary(),
            BoundingBox(),
            CheckValidity(),
            Clip(),
            DeleteColumn(),
            ExtentFromLayer(),
            ExtractByExpression(),
            GridPolygon(),
            Merge()
        ]

        if hasPlotly:
            #     from .VectorLayerHistogram import VectorLayerHistogram
            #     from .RasterLayerHistogram import RasterLayerHistogram
            #     from .VectorLayerScatterplot import VectorLayerScatterplot
            #     from .MeanAndStdDevPlot import MeanAndStdDevPlot
            from .BarPlot import BarPlot
            #     from .PolarPlot import PolarPlot
            #     from .BoxPlot import BoxPlot
            #     from .VectorLayerScatterplot3D import VectorLayerScatterplot3D
            #
            algs.extend([BarPlot()])
            #[VectorLayerHistogram(), RasterLayerHistogram(),
        #                  VectorLayerScatterplot(), MeanAndStdDevPlot(),
        #                  BarPlot(), PolarPlot(), BoxPlot(),
        #                  VectorLayerScatterplot3D()])

        # to store algs added by 3rd party plugins as scripts
        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        #algs.extend(scripts)

        return algs
Exemplo n.º 26
0
    def __init__(self):
        AlgorithmProvider.__init__(self)
        self.alglist = [SumLines(), PointsInPolygon(),
                        PointsInPolygonWeighted(), PointsInPolygonUnique(),
                        BasicStatisticsStrings(), BasicStatisticsNumbers(),
                        NearestNeighbourAnalysis(), MeanCoords(),
                        LinesIntersection(), UniqueValues(), PointDistance(),
                        ReprojectLayer(), ExportGeometryInfo(), Centroids(),
                        Delaunay(), VoronoiPolygons(), SimplifyGeometries(),
                        DensifyGeometries(), DensifyGeometriesInterval(),
                        MultipartToSingleparts(), SinglePartsToMultiparts(),
                        PolygonsToLines(), LinesToPolygons(), ExtractNodes(),
                        Eliminate(), ConvexHull(), FixedDistanceBuffer(),
                        VariableDistanceBuffer(), Dissolve(), Difference(),
                        Intersection(), Union(), Clip(), ExtentFromLayer(),
                        RandomSelection(), RandomSelectionWithinSubsets(),
                        SelectByLocation(), RandomExtract(), DeleteHoles(),
                        RandomExtractWithinSubsets(), ExtractByLocation(),
                        SpatialJoin(), RegularPoints(), SymmetricalDifference(),
                        VectorSplit(), VectorGrid(), DeleteColumn(),
                        DeleteDuplicateGeometries(), TextToFloat(),
                        ExtractByAttribute(), SelectByAttribute(), Grid(),
                        Gridify(), HubDistance(), HubLines(), Merge(),
                        GeometryConvert(), AddTableField(), FieldsCalculator(),
                        SaveSelectedFeatures(), JoinAttributes(),
                        AutoincrementalField(), Explode(), FieldsPyculator(),
                        EquivalentNumField(), PointsLayerFromTable(),
                        StatisticsByCategories(), ConcaveHull(), Polygonize(),
                        RasterLayerStatistics(), PointsDisplacement(),
                        ZonalStatistics(), PointsFromPolygons(),
                        PointsFromLines(), RandomPointsExtent(),
                        RandomPointsLayer(), RandomPointsPolygonsFixed(),
                        RandomPointsPolygonsVariable(),
                        RandomPointsAlongLines(), PointsToPaths(),
                        PostGISExecuteSQL(), ImportIntoPostGIS(),
                        SetVectorStyle(), SetRasterStyle(),
                        SelectByExpression(), HypsometricCurves(),
                        SplitLinesWithLines(), CreateConstantRaster(),
                        FieldsMapper(), SelectByAttributeSum(), Datasources2Vrt(),
                        CheckValidity()
                        ]

        if hasMatplotlib:
            from VectorLayerHistogram import VectorLayerHistogram
            from RasterLayerHistogram import RasterLayerHistogram
            from VectorLayerScatterplot import VectorLayerScatterplot
            from MeanAndStdDevPlot import MeanAndStdDevPlot
            from BarPlot import BarPlot
            from PolarPlot import PolarPlot

            self.alglist.extend([
                VectorLayerHistogram(), RasterLayerHistogram(),
                VectorLayerScatterplot(), MeanAndStdDevPlot(), BarPlot(),
                PolarPlot(),
            ])

        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        self.alglist.extend(scripts)
        for alg in self.alglist:
            alg._icon = self._icon
Exemplo n.º 27
0
    def __init__(self):
        AlgorithmProvider.__init__(self)
        self.alglist = [
            SumLines(),
            PointsInPolygon(),
            PointsInPolygonWeighted(),
            PointsInPolygonUnique(),
            BasicStatisticsStrings(),
            BasicStatisticsNumbers(),
            NearestNeighbourAnalysis(),
            MeanCoords(),
            LinesIntersection(),
            UniqueValues(),
            PointDistance(),
            ReprojectLayer(),
            ExportGeometryInfo(),
            Centroids(),
            Delaunay(),
            VoronoiPolygons(),
            SimplifyGeometries(),
            DensifyGeometries(),
            DensifyGeometriesInterval(),
            MultipartToSingleparts(),
            SinglePartsToMultiparts(),
            PolygonsToLines(),
            LinesToPolygons(),
            ExtractNodes(),
            Eliminate(),
            ConvexHull(),
            FixedDistanceBuffer(),
            VariableDistanceBuffer(),
            Dissolve(),
            Difference(),
            Intersection(),
            Union(),
            Clip(),
            ExtentFromLayer(),
            RandomSelection(),
            RandomSelectionWithinSubsets(),
            SelectByLocation(),
            RandomExtract(),
            RandomExtractWithinSubsets(),
            ExtractByLocation(),
            SpatialJoin(),
            RegularPoints(),
            SymetricalDifference(),
            VectorSplit(),
            VectorGrid(),
            DeleteColumn(),
            DeleteDuplicateGeometries(),
            TextToFloat(),
            ExtractByAttribute(),
            SelectByAttribute(),
            Grid(),
            Gridify(),
            HubDistance(),
            HubLines(),
            Merge(),
            GeometryConvert(),
            AddTableField(),
            FieldsCalculator(),
            SaveSelectedFeatures(),
            JoinAttributes(),
            AutoincrementalField(),
            Explode(),
            FieldsPyculator(),
            EquivalentNumField(),
            PointsLayerFromTable(),
            StatisticsByCategories(),
            ConcaveHull(),
            Polygonize(),
            RasterLayerStatistics(),
            PointsDisplacement(),
            ZonalStatistics(),
            PointsFromPolygons(),
            PointsFromLines(),
            RandomPointsExtent(),
            RandomPointsLayer(),
            RandomPointsPolygonsFixed(),
            RandomPointsPolygonsVariable(),
            RandomPointsAlongLines(),
            PointsToPaths(),
            PostGISExecuteSQL(),
            ImportIntoPostGIS(),
            SetVectorStyle(),
            SetRasterStyle(),
            SelectByExpression(),
            HypsometricCurves(),
            SplitLinesWithLines(),
            CreateConstantRaster(),
        ]

        if hasMatplotlib:
            from VectorLayerHistogram import VectorLayerHistogram
            from RasterLayerHistogram import RasterLayerHistogram
            from VectorLayerScatterplot import VectorLayerScatterplot
            from MeanAndStdDevPlot import MeanAndStdDevPlot
            from BarPlot import BarPlot
            from PolarPlot import PolarPlot

            self.alglist.extend([
                VectorLayerHistogram(),
                RasterLayerHistogram(),
                VectorLayerScatterplot(),
                MeanAndStdDevPlot(),
                BarPlot(),
                PolarPlot(),
            ])

        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        self.alglist.extend(scripts)
        for alg in self.alglist:
            alg._icon = self._icon
Exemplo n.º 28
0
 def _loadAlgorithms(self):
     folder = ScriptUtils.scriptsFolder()
     self.loadFromFolder(folder)
     folder = os.path.join(os.path.dirname(__file__), 'scripts')
     self.loadFromFolder(folder)
Exemplo n.º 29
0
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     ProcessingConfig.addSetting(
         Setting(self.getDescription(), ScriptUtils.SCRIPTS_FOLDER,
                 'Scripts folder', ScriptUtils.scriptsFolder()))
Exemplo n.º 30
0
    def __init__(self):
        AlgorithmProvider.__init__(self)
        self._icon = QIcon(os.path.join(pluginPath, 'images', 'qgis.svg'))

        self.alglist = [SumLines(), PointsInPolygon(),
                        PointsInPolygonWeighted(), PointsInPolygonUnique(),
                        BasicStatisticsStrings(), BasicStatisticsNumbers(),
                        NearestNeighbourAnalysis(), MeanCoords(),
                        LinesIntersection(), UniqueValues(), PointDistance(),
                        ReprojectLayer(), ExportGeometryInfo(), Centroids(),
                        Delaunay(), VoronoiPolygons(), SimplifyGeometries(),
                        DensifyGeometries(), DensifyGeometriesInterval(),
                        MultipartToSingleparts(), SinglePartsToMultiparts(),
                        PolygonsToLines(), LinesToPolygons(), ExtractNodes(),
                        Eliminate(), ConvexHull(), FixedDistanceBuffer(),
                        VariableDistanceBuffer(), Dissolve(), Difference(),
                        Intersection(), Union(), Clip(), ExtentFromLayer(),
                        RandomSelection(), RandomSelectionWithinSubsets(),
                        SelectByLocation(), RandomExtract(), DeleteHoles(),
                        RandomExtractWithinSubsets(), ExtractByLocation(),
                        SpatialJoin(), RegularPoints(), SymmetricalDifference(),
                        VectorSplit(), VectorGridLines(), VectorGridPolygons(),
                        DeleteColumn(), DeleteDuplicateGeometries(), TextToFloat(),
                        ExtractByAttribute(), SelectByAttribute(), GridPolygon(),
                        GridLine(), Gridify(), HubDistancePoints(),
                        HubDistanceLines(), HubLines(), Merge(),
                        GeometryConvert(), AddTableField(), FieldsCalculator(),
                        SaveSelectedFeatures(), JoinAttributes(),
                        AutoincrementalField(), Explode(), FieldsPyculator(),
                        EquivalentNumField(), PointsLayerFromTable(),
                        StatisticsByCategories(), ConcaveHull(),
                        RasterLayerStatistics(), PointsDisplacement(),
                        ZonalStatistics(), PointsFromPolygons(),
                        PointsFromLines(), RandomPointsExtent(),
                        RandomPointsLayer(), RandomPointsPolygonsFixed(),
                        RandomPointsPolygonsVariable(),
                        RandomPointsAlongLines(), PointsToPaths(),
                        SpatialiteExecuteSQL(), ImportIntoSpatialite(),
                        PostGISExecuteSQL(), ImportIntoPostGIS(),
                        SetVectorStyle(), SetRasterStyle(),
                        SelectByExpression(), HypsometricCurves(),
                        SplitLinesWithLines(), CreateConstantRaster(),
                        FieldsMapper(), SelectByAttributeSum(), Datasources2Vrt(),
                        CheckValidity(), OrientedMinimumBoundingBox(), Smooth(),
                        ReverseLineDirection(), SpatialIndex(), DefineProjection(),
                        RectanglesOvalsDiamondsVariable(),
                        RectanglesOvalsDiamondsFixed(), MergeLines(),
                        BoundingBox(), Boundary(), PointOnSurface(),
                        OffsetLine(), PolygonCentroids(), Translate(),
                        SingleSidedBuffer(), PointsAlongGeometry(),
                        Aspect(), Slope(), Ruggedness(), Hillshade(),
                        ReliefAuto(), ZonalStatisticsQgis(),
                        IdwInterpolationZValue(), IdwInterpolationAttribute(),
                        TinInterpolationZValue(), TinInterpolationAttribute(),
                        RemoveNullGeometry(), ExtractByExpression(), ExtendLines(),
                        ExtractSpecificNodes()
                        ]

        if hasMatplotlib:
            from .VectorLayerHistogram import VectorLayerHistogram
            from .RasterLayerHistogram import RasterLayerHistogram
            from .VectorLayerScatterplot import VectorLayerScatterplot
            from .MeanAndStdDevPlot import MeanAndStdDevPlot
            from .BarPlot import BarPlot
            from .PolarPlot import PolarPlot

            self.alglist.extend([
                VectorLayerHistogram(), RasterLayerHistogram(),
                VectorLayerScatterplot(), MeanAndStdDevPlot(), BarPlot(),
                PolarPlot(),
            ])

        if hasShapely:
            from .Polygonize import Polygonize
            self.alglist.extend([Polygonize()])

        if Qgis.QGIS_VERSION_INT >= 21300:
            from .ExecuteSQL import ExecuteSQL
            self.alglist.extend([ExecuteSQL()])

        self.externalAlgs = []  # to store algs added by 3rd party plugins as scripts

        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        self.alglist.extend(scripts)
        for alg in self.alglist:
            alg._icon = self._icon
Exemplo n.º 31
0
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     ProcessingConfig.addSetting(Setting(self.name(),
                                         ScriptUtils.SCRIPTS_FOLDER,
                                         self.tr('Scripts folder', 'ScriptAlgorithmProvider'),
                                         ScriptUtils.defaultScriptsFolder(), valuetype=Setting.MULTIPLE_FOLDERS))
Exemplo n.º 32
0
 def _loadAlgorithms(self):
     folder = ScriptUtils.scriptsFolder()
     self.loadFromFolder(folder)
     folder = os.path.join(os.path.dirname(__file__), 'scripts')
     self.loadFromFolder(folder)
Exemplo n.º 33
0
 def _loadAlgorithms(self):
     folders = ScriptUtils.scriptsFolders()
     self.algs = []
     for f in folders:
         self.algs.extend(ScriptUtils.loadFromFolder(f))
Exemplo n.º 34
0
 def addAlgorithmsFromFolder(self, folder):
     self.algs.extend(ScriptUtils.loadFromFolder(folder))
Exemplo n.º 35
0
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     ProcessingConfig.addSetting(Setting(self.name(),
                                         ScriptUtils.SCRIPTS_FOLDER,
                                         self.tr('Scripts folder', 'ScriptAlgorithmProvider'),
                                         ScriptUtils.defaultScriptsFolder(), valuetype=Setting.MULTIPLE_FOLDERS))
Exemplo n.º 36
0
 def addAlgorithmsFromFolder(self, folder):
     self.algs.extend(ScriptUtils.loadFromFolder(folder))
Exemplo n.º 37
0
    def getAlgs(self):
        algs = [AddTableField(),
                Aggregate(),
                Aspect(),
                BasicStatisticsForField(),
                CheckValidity(),
                ConcaveHull(),
                CreateAttributeIndex(),
                CreateConstantRaster(),
                Datasources2Vrt(),
                DefineProjection(),
                Delaunay(),
                DeleteColumn(),
                DeleteDuplicateGeometries(),
                DeleteHoles(),
                DensifyGeometries(),
                DensifyGeometriesInterval(),
                Difference(),
                EliminateSelection(),
                EquivalentNumField(),
                ExecuteSQL(),
                Explode(),
                ExportGeometryInfo(),
                ExtendLines(),
                ExtentFromLayer(),
                ExtractSpecificNodes(),
                FieldsCalculator(),
                FieldsMapper(),
                FieldsPyculator(),
                FindProjection(),
                GeometryByExpression(),
                GeometryConvert(),
                GridLine(),
                GridPolygon(),
                Heatmap(),
                Hillshade(),
                HubDistanceLines(),
                HubDistancePoints(),
                HypsometricCurves(),
                IdwInterpolation(),
                ImportIntoPostGIS(),
                ImportIntoSpatialite(),
                Intersection(),
                LinesToPolygons(),
                MinimumBoundingGeometry(),
                NearestNeighbourAnalysis(),
                OffsetLine(),
                Orthogonalize(),
                PointDistance(),
                PointOnSurface(),
                PointsAlongGeometry(),
                PointsDisplacement(),
                PointsFromLines(),
                PointsFromPolygons(),
                PointsInPolygon(),
                PointsLayerFromTable(),
                PointsToPaths(),
                PoleOfInaccessibility(),
                Polygonize(),
                PolygonsToLines(),
                PostGISExecuteSQL(),
                RandomExtract(),
                RandomExtractWithinSubsets(),
                RandomPointsAlongLines(),
                RandomPointsExtent(),
                RandomPointsLayer(),
                RandomPointsPolygons(),
                RandomSelection(),
                RandomSelectionWithinSubsets(),
                RasterCalculator(),
                RasterizeAlgorithm(),
                RasterLayerStatistics(),
                RectanglesOvalsDiamondsFixed(),
                RectanglesOvalsDiamondsVariable(),
                RegularPoints(),
                Relief(),
                ReverseLineDirection(),
                Ruggedness(),
                SelectByAttribute(),
                SelectByExpression(),
                ServiceAreaFromLayer(),
                ServiceAreaFromPoint(),
                SetMValue(),
                SetRasterStyle(),
                SetVectorStyle(),
                SetZValue(),
                ShortestPathLayerToPoint(),
                ShortestPathPointToLayer(),
                ShortestPathPointToPoint(),
                SingleSidedBuffer(),
                Slope(),
                SnapGeometriesToLayer(),
                SpatialiteExecuteSQL(),
                SpatialIndex(),
                SpatialJoin(),
                SpatialJoinSummary(),
                StatisticsByCategories(),
                SumLines(),
                SymmetricalDifference(),
                TextToFloat(),
                TinInterpolation(),
                TopoColor(),
                TruncateTable(),
                Union(),
                UniqueValues(),
                VariableDistanceBuffer(),
                VectorSplit(),
                VoronoiPolygons(),
                ZonalStatistics()
                ]

        if hasPlotly:
            from .BarPlot import BarPlot
            from .BoxPlot import BoxPlot
            from .MeanAndStdDevPlot import MeanAndStdDevPlot
            from .PolarPlot import PolarPlot
            from .RasterLayerHistogram import RasterLayerHistogram
            from .VectorLayerHistogram import VectorLayerHistogram
            from .VectorLayerScatterplot import VectorLayerScatterplot
            from .VectorLayerScatterplot3D import VectorLayerScatterplot3D

            algs.extend([BarPlot(),
                         BoxPlot(),
                         MeanAndStdDevPlot(),
                         PolarPlot(),
                         RasterLayerHistogram(),
                         VectorLayerHistogram(),
                         VectorLayerScatterplot(),
                         VectorLayerScatterplot3D()])

        # to store algs added by 3rd party plugins as scripts
        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        algs.extend(scripts)

        return algs
Exemplo n.º 38
0
 def _loadAlgorithms(self):
     folder = ScriptUtils.scriptsFolder()
     self.algs = ScriptUtils.loadFromFolder(folder)
Exemplo n.º 39
0
    def __init__(self):
        AlgorithmProvider.__init__(self)
        self._icon = QIcon(os.path.join(pluginPath, 'images', 'qgis.svg'))

        self.alglist = [
            SumLines(),
            PointsInPolygon(),
            PointsInPolygonWeighted(),
            PointsInPolygonUnique(),
            BasicStatisticsStrings(),
            BasicStatisticsNumbers(),
            NearestNeighbourAnalysis(),
            MeanCoords(),
            LinesIntersection(),
            UniqueValues(),
            PointDistance(),
            ReprojectLayer(),
            ExportGeometryInfo(),
            Centroids(),
            Delaunay(),
            VoronoiPolygons(),
            SimplifyGeometries(),
            DensifyGeometries(),
            DensifyGeometriesInterval(),
            MultipartToSingleparts(),
            SinglePartsToMultiparts(),
            PolygonsToLines(),
            LinesToPolygons(),
            ExtractNodes(),
            Eliminate(),
            ConvexHull(),
            FixedDistanceBuffer(),
            VariableDistanceBuffer(),
            Dissolve(),
            Difference(),
            Intersection(),
            Union(),
            Clip(),
            ExtentFromLayer(),
            RandomSelection(),
            RandomSelectionWithinSubsets(),
            SelectByLocation(),
            RandomExtract(),
            DeleteHoles(),
            RandomExtractWithinSubsets(),
            ExtractByLocation(),
            SpatialJoin(),
            RegularPoints(),
            SymmetricalDifference(),
            VectorSplit(),
            VectorGridLines(),
            VectorGridPolygons(),
            DeleteColumn(),
            DeleteDuplicateGeometries(),
            TextToFloat(),
            ExtractByAttribute(),
            SelectByAttribute(),
            GridPolygon(),
            GridLine(),
            Gridify(),
            HubDistancePoints(),
            HubDistanceLines(),
            HubLines(),
            Merge(),
            GeometryConvert(),
            AddTableField(),
            FieldsCalculator(),
            SaveSelectedFeatures(),
            JoinAttributes(),
            AutoincrementalField(),
            Explode(),
            FieldsPyculator(),
            EquivalentNumField(),
            PointsLayerFromTable(),
            StatisticsByCategories(),
            ConcaveHull(),
            RasterLayerStatistics(),
            PointsDisplacement(),
            ZonalStatistics(),
            PointsFromPolygons(),
            PointsFromLines(),
            RandomPointsExtent(),
            RandomPointsLayer(),
            RandomPointsPolygonsFixed(),
            RandomPointsPolygonsVariable(),
            RandomPointsAlongLines(),
            PointsToPaths(),
            SpatialiteExecuteSQL(),
            ImportIntoSpatialite(),
            PostGISExecuteSQL(),
            ImportIntoPostGIS(),
            SetVectorStyle(),
            SetRasterStyle(),
            SelectByExpression(),
            HypsometricCurves(),
            SplitLinesWithLines(),
            CreateConstantRaster(),
            FieldsMapper(),
            SelectByAttributeSum(),
            Datasources2Vrt(),
            CheckValidity(),
            OrientedMinimumBoundingBox(),
            Smooth(),
            ReverseLineDirection(),
            SpatialIndex(),
            DefineProjection(),
            RectanglesOvalsDiamondsVariable(),
            RectanglesOvalsDiamondsFixed(),
            MergeLines(),
            BoundingBox(),
            Boundary(),
            PointOnSurface(),
            OffsetLine(),
            PolygonCentroids(),
            Translate(),
            SingleSidedBuffer(),
            PointsAlongGeometry(),
            Aspect(),
            Slope(),
            Ruggedness(),
            Hillshade(),
            ReliefAuto(),
            ZonalStatisticsQgis(),
            IdwInterpolationZValue(),
            IdwInterpolationAttribute(),
            TinInterpolationZValue(),
            TinInterpolationAttribute(),
            RemoveNullGeometry(),
            ExtractByExpression(),
            ExtendLines(),
            ExtractSpecificNodes(),
            GeometryByExpression(),
            SnapGeometriesToLayer()
        ]

        if hasMatplotlib:
            from .VectorLayerHistogram import VectorLayerHistogram
            from .RasterLayerHistogram import RasterLayerHistogram
            from .VectorLayerScatterplot import VectorLayerScatterplot
            from .MeanAndStdDevPlot import MeanAndStdDevPlot
            from .BarPlot import BarPlot
            from .PolarPlot import PolarPlot

            self.alglist.extend([
                VectorLayerHistogram(),
                RasterLayerHistogram(),
                VectorLayerScatterplot(),
                MeanAndStdDevPlot(),
                BarPlot(),
                PolarPlot(),
            ])

        if hasShapely:
            from .Polygonize import Polygonize
            self.alglist.extend([Polygonize()])

        if Qgis.QGIS_VERSION_INT >= 21300:
            from .ExecuteSQL import ExecuteSQL
            self.alglist.extend([ExecuteSQL()])

        self.externalAlgs = [
        ]  # to store algs added by 3rd party plugins as scripts

        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        self.alglist.extend(scripts)
        for alg in self.alglist:
            alg._icon = self._icon
Exemplo n.º 40
0
    def getAlgs(self):
        algs = [AddTableField(),
                Aggregate(),
                Aspect(),
                BasicStatisticsForField(),
                CheckValidity(),
                ConcaveHull(),
                CreateAttributeIndex(),
                CreateConstantRaster(),
                Datasources2Vrt(),
                DefineProjection(),
                Delaunay(),
                DeleteColumn(),
                DeleteDuplicateGeometries(),
                DeleteHoles(),
                DensifyGeometries(),
                DensifyGeometriesInterval(),
                Difference(),
                EliminateSelection(),
                EquivalentNumField(),
                ExecuteSQL(),
                Explode(),
                ExportGeometryInfo(),
                ExtendLines(),
                ExtentFromLayer(),
                ExtractSpecificNodes(),
                FieldsCalculator(),
                FieldsMapper(),
                FieldsPyculator(),
                FindProjection(),
                FixedDistanceBuffer(),
                GeometryByExpression(),
                GeometryConvert(),
                GridLine(),
                GridPolygon(),
                Heatmap(),
                Hillshade(),
                HubDistanceLines(),
                HubDistancePoints(),
                HypsometricCurves(),
                IdwInterpolation(),
                ImportIntoPostGIS(),
                ImportIntoSpatialite(),
                Intersection(),
                LinesToPolygons(),
                Merge(),
                MinimumBoundingGeometry(),
                NearestNeighbourAnalysis(),
                OffsetLine(),
                Orthogonalize(),
                PointDistance(),
                PointOnSurface(),
                PointsAlongGeometry(),
                PointsDisplacement(),
                PointsFromLines(),
                PointsFromPolygons(),
                PointsInPolygon(),
                PointsLayerFromTable(),
                PointsToPaths(),
                PoleOfInaccessibility(),
                Polygonize(),
                PolygonsToLines(),
                PostGISExecuteSQL(),
                RandomExtract(),
                RandomExtractWithinSubsets(),
                RandomPointsAlongLines(),
                RandomPointsExtent(),
                RandomPointsLayer(),
                RandomPointsPolygons(),
                RandomSelection(),
                RandomSelectionWithinSubsets(),
                RasterCalculator(),
                RasterizeAlgorithm(),
                RasterLayerStatistics(),
                RectanglesOvalsDiamondsFixed(),
                RectanglesOvalsDiamondsVariable(),
                RegularPoints(),
                Relief(),
                ReverseLineDirection(),
                Ruggedness(),
                SelectByAttribute(),
                SelectByExpression(),
                ServiceAreaFromLayer(),
                ServiceAreaFromPoint(),
                SetMValue(),
                SetRasterStyle(),
                SetVectorStyle(),
                SetZValue(),
                ShortestPathLayerToPoint(),
                ShortestPathPointToLayer(),
                ShortestPathPointToPoint(),
                SingleSidedBuffer(),
                Slope(),
                SnapGeometriesToLayer(),
                SpatialiteExecuteSQL(),
                SpatialIndex(),
                SpatialJoin(),
                SpatialJoinSummary(),
                StatisticsByCategories(),
                SumLines(),
                SymmetricalDifference(),
                TextToFloat(),
                TinInterpolation(),
                TopoColor(),
                Translate(),
                TruncateTable(),
                Union(),
                UniqueValues(),
                VariableDistanceBuffer(),
                VectorSplit(),
                VoronoiPolygons(),
                ZonalStatistics()
                ]

        if hasPlotly:
            from .BarPlot import BarPlot
            from .BoxPlot import BoxPlot
            from .MeanAndStdDevPlot import MeanAndStdDevPlot
            from .PolarPlot import PolarPlot
            from .RasterLayerHistogram import RasterLayerHistogram
            from .VectorLayerHistogram import VectorLayerHistogram
            from .VectorLayerScatterplot import VectorLayerScatterplot
            from .VectorLayerScatterplot3D import VectorLayerScatterplot3D

            algs.extend([BarPlot(),
                         BoxPlot(),
                         MeanAndStdDevPlot(),
                         PolarPlot(),
                         RasterLayerHistogram(),
                         VectorLayerHistogram(),
                         VectorLayerScatterplot(),
                         VectorLayerScatterplot3D()])

        # to store algs added by 3rd party plugins as scripts
        folder = os.path.join(os.path.dirname(__file__), 'scripts')
        scripts = ScriptUtils.loadFromFolder(folder)
        for script in scripts:
            script.allowEdit = False
        algs.extend(scripts)

        return algs
Exemplo n.º 41
0
 def initializeSettings(self):
     AlgorithmProvider.initializeSettings(self)
     ProcessingConfig.addSetting(Setting(self.getDescription(),
                                 ScriptUtils.SCRIPTS_FOLDER,
                                 self.tr('Scripts folder', 'ScriptAlgorithmProvider'),
                                 ScriptUtils.scriptsFolder(), valuetype=Setting.FOLDER))