2012-12-20 00:16:05 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
***************************************************************************
|
2013-02-27 12:32:46 +04:00
|
|
|
QGISAlgorithmProvider.py
|
2012-12-20 00:16:05 +01:00
|
|
|
---------------------
|
2013-02-27 12:32:46 +04:00
|
|
|
Date : December 2012
|
2012-12-20 00:16:05 +01:00
|
|
|
Copyright : (C) 2012 by Victor Olaya
|
|
|
|
Email : volayaf at gmail dot com
|
|
|
|
***************************************************************************
|
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
***************************************************************************
|
|
|
|
"""
|
2013-02-16 00:23:56 +01:00
|
|
|
|
2012-12-20 00:16:05 +01:00
|
|
|
__author__ = 'Victor Olaya'
|
2013-02-27 12:32:46 +04:00
|
|
|
__date__ = 'December 2012'
|
2012-12-20 00:16:05 +01:00
|
|
|
__copyright__ = '(C) 2012, Victor Olaya'
|
2013-10-01 20:52:22 +03:00
|
|
|
|
2012-12-20 00:16:05 +01:00
|
|
|
# This will get replaced with a git SHA1 when you do a git archive
|
2013-10-01 20:52:22 +03:00
|
|
|
|
2012-12-20 00:16:05 +01:00
|
|
|
__revision__ = '$Format:%H$'
|
|
|
|
|
2013-02-27 12:32:46 +04:00
|
|
|
from PyQt4.QtGui import *
|
2013-10-07 18:41:07 +02:00
|
|
|
from processing.algs.ftools.RandomExtract import RandomExtract
|
|
|
|
from processing.algs.ftools.RandomExtractWithinSubsets import \
|
|
|
|
RandomExtractWithinSubsets
|
|
|
|
from processing.algs.ftools.ExtractByLocation import ExtractByLocation
|
|
|
|
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.core.AlgorithmProvider import AlgorithmProvider
|
|
|
|
from processing.algs.ftools.PointsInPolygon import PointsInPolygon
|
|
|
|
from processing.algs.ftools.PointsInPolygonUnique import PointsInPolygonUnique
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.ftools.PointsInPolygonWeighted import \
|
|
|
|
PointsInPolygonWeighted
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.algs.ftools.SumLines import SumLines
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.ftools.BasicStatisticsNumbers import \
|
|
|
|
BasicStatisticsNumbers
|
|
|
|
from processing.algs.ftools.BasicStatisticsStrings import \
|
|
|
|
BasicStatisticsStrings
|
|
|
|
from processing.algs.ftools.NearestNeighbourAnalysis import \
|
|
|
|
NearestNeighbourAnalysis
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.algs.ftools.LinesIntersection import LinesIntersection
|
|
|
|
from processing.algs.ftools.MeanCoords import MeanCoords
|
|
|
|
from processing.algs.ftools.PointDistance import PointDistance
|
|
|
|
from processing.algs.ftools.UniqueValues import UniqueValues
|
|
|
|
from processing.algs.ftools.ReprojectLayer import ReprojectLayer
|
|
|
|
from processing.algs.ftools.ExportGeometryInfo import ExportGeometryInfo
|
|
|
|
from processing.algs.ftools.Centroids import Centroids
|
|
|
|
from processing.algs.ftools.Delaunay import Delaunay
|
|
|
|
from processing.algs.ftools.VoronoiPolygons import VoronoiPolygons
|
|
|
|
from processing.algs.ftools.DensifyGeometries import DensifyGeometries
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.ftools.MultipartToSingleparts import \
|
|
|
|
MultipartToSingleparts
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.algs.ftools.SimplifyGeometries import SimplifyGeometries
|
|
|
|
from processing.algs.ftools.LinesToPolygons import LinesToPolygons
|
|
|
|
from processing.algs.ftools.PolygonsToLines import PolygonsToLines
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.ftools.SinglePartsToMultiparts import \
|
|
|
|
SinglePartsToMultiparts
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.algs.ftools.ExtractNodes import ExtractNodes
|
|
|
|
from processing.algs.ftools.ConvexHull import ConvexHull
|
|
|
|
from processing.algs.ftools.FixedDistanceBuffer import FixedDistanceBuffer
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.ftools.VariableDistanceBuffer import \
|
|
|
|
VariableDistanceBuffer
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.algs.ftools.Clip import Clip
|
|
|
|
from processing.algs.ftools.Difference import Difference
|
|
|
|
from processing.algs.ftools.Dissolve import Dissolve
|
|
|
|
from processing.algs.ftools.Intersection import Intersection
|
|
|
|
from processing.algs.ftools.ExtentFromLayer import ExtentFromLayer
|
|
|
|
from processing.algs.ftools.RandomSelection import RandomSelection
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.ftools.RandomSelectionWithinSubsets import \
|
|
|
|
RandomSelectionWithinSubsets
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.algs.ftools.SelectByLocation import SelectByLocation
|
|
|
|
from processing.algs.ftools.Union import Union
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.ftools.DensifyGeometriesInterval import \
|
|
|
|
DensifyGeometriesInterval
|
|
|
|
from processing.algs.ftools.Eliminate import Eliminate
|
2013-08-12 20:44:27 +02:00
|
|
|
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.mmqgisx.MMQGISXAlgorithms import \
|
|
|
|
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, \
|
2013-10-07 18:41:07 +02:00
|
|
|
mmqgisx_select_algorithm, mmqgisx_text_to_float_algorithm,\
|
|
|
|
mmqgisx_extract_algorithm
|
2013-02-27 12:32:46 +04:00
|
|
|
|
2013-10-01 20:52:22 +03:00
|
|
|
from processing.algs.Polygonize import Polygonize
|
2013-08-12 20:44:27 +02:00
|
|
|
from processing.algs.RasterLayerStatistics import RasterLayerStatistics
|
|
|
|
from processing.algs.StatisticsByCategories import StatisticsByCategories
|
|
|
|
from processing.algs.EquivalentNumField import EquivalentNumField
|
|
|
|
from processing.algs.AddTableField import AddTableField
|
|
|
|
from processing.algs.FieldsCalculator import FieldsCalculator
|
|
|
|
from processing.algs.SaveSelectedFeatures import SaveSelectedFeatures
|
|
|
|
from processing.algs.Explode import Explode
|
|
|
|
from processing.algs.AutoincrementalField import AutoincrementalField
|
|
|
|
from processing.algs.FieldPyculator import FieldsPyculator
|
|
|
|
from processing.algs.JoinAttributes import JoinAttributes
|
|
|
|
from processing.algs.CreateConstantRaster import CreateConstantRaster
|
|
|
|
from processing.algs.PointsLayerFromTable import PointsLayerFromTable
|
2013-07-30 19:43:01 +03:00
|
|
|
from processing.algs.PointsDisplacement import PointsDisplacement
|
2013-08-27 19:47:44 +03:00
|
|
|
from processing.algs.ZonalStatistics import ZonalStatistics
|
|
|
|
from processing.algs.PointsFromPolygons import PointsFromPolygons
|
|
|
|
from processing.algs.PointsFromLines import PointsFromLines
|
2013-07-30 19:43:01 +03:00
|
|
|
|
2013-10-01 20:52:22 +03:00
|
|
|
# from processing.algs.VectorLayerHistogram import VectorLayerHistogram
|
|
|
|
# from processing.algs.VectorLayerScatterplot import VectorLayerScatterplot
|
|
|
|
# from processing.algs.MeanAndStdDevPlot import MeanAndStdDevPlot
|
|
|
|
# from processing.algs.BarPlot import BarPlot
|
|
|
|
# from processing.algs.PolarPlot import PolarPlot
|
|
|
|
# from processing.algs.RasterLayerHistogram import RasterLayerHistogram
|
2013-08-12 20:44:27 +02:00
|
|
|
|
|
|
|
import processing.resources_rc
|
2013-02-27 12:32:46 +04:00
|
|
|
|
2013-10-01 20:52:22 +03:00
|
|
|
|
2012-12-20 00:16:05 +01:00
|
|
|
class QGISAlgorithmProvider(AlgorithmProvider):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
AlgorithmProvider.__init__(self)
|
2013-10-01 20:52:22 +03:00
|
|
|
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(),
|
2013-10-07 18:41:07 +02:00
|
|
|
SelectByLocation(), RandomExtract(), RandomExtractWithinSubsets(),
|
|
|
|
ExtractByLocation(),
|
2013-02-27 12:32:46 +04:00
|
|
|
# ------ mmqgisx ------
|
2012-12-20 00:16:05 +01:00
|
|
|
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(),
|
2013-02-07 01:09:39 +01:00
|
|
|
mmqgisx_select_algorithm(),
|
2013-10-07 18:41:07 +02:00
|
|
|
mmqgisx_extract_algorithm(),
|
2013-02-03 10:26:43 +01:00
|
|
|
mmqgisx_text_to_float_algorithm(),
|
2013-02-27 12:32:46 +04:00
|
|
|
# ------ native algs ------
|
2013-10-01 20:52:22 +03:00
|
|
|
AddTableField(), FieldsCalculator(),
|
|
|
|
SaveSelectedFeatures(), JoinAttributes(),
|
|
|
|
AutoincrementalField(), Explode(), FieldsPyculator(),
|
|
|
|
EquivalentNumField(), PointsLayerFromTable(),
|
|
|
|
StatisticsByCategories(), Polygonize(),
|
|
|
|
RasterLayerStatistics(), PointsDisplacement(),
|
|
|
|
ZonalStatistics(), PointsFromPolygons(),
|
|
|
|
PointsFromLines(),
|
2013-02-27 12:32:46 +04:00
|
|
|
# ------ raster ------
|
2013-10-01 20:52:22 +03:00
|
|
|
# CreateConstantRaster(),
|
2013-02-27 12:32:46 +04:00
|
|
|
# ------ graphics ------
|
2013-10-01 20:52:22 +03:00
|
|
|
# VectorLayerHistogram(), VectorLayerScatterplot(),
|
|
|
|
# RasterLayerHistogram(), MeanAndStdDevPlot(),
|
|
|
|
# BarPlot(), PolarPlot()
|
|
|
|
]
|
2012-12-20 00:16:05 +01:00
|
|
|
|
|
|
|
def initializeSettings(self):
|
|
|
|
AlgorithmProvider.initializeSettings(self)
|
|
|
|
|
|
|
|
def unload(self):
|
|
|
|
AlgorithmProvider.unload(self)
|
|
|
|
|
|
|
|
def getName(self):
|
2013-10-01 20:52:22 +03:00
|
|
|
return 'qgis'
|
2012-12-20 00:16:05 +01:00
|
|
|
|
|
|
|
def getDescription(self):
|
2013-10-01 20:52:22 +03:00
|
|
|
return 'QGIS geoalgorithms'
|
2012-12-20 00:16:05 +01:00
|
|
|
|
|
|
|
def getIcon(self):
|
2013-10-01 20:52:22 +03:00
|
|
|
return QIcon(':/processing/images/qgis.png')
|
2012-12-20 00:16:05 +01:00
|
|
|
|
|
|
|
def _loadAlgorithms(self):
|
|
|
|
self.algs = self.alglist
|
|
|
|
|
|
|
|
def supportsNonFileBasedOutput(self):
|
2013-02-18 11:44:54 +04:00
|
|
|
return True
|