dig_externs.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. /*!
  2. \file include/vect/dig_externs.h
  3. \brief Function prototypes for diglib (part of vector library)
  4. */
  5. /* allocation.c */
  6. void *dig_alloc_space(int, int *, int, void *, int); /* exits on error, calls _alloc_space () */
  7. void *dig__alloc_space(int, int *, int, void *, int); /* returns NULL on error, calls calloc(), _frealloc() */
  8. void *dig_falloc(int, int); /* exits on error, calls _falloc () */
  9. void *dig_frealloc(void *, int, int, int); /* exits on error, calls _frealloc () */
  10. void *dig__falloc(int, int); /* returns NULL on error, calls calloc () */
  11. void *dig__frealloc(void *, int, int, int); /* returns NULL on error, calls calloc () */
  12. /* angle.c */
  13. float dig_calc_begin_angle(const struct line_pnts *, double);
  14. float dig_calc_end_angle(const struct line_pnts *, double);
  15. int dig_line_degenerate(const struct line_pnts *);
  16. int dig_is_line_degenerate(const struct line_pnts *, double);
  17. /* box.c */
  18. int dig_box_copy(struct bound_box *, struct bound_box *);
  19. int dig_box_extend(struct bound_box *, struct bound_box *);
  20. int dig_line_box(const struct line_pnts *, struct bound_box *);
  21. /*
  22. int dig_line_set_box(struct Plus_head *, plus_t, struct bound_box *);
  23. int dig_line_get_box(struct Plus_head *, plus_t, struct bound_box *);
  24. int dig_area_bound_box(struct Map_info *, struct P_area *);
  25. int dig_bound_box2(struct line_pnts *, double *, double *, double *, double *,
  26. long);
  27. */
  28. /* category index */
  29. /* cindex.c */
  30. int dig_cidx_init(struct Plus_head *);
  31. void dig_cidx_free(struct Plus_head *);
  32. int dig_cidx_add_cat(struct Plus_head *, int, int, int, int);
  33. int dig_cidx_add_cat_sorted(struct Plus_head *, int, int, int, int);
  34. int dig_cidx_del_cat(struct Plus_head *, int, int, int, int);
  35. void dig_cidx_sort(struct Plus_head *);
  36. /* cindex_rw.c */
  37. int dig_write_cidx_head(struct gvfile *, struct Plus_head *);
  38. int dig_read_cidx_head(struct gvfile *, struct Plus_head *);
  39. int dig_write_cidx(struct gvfile *, struct Plus_head *);
  40. int dig_read_cidx(struct gvfile *, struct Plus_head *, int);
  41. /* file.c */
  42. /* file loaded to memory; mostly unused */
  43. off_t dig_ftell(struct gvfile * file);
  44. int dig_fseek(struct gvfile * file, off_t offset, int whence);
  45. void dig_rewind(struct gvfile * file);
  46. int dig_fflush(struct gvfile * file);
  47. size_t dig_fread(void *ptr, size_t size, size_t nmemb, struct gvfile * file);
  48. size_t dig_fwrite(const void *ptr, size_t size, size_t nmemb, struct gvfile * file);
  49. void dig_file_init(struct gvfile * file);
  50. int dig_file_load(struct gvfile * file);
  51. void dig_file_free(struct gvfile * file);
  52. /* frmt.c */
  53. int dig_write_frmt_ascii(FILE *, struct Format_info *, int);
  54. int dig_read_frmt_ascii(FILE *, struct Format_info *);
  55. /* head.c */
  56. int dig__write_head(struct Map_info *);
  57. int dig__read_head(struct Map_info *);
  58. /* inside.c */
  59. double dig_x_intersect(double, double, double, double, double);
  60. /* linecross.c */
  61. int dig_test_for_intersection(double, double, double, double, double, double,
  62. double, double);
  63. int dig_find_intersection(double, double, double, double, double, double,
  64. double, double, double *, double *);
  65. /* line_dist.c */
  66. double dig_distance2_point_to_line(double, double, double, double, double,
  67. double, double, double, double, int,
  68. double *, double *, double *, double *,
  69. int *);
  70. int dig_set_distance_to_line_tolerance(double);
  71. /* list.c */
  72. int dig_init_list(struct ilist *);
  73. int dig_list_add(struct ilist *, int);
  74. int dig_init_boxlist(struct boxlist *);
  75. int dig_boxlist_add(struct boxlist *, int, struct bound_box);
  76. /* plus.c */
  77. int dig_init_plus(struct Plus_head *);
  78. void dig_free_plus_nodes(struct Plus_head *);
  79. void dig_free_plus_lines(struct Plus_head *);
  80. void dig_free_plus_areas(struct Plus_head *);
  81. void dig_free_plus_isles(struct Plus_head *);
  82. void dig_free_plus(struct Plus_head *);
  83. int dig_load_plus(struct Plus_head *, struct gvfile *, int);
  84. int dig_write_plus_file(struct gvfile *, struct Plus_head *);
  85. int dig_write_nodes(struct gvfile *, struct Plus_head *);
  86. int dig_write_lines(struct gvfile *, struct Plus_head *);
  87. int dig_write_areas(struct gvfile *, struct Plus_head *);
  88. int dig_write_isles(struct gvfile *, struct Plus_head *);
  89. /* plus_area.c */
  90. int dig_add_area(struct Plus_head *, int, plus_t *, struct bound_box *);
  91. int dig_area_add_isle(struct Plus_head *, int, int);
  92. int dig_area_del_isle(struct Plus_head *, int, int);
  93. int dig_del_area(struct Plus_head *, int);
  94. int dig_add_isle(struct Plus_head *, int, plus_t *, struct bound_box *);
  95. int dig_del_isle(struct Plus_head *, int);
  96. int dig_build_area_with_line(struct Plus_head *, plus_t, int, plus_t **);
  97. int dig_angle_next_line(struct Plus_head *, plus_t, int, int);
  98. int dig_node_angle_check(struct Plus_head *, int, int);
  99. int dig_area_get_box(struct Plus_head *, plus_t, struct bound_box *);
  100. int dig_isle_get_box(struct Plus_head *, plus_t, struct bound_box *);
  101. /* plus_line.c */
  102. int dig_add_line(struct Plus_head *, int, const struct line_pnts *,
  103. struct bound_box *, off_t);
  104. int dig_restore_line(struct Plus_head *, int, int, struct line_pnts *,
  105. struct bound_box *, off_t);
  106. int dig_del_line(struct Plus_head *, int, double, double, double);
  107. plus_t dig_line_get_area(struct Plus_head *, plus_t, int);
  108. int dig_line_set_area(struct Plus_head *, plus_t, int, plus_t);
  109. /* plus_node.c */
  110. int dig_add_node(struct Plus_head *, double, double, double);
  111. int dig_which_node(struct Plus_head *, double, double, double);
  112. int dig_node_add_line(struct Plus_head *, int, int, const struct line_pnts *, int);
  113. float dig_node_line_angle(struct Plus_head *, int, int);
  114. /* plus_struct.c */
  115. int dig_Rd_P_node(struct Plus_head *, int i, struct gvfile *);
  116. int dig_Wr_P_node(struct Plus_head *, int i, struct gvfile *);
  117. int dig_Rd_P_line(struct Plus_head *, int i, struct gvfile *);
  118. int dig_Wr_P_line(struct Plus_head *, int i, struct gvfile *);
  119. int dig_Rd_P_area(struct Plus_head *, int i, struct gvfile *);
  120. int dig_Wr_P_area(struct Plus_head *, int i, struct gvfile *);
  121. int dig_Rd_P_isle(struct Plus_head *, int i, struct gvfile *);
  122. int dig_Wr_P_isle(struct Plus_head *, int i, struct gvfile *);
  123. int dig_Rd_Plus_head(struct gvfile *, struct Plus_head *);
  124. int dig_Wr_Plus_head(struct gvfile *, struct Plus_head *);
  125. /* poly.c */
  126. int dig_find_area_poly(struct line_pnts *, double *);
  127. double dig_find_poly_orientation(struct line_pnts *);
  128. int dig_get_poly_points(int, struct line_pnts **, int *, struct line_pnts *);
  129. /* portable.c */
  130. void dig_init_portable(struct Port_info *, int);
  131. int dig__byte_order_out();
  132. /* int dig__set_cur_head (struct dig_head *); */
  133. int dig_set_cur_port(struct Port_info *);
  134. int dig__fread_port_D(double *, size_t, struct gvfile *);
  135. int dig__fread_port_F(float *, size_t, struct gvfile *);
  136. int dig__fread_port_O(off_t *, size_t, struct gvfile *, size_t);
  137. int dig__fread_port_L(long *, size_t, struct gvfile *);
  138. int dig__fread_port_S(short *, size_t, struct gvfile *);
  139. int dig__fread_port_I(int *, size_t, struct gvfile *);
  140. int dig__fread_port_P(plus_t *, size_t, struct gvfile *);
  141. int dig__fread_port_C(char *, size_t, struct gvfile *);
  142. int dig__fwrite_port_D(const double *, size_t, struct gvfile *);
  143. int dig__fwrite_port_F(const float *, size_t, struct gvfile *);
  144. int dig__fwrite_port_O(const off_t *, size_t, struct gvfile *, size_t);
  145. int dig__fwrite_port_L(const long *, size_t, struct gvfile *);
  146. int dig__fwrite_port_S(const short *, size_t, struct gvfile *);
  147. int dig__fwrite_port_I(const int *, size_t, struct gvfile *);
  148. int dig__fwrite_port_P(const plus_t *, size_t, struct gvfile *);
  149. int dig__fwrite_port_C(const char *, size_t, struct gvfile *);
  150. /* port_init.c */
  151. /* port_test.c */
  152. /* prune.c */
  153. int dig_prune(struct line_pnts *, double);
  154. /* spatial index */
  155. /* spindex.c */
  156. int dig_spidx_init(struct Plus_head *);
  157. void dig_spidx_free_nodes(struct Plus_head *);
  158. void dig_spidx_free_lines(struct Plus_head *);
  159. void dig_spidx_free_areas(struct Plus_head *);
  160. void dig_spidx_free_isles(struct Plus_head *);
  161. void dig_spidx_free(struct Plus_head *);
  162. int dig_spidx_add_node(struct Plus_head *, int, double, double, double);
  163. int dig_spidx_add_line(struct Plus_head *, int, struct bound_box *);
  164. int dig_spidx_add_area(struct Plus_head *, int, struct bound_box *);
  165. int dig_spidx_add_isle(struct Plus_head *, int, struct bound_box *);
  166. int dig_spidx_del_node(struct Plus_head *, int);
  167. int dig_spidx_del_line(struct Plus_head *, int, double, double, double);
  168. int dig_spidx_del_area(struct Plus_head *, int);
  169. int dig_spidx_del_isle(struct Plus_head *, int);
  170. int dig_select_nodes(struct Plus_head *, const struct bound_box *, struct ilist *);
  171. int dig_select_lines(struct Plus_head *, const struct bound_box *, struct ilist *);
  172. int dig_select_lines_with_box(struct Plus_head *, const struct bound_box *, struct boxlist *);
  173. int dig_select_areas(struct Plus_head *, const struct bound_box *, struct ilist *);
  174. int dig_select_areas_with_box(struct Plus_head *, const struct bound_box *, struct boxlist *);
  175. int dig_select_isles(struct Plus_head *, const struct bound_box *, struct ilist *);
  176. int dig_select_isles_with_box(struct Plus_head *, const struct bound_box *, struct boxlist *);
  177. int dig_find_node(struct Plus_head *, double, double, double);
  178. int dig_find_line_box(const struct Plus_head *, struct boxlist *);
  179. int dig_find_area_box(const struct Plus_head *, struct boxlist *);
  180. int dig_find_isle_box(const struct Plus_head *, struct boxlist *);
  181. /* spindex_rw.c */
  182. int dig_Rd_spidx_head(struct gvfile *, struct Plus_head *);
  183. int dig_Wr_spidx_head(struct gvfile *, struct Plus_head *);
  184. int dig_Wr_spidx(struct gvfile *, struct Plus_head *);
  185. int dig_Rd_spidx(struct gvfile *, struct Plus_head *);
  186. int dig_dump_spidx(FILE *, const struct Plus_head *);
  187. int rtree_search(struct RTree *, struct Rect *, SearchHitCallback ,
  188. void *, struct Plus_head *);
  189. /* struct_alloc.c */
  190. int dig_node_alloc_line(struct P_node *, int add);
  191. int dig_alloc_nodes(struct Plus_head *, int);
  192. int dig_alloc_lines(struct Plus_head *, int);
  193. int dig_alloc_areas(struct Plus_head *, int);
  194. int dig_alloc_isles(struct Plus_head *, int);
  195. struct P_node *dig_alloc_node();
  196. struct P_line *dig_alloc_line();
  197. void *dig_alloc_topo(char);
  198. struct P_area *dig_alloc_area();
  199. struct P_isle *dig_alloc_isle();
  200. void dig_free_node(struct P_node *);
  201. void dig_free_line(struct P_line *);
  202. void dig_free_area(struct P_area *);
  203. void dig_free_isle(struct P_isle *);
  204. int dig_alloc_points(struct line_pnts *, int);
  205. int dig_alloc_cats(struct line_cats *, int);
  206. int dig_area_alloc_line(struct P_area *, int);
  207. int dig_area_alloc_isle(struct P_area *, int);
  208. int dig_isle_alloc_line(struct P_isle *, int);
  209. int dig_out_of_memory(void);
  210. /* type.c */
  211. /* conversion of types */
  212. int dig_type_to_store(int);
  213. int dig_type_from_store(int);
  214. /* update.c */
  215. /* unused */
  216. /* list of updated */
  217. void dig_line_reset_updated(struct Plus_head *Plus);
  218. void dig_line_add_updated(struct Plus_head *Plus, int line);
  219. void dig_node_reset_updated(struct Plus_head *Plus);
  220. void dig_node_add_updated(struct Plus_head *Plus, int node);
  221. /*********************************************************************
  222. * unused/removed functions
  223. *********************************************************************/
  224. char *color_name(int); /* pass it an int, returns the name of the color */
  225. char *dig_float_point(char *, int, double);
  226. /* double dig_point_in_area (struct Map_info *, double, double, struct P_area *); */
  227. double dig_unit_conversion(void);
  228. /* portable data routines - only to be called by library routines! */
  229. double *dig__double_convert(double *, double *, int, struct dig_head *);
  230. float *dig__float_convert(float *, float *, int, struct dig_head *);
  231. short *dig__short_convert(short *in, short *out, int, struct dig_head *);
  232. long *dig__long_convert(long *, long *, int, struct dig_head *);
  233. long *dig__int_convert(int *, long *, int, struct dig_head *);
  234. long *dig__plus_t_convert(plus_t *, long *, int, struct dig_head *);
  235. int *dig__long_convert_to_int(long *, int *, int, struct dig_head *);
  236. plus_t *dig__long_convert_to_plus_t(long *, plus_t *, int, struct dig_head *);
  237. char *dig__convert_buffer(int);
  238. plus_t **dig_get_cont_lines(struct Map_info *, plus_t, double, int);
  239. plus_t dig_get_next_cont_line(struct Map_info *, plus_t, double, int);
  240. struct dig_head *dig_get_head(void);
  241. struct dig_head *dig__get_head(void);
  242. /* int dig_check_nodes (struct Map_info *, struct new_node *, struct line_pnts *);
  243. int dig_in_area_bbox (struct P_area *, double, double); */
  244. int dig_start_clock(long *);
  245. int dig_stop_clock(long *);
  246. char *dig_stop_clock_str(long *);
  247. int dig_write_file_checks(struct gvfile *, struct Plus_head *);
  248. int dig_do_file_checks(struct Map_info *, char *, char *);
  249. /* int dig_find_area (struct Map_info *, struct P_area *, double *, double *, double *, double);
  250. int dig_find_area2 (struct Map_info *, struct P_area *, double *); */
  251. int dig_map_to_head(struct Map_info *, struct Plus_head *);
  252. int dig_head_to_map(struct Plus_head *, struct Map_info *);
  253. int dig_spindex_init(struct Plus_head *);
  254. /* int dig_snap_line_to_node (struct Map_info *, int, int, struct line_pnts *); */
  255. /* int dig_node_del_line (struct Plus_head *plus, int node, int line);
  256. int dig_add_line_to_node (int, int, char, struct Map_info *, struct line_pnts *); */
  257. int dig_point_to_area(struct Map_info *, double, double);
  258. int dig_point_to_next_area(struct Map_info *, double, double, double *);
  259. int dig_point_to_line(struct Map_info *, double, double, char);
  260. /* int dig_in_line_bbox (struct P_line *, double, double); */
  261. int dig_check_dist(struct Map_info *, int, double, double, double *);
  262. int dig__check_dist(struct Map_info *, struct line_pnts *, double, double,
  263. double *);
  264. /* int dig_center_check (struct P_line *, int, int, double, double); */
  265. int dig_point_by_line(struct Map_info *, double, double, double, double,
  266. char);
  267. /* int dig_by_line_bbox (struct P_line *, double, double, double, double); */
  268. int dig_write_head_ascii(FILE *, struct dig_head *);
  269. int dig_read_head_ascii(FILE *, struct dig_head *);
  270. int dig_struct_copy(void *, void *, int);
  271. int dig_rmcr(char *);