global.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  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 smooth_flag; /* this is 0 for no smoothing, 1 for smoothing of lines */
  42. extern int value_flag; /* use raster values as categories */
  43. extern struct Categories RastCats;
  44. extern int has_cats; /* Category labels available */
  45. extern struct field_info *Fi;
  46. extern dbDriver *driver;
  47. extern dbString sql, label;
  48. struct COOR
  49. {
  50. struct COOR *bptr, *fptr; /* pointers to neighboring points */
  51. int row, col, node; /* row, column of point; node flag */
  52. int val; /* CELL value */
  53. double dval; /* FCELL/DCELL value */
  54. double right, left; /* areas to right and left of line */
  55. };
  56. struct line_hdr
  57. {
  58. struct COOR *left;
  59. struct COOR *right;
  60. struct COOR *center;
  61. };
  62. #define NULPTR ((struct COOR *) NULL)
  63. /* area_table - structure to store stuff associated with each */
  64. /* area number */
  65. struct area_table
  66. {
  67. int free; /* this entry is not taken yet */
  68. double cat; /* category number for this area */
  69. int row; /* row and column of point where the */
  70. int col; /* area is widest */
  71. int width; /* and width there */
  72. };
  73. /* equiv_table - structure in which to compile equivalences between area */
  74. /* numbers */
  75. struct equiv_table
  76. {
  77. int mapped; /* is this area number mapped? */
  78. int where; /* if so, where */
  79. int count; /* if not, number mapped here */
  80. int length;
  81. int *ptr; /* and pointer to them */
  82. };
  83. /* lines.c */
  84. int alloc_lines_bufs(int);
  85. int extract_lines(void);
  86. /* lines_io.c */
  87. int write_line(struct COOR *seed);
  88. /* areas.c */
  89. int alloc_areas_bufs(int);
  90. int extract_areas(void);
  91. int more_equivs(void);
  92. /* areas_io.c */
  93. int write_boundary(struct COOR *seed);
  94. int write_area(struct area_table *, struct equiv_table *, int, int);
  95. /* points.c */
  96. int extract_points(int);
  97. /* util.c */
  98. struct COOR *move(struct COOR *);
  99. struct COOR *find_end(struct COOR *, int, int *, int *);
  100. int at_end(struct COOR *);
  101. int read_row(void *);
  102. void insert_value(int, int, double);