global.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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. char *fs;
  32. };
  33. extern struct options options;
  34. struct vstat
  35. {
  36. int rcat; /* number of categories read from map */
  37. int select; /* number of categories selected from DB */
  38. int exist; /* number of cats existing in selection from DB */
  39. int notexist; /* number of cats not existing in selection from DB */
  40. int dupl; /* number of cats with duplicate elements (currently O_COOR only) */
  41. int update; /* number of updated rows */
  42. int error; /* number of errors */
  43. int qtype; /* C type of query column */
  44. };
  45. extern struct vstat vstat;
  46. #define O_CAT 1
  47. #define O_AREA 2
  48. #define O_LENGTH 3
  49. #define O_COUNT 4
  50. #define O_COOR 5 /* Point coordinates */
  51. #define O_QUERY 6 /* Query database records linked by another field (qfield) */
  52. #define O_SIDES 7 /* Left and right area of boundary */
  53. #define O_COMPACT 8 /* Compactness of an area. Circle = 1.0 */
  54. #define O_PERIMETER 9
  55. #define O_START 10 /* line/boundary starting point */
  56. #define O_END 11 /* line/boundary end point */
  57. #define O_SLOPE 12 /* Line slope */
  58. #define O_FD 13 /* fractal dimension */
  59. #define O_SINUOUS 14 /* sinuousity of a line (length / <distance between end points>) */
  60. #define O_AZIMUTH 15 /* line azimuth */
  61. /* areas.c */
  62. int read_areas(struct Map_info *);
  63. /* calc.c */
  64. double length(register int, register double *, register double *);
  65. /* find.c */
  66. int find_cat(int, int);
  67. /* line.c */
  68. int read_lines(struct Map_info *);
  69. /* parse.c */
  70. int parse_command_line(int, char *[]);
  71. /* query.c */
  72. int query(struct Map_info *);
  73. /* report.c */
  74. int report(void);
  75. int print_stat(void);
  76. /* units.c */
  77. int conv_units(void);
  78. /* update.c */
  79. int update(struct Map_info *);