diff --git a/python/plugins/processing/algs/grass7/description/r.mask.rast.txt b/python/plugins/processing/algs/grass7/description/r.mask.rast.txt new file mode 100644 index 000000000000..358253e907f1 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.mask.rast.txt @@ -0,0 +1,8 @@ +r.mask +r.mask.rast - Creates a MASK for limiting raster operation. +Raster (r.*) +ParameterRaster|raster|Name of raster map to use as mask|False +ParameterRaster|input|Name of raster map to which apply the mask|False +ParameterString|maskcats|Raster values to use for mask. Format: 1 2 3 thru 7 *|*|False|True +*ParameterBoolean|-i|Create inverse mask|False|True +OutputRaster|output|Masked diff --git a/python/plugins/processing/algs/grass7/description/r.mask.vect.txt b/python/plugins/processing/algs/grass7/description/r.mask.vect.txt new file mode 100644 index 000000000000..cc009c630ca8 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.mask.vect.txt @@ -0,0 +1,9 @@ +r.mask +r.mask.vect - Creates a MASK for limiting raster operation with a vector layer. +Raster (r.*) +ParameterVector|vector|Name of vector map to use as mask|1,2|False +ParameterRaster|input|Name of raster map to which apply the mask|False +*ParameterString|cats|Category values. Example: 1,3,7-9,13|None|False|True +*ParameterString|where|WHERE conditions of SQL statement without 'where' keyword|None|True|True +*ParameterBoolean|-i|Create inverse mask|False|True +OutputRaster|output|Masked diff --git a/python/plugins/processing/algs/grass7/ext/r_mask.py b/python/plugins/processing/algs/grass7/ext/r_mask.py new file mode 100644 index 000000000000..97875aab7349 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_mask.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_mask.py + --------- + Date : February 2016 + Copyright : (C) 2016 by Médéric Ribreux + Email : medspx at medspx dot fr +*************************************************************************** +* * +* 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__ = 'Médéric Ribreux' +__date__ = 'February 2016' +__copyright__ = '(C) 2016, Médéric Ribreux' + +# This will get replaced with a git SHA1 when you do a git archive + +__revision__ = '$Format:%H$' + + +def processCommand(alg): + # Remove output and input + clipped = alg.getParameterFromName('input') + out = alg.getOutputFromName('output') + alg.exportedLayers[out.value] = alg.exportedLayers[clipped.value] + alg.removeOutputFromName('output') + alg.parameters.remove(clipped) + + alg.processCommand() + + # Re-add the output ! + alg.addOutput(out) + + +def processOutputs(alg): + out = alg.getOutputValue('output') + inputRaster = alg.exportedLayers[out] + command = u"r.out.gdal --overwrite -c createopt=\"TFW=YES,COMPRESS=LZW\" input={} output=\"{}\"".format( + inputRaster, out) + alg.commands.append(command) + alg.outputCommands.append(command) diff --git a/python/plugins/processing/algs/grass7/ext/r_mask_rast.py b/python/plugins/processing/algs/grass7/ext/r_mask_rast.py new file mode 100644 index 000000000000..4714ea11972d --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_mask_rast.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_mask_rast.py + -------------- + Date : February 2016 + Copyright : (C) 2016 by Médéric Ribreux + Email : medspx at medspx dot fr +*************************************************************************** +* * +* 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__ = 'Médéric Ribreux' +__date__ = 'February 2016' +__copyright__ = '(C) 2016, Médéric Ribreux' + +# This will get replaced with a git SHA1 when you do a git archive + +__revision__ = '$Format:%H$' + +import r_mask + + +def processCommand(alg): + r_mask.processCommand(alg) + + +def processOutputs(alg): + r_mask.processOutputs(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_mask_vect.py b/python/plugins/processing/algs/grass7/ext/r_mask_vect.py new file mode 100644 index 000000000000..dfc332d5eda0 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_mask_vect.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_mask_vect.py + -------------- + Date : February 2016 + Copyright : (C) 2016 by Médéric Ribreux + Email : medspx at medspx dot fr +*************************************************************************** +* * +* 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__ = 'Médéric Ribreux' +__date__ = 'February 2016' +__copyright__ = '(C) 2016, Médéric Ribreux' + +# This will get replaced with a git SHA1 when you do a git archive + +__revision__ = '$Format:%H$' + +import r_mask + + +def processCommand(alg): + r_mask.processCommand(alg) + + +def processOutputs(alg): + r_mask.processOutputs(alg)