mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Tweak new info in grass7.txt
This commit is contained in:
parent
830dc772b6
commit
2b9e2b77be
@ -173,17 +173,17 @@ There are 4 different levels where you can add logic:
|
||||
- Processing the command itself: if you need to chain more than one GRASS command for your algorithm.
|
||||
- Processing the outputs: if you need to do special things before exporting layers or if you need special export methods.
|
||||
|
||||
To add some logic on one (or more) level(s), you have to create a .py file named according to the algorithm name in python/plugins/grassprovider/ext, replacing '.' with '_'.
|
||||
Then you need to create methods using the respective names:
|
||||
To add some logic on one or more of these levels you have to create a .py file named according to the algorithm name in python/plugins/grassprovider/ext, replacing '.' with '_'.
|
||||
Then create methods using the respective names:
|
||||
- Input parameters: checkParameterValuesBeforeExecuting
|
||||
- Inputs import: processInputs
|
||||
- Command: processCommand
|
||||
- Outputs: processOutputs
|
||||
|
||||
If there is a Python file with the algorithm name in the ext directory, methods will be imported from the file and run instead of the common methods (there are "standard" processCommand/processInputs/processOutputs/checkParameterValuesBeforeExecuting methods in the code of the GRASS provider for QGIS Processing, in python/plugins/grassprovider/grass_algorithm.py).
|
||||
If there is a Python file with the algorithm name in the ext directory, methods will be imported from the file and run instead of the common methods (there are "standard" processCommand/processInputs/processOutputs/checkParameterValuesBeforeExecuting methods in the code of the GRASS provider, in python/plugins/grassprovider/grass_algorithm.py).
|
||||
|
||||
If we take the example of v.what.rast, there is an ext file: ext/v_what_rast.py.
|
||||
In this file there is a processCommand method. It just launches the standard processCommand but with the delOutputs option set to True (we do not want to have standard outputs).
|
||||
Then there is also a customized processOutputs which exports the input vector as an output for QGIS. We need to do this because v.what.rast modifies values directly in the input vector layer instead of generating a new output, so we have to build this output ourself.
|
||||
|
||||
If you want to do special things in the ext mechanism, you will need to read (and understand) the GRASS provider code standard methods in Grass7Algorithm.py.
|
||||
If you want to do special things in the ext mechanism, you will need to read (and understand) the code for the standard methods in Grass7Algorithm.py.
|
||||
|
Loading…
x
Reference in New Issue
Block a user