global.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* Global variables: */
  2. /* direction indicates whether we should use fptr or bptr to */
  3. /* move to the "next" point on the line */
  4. /* first_read flag to indicate that we haven't read from input */
  5. /* file yet */
  6. /* last_read flag to indicate we have reached EOF on input */
  7. /* row_length length of each row of the raster map (i.e., number of */
  8. /* columns) */
  9. /* n_rows number of rows in the raster map */
  10. /* row_count number of the row just read in--used to prevent reading */
  11. /* beyond end of the raster map */
  12. /* equivs pointer to allocated equivalence table made by */
  13. /* write_equiv() */
  14. /* areas pointer to allocated array of area information passed */
  15. /* from bound.c */
  16. /* total_areas number of distinct areas found */
  17. /* Entry points: */
  18. /* write_line write a line out to the digit files */
  19. /* write_boundary write a line out to the digit files */
  20. /* write_area make table of area mappings and write dlg label file */
  21. #define BACKWARD 1
  22. #define FORWARD 2
  23. #define OPEN 1
  24. #define END 2
  25. #define LOOP 3
  26. #define SMOOTH 1
  27. #define NO_SMOOTH 0
  28. #define CATNUM 0
  29. #define CATLABEL 1
  30. extern int data_type;
  31. extern int data_size;
  32. extern struct Map_info Map;
  33. extern int input_fd; /* input_fd input raster map descriptor */
  34. extern struct line_cats *Cats;
  35. extern struct Cell_head cell_head;
  36. extern int direction;
  37. extern int first_read, last_read;
  38. extern int input_fd;
  39. extern int row_length, row_count, n_rows;
  40. extern int total_areas;
  41. extern int n_alloced_ptrs;
  42. extern int smooth_flag; /* this is 0 for no smoothing, 1 for smoothing of lines */
  43. extern int value_flag; /* use raster values as categories */
  44. extern struct Categories RastCats;
  45. extern int has_cats; /* Category labels available */
  46. extern struct field_info *Fi;
  47. extern dbDriver *driver;
  48. extern dbString sql, label;
  49. struct COOR
  50. {
  51. struct COOR *bptr, *fptr; /* pointers to neighboring points */
  52. int row, col, node; /* row, column of point; node flag */
  53. int val; /* CELL value */
  54. double dval; /* FCELL/DCELL value */
  55. double right, left; /* areas to right and left of line */
  56. };
  57. struct line_hdr
  58. {
  59. struct COOR *left;
  60. struct COOR *right;
  61. struct COOR *center;
  62. };
  63. #define NULPTR ((struct COOR *) NULL)
  64. /* area_table - structure to store stuff associated with each */
  65. /* area number */
  66. struct area_table
  67. {
  68. int free; /* this entry is not taken yet */
  69. double cat; /* category number for this area */
  70. int row; /* row and column of point where the */
  71. int col; /* area is widest */
  72. int width; /* and width there */
  73. };
  74. /* equiv_table - structure in which to compile equivalences between area */
  75. /* numbers */
  76. struct equiv_table
  77. {
  78. int mapped; /* is this area number mapped? */
  79. int where; /* if so, where */
  80. int count; /* if not, number mapped here */
  81. int length;
  82. int *ptr; /* and pointer to them */
  83. };
  84. /* lines.c */
  85. int alloc_lines_bufs(int);
  86. int extract_lines(void);
  87. /* lines_io.c */
  88. int write_line(struct COOR *);
  89. /* areas.c */
  90. int alloc_areas_bufs(int);
  91. int extract_areas(void);
  92. int more_equivs(void);
  93. /* areas_io.c */
  94. int write_boundary(struct COOR *);
  95. int write_area(struct area_table *, struct equiv_table *, int, int);
  96. /* points.c */
  97. int extract_points(int);
  98. /* util.c */
  99. struct COOR *move(struct COOR *);
  100. struct COOR *find_end(struct COOR *, int, int *, int *);
  101. int at_end(struct COOR *);
  102. int read_row(void *);
  103. void insert_value(int, int, double);
  104. int free_ptr(struct COOR *);
  105. /* set_error_handler.c */
  106. void set_error_handler(struct Map_info *, dbDriver **);