global.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #include <grass/gis.h>
  2. #include <grass/vector.h>
  3. struct value
  4. {
  5. int cat; /* category */
  6. int count1, count2; /* Count of found values; i1: count, coor, sides; i2: sides */
  7. /* for sides set to 2, if more than 1 area category was found, */
  8. /* including no category (cat = -1)! */
  9. int i1, i2; /* values; i1: query (result int), sides; i2: sides */
  10. double d1, d2, d3; /* values (length, area, x/y/z, query) */
  11. char *str1; /* string value (query) */
  12. int *qcat; /* array query categories */
  13. int nqcats; /* number of query cats */
  14. int aqcats; /* number of allocated query cats */
  15. char null; /* no records selected by query */
  16. };
  17. extern struct value *Values;
  18. struct options
  19. {
  20. char *name;
  21. int field;
  22. char *col[3];
  23. char *qcol;
  24. int type;
  25. int option;
  26. int print; /* print only */
  27. int sql; /* print only sql statements */
  28. int total; /* print totals */
  29. int units;
  30. int qfield; /* query field */
  31. };
  32. extern struct options options;
  33. struct vstat
  34. {
  35. int rcat; /* number of categories read from map */
  36. int select; /* number of categories selected from DB */
  37. int exist; /* number of cats existing in selection from DB */
  38. int notexist; /* number of cats not existing in selection from DB */
  39. int dupl; /* number of cats with duplicate elements (currently O_COOR only) */
  40. int update; /* number of updated rows */
  41. int error; /* number of errors */
  42. int qtype; /* C type of query column */
  43. };
  44. extern struct vstat vstat;
  45. #define O_CAT 1
  46. #define O_AREA 2
  47. #define O_LENGTH 3
  48. #define O_COUNT 4
  49. #define O_COOR 5 /* Point coordinates */
  50. #define O_QUERY 6 /* Query database records linked by another field (qfield) */
  51. #define O_SIDES 7 /* Left and right area of boundary */
  52. #define O_COMPACT 8 /* Compactness of an area. Circle = 1.0 */
  53. #define O_PERIMETER 9
  54. #define O_START 10 /* line/boundary starting point */
  55. #define O_END 11 /* line/boundary end point */
  56. #define O_SLOPE 12 /* Line slope */
  57. #define O_FD 13 /* fractal dimension */
  58. #define O_SINUOUS 14 /* sinuousity of a line (length / <distance between end points>) */
  59. #define O_AZIMUTH 15 /* line azimuth */
  60. /* areas.c */
  61. int read_areas(struct Map_info *);
  62. /* calc.c */
  63. double length(register int, register double *, register double *);
  64. /* find.c */
  65. int find_cat(int, int);
  66. /* line.c */
  67. int read_lines(struct Map_info *);
  68. /* parse.c */
  69. int parse_command_line(int, char *[]);
  70. /* query.c */
  71. int query(struct Map_info *);
  72. /* report.c */
  73. int report(void);
  74. int print_stat(void);
  75. /* units.c */
  76. int conv_units(void);
  77. /* update.c */
  78. int update(struct Map_info *);