QgisAlgorithmProvider.py 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. """
  2. ***************************************************************************
  3. QgisAlgorithmProvider.py
  4. ---------------------
  5. Date : December 2012
  6. Copyright : (C) 2012 by Victor Olaya
  7. Email : volayaf at gmail dot com
  8. ***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************
  16. """
  17. __author__ = 'Victor Olaya'
  18. __date__ = 'December 2012'
  19. __copyright__ = '(C) 2012, Victor Olaya'
  20. import os
  21. from PyQt5.QtGui import QIcon
  22. from qgis.core import (QgsApplication,
  23. QgsProcessingProvider,
  24. QgsRuntimeProfiler)
  25. from PyQt5.QtCore import QCoreApplication
  26. from .BarPlot import BarPlot
  27. from .BasicStatistics import BasicStatisticsForField
  28. from .BoxPlot import BoxPlot
  29. from .CheckValidity import CheckValidity
  30. from .Climb import Climb
  31. from .DefineProjection import DefineProjection
  32. from .EliminateSelection import EliminateSelection
  33. from .ExecuteSQL import ExecuteSQL
  34. from .ExportGeometryInfo import ExportGeometryInfo
  35. from .FieldPyculator import FieldsPyculator
  36. from .FindProjection import FindProjection
  37. from .GeometryConvert import GeometryConvert
  38. from .Heatmap import Heatmap
  39. from .HubDistanceLines import HubDistanceLines
  40. from .HubDistancePoints import HubDistancePoints
  41. from .HypsometricCurves import HypsometricCurves
  42. from .IdwInterpolation import IdwInterpolation
  43. from .ImportIntoSpatialite import ImportIntoSpatialite
  44. from .KNearestConcaveHull import KNearestConcaveHull
  45. from .LinesToPolygons import LinesToPolygons
  46. from .MeanAndStdDevPlot import MeanAndStdDevPlot
  47. from .MinimumBoundingGeometry import MinimumBoundingGeometry
  48. from .PointDistance import PointDistance
  49. from .PointsDisplacement import PointsDisplacement
  50. from .PointsFromLines import PointsFromLines
  51. from .PolarPlot import PolarPlot
  52. from .PostGISExecuteAndLoadSQL import PostGISExecuteAndLoadSQL
  53. from .RandomExtractWithinSubsets import RandomExtractWithinSubsets
  54. from .RandomPointsAlongLines import RandomPointsAlongLines
  55. from .RandomPointsLayer import RandomPointsLayer
  56. from .RandomPointsPolygons import RandomPointsPolygons
  57. from .RandomSelection import RandomSelection
  58. from .RandomSelectionWithinSubsets import RandomSelectionWithinSubsets
  59. from .RasterCalculator import RasterCalculator
  60. from .RasterLayerHistogram import RasterLayerHistogram
  61. from .RectanglesOvalsDiamondsVariable import RectanglesOvalsDiamondsVariable
  62. from .RegularPoints import RegularPoints
  63. from .Relief import Relief
  64. from .SelectByAttribute import SelectByAttribute
  65. from .SelectByExpression import SelectByExpression
  66. from .SetRasterStyle import SetRasterStyle
  67. from .SetVectorStyle import SetVectorStyle
  68. from .StatisticsByCategories import StatisticsByCategories
  69. from .TextToFloat import TextToFloat
  70. from .TinInterpolation import TinInterpolation
  71. from .TopoColors import TopoColor
  72. from .UniqueValues import UniqueValues
  73. from .VariableDistanceBuffer import VariableDistanceBuffer
  74. from .VectorLayerHistogram import VectorLayerHistogram
  75. from .VectorLayerScatterplot import VectorLayerScatterplot
  76. from .VectorLayerScatterplot3D import VectorLayerScatterplot3D
  77. pluginPath = os.path.normpath(os.path.join(
  78. os.path.split(os.path.dirname(__file__))[0], os.pardir))
  79. class QgisAlgorithmProvider(QgsProcessingProvider):
  80. fieldMappingParameterName = QCoreApplication.translate('Processing', 'Fields Mapper')
  81. def __init__(self):
  82. super().__init__()
  83. QgsApplication.processingRegistry().addAlgorithmAlias('qgis:rectanglesovalsdiamondsfixed',
  84. 'native:rectanglesovalsdiamonds')
  85. def getAlgs(self):
  86. algs = [BarPlot(),
  87. BasicStatisticsForField(),
  88. BoxPlot(),
  89. CheckValidity(),
  90. Climb(),
  91. DefineProjection(),
  92. EliminateSelection(),
  93. ExecuteSQL(),
  94. ExportGeometryInfo(),
  95. FieldsPyculator(),
  96. FindProjection(),
  97. GeometryConvert(),
  98. Heatmap(),
  99. HubDistanceLines(),
  100. HubDistancePoints(),
  101. HypsometricCurves(),
  102. IdwInterpolation(),
  103. ImportIntoSpatialite(),
  104. KNearestConcaveHull(),
  105. LinesToPolygons(),
  106. MeanAndStdDevPlot(),
  107. MinimumBoundingGeometry(),
  108. PointDistance(),
  109. PointsDisplacement(),
  110. PointsFromLines(),
  111. PolarPlot(),
  112. PostGISExecuteAndLoadSQL(),
  113. RandomExtractWithinSubsets(),
  114. RandomPointsAlongLines(),
  115. RandomPointsLayer(),
  116. RandomPointsPolygons(),
  117. RandomSelection(),
  118. RandomSelectionWithinSubsets(),
  119. RasterCalculator(),
  120. RasterLayerHistogram(),
  121. RectanglesOvalsDiamondsVariable(),
  122. RegularPoints(),
  123. Relief(),
  124. SelectByAttribute(),
  125. SelectByExpression(),
  126. SetRasterStyle(),
  127. SetVectorStyle(),
  128. StatisticsByCategories(),
  129. TextToFloat(),
  130. TinInterpolation(),
  131. TopoColor(),
  132. UniqueValues(),
  133. VariableDistanceBuffer(),
  134. VectorLayerHistogram(),
  135. VectorLayerScatterplot(),
  136. VectorLayerScatterplot3D(),
  137. ]
  138. return algs
  139. def id(self):
  140. return 'qgis'
  141. def helpId(self):
  142. return 'qgis'
  143. def name(self):
  144. return 'QGIS'
  145. def icon(self):
  146. return QIcon(os.path.join(pluginPath, 'images', 'dbms', 'tools.png'))
  147. # return QgsApplication.getThemeIcon("/providerGdal.svg")
  148. def svgIconPath(self):
  149. return os.path.join(pluginPath, 'images', 'dbms', 'tools.png')
  150. # return QgsApplication.iconPath("providerGdal.svg")
  151. def loadAlgorithms(self):
  152. for a in self.getAlgs():
  153. self.addAlgorithm(a)
  154. def load(self):
  155. with QgsRuntimeProfiler.profile('QGIS Python Provider'):
  156. success = super().load()
  157. return success
  158. def unload(self):
  159. super().unload()
  160. def supportsNonFileBasedOutput(self):
  161. return True