v_reclass.py 1.5 KB

12345678910111213141516171819202122232425262728293031
  1. """
  2. ***************************************************************************
  3. v_reclass.py
  4. ----------
  5. Date : June 2023
  6. Copyright : (C) 2023 by Andrea Giudiceandrea
  7. Email : andreaerdna at libero dot it
  8. ***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * any later version. *
  14. * *
  15. ***************************************************************************
  16. """
  17. __author__ = 'Andrea Giudiceandrea'
  18. __date__ = 'June 2023'
  19. __copyright__ = '(C) 2023, Andrea Giudiceandrea'
  20. def checkParameterValuesBeforeExecuting(alg, parameters, context):
  21. """ Verify if we have the right parameters """
  22. # rules and column parameters are mutually exclusive
  23. rules = alg.parameterAsString(parameters, 'rules', context)
  24. column = alg.parameterAsString(parameters, 'column', context)
  25. if (rules and column) or (not rules and not column):
  26. return False, alg.tr("You need to set either a rules file or a column!")
  27. return True, None