v.type.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #!/bin/sh
  2. ############################################################################
  3. #
  4. # MODULE: v.type.sh (v.type wrapper script)
  5. # AUTHOR(S): Hamish Bowman (Otago University, New Zealand)
  6. # PURPOSE: Supply v.type options in a GUI compatible way
  7. # COPYRIGHT: (c) 2007 by Hamish Bowman, and the GRASS Development Team
  8. #
  9. # This program is free software under the GNU General Public
  10. # License (>=v2). Read the file COPYING that comes with GRASS
  11. # for details.
  12. #
  13. #############################################################################
  14. # Notes:
  15. # Created with "v.type --script" from GRASS 6.3-CVS 23 May 2007
  16. #%Module
  17. #% description: Change the type of geometry elements.
  18. #% keywords: vector, geometry
  19. #%End
  20. #%Option
  21. #% key: input
  22. #% type: string
  23. #% required: yes
  24. #% multiple: no
  25. #% key_desc: name
  26. #% description: Name of input vector map
  27. #% gisprompt: old,vector,vector
  28. #%End
  29. #%Option
  30. #% key: output
  31. #% type: string
  32. #% required: yes
  33. #% multiple: no
  34. #% key_desc: name
  35. #% description: Name for output vector map
  36. #% gisprompt: new,vector,vector
  37. #%End
  38. #%Option
  39. #% key: type
  40. #% type: string
  41. #% required: no
  42. #% multiple: no
  43. #% options: point to centroid,point to kernel,centroid to point,centroid to kernel,kernel to point,kernel to centroid,line to boundary,line to face,boundary to line,boundary to face,face to line,face to boundary
  44. #% description: Conversion
  45. #% answer: boundary to line
  46. #%End
  47. if [ -z "$GISBASE" ] ; then
  48. echo "You must be in GRASS GIS to run this program." 1>&2
  49. exit 1
  50. fi
  51. if [ "$1" != "@ARGS_PARSED@" ] ; then
  52. exec g.parser "$0" "$@"
  53. fi
  54. unset TYPE_CNV
  55. case "$GIS_OPT_TYPE" in
  56. "point to centroid")
  57. TYPE_CNV="point,centroid" ;;
  58. "centroid to point")
  59. TYPE_CNV="centroid,point" ;;
  60. "line to boundary")
  61. TYPE_CNV="line,boundary" ;;
  62. "boundary to line")
  63. TYPE_CNV="boundary,line" ;;
  64. "kernel to centroid")
  65. TYPE_CNV="kernel,centroid" ;;
  66. "centroid to kernel")
  67. TYPE_CNV="centroid,kernel" ;;
  68. "face to boundary")
  69. TYPE_CNV="face,boundary" ;;
  70. "boundary to face")
  71. TYPE_CNV="boundary,face" ;;
  72. "point to kernel")
  73. TYPE_CNV="point,kernel" ;;
  74. "kernel to point")
  75. TYPE_CNV="kernel,point" ;;
  76. "line to face")
  77. TYPE_CNV="line,face" ;;
  78. "face to line")
  79. TYPE_CNV="face,line" ;;
  80. esac
  81. exec v.type input="$GIS_OPT_INPUT" output="$GIS_OPT_OUTPUT" type="$TYPE_CNV"