Skip to content

Commit

Permalink
[processing] improvements in help for algorithms
Browse files Browse the repository at this point in the history
Avoid creating temporary helpfiles
Added basic converter to convert rst into html on the fly
Added SAGA help files
  • Loading branch information
volaya committed Apr 19, 2014
1 parent 9b277cb commit bce5b89
Show file tree
Hide file tree
Showing 249 changed files with 9,145 additions and 75 deletions.
7 changes: 3 additions & 4 deletions python/plugins/processing/algs/grass/GrassAlgorithm.py
Expand Up @@ -91,14 +91,13 @@ def getCopy(self):
def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/grass.png')

def helpFile(self):
return 'http://grass.osgeo.org/grass64/manuals/' + self.grassName \
+ '.html'
def help(self):
return False, 'http://grass.osgeo.org/grass64/manuals/' + self.grassName + '.html'

def getParameterDescriptions(self):
descs = {}
try:
helpfile = self.helpFile()
_, helpfile = self.help()
except WrongHelpFileException:
return descs
if helpfile:
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/otb/OTBAlgorithm.py
Expand Up @@ -74,11 +74,11 @@ def getCopy(self):
def getIcon(self):
return PyQt4.QtGui.QIcon(os.path.dirname(__file__) + "/../../images/otb.png")

def helpFile(self):
def help(self):
folder = os.path.join( OTBUtils.otbDescriptionPath(), 'doc' )
helpfile = os.path.join( str(folder), self.appkey + ".html")
if os.path.exists(helpfile):
return helpfile
return False, helpfile
else:
raise WrongHelpFileException("Could not find help file for this algorithm. \nIf you have it put it in: \n"+str(folder))

Expand Down
7 changes: 3 additions & 4 deletions python/plugins/processing/algs/r/RAlgorithm.py
Expand Up @@ -34,7 +34,7 @@
from processing.core.GeoAlgorithmExecutionException import \
GeoAlgorithmExecutionException
from processing.core.ProcessingLog import ProcessingLog
from processing.gui.Help2Html import Help2Html
from processing.gui.Help2Html import getHtmlFromHelpFile
from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterTable import ParameterTable
from processing.parameters.ParameterVector import ParameterVector
Expand Down Expand Up @@ -401,11 +401,10 @@ def getImportCommands(self):
def getRCommands(self):
return self.commands

def helpFile(self):
def help(self):
helpfile = unicode(self.descriptionFile) + '.help'
if os.path.exists(helpfile):
h2h = Help2Html()
return h2h.getHtmlFile(self, helpfile)
return True, getHtmlFromHelpFile(self, helpfile)
else:
return None

Expand Down
13 changes: 10 additions & 3 deletions python/plugins/processing/algs/saga/SagaAlgorithm.py
Expand Up @@ -16,6 +16,7 @@
* *
***************************************************************************
"""
from processing.gui.Help2Html import getHtmlFromRstFile

__author__ = 'Victor Olaya'
__date__ = 'August 2012'
Expand Down Expand Up @@ -501,9 +502,15 @@ def checkParameterValuesBeforeExecuting(self):
+ ' has more than one band.\n' \
+ 'Multiband layers are not supported by SAGA'

def helpFile(self):
return os.path.join(os.path.dirname(__file__), 'help',
self.name.replace(' ', '') + '.html')
def help(self):
name = self.cmdname.lower()
validChars = 'abcdefghijklmnopqrstuvwxyz'
name = ''.join(c for c in name if c in validChars)
html = getHtmlFromRstFile(os.path.join(os.path.dirname(__file__), 'help',
name + '.rst'))
imgpath = os.path.join(os.path.dirname(__file__),os.pardir, os.pardir, 'images', 'saga100x100.jpg')
html = ('<img src="%s"/>' % imgpath) + html
return True, html

def getPostProcessingErrorMessage(self, wrongLayers):
html = GeoAlgorithm.getPostProcessingErrorMessage(self, wrongLayers)
Expand Down
@@ -0,0 +1,31 @@
ACCUMULATED COST (ANISOTROPIC)
==============================

Description
-----------

Parameters
----------

- ``Cost Grid[Raster]``:
- ``Direction of max cost[Raster]``:
- ``Destination Points[Raster]``:
- ``k factor[Number]``:
- ``Threshold for different route[Number]``:

Outputs
-------

- ``Accumulated Cost[Raster]``:

See also
---------


Console usage
-------------


::

sextante.runalg('saga:accumulatedcostanisotropic', cost, direction, points, k, threshold, acccost)
@@ -0,0 +1,30 @@
ACCUMULATED COST (ISOTROPIC)
============================

Description
-----------

Parameters
----------

- ``Cost Grid[Raster]``:
- ``Destination Points[Raster]``:
- ``Threshold for different route[Number]``:

Outputs
-------

- ``Accumulated Cost[Raster]``:
- ``Closest Point[Raster]``:

See also
---------


Console usage
-------------


::

sextante.runalg('saga:accumulatedcostisotropic', cost, points, threshold, acccost, closestpt)
@@ -0,0 +1,28 @@
ADD COORDINATES TO POINTS
=========================

Description
-----------
This algorithm adds the X and Y coordinates in the attribute table.

Parameters
----------

- ``Points[Vector]``: input points layer

Outputs
-------

- ``Output[Vector]``: resulting layer with the updated attribute table.

See also
---------


Console usage
-------------


::

sextante.runalg('saga:addcoordinatestopoints', input, output)
44 changes: 44 additions & 0 deletions python/plugins/processing/algs/saga/help/addgridvaluestopoints.rst
@@ -0,0 +1,44 @@
ADD GRID VALUES TO POINTS
=========================

Description
-----------
This algorithm creates a new vector layer as a result of the union of a points layer with the interpolated value of one or more base background grid layer/s. This way, the new layer created will have a new column in the attribute table that reflects the interpolated value of the background grid.
There are several interpolation methods available:
- nearest neighbor
- bilinear interpolation
- inverse distance interpolation
- bicubic spline interpolation
- b-spline interpolation
Parameters
----------

- ``Points[Vector]``: points layer in input
- ``Grids[MultipleInput]``: background grid layer (it possible to choose multiple grids)
- ``Interpolation[Selection]``: interpolation method

Outputs
-------

- ``Result[Vector]``: the resulting vector

See also
---------


Console usage
-------------


::

sextante.runalg('saga:addgridvaluestopoints', shapes, grids, interpol, result)

Available options for selection parameters:

interpol(Interpolation)
0 - [0] Nearest Neighbor
1 - [1] Bilinear Interpolation
2 - [2] Inverse Distance Interpolation
3 - [3] Bicubic Spline Interpolation
4 - [4] B-Spline Interpolation
38 changes: 38 additions & 0 deletions python/plugins/processing/algs/saga/help/addgridvaluestoshapes.rst
@@ -0,0 +1,38 @@
ADD GRID VALUES TO SHAPES
=========================

Description
-----------

Parameters
----------

- ``Shapes[Vector]``:
- ``Grids[MultipleInput]``:
- ``Interpolation[Selection]``:

Outputs
-------

- ``Result[Vector]``:

See also
---------


Console usage
-------------


::

sextante.runalg('saga:addgridvaluestoshapes', shapes, grids, interpol, result)

Available options for selection parameters:

interpol(Interpolation)
0 - [0] Nearest Neighbor
1 - [1] Bilinear Interpolation
2 - [2] Inverse Distance Interpolation
3 - [3] Bicubic Spline Interpolation
4 - [4] B-Spline Interpolation
@@ -0,0 +1,31 @@
ADD POLYGON ATTRIBUTES TO POINTS
================================

Description
-----------
This algorithm adds the specified field of the polygons layer to the attribute table of the points layer in input.
The new attributes added for each point depend on the value of the background polygon layer.

Parameters
----------

- ``Points[Vector]``: points layer
- ``Polygons[Vector]``: polygons layer
- ``Attribute[TableField]``: attribute of the polygons layer that will be added to the table attribute

Outputs
-------

- ``Result[Vector]``: resulting points layer with the new field

See also
---------


Console usage
-------------


::

sextante.runalg('saga:addpolygonattributestopoints', input, polygons, field, output)
35 changes: 35 additions & 0 deletions python/plugins/processing/algs/saga/help/aggregate.rst
@@ -0,0 +1,35 @@
AGGREGATE
=========

Description
-----------

Parameters
----------

- ``Grid[Raster]``:
- ``Aggregation Size[Number]``:
- ``Method[Selection]``:

Outputs
-------


See also
---------


Console usage
-------------


::

sextante.runalg('saga:aggregate', input, size, method)

Available options for selection parameters:

method(Method)
0 - [0] Sum
1 - [1] Min
2 - [2] Max
@@ -0,0 +1,37 @@
AGGREGATE POINT OBSERVATIONS
============================

Description
-----------

Parameters
----------

- ``Reference Points[Vector]``:
- ``ID[TableField]``:
- ``Observations[Table]``:
- ``X[TableField]``:
- ``Y[TableField]``:
- ``Track[TableField]``:
- ``Date[TableField]``:
- ``Time[TableField]``:
- ``Parameter[TableField]``:
- ``Maximum Time Span (Seconds)[Number]``:
- ``Maximum Distance[Number]``:

Outputs
-------

- ``Aggregated[Table]``:

See also
---------


Console usage
-------------


::

sextante.runalg('saga:aggregatepointobservations', reference, reference_id, observations, x, y, track, date, time, parameter, eps_time, eps_space, aggregated)
28 changes: 28 additions & 0 deletions python/plugins/processing/algs/saga/help/aggregationindex.rst
@@ -0,0 +1,28 @@
AGGREGATION INDEX
=================

Description
-----------

Parameters
----------

- ``Input Grid[Raster]``:
- ``Max. Number of Classes[Number]``:

Outputs
-------

- ``Result[Table]``:

See also
---------


Console usage
-------------


::

sextante.runalg('saga:aggregationindex', input, maxnumclass, result)

0 comments on commit bce5b89

Please sign in to comment.