Skip to content
Permalink
Browse files
add short help
  • Loading branch information
alexbruy committed Jun 21, 2021
1 parent da036c9 commit 5e8e2a663e759012abc94970ac3f2e48f048693a
@@ -3,6 +3,7 @@ file(GLOB DESCR_FILES description/*.txt)
file(GLOB OTHER_FILES metadata.txt)

add_subdirectory(ext)
add_subdirectory(shorthelp)

PLUGIN_INSTALL(sagaprovider . ${PY_FILES} ${OTHER_FILES})
PLUGIN_INSTALL(sagaprovider ./description/ ${DESCR_FILES})
@@ -45,12 +45,12 @@
QgsProcessingParameterRasterDestination,
QgsProcessingParameterVectorDestination)
from processing.core.ProcessingConfig import ProcessingConfig
from processing.algs.help import shortHelp
from processing.tools.system import getTempFilename
from .SagaNameDecorator import decoratedAlgorithmName, decoratedGroupName
from .SagaParameters import Parameters
from . import SagaUtils
from .SagaAlgorithmBase import SagaAlgorithmBase
from .shorthelp import shortHelp

pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))
@@ -0,0 +1,5 @@
file(GLOB PY_FILES *.py)
file(GLOB YAML_FILES *.yaml)

PLUGIN_INSTALL(sagaprovider ./shorthelp/ ${PY_FILES})
PLUGIN_INSTALL(sagaprovider ./shorthelp/ ${YAML_FILES})
@@ -0,0 +1,69 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
__init__.py
---------------------
Date : January 2016
Copyright : (C) 2016 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. *
* *
***************************************************************************
"""

__author__ = 'Victor Olaya'
__date__ = 'January 2016'
__copyright__ = '(C) 2016, Victor Olaya'

import os
import codecs
import warnings

with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
import yaml

from qgis.core import QgsSettings, Qgis
from qgis.PyQt.QtCore import QLocale, QCoreApplication


def loadShortHelp():
h = {}
path = os.path.dirname(__file__)
for f in os.listdir(path):
if f.endswith("yaml"):
filename = os.path.join(path, f)
with codecs.open(filename, encoding='utf-8') as stream:
with warnings.catch_warnings():
warnings.filterwarnings("ignore", category=DeprecationWarning)
for k, v in yaml.load(stream, Loader=yaml.SafeLoader).items():
if v is None:
continue
h[k] = QCoreApplication.translate("{}Algorithm".format(f[:-5].upper()), v)

version = ".".join(Qgis.QGIS_VERSION.split(".")[0:2])
overrideLocale = QgsSettings().value('locale/overrideFlag', False, bool)
if not overrideLocale:
locale = QLocale.system().name()[:2]
else:
locale = QgsSettings().value('locale/userLocale', '')
locale = locale.split("_")[0]

def replace(s):
if s is not None:
return s.replace("{qgisdocs}", "https://docs.qgis.org/%s/%s/docs" % (version, locale))
else:
return None

h = {k: replace(v) for k, v in list(h.items())}

return h


shortHelp = loadShortHelp()
@@ -0,0 +1,48 @@
saga:rastercalculator: >
This algorithm allows performing algebraic operations on raster layers

It requires a base layer, and a set of additional layers. The base layer is identified as "a" in the formula, while the additional layers are identified as "b, c, d...", using the order in which they appear in the multiple selection dialog.

The resulting layer has the extent and cell size of the main layer.

The following operators and functions are available.

- Addition (+)

- Subtraction ( - )

- Multiplication (*)

- Division (/)

- Power (^)

- ln(x): returns natural logarithm of x.

- sin(x): returns the sine of x. x must be in radians

- cos(x): returns the cosine of x. x must be in radians

- tan(x): returns the tangent of x. x must be in radians

- asin(x): returns the arcsine of x, in radians

- acos(x): returns the arccosine of x, in radians

- atan(x): returns the arctangent of x, in radians

- atan2(x,y): returns the arctangent y/x, in radians

- abs(x): return the absolute value of x. abs(- 5)=5

- int(x): returns the integer part of x. int(5.4)=5

- mod(x,y): returns the modulus of x/y. mod(7,4)=3

- gt(x,y): true if x is greater than y

- lt(x,y): true if x is lower than y

- eq(x,y): true if x equals y. When using this function SAGA evaluates it in a per–cell basis. Therefore, eq(a,b) will not return 1 if grid a equals grid b. It will return 1 for those cells that have the same value in both grids, and zero otherwise.

- ifelse(condition, x, y) returns x if condition evaluates to true (condition=1) or y if it evaluates to false

0 comments on commit 5e8e2a6

Please sign in to comment.