2016-02-27 15:19:55 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
"""
|
|
|
|
***************************************************************************
|
|
|
|
r_drain.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$'
|
|
|
|
|
|
|
|
|
2017-10-22 10:25:09 +02:00
|
|
|
def checkParameterValuesBeforeExecuting(alg, parameters, context):
|
2016-02-27 15:19:55 +01:00
|
|
|
""" Verify if we have the right parameters """
|
2017-10-22 10:25:09 +02:00
|
|
|
if (alg.parameterAsString(parameters, 'start_coordinates', context)
|
|
|
|
and alg.parameterAsVectorLayer(parameters, 'start_points', context)):
|
2016-03-25 22:50:50 +01:00
|
|
|
return alg.tr("You need to set either start coordinates OR a start points vector layer!")
|
2016-02-27 15:19:55 +01:00
|
|
|
|
2017-10-22 10:25:09 +02:00
|
|
|
paramscore = [f for f in ['-c', '-a', '-n']
|
|
|
|
if alg.parameterAsBool(parameters, f, context)]
|
2016-02-27 15:19:55 +01:00
|
|
|
if len(paramscore) > 1:
|
2016-03-25 23:08:32 +01:00
|
|
|
return alg.tr("-c, -a, -n parameters are mutually exclusive!")
|
2016-02-27 15:19:55 +01:00
|
|
|
return None
|