vector.h 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496
  1. #ifndef GRASS_VECT_H
  2. #define GRASS_VECT_H
  3. #include <grass/gis.h>
  4. #include <grass/vect/digit.h>
  5. #ifdef HAVE_GEOS
  6. #include <geos_c.h>
  7. #if GEOS_VERSION_MAJOR < 3
  8. typedef struct GEOSGeom_t GEOSGeometry;
  9. typedef struct GEOSCoordSeq_t GEOSCoordSequence;
  10. #endif
  11. #endif
  12. /* --- ANSI prototypes for the lib/vector/Vlib functions --- */
  13. /*
  14. * "Public" functions, for use in modules
  15. */
  16. /* Points (line) */
  17. struct line_pnts *Vect_new_line_struct(void);
  18. int Vect_append_point(struct line_pnts *, double, double, double);
  19. int Vect_append_points(struct line_pnts *, const struct line_pnts *, int);
  20. int Vect_line_insert_point(struct line_pnts *, int, double, double, double);
  21. int Vect_line_delete_point(struct line_pnts *, int);
  22. int Vect_line_get_point(const struct line_pnts *, int ,
  23. double *, double *, double *);
  24. int Vect_get_num_line_points(const struct line_pnts *);
  25. int Vect_line_prune(struct line_pnts *);
  26. int Vect_line_prune_thresh(struct line_pnts *, double);
  27. void Vect_line_reverse(struct line_pnts *);
  28. int Vect_copy_xyz_to_pnts(struct line_pnts *, const double *, const double *, const double *,
  29. int);
  30. int Vect_copy_pnts_to_xyz(const struct line_pnts *, double *, double *, double *,
  31. int *);
  32. void Vect_reset_line(struct line_pnts *);
  33. void Vect_destroy_line_struct(struct line_pnts *);
  34. int Vect_point_on_line(const struct line_pnts *, double, double *, double *,
  35. double *, double *, double *);
  36. int Vect_line_segment(const struct line_pnts *, double, double, struct line_pnts *);
  37. double Vect_line_length(const struct line_pnts *);
  38. double Vect_area_perimeter(const struct line_pnts *);
  39. double Vect_line_geodesic_length(const struct line_pnts *);
  40. int Vect_line_distance(const struct line_pnts *, double, double, double, int,
  41. double *, double *, double *, double *, double *,
  42. double *);
  43. void Vect_line_box(const struct line_pnts *, struct bound_box *);
  44. void Vect_line_parallel(struct line_pnts *, double, double, int,
  45. struct line_pnts *);
  46. void Vect_line_parallel2(struct line_pnts *, double, double,
  47. double, int, int, double,
  48. struct line_pnts *);
  49. void Vect_line_buffer(const struct line_pnts *, double, double, struct line_pnts *);
  50. void Vect_line_buffer2(const struct line_pnts *, double, double,
  51. double, int, int, double,
  52. struct line_pnts **,
  53. struct line_pnts ***, int *);
  54. void Vect_area_buffer2(const struct Map_info *, int, double, double,
  55. double, int, int, double,
  56. struct line_pnts **,
  57. struct line_pnts ***, int *);
  58. void Vect_point_buffer2(double, double, double, double,
  59. double, int, double,
  60. struct line_pnts **);
  61. /* Categories */
  62. struct line_cats *Vect_new_cats_struct(void);
  63. int Vect_cat_set(struct line_cats *, int, int);
  64. int Vect_cat_get(const struct line_cats *, int, int *);
  65. int Vect_cat_del(struct line_cats *, int);
  66. int Vect_field_cat_del(struct line_cats *, int, int);
  67. int Vect_field_cat_get(const struct line_cats *, int, struct ilist *);
  68. int Vect_cat_in_array(int, const int *, int);
  69. int Vect_reset_cats(struct line_cats *);
  70. void Vect_destroy_cats_struct(struct line_cats *);
  71. int Vect_get_area_cats(const struct Map_info *, int, struct line_cats *);
  72. int Vect_get_area_cat(const struct Map_info *, int, int);
  73. int Vect_get_line_cat(const struct Map_info *, int, int);
  74. /* List of categories */
  75. struct cat_list *Vect_new_cat_list(void);
  76. int Vect_str_to_cat_list(const char *, struct cat_list *);
  77. int Vect_array_to_cat_list(const int *, int, struct cat_list *);
  78. int Vect_cat_in_cat_list(int, const struct cat_list *);
  79. void Vect_destroy_cat_list(struct cat_list *);
  80. /* Vector array */
  81. struct varray *Vect_new_varray(int);
  82. int Vect_set_varray_from_cat_string(const struct Map_info *, int, const char *, int,
  83. int, struct varray *);
  84. int Vect_set_varray_from_cat_list(const struct Map_info *, int, struct cat_list *,
  85. int, int, struct varray *);
  86. int Vect_set_varray_from_db(const struct Map_info *, int, const char *, int, int,
  87. struct varray *);
  88. /* DB connection - field info */
  89. struct dblinks *Vect_new_dblinks_struct(void);
  90. void Vect_reset_dblinks(struct dblinks *);
  91. int Vect_add_dblink(struct dblinks *, int, const char *,
  92. const char *, const char *, const char *, const char *);
  93. int Vect_check_dblink(const struct dblinks *, int, const char *);
  94. int Vect_map_add_dblink(struct Map_info *, int, const char *,
  95. const char *, const char *, const char *,
  96. const char *);
  97. int Vect_map_del_dblink(struct Map_info *, int);
  98. int Vect_map_check_dblink(const struct Map_info *, int, const char *);
  99. int Vect_read_dblinks(struct Map_info *);
  100. int Vect_write_dblinks(struct Map_info *);
  101. struct field_info *Vect_default_field_info(struct Map_info *, int,
  102. const char *, int);
  103. struct field_info *Vect_get_dblink(const struct Map_info *, int);
  104. struct field_info *Vect_get_field(const struct Map_info *, int);
  105. struct field_info *Vect_get_field_by_name(const struct Map_info *, const char *);
  106. void Vect_set_db_updated(struct Map_info *);
  107. const char *Vect_get_column_names(const struct Map_info *, int);
  108. const char *Vect_get_column_types(const struct Map_info *, int);
  109. const char *Vect_get_column_names_types(const struct Map_info *, int);
  110. /* List of FID (feature ID) (integers) */
  111. struct ilist *Vect_new_list(void);
  112. int Vect_list_append(struct ilist *, int);
  113. int Vect_list_append_list(struct ilist *, const struct ilist *);
  114. int Vect_list_delete(struct ilist *, int);
  115. int Vect_list_delete_list(struct ilist *, const struct ilist *);
  116. int Vect_val_in_list(const struct ilist *, int);
  117. int Vect_reset_list(struct ilist *);
  118. void Vect_destroy_list(struct ilist *);
  119. /* Bounding box (MBR) */
  120. int Vect_point_in_box(double, double, double, const struct bound_box *);
  121. int Vect_box_overlap(const struct bound_box *, const struct bound_box *);
  122. int Vect_box_copy(struct bound_box *, const struct bound_box *);
  123. int Vect_box_extend(struct bound_box *, const struct bound_box *);
  124. int Vect_box_clip(double *, double *, double *, double *, const struct bound_box *);
  125. int Vect_region_box(const struct Cell_head *, struct bound_box *);
  126. /* Category index */
  127. int Vect_cidx_get_num_fields(const struct Map_info *);
  128. int Vect_cidx_get_field_number(const struct Map_info *, int);
  129. int Vect_cidx_get_field_index(const struct Map_info *, int);
  130. int Vect_cidx_get_num_unique_cats_by_index(const struct Map_info *, int);
  131. int Vect_cidx_get_num_cats_by_index(const struct Map_info *, int);
  132. int Vect_cidx_get_num_types_by_index(const struct Map_info *, int);
  133. int Vect_cidx_get_type_count_by_index(const struct Map_info *, int, int, int *,
  134. int *);
  135. int Vect_cidx_get_type_count(const struct Map_info *, int, int);
  136. int Vect_cidx_get_cat_by_index(const struct Map_info *, int, int, int *, int *,
  137. int *);
  138. int Vect_cidx_find_next(const struct Map_info *, int, int, int, int, int *, int *);
  139. void Vect_cidx_find_all(const struct Map_info *, int, int, int, struct ilist *);
  140. int Vect_cidx_dump(const struct Map_info *, FILE *);
  141. int Vect_cidx_save(struct Map_info *);
  142. int Vect_cidx_open(struct Map_info *, int);
  143. /* Set/get map header info */
  144. int Vect_read_header(struct Map_info *);
  145. int Vect_write_header(const struct Map_info *);
  146. const char *Vect_get_name(const struct Map_info *);
  147. const char *Vect_get_mapset(const struct Map_info *);
  148. const char *Vect_get_full_name(const struct Map_info *);
  149. int Vect_is_3d(const struct Map_info *);
  150. int Vect_set_organization(struct Map_info *, const char *);
  151. const char *Vect_get_organization(const struct Map_info *);
  152. int Vect_set_date(struct Map_info *, const char *);
  153. const char *Vect_get_date(const struct Map_info *);
  154. int Vect_set_person(struct Map_info *, const char *);
  155. const char *Vect_get_person(const struct Map_info *);
  156. int Vect_set_map_name(struct Map_info *, const char *);
  157. const char *Vect_get_map_name(const struct Map_info *);
  158. int Vect_set_map_date(struct Map_info *, const char *);
  159. const char *Vect_get_map_date(const struct Map_info *);
  160. int Vect_set_comment(struct Map_info *, const char *);
  161. const char *Vect_get_comment(const struct Map_info *);
  162. int Vect_set_scale(struct Map_info *, int);
  163. int Vect_get_scale(const struct Map_info *);
  164. int Vect_set_zone(struct Map_info *, int);
  165. int Vect_get_zone(const struct Map_info *);
  166. int Vect_get_proj(const struct Map_info *);
  167. int Vect_set_proj(struct Map_info *, int);
  168. const char *Vect_get_proj_name(const struct Map_info *);
  169. int Vect_set_thresh(struct Map_info *, double);
  170. double Vect_get_thresh(const struct Map_info *);
  171. int Vect_get_constraint_box(const struct Map_info *, struct bound_box *);
  172. /* Get map level 2 informations */
  173. int Vect_level(const struct Map_info *);
  174. long Vect_get_num_nodes(const struct Map_info *);
  175. long Vect_get_num_primitives(const struct Map_info *, int);
  176. long Vect_get_num_lines(const struct Map_info *);
  177. long Vect_get_num_areas(const struct Map_info *);
  178. long Vect_get_num_faces(const struct Map_info *);
  179. long Vect_get_num_kernels(const struct Map_info *);
  180. long Vect_get_num_volumes(const struct Map_info *);
  181. long Vect_get_num_islands(const struct Map_info *);
  182. long Vect_get_num_holes(const struct Map_info *);
  183. int Vect_get_line_box(const struct Map_info *, int, struct bound_box *);
  184. int Vect_get_area_box(const struct Map_info *, int, struct bound_box *);
  185. int Vect_get_isle_box(const struct Map_info *, int, struct bound_box *);
  186. int Vect_get_map_box(const struct Map_info *, struct bound_box *);
  187. int V__map_overlap(struct Map_info *, double, double, double, double);
  188. void Vect_set_release_support(struct Map_info *);
  189. void Vect_set_category_index_update(struct Map_info *);
  190. /* Set/get fatal error behaviour */
  191. int Vect_set_fatal_error(int);
  192. int Vect_get_fatal_error();
  193. /* Open/close/rewind/set_constraints for map */
  194. int Vect_check_input_output_name(const char *, const char *, int);
  195. int Vect_legal_filename(const char *);
  196. int Vect_set_open_level(int);
  197. int Vect_open_old(struct Map_info *, const char *, const char *);
  198. int Vect_open_old2(struct Map_info *, const char *, const char *, const char *);
  199. int Vect_open_old_head(struct Map_info *, const char *, const char *);
  200. int Vect_open_old_head2(struct Map_info *, const char *, const char *, const char *);
  201. int Vect_open_new(struct Map_info *, const char *, int);
  202. int Vect_open_update(struct Map_info *, const char *, const char *);
  203. int Vect_open_update_head(struct Map_info *, const char *, const char *);
  204. int Vect_copy_head_data(const struct Map_info *, struct Map_info *);
  205. int Vect_build(struct Map_info *);
  206. int Vect_get_built(const struct Map_info *);
  207. int Vect_build_partial(struct Map_info *, int);
  208. int Vect_set_constraint_region(struct Map_info *, double, double, double,
  209. double, double, double);
  210. int Vect_set_constraint_type(struct Map_info *, int);
  211. int Vect_remove_constraints(struct Map_info *);
  212. int Vect_rewind(struct Map_info *);
  213. int Vect_close(struct Map_info *);
  214. /* Read/write lines, nodes, areas */
  215. /* Level 1 and 2 */
  216. int Vect_read_next_line(const struct Map_info *, struct line_pnts *,
  217. struct line_cats *);
  218. off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *,
  219. const struct line_cats *);
  220. int Vect_get_num_dblinks(const struct Map_info *);
  221. /* Level 2 only */
  222. int Vect_read_line(const struct Map_info *, struct line_pnts *, struct line_cats *,
  223. int);
  224. int Vect_rewrite_line(struct Map_info *, int, int, const struct line_pnts *,
  225. const struct line_cats *);
  226. int Vect_delete_line(struct Map_info *, int);
  227. int Vect_restore_line(struct Map_info *, int, off_t);
  228. int Vect_line_alive(const struct Map_info *, int);
  229. int Vect_node_alive(const struct Map_info *, int);
  230. int Vect_area_alive(const struct Map_info *, int);
  231. int Vect_isle_alive(const struct Map_info *, int);
  232. int Vect_get_line_nodes(const struct Map_info *, int, int *, int *);
  233. int Vect_get_line_areas(const struct Map_info *, int, int *, int *);
  234. off_t Vect_get_line_offset(const struct Map_info *, int);
  235. int Vect_get_node_coor(const struct Map_info *, int, double *, double *, double *);
  236. int Vect_get_node_n_lines(const struct Map_info *, int);
  237. int Vect_get_node_line(const struct Map_info *, int, int);
  238. float Vect_get_node_line_angle(const struct Map_info *, int, int);
  239. int Vect_get_area_points(const struct Map_info *, int, struct line_pnts *);
  240. int Vect_get_area_centroid(const struct Map_info *, int);
  241. int Vect_get_area_num_isles(const struct Map_info *, int);
  242. int Vect_get_area_isle(const struct Map_info *, int, int);
  243. double Vect_get_area_area(const struct Map_info *, int);
  244. int Vect_get_area_boundaries(const struct Map_info *, int, struct ilist *);
  245. int Vect_get_isle_points(const struct Map_info *, int, struct line_pnts *);
  246. int Vect_get_isle_area(const struct Map_info *, int);
  247. int Vect_get_isle_boundaries(const struct Map_info *, int, struct ilist *);
  248. int Vect_get_centroid_area(const struct Map_info *, int);
  249. /* Level 2 update only */
  250. int Vect_get_num_updated_lines(const struct Map_info *);
  251. int Vect_get_updated_line(const struct Map_info *, int);
  252. int Vect_get_num_updated_nodes(const struct Map_info *);
  253. int Vect_get_updated_node(const struct Map_info *, int);
  254. /* History */
  255. int Vect_hist_command(struct Map_info *);
  256. int Vect_hist_write(struct Map_info *, const char *);
  257. int Vect_hist_copy(const struct Map_info *, struct Map_info *);
  258. void Vect_hist_rewind(struct Map_info *);
  259. char *Vect_hist_read(char *, int, const struct Map_info *);
  260. /* Selecting features */
  261. int Vect_select_lines_by_box(struct Map_info *, const struct bound_box *, int,
  262. struct ilist *);
  263. int Vect_select_areas_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
  264. int Vect_select_isles_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
  265. int Vect_select_nodes_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
  266. int Vect_find_node(struct Map_info *, double, double, double, double, int);
  267. int Vect_find_line(struct Map_info *, double, double, double, int, double,
  268. int, int);
  269. int Vect_find_line_list(struct Map_info *, double, double, double, int,
  270. double, int, const struct ilist *, struct ilist *);
  271. int Vect_find_area(struct Map_info *, double, double);
  272. int Vect_find_island(struct Map_info *, double, double);
  273. int Vect_select_lines_by_polygon(struct Map_info *, struct line_pnts *, int,
  274. struct line_pnts **, int, struct ilist *);
  275. int Vect_select_areas_by_polygon(struct Map_info *, struct line_pnts *, int,
  276. struct line_pnts **, struct ilist *);
  277. /* Analysis */
  278. int Vect_point_in_area(const struct Map_info *, int, double, double);
  279. int Vect_tin_get_z(struct Map_info *, double, double, double *, double *,
  280. double *);
  281. int Vect_get_point_in_area(const struct Map_info *, int, double *, double *);
  282. /* int Vect_point_in_islands (struct Map_info *, int, double, double); */
  283. int Vect_find_poly_centroid(const struct line_pnts *, double *, double *);
  284. int Vect_get_point_in_poly_isl(const struct line_pnts *, const struct line_pnts **, int,
  285. double *, double *);
  286. int Vect__intersect_line_with_poly(const struct line_pnts *, double,
  287. struct line_pnts *);
  288. int Vect_get_point_in_poly(const struct line_pnts *, double *, double *);
  289. int Vect_point_in_poly(double, double, const struct line_pnts *);
  290. int Vect_point_in_area_outer_ring(double, double, const struct Map_info *, int);
  291. int Vect_point_in_island(double, double, const struct Map_info *, int);
  292. /* Cleaning */
  293. void Vect_break_lines(struct Map_info *, int, struct Map_info *);
  294. int Vect_break_lines_list(struct Map_info *, struct ilist *, struct ilist *,
  295. int, struct Map_info *);
  296. int Vect_merge_lines(struct Map_info *, int, int *, struct Map_info *);
  297. void Vect_break_polygons(struct Map_info *, int, struct Map_info *);
  298. void Vect_remove_duplicates(struct Map_info *, int, struct Map_info *);
  299. int Vect_line_check_duplicate(const struct line_pnts *,
  300. const struct line_pnts *, int);
  301. void Vect_snap_lines(struct Map_info *, int, double, struct Map_info *);
  302. void Vect_snap_lines_list(struct Map_info *, const struct ilist *, double,
  303. struct Map_info *);
  304. void Vect_remove_dangles(struct Map_info *, int, double, struct Map_info *);
  305. void Vect_chtype_dangles(struct Map_info *, double, struct Map_info *);
  306. void Vect_select_dangles(struct Map_info *, int, double, struct ilist *);
  307. void Vect_remove_bridges(struct Map_info *, struct Map_info *);
  308. void Vect_chtype_bridges(struct Map_info *, struct Map_info *);
  309. int Vect_remove_small_areas(struct Map_info *, double, struct Map_info *,
  310. double *);
  311. int Vect_clean_small_angles_at_nodes(struct Map_info *, int,
  312. struct Map_info *);
  313. /* Overlay */
  314. int Vect_overlay_str_to_operator(const char *);
  315. int Vect_overlay(struct Map_info *, int, struct ilist *, struct ilist *,
  316. struct Map_info *, int, struct ilist *, struct ilist *,
  317. int, struct Map_info *);
  318. int Vect_overlay_and(struct Map_info *, int, struct ilist *,
  319. struct ilist *, struct Map_info *, int,
  320. struct ilist *, struct ilist *, struct Map_info *);
  321. /* Graph */
  322. void Vect_graph_init(dglGraph_s *, int);
  323. void Vect_graph_build(dglGraph_s *);
  324. void Vect_graph_add_edge(dglGraph_s *, int, int, double, int);
  325. void Vect_graph_set_node_costs(dglGraph_s *, int, double);
  326. int Vect_graph_shortest_path(dglGraph_s *, int, int, struct ilist *, double *);
  327. /* Network (graph) */
  328. int Vect_net_build_graph(struct Map_info *, int, int, int, const char *,
  329. const char *, const char *, int, int);
  330. int Vect_net_shortest_path(struct Map_info *, int, int, struct ilist *,
  331. double *);
  332. int Vect_net_get_line_cost(const struct Map_info *, int, int, double *);
  333. int Vect_net_get_node_cost(const struct Map_info *, int, double *);
  334. int Vect_net_nearest_nodes(struct Map_info *, double, double, double, int,
  335. double, int *, int *, int *, double *, double *,
  336. struct line_pnts *, struct line_pnts *, double *);
  337. int Vect_net_shortest_path_coor(struct Map_info *, double, double, double,
  338. double, double, double, double, double,
  339. double *, struct line_pnts *, struct ilist *,
  340. struct line_pnts *, struct line_pnts *,
  341. double *, double *);
  342. /* Miscellaneous */
  343. int Vect_topo_dump(const struct Map_info *, FILE *);
  344. double Vect_points_distance(double, double, double, double, double, double,
  345. int);
  346. int Vect_option_to_types(const struct Option *);
  347. int Vect_copy_map_lines(struct Map_info *, struct Map_info *);
  348. int Vect_copy(const char *, const char *, const char *);
  349. int Vect_rename(const char *, const char *);
  350. int Vect_copy_table(const struct Map_info *, struct Map_info *, int, int,
  351. const char *, int);
  352. int Vect_copy_table_by_cats(const struct Map_info *, struct Map_info *, int, int,
  353. const char *, int, int *, int);
  354. int Vect_copy_tables(const struct Map_info *, struct Map_info *, int);
  355. int Vect_delete(const char *);
  356. int Vect_segment_intersection(double, double, double, double, double, double,
  357. double, double, double, double, double, double,
  358. double *, double *, double *, double *,
  359. double *, double *, int);
  360. int Vect_line_intersection(struct line_pnts *, struct line_pnts *,
  361. struct line_pnts ***, struct line_pnts ***, int *,
  362. int *, int);
  363. int Vect_line_check_intersection(struct line_pnts *, struct line_pnts *, int);
  364. int Vect_line_get_intersections(struct line_pnts *, struct line_pnts *,
  365. struct line_pnts *, int);
  366. char *Vect_subst_var(const char *, const struct Map_info *);
  367. /* Custom spatial index */
  368. void Vect_spatial_index_init(struct spatial_index *, int);
  369. void Vect_spatial_index_destroy(struct spatial_index *);
  370. void Vect_spatial_index_add_item(struct spatial_index *, int, const struct bound_box *);
  371. void Vect_spatial_index_del_item(struct spatial_index *, int, const struct bound_box *);
  372. int Vect_spatial_index_select(const struct spatial_index *, const struct bound_box *, struct ilist *);
  373. /*
  374. * Internal functions, MUST NOT be used in modules
  375. */
  376. int Vect_print_header(const struct Map_info *);
  377. void Vect__init_head(struct Map_info *);
  378. /* Open/close/rewind map */
  379. int Vect_coor_info(const struct Map_info *, struct Coor_info *);
  380. const char *Vect_maptype_info(const struct Map_info *);
  381. int Vect_open_topo(struct Map_info *, int);
  382. int Vect_save_topo(struct Map_info *);
  383. int Vect_open_sidx(struct Map_info *, int);
  384. int Vect_save_sidx(struct Map_info *);
  385. int Vect_sidx_dump(struct Map_info *, FILE *);
  386. int Vect_build_sidx_from_topo(struct Map_info *);
  387. int Vect_build_sidx(struct Map_info *);
  388. int Vect__write_head(const struct Map_info *);
  389. int Vect__read_head(struct Map_info *);
  390. int V1_open_old_nat(struct Map_info *, int);
  391. int V1_open_old_ogr(struct Map_info *, int);
  392. int V2_open_old_ogr(struct Map_info *);
  393. int V1_open_new_nat(struct Map_info *, const char *, int);
  394. int V1_rewind_nat(struct Map_info *);
  395. int V1_rewind_ogr(struct Map_info *);
  396. int V2_rewind_nat(struct Map_info *);
  397. int V2_rewind_ogr(struct Map_info *);
  398. int V1_close_nat(struct Map_info *);
  399. int V1_close_ogr(struct Map_info *);
  400. int V2_close_ogr(struct Map_info *);
  401. /* Read/write lines */
  402. int V1_read_line_nat(struct Map_info *, struct line_pnts *,
  403. struct line_cats *, off_t);
  404. int V1_read_next_line_nat(struct Map_info *, struct line_pnts *,
  405. struct line_cats *);
  406. int V1_read_next_line_ogr(struct Map_info *, struct line_pnts *,
  407. struct line_cats *);
  408. int V2_read_line_nat(struct Map_info *, struct line_pnts *,
  409. struct line_cats *, int);
  410. int V2_read_line_ogr(struct Map_info *, struct line_pnts *,
  411. struct line_cats *, int);
  412. int V2_read_next_line_nat(struct Map_info *, struct line_pnts *,
  413. struct line_cats *);
  414. int V2_read_next_line_ogr(struct Map_info *, struct line_pnts *,
  415. struct line_cats *);
  416. int V1_delete_line_nat(struct Map_info *, off_t);
  417. int V2_delete_line_nat(struct Map_info *, int);
  418. int V1_restore_line_nat(struct Map_info *, off_t);
  419. int V2_restore_line_nat(struct Map_info *, int, off_t);
  420. off_t V1_write_line_nat(struct Map_info *, int, const struct line_pnts *,
  421. const struct line_cats *);
  422. off_t V2_write_line_nat(struct Map_info *, int, const struct line_pnts *,
  423. const struct line_cats *);
  424. #if 0
  425. long V1_write_line_ogr(struct Map_info *, int, struct line_pnts *,
  426. struct line_cats *);
  427. #endif
  428. off_t V1_rewrite_line_nat(struct Map_info *, off_t, int,
  429. const struct line_pnts *, const struct line_cats *);
  430. int V2_rewrite_line_nat(struct Map_info *, int, int,
  431. const struct line_pnts *, const struct line_cats *);
  432. #if 0
  433. long V1_rewrite_line_ogr(struct Map_info *, long offset, int type,
  434. struct line_pnts *, struct line_cats *);
  435. #endif
  436. /* Build topology */
  437. int Vect_build_nat(struct Map_info *, int);
  438. int Vect_build_ogr(struct Map_info *, int);
  439. int Vect_build_line_area(struct Map_info *, int, int);
  440. int Vect_isle_find_area(struct Map_info *, int);
  441. int Vect_attach_isle(struct Map_info *, int);
  442. int Vect_attach_isles(struct Map_info *, const struct bound_box *);
  443. int Vect_attach_centroids(struct Map_info *, const struct bound_box *);
  444. /* GEOS support */
  445. #ifdef HAVE_GEOS
  446. GEOSGeometry *Vect_read_line_geos(struct Map_info *, int, int*);
  447. GEOSGeometry *Vect_line_to_geos(struct Map_info *, const struct line_pnts*, int);
  448. GEOSGeometry *Vect_read_area_geos(struct Map_info *, int);
  449. GEOSCoordSequence *Vect_get_area_points_geos(struct Map_info *, int);
  450. GEOSCoordSequence *Vect_get_isle_points_geos(struct Map_info *, int);
  451. #endif
  452. #endif /* GRASS_VECT_H */