p.rast 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. #!/bin/sh
  2. #%Module
  3. #% description: Displays and overlays raster map layers in the active display frame on the graphics monitor
  4. #% keywords: display
  5. #%End
  6. #%flag
  7. #% key: i
  8. #% description: Invert catlist
  9. #%End
  10. #%Option
  11. #% key: map
  12. #% type: string
  13. #% required: yes
  14. #% multiple: no
  15. #% description: Raster map to be displayed
  16. #% gisprompt: old,cell,raster
  17. #%End
  18. #%Option
  19. #% key: catlist
  20. #% type: string
  21. #% required: no
  22. #% multiple: yes
  23. #% key_desc: cat[-cat]
  24. #% description: List of categories to be displayed (INT maps)
  25. #%End
  26. #%Option
  27. #% key: vallist
  28. #% type: string
  29. #% required: no
  30. #% multiple: yes
  31. #% key_desc: val[-val]
  32. #% description: List of values to be displayed (FP maps)
  33. #%End
  34. #%Option
  35. #% key: opacity
  36. #% type: string
  37. #% required: no
  38. #% multiple: no
  39. #% key_desc: val[-val]
  40. #% description: Set opacity between 0-100%
  41. #%End
  42. if [ -z "$GISBASE" ] ; then
  43. echo "You must be in GRASS GIS to run this program." 1>&2
  44. exit 1
  45. fi
  46. if [ "$1" != "@ARGS_PARSED@" ] ; then
  47. exec g.parser "$0" "$@"
  48. fi
  49. # CODE GOES HERE
  50. cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
  51. if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
  52. echo -n
  53. else
  54. g.message -e "GRASS_PYCMDFILE - File not found. Run p.mon"
  55. exit 1
  56. fi
  57. eval "`echo ${GIS_OPT_MAP} | sed -e 's/^/NAME=/' -e 's/@/; MAPSET=/'`;"
  58. #echo $NAME
  59. if [ -z "${MAPSET}" ]; then
  60. mapset=""
  61. else
  62. mapset="mapset=${MAPSET}"
  63. fi
  64. #echo $MAPSET
  65. eval "`g.findfile element=cell file=${NAME} ${mapset}`"
  66. #echo $NAME
  67. #echo $MAPSET
  68. if [ -z "${GIS_OPT_CATLIST}" ]; then
  69. CATLIST="None"
  70. else
  71. CATLIST="${GIS_OPT_CATLIST}"
  72. fi
  73. if [ -z "${GIS_OPT_VALLIST}" ]; then
  74. VALLIST="None"
  75. else
  76. VALLIST="${GIS_OPT_VALLIST}"
  77. fi
  78. if [ -z "${GIS_OPT_OPACITY}" ]; then
  79. OPACITY="100"
  80. else
  81. OPACITY="${GIS_OPT_OPACITY}"
  82. fi
  83. if [ "${GIS_FLAG_I}" -eq "1" ]; then
  84. INVERT="True"
  85. else
  86. INVERT="False"
  87. fi
  88. #cmd="self.map.AddRasterLayer(self, $NAME $MAPSET $CATLIST $VALLIST $INVERCATS $INVERT $OPACITY)"
  89. cmd="addraster ${name} ${mapset} ${CATLIST} ${VALLIST} ${INVERT} ${OPACITY}"
  90. #echo "${cmd}"
  91. echo "${cmd}" >> "${cmdfile}"