v_voronoi.py 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. """
  2. ***************************************************************************
  3. v_voronoi.py
  4. ------------
  5. Date : February 2016
  6. Copyright : (C) 2016 by Médéric Ribreux
  7. Email : medspx at medspx dot fr
  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. * (at your option) any later version. *
  14. * *
  15. ***************************************************************************
  16. """
  17. __author__ = 'Médéric Ribreux'
  18. __date__ = 'February 2016'
  19. __copyright__ = '(C) 2016, Médéric Ribreux'
  20. def processInputs(alg, parameters, context, feedback):
  21. if 'input' in alg.exportedLayers:
  22. return
  23. # We need to use v.in.ogr instead of v.external
  24. alg.loadVectorLayerFromParameter('input', parameters, context, feedback, False)
  25. alg.processInputs(parameters, context, feedback)
  26. def processOutputs(alg, parameters, context, feedback):
  27. fileName = alg.parameterAsOutputLayer(parameters, 'output', context)
  28. grassName = '{}{}'.format('output', alg.uniqueSuffix)
  29. dataType = 'auto'
  30. # if we export a graph, output type will be a line
  31. if alg.parameterAsBoolean(parameters, '-l', context):
  32. dataType = 'line'
  33. alg.exportVectorLayer(grassName, fileName, dataType=dataType)