p.vect 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336
  1. #!/bin/sh
  2. #%Module
  3. #% description: Displays GRASS vector data in the active frame on the graphics monitor.
  4. #% keywords: display
  5. #%End
  6. #%Flag
  7. #% key: v
  8. #% description: Run verbosely
  9. #%End
  10. #%Flag
  11. #% key: a
  12. #% description: Get colors from map table column (of form RRR:GGG:BBB)
  13. #% guisection: Colors
  14. #%End
  15. #%Flag
  16. #% key: c
  17. #% description: Random colors according to category number (or layer number if 'layer=-1' is given)
  18. #% guisection: Colors
  19. #%End
  20. #%Flag
  21. #% key: i
  22. #% description: Use values from 'cats' option as line ID
  23. #% guisection: Query
  24. #%End
  25. #%Flag
  26. #% key: x
  27. #% description: Don't add to list of vectors and commands in monitor (it won't be drawn if the monitor is refreshed)
  28. #%End
  29. #%Option
  30. #% key: map
  31. #% type: string
  32. #% required: yes
  33. #% multiple: no
  34. #% key_desc: name
  35. #% description: Name of input vector map
  36. #% gisprompt: old,vector,vector
  37. #%End
  38. #%Option
  39. #% key: type
  40. #% type: string
  41. #% required: no
  42. #% multiple: yes
  43. #% options: point,line,boundary,centroid,area,face
  44. #% label: Type
  45. #% description: Feature type(s)
  46. #% answer: point,line,boundary,centroid,area,face
  47. #%End
  48. #%Option
  49. #% key: display
  50. #% type: string
  51. #% required: no
  52. #% multiple: yes
  53. #% options: shape,cat,topo,dir,attr,zcoor
  54. #% description: Display
  55. #% answer: shape
  56. #%End
  57. #%Option
  58. #% key: attrcol
  59. #% type: string
  60. #% required: no
  61. #% multiple: no
  62. #% description: Name of column to be displayed
  63. #% guisection: Labels
  64. #%End
  65. #%Option
  66. #% key: icon
  67. #% type: string
  68. #% required: no
  69. #% multiple: no
  70. #% options: demo/muchomurka,demo/smrk,basic/arrow1,basic/arrow2,basic/box,basic/circle,basic/cross1,basic/cross2,basic/diamond,basic/marker,basic/octagon,basic/point,basic/pushpin,basic/star,basic/triangle,basic/x,extra/4pt_star,extra/adcp,extra/airport,extra/alpha_flag,extra/bridge,extra/compass,extra/dive_flag,extra/fancy_compass,extra/half-circle,extra/offbox_ne,extra/offbox_nw,extra/offbox_se,extra/offbox_sw,extra/pentagon,extra/target
  71. #% description: Point and centroid symbol
  72. #% answer: basic/x
  73. #% guisection: Symbols
  74. #%End
  75. #%Option
  76. #% key: size
  77. #% type: integer
  78. #% required: no
  79. #% multiple: no
  80. #% description: Symbol size
  81. #% answer: 8
  82. #% guisection: Symbols
  83. #%End
  84. #%Option
  85. #% key: layer
  86. #% type: integer
  87. #% required: no
  88. #% multiple: no
  89. #% label: Layer number
  90. #% description: Layer number. If -1, all layers are displayed.
  91. #% answer: 1
  92. #%End
  93. #%Option
  94. #% key: cats
  95. #% type: string
  96. #% required: no
  97. #% multiple: no
  98. #% key_desc: range
  99. #% label: Category values
  100. #% description: Example: 1,3,7-9,13
  101. #% guisection: Query
  102. #%End
  103. #%Option
  104. #% key: where
  105. #% type: string
  106. #% required: no
  107. #% multiple: no
  108. #% key_desc: sql_query
  109. #% label: WHERE conditions of SQL statement without 'where' keyword.
  110. #% description: Example: income < 1000 and inhab >= 10000
  111. #% guisection: Query
  112. #%End
  113. #%Option
  114. #% key: width
  115. #% type: integer
  116. #% required: no
  117. #% multiple: no
  118. #% description: Line width
  119. #% answer: 0
  120. #% guisection: Lines
  121. #%End
  122. #%Option
  123. #% key: wcolumn
  124. #% type: string
  125. #% required: no
  126. #% multiple: no
  127. #% description: Name of column for line widths (these values will be scaled by wscale)
  128. #% guisection: Lines
  129. #%End
  130. #%Option
  131. #% key: wscale
  132. #% type: double
  133. #% required: no
  134. #% multiple: no
  135. #% description: Scale factor for wcolumn
  136. #% answer: 1
  137. #% guisection: Lines
  138. #%End
  139. #%Option
  140. #% key: color
  141. #% type: string
  142. #% required: no
  143. #% multiple: no
  144. #% description: Line color
  145. #% answer: black
  146. #% gisprompt: color,grass,color
  147. #% guisection: Colors
  148. #%End
  149. #%Option
  150. #% key: fcolor
  151. #% type: string
  152. #% required: no
  153. #% multiple: no
  154. #% description: Area fill color
  155. #% answer: 200:200:200
  156. #% gisprompt: color,grass,color
  157. #% guisection: Colors
  158. #%End
  159. #%Option
  160. #% key: rgb_column
  161. #% type: string
  162. #% required: no
  163. #% multiple: no
  164. #% description: Name of color definition column (for use with -a flag)
  165. #% answer: GRASSRGB
  166. #% guisection: Colors
  167. #%End
  168. #%Option
  169. #% key: llayer
  170. #% type: integer
  171. #% required: no
  172. #% multiple: no
  173. #% description: Layer for labels (default: the given layer number)
  174. #% guisection: Labels
  175. #%End
  176. #%Option
  177. #% key: lcolor
  178. #% type: string
  179. #% required: no
  180. #% multiple: no
  181. #% description: Label color
  182. #% answer: red
  183. #% gisprompt: color,grass,color
  184. #% guisection: Labels
  185. #%End
  186. #%Option
  187. #% key: bgcolor
  188. #% type: string
  189. #% required: no
  190. #% multiple: no
  191. #% description: Label background color
  192. #% answer: none
  193. #% gisprompt: color,grass,color
  194. #% guisection: Labels
  195. #%End
  196. #%Option
  197. #% key: bcolor
  198. #% type: string
  199. #% required: no
  200. #% multiple: no
  201. #% description: Label border color
  202. #% answer: none
  203. #% gisprompt: color,grass,color
  204. #% guisection: Labels
  205. #%End
  206. #%Option
  207. #% key: lsize
  208. #% type: integer
  209. #% required: no
  210. #% multiple: no
  211. #% description: Label size (pixels)
  212. #% answer: 8
  213. #% guisection: Labels
  214. #%End
  215. #%Option
  216. #% key: font
  217. #% type: string
  218. #% required: no
  219. #% multiple: no
  220. #% description: Font name
  221. #% guisection: Labels
  222. #%End
  223. #%Option
  224. #% key: xref
  225. #% type: string
  226. #% required: no
  227. #% multiple: no
  228. #% options: left,center,right
  229. #% description: Label horizontal justification
  230. #% answer: left
  231. #% guisection: Labels
  232. #%End
  233. #%Option
  234. #% key: yref
  235. #% type: string
  236. #% required: no
  237. #% multiple: no
  238. #% options: top,center,bottom
  239. #% description: Label vertical justification
  240. #% answer: center
  241. #% guisection: Labels
  242. #%End
  243. #%Option
  244. #% key: minreg
  245. #% type: double
  246. #% required: no
  247. #% multiple: no
  248. #% description: Minimum region size (average from height and width) when map is displayed
  249. #%End
  250. #%Option
  251. #% key: maxreg
  252. #% type: double
  253. #% required: no
  254. #% multiple: no
  255. #% description: Maximum region size (average from height and width) when map is displayed
  256. #%End
  257. #%Option
  258. #% key: render
  259. #% type: string
  260. #% required: no
  261. #% multiple: no
  262. #% options: g,r,d,c
  263. #% description: Rendering method for filled polygons
  264. #% answer: g
  265. #%End
  266. if [ -z "$GISBASE" ] ; then
  267. echo "You must be in GRASS GIS to run this program." 1>&2
  268. exit 1
  269. fi
  270. if [ "$1" != "@ARGS_PARSED@" ] ; then
  271. exec g.parser "$0" "$@"
  272. fi
  273. # CODE GOES HERE
  274. cmdfile="`g.gisenv get=GRASS_PYCMDFILE`"
  275. if [ -e ${cmdfile} ] && [ -n "${cmdfile}" ]; then
  276. echo -n
  277. else
  278. echo "WARNING: GRASS_PYCMDFILE - File not found. Run p.mon" >&2
  279. exit 1
  280. fi
  281. eval "`echo ${GIS_OPT_MAP} | sed -e 's/^/NAME=/' -e 's/@/; MAPSET=/'`;"
  282. #echo $NAME
  283. if [ -z "${MAPSET}" ]; then
  284. mapset=""
  285. else
  286. mapset="mapset=${MAPSET}"
  287. fi
  288. #echo $MAPSET
  289. eval "`g.findfile element=vector file=${NAME} ${mapset}`"
  290. #echo $NAME
  291. #echo $MAPSET
  292. if [ -z "${GIS_OPT_CATLIST}" ]; then
  293. CATLIST="None"
  294. else
  295. CATLIST="${GIS_OPT_CATLIST}"
  296. fi
  297. if [ -z "${GIS_OPT_VALLIST}" ]; then
  298. VALLIST="None"
  299. else
  300. VALLIST="${GIS_OPT_VALLIST}"
  301. fi
  302. if [ -z "${GIS_OPT_OPACITY}" ]; then
  303. OPACITY="100"
  304. else
  305. OPACITY="${GIS_OPT_OPACITY}"
  306. fi
  307. if [ "${GIS_FLAG_c}" -eq "1" ]; then
  308. CATSCOLORS="True"
  309. else
  310. CATSCOLORS="False"
  311. fi
  312. #cmd="self.map.AddRasterLayer(self, $NAME $MAPSET $CATLIST $VALLIST $INVERCATS $INVERT $OPACITY)"
  313. cmd="addvector ${name} ${mapset}"
  314. echo "${cmd}" >> "${cmdfile}"