global.h 2.7 KB

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