[GRASS-SVN] r46898 - in grass/trunk/include: . vect
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Jul 1 04:52:08 EDT 2011
Author: mmetz
Date: 2011-07-01 01:52:08 -0700 (Fri, 01 Jul 2011)
New Revision: 46898
Modified:
grass/trunk/include/vect/dig_defines.h
grass/trunk/include/vect/dig_externs.h
grass/trunk/include/vect/dig_structs.h
grass/trunk/include/vector.h
Log:
remove bounding boxes from vector topology (Radim's TODO): update headers
Modified: grass/trunk/include/vect/dig_defines.h
===================================================================
--- grass/trunk/include/vect/dig_defines.h 2011-07-01 08:27:49 UTC (rev 46897)
+++ grass/trunk/include/vect/dig_defines.h 2011-07-01 08:52:08 UTC (rev 46898)
@@ -154,7 +154,7 @@
#define GV_COOR_VER_MAJOR 5
#define GV_COOR_VER_MINOR 1
#define GV_TOPO_VER_MAJOR 5
-#define GV_TOPO_VER_MINOR 0
+#define GV_TOPO_VER_MINOR 1
#define GV_SIDX_VER_MAJOR 5
#define GV_SIDX_VER_MINOR 1
#define GV_CIDX_VER_MAJOR 5
@@ -165,7 +165,7 @@
#define GV_COOR_EARLIEST_MAJOR 5
#define GV_COOR_EARLIEST_MINOR 1
#define GV_TOPO_EARLIEST_MAJOR 5
-#define GV_TOPO_EARLIEST_MINOR 0
+#define GV_TOPO_EARLIEST_MINOR 1
#define GV_SIDX_EARLIEST_MAJOR 5
#define GV_SIDX_EARLIEST_MINOR 1
#define GV_CIDX_EARLIEST_MAJOR 5
Modified: grass/trunk/include/vect/dig_externs.h
===================================================================
--- grass/trunk/include/vect/dig_externs.h 2011-07-01 08:27:49 UTC (rev 46897)
+++ grass/trunk/include/vect/dig_externs.h 2011-07-01 08:52:08 UTC (rev 46898)
@@ -4,6 +4,7 @@
\brief Function prototypes for diglib (part of vector library)
*/
+/* allocation.c */
void *dig_alloc_space(int, int *, int, void *, int); /* exits on error, calls _alloc_space () */
void *dig__alloc_space(int, int *, int, void *, int); /* returns NULL on error, calls calloc(), _frealloc() */
void *dig_falloc(int, int); /* exits on error, calls _falloc () */
@@ -11,48 +12,148 @@
void *dig__falloc(int, int); /* returns NULL on error, calls calloc () */
void *dig__frealloc(void *, int, int, int); /* returns NULL on error, calls calloc () */
-int dig_init_list(struct ilist *);
-int dig_list_add(struct ilist *, int);
-
-char *color_name(int); /* pass it an int, returns the name of the color */
-
+/* angle.c */
float dig_calc_begin_angle(const struct line_pnts *, double);
float dig_calc_end_angle(const struct line_pnts *, double);
int dig_line_degenerate(const struct line_pnts *);
-char *dig_float_point(char *, int, double);
+int dig_is_line_degenerate(const struct line_pnts *, double);
-/* double dig_point_in_area (struct Map_info *, double, double, struct P_area *); */
+/* box.c */
+int dig_box_copy(struct bound_box *, struct bound_box *);
+int dig_box_extend(struct bound_box *, struct bound_box *);
+int dig_line_box(const struct line_pnts *, struct bound_box *);
+/*
+int dig_line_set_box(struct Plus_head *, plus_t, struct bound_box *);
+int dig_line_get_box(struct Plus_head *, plus_t, struct bound_box *);
+
+int dig_area_bound_box(struct Map_info *, struct P_area *);
+int dig_bound_box2(struct line_pnts *, double *, double *, double *, double *,
+ long);
+*/
+
+/* category index */
+/* cindex.c */
+int dig_cidx_init(struct Plus_head *);
+void dig_cidx_free(struct Plus_head *);
+int dig_cidx_add_cat(struct Plus_head *, int, int, int, int);
+int dig_cidx_add_cat_sorted(struct Plus_head *, int, int, int, int);
+int dig_cidx_del_cat(struct Plus_head *, int, int, int, int);
+void dig_cidx_sort(struct Plus_head *);
+
+/* cindex_rw.c */
+int dig_write_cidx_head(struct gvfile *, struct Plus_head *);
+int dig_read_cidx_head(struct gvfile *, struct Plus_head *);
+int dig_write_cidx(struct gvfile *, struct Plus_head *);
+int dig_read_cidx(struct gvfile *, struct Plus_head *, int);
+
+/* file.c */
+/* file loaded to memory; mostly unused */
+off_t dig_ftell(struct gvfile * file);
+int dig_fseek(struct gvfile * file, off_t offset, int whence);
+void dig_rewind(struct gvfile * file);
+int dig_fflush(struct gvfile * file);
+size_t dig_fread(void *ptr, size_t size, size_t nmemb, struct gvfile * file);
+size_t dig_fwrite(const void *ptr, size_t size, size_t nmemb, struct gvfile * file);
+void dig_file_init(struct gvfile * file);
+int dig_file_load(struct gvfile * file);
+void dig_file_free(struct gvfile * file);
+
+/* frmt.c */
+int dig_write_frmt_ascii(FILE *, struct Format_info *, int);
+int dig_read_frmt_ascii(FILE *, struct Format_info *);
+
+/* head.c */
+int dig__write_head(struct Map_info *);
+int dig__read_head(struct Map_info *);
+
+/* inside.c */
double dig_x_intersect(double, double, double, double, double);
+
+/* linecross.c */
+int dig_test_for_intersection(double, double, double, double, double, double,
+ double, double);
+int dig_find_intersection(double, double, double, double, double, double,
+ double, double, double *, double *);
+
+/* line_dist.c */
double dig_distance2_point_to_line(double, double, double, double, double,
double, double, double, double, int,
double *, double *, double *, double *,
int *);
+int dig_set_distance_to_line_tolerance(double);
-double dig_unit_conversion(void);
+/* list.c */
+int dig_init_list(struct ilist *);
+int dig_list_add(struct ilist *, int);
+int dig_init_boxlist(struct boxlist *);
+int dig_boxlist_add(struct boxlist *, int, struct bound_box);
-/* portable data routines - only to be called by library routines! */
-double *dig__double_convert(double *, double *, int, struct dig_head *);
-float *dig__float_convert(float *, float *, int, struct dig_head *);
-short *dig__short_convert(short *in, short *out, int, struct dig_head *);
-long *dig__long_convert(long *, long *, int, struct dig_head *);
-long *dig__int_convert(int *, long *, int, struct dig_head *);
-long *dig__plus_t_convert(plus_t *, long *, int, struct dig_head *);
-int *dig__long_convert_to_int(long *, int *, int, struct dig_head *);
-plus_t *dig__long_convert_to_plus_t(long *, plus_t *, int, struct dig_head *);
-char *dig__convert_buffer(int);
+/* plus.c */
+int dig_init_plus(struct Plus_head *);
+void dig_free_plus_nodes(struct Plus_head *);
+void dig_free_plus_lines(struct Plus_head *);
+void dig_free_plus_areas(struct Plus_head *);
+void dig_free_plus_isles(struct Plus_head *);
+void dig_free_plus(struct Plus_head *);
+int dig_load_plus(struct Plus_head *, struct gvfile *, int);
+int dig_write_plus_file(struct gvfile *, struct Plus_head *);
+int dig_write_nodes(struct gvfile *, struct Plus_head *);
+int dig_write_lines(struct gvfile *, struct Plus_head *);
+int dig_write_areas(struct gvfile *, struct Plus_head *);
+int dig_write_isles(struct gvfile *, struct Plus_head *);
-plus_t **dig_get_cont_lines(struct Map_info *, plus_t, double, int);
-plus_t dig_get_next_cont_line(struct Map_info *, plus_t, double, int);
+/* plus_area.c */
+int dig_add_area(struct Plus_head *, int, plus_t *, struct bound_box *);
+int dig_area_add_isle(struct Plus_head *, int, int);
+int dig_area_del_isle(struct Plus_head *, int, int);
+int dig_del_area(struct Plus_head *, int);
+int dig_add_isle(struct Plus_head *, int, plus_t *, struct bound_box *);
+int dig_del_isle(struct Plus_head *, int);
+int dig_build_area_with_line(struct Plus_head *, plus_t, int, plus_t **);
+int dig_angle_next_line(struct Plus_head *, plus_t, int, int);
+int dig_node_angle_check(struct Plus_head *, int, int);
+int dig_area_get_box(struct Plus_head *, plus_t, struct bound_box *);
+int dig_isle_get_box(struct Plus_head *, plus_t, struct bound_box *);
-struct dig_head *dig_get_head(void);
-struct dig_head *dig__get_head(void);
+/* plus_line.c */
+int dig_add_line(struct Plus_head *, int, const struct line_pnts *,
+ struct bound_box *, off_t);
+int dig_restore_line(struct Plus_head *, int, int, struct line_pnts *,
+ struct bound_box *, off_t);
+int dig_del_line(struct Plus_head *, int, double, double, double);
+plus_t dig_line_get_area(struct Plus_head *, plus_t, int);
+int dig_line_set_area(struct Plus_head *, plus_t, int, plus_t);
+
+/* plus_node.c */
+int dig_add_node(struct Plus_head *, double, double, double);
+int dig_which_node(struct Plus_head *, double, double, double);
+
+int dig_node_add_line(struct Plus_head *, int, int, const struct line_pnts *, int);
+float dig_node_line_angle(struct Plus_head *, int, int);
+
+/* plus_struct.c */
+int dig_Rd_P_node(struct Plus_head *, int i, struct gvfile *);
+int dig_Wr_P_node(struct Plus_head *, int i, struct gvfile *);
+int dig_Rd_P_line(struct Plus_head *, int i, struct gvfile *);
+int dig_Wr_P_line(struct Plus_head *, int i, struct gvfile *);
+int dig_Rd_P_area(struct Plus_head *, int i, struct gvfile *);
+int dig_Wr_P_area(struct Plus_head *, int i, struct gvfile *);
+int dig_Rd_P_isle(struct Plus_head *, int i, struct gvfile *);
+int dig_Wr_P_isle(struct Plus_head *, int i, struct gvfile *);
+int dig_Rd_Plus_head(struct gvfile *, struct Plus_head *);
+int dig_Wr_Plus_head(struct gvfile *, struct Plus_head *);
+
+/* poly.c */
+int dig_find_area_poly(struct line_pnts *, double *);
+double dig_find_poly_orientation(struct line_pnts *);
+int dig_get_poly_points(int, struct line_pnts **, int *, struct line_pnts *);
+
+/* portable.c */
void dig_init_portable(struct Port_info *, int);
int dig__byte_order_out();
/* int dig__set_cur_head (struct dig_head *); */
int dig_set_cur_port(struct Port_info *);
-int dig__write_head(struct Map_info *);
-int dig__read_head(struct Map_info *);
int dig__fread_port_D(double *, size_t, struct gvfile *);
int dig__fread_port_F(float *, size_t, struct gvfile *);
@@ -71,94 +172,21 @@
int dig__fwrite_port_P(const plus_t *, size_t, struct gvfile *);
int dig__fwrite_port_C(const char *, size_t, struct gvfile *);
+/* port_init.c */
-/******************************************************************************/
-int dig_build_area_with_line(struct Plus_head *, plus_t, int, plus_t **);
-plus_t dig_line_get_area(struct Plus_head *, plus_t, int);
-int dig_line_set_area(struct Plus_head *, plus_t, int, plus_t);
-int dig_add_area(struct Plus_head *, int, plus_t *);
-int dig_area_add_isle(struct Plus_head *, int, int);
-int dig_area_del_isle(struct Plus_head *, int, int);
-int dig_del_area(struct Plus_head *, int);
-int dig_angle_next_line(struct Plus_head *, plus_t, int, int);
+/* port_test.c */
-/* int dig_area_bound_box (struct Map_info *, struct P_area *); */
-int dig_bound_box2(struct line_pnts *, double *, double *, double *, double *,
- long);
-int dig_box_copy(struct bound_box *, struct bound_box *);
-int dig_box_extend(struct bound_box *, struct bound_box *);
-int dig_line_box(const struct line_pnts *, struct bound_box *);
-int dig_line_set_box(struct Plus_head *, plus_t, struct bound_box *);
-int dig_line_get_box(struct Plus_head *, plus_t, struct bound_box *);
-int dig_area_set_box(struct Plus_head *, plus_t, struct bound_box *);
-int dig_area_get_box(struct Plus_head *, plus_t, struct bound_box *);
-int dig_isle_set_box(struct Plus_head *, plus_t, struct bound_box *);
-int dig_isle_get_box(struct Plus_head *, plus_t, struct bound_box *);
+/* prune.c */
+int dig_prune(struct line_pnts *, double);
-int dig_is_line_degenerate(const struct line_pnts *, double);
-
-/* int dig_check_nodes (struct Map_info *, struct new_node *, struct line_pnts *);
- int dig_in_area_bbox (struct P_area *, double, double); */
-int dig_start_clock(long *);
-int dig_stop_clock(long *);
-char *dig_stop_clock_str(long *);
-int dig_write_file_checks(struct gvfile *, struct Plus_head *);
-int dig_do_file_checks(struct Map_info *, char *, char *);
-
-/* int dig_find_area (struct Map_info *, struct P_area *, double *, double *, double *, double);
- int dig_find_area2 (struct Map_info *, struct P_area *, double *); */
-int dig_find_area_poly(struct line_pnts *, double *);
-double dig_find_poly_orientation(struct line_pnts *);
-int dig_get_poly_points(int, struct line_pnts **, int *, struct line_pnts *);
-int dig_add_isle(struct Plus_head *, int, plus_t *);
-int dig_del_isle(struct Plus_head *, int);
-int dig_set_distance_to_line_tolerance(double);
-int dig_test_for_intersection(double, double, double, double, double, double,
- double, double);
-int dig_find_intersection(double, double, double, double, double, double,
- double, double, double *, double *);
-
-int dig_init_plus(struct Plus_head *);
-void dig_free_plus_nodes(struct Plus_head *);
-void dig_free_plus_lines(struct Plus_head *);
-void dig_free_plus_areas(struct Plus_head *);
-void dig_free_plus_isles(struct Plus_head *);
-void dig_free_plus(struct Plus_head *);
-int dig_load_plus(struct Plus_head *, struct gvfile *, int);
-int dig_map_to_head(struct Map_info *, struct Plus_head *);
-int dig_head_to_map(struct Plus_head *, struct Map_info *);
-int dig_spindex_init(struct Plus_head *);
-
-/* int dig_snap_line_to_node (struct Map_info *, int, int, struct line_pnts *); */
-
-int dig_add_node(struct Plus_head *, double, double, double);
-int dig_which_node(struct Plus_head *, double, double, double);
-int dig_add_line(struct Plus_head *, int, const struct line_pnts *,
- off_t);
-int dig_restore_line(struct Plus_head *, int, int, struct line_pnts *,
- off_t);
-int dig_del_line(struct Plus_head *, int);
-int dig_node_add_line(struct Plus_head *, int, int, const struct line_pnts *, int);
-float dig_node_line_angle(struct Plus_head *, int, int);
-int dig_node_angle_check(struct Plus_head *, int, int);
-
-/* int dig_node_del_line (struct Plus_head *plus, int node, int line);
- int dig_add_line_to_node (int, int, char, struct Map_info *, struct line_pnts *); */
-int dig_point_to_area(struct Map_info *, double, double);
-int dig_point_to_next_area(struct Map_info *, double, double, double *);
-int dig_point_to_line(struct Map_info *, double, double, char);
-
-/* list of updated */
-void dig_line_reset_updated(struct Plus_head *Plus);
-void dig_line_add_updated(struct Plus_head *Plus, int line);
-void dig_node_reset_updated(struct Plus_head *Plus);
-void dig_node_add_updated(struct Plus_head *Plus, int node);
-
-/* conversion of types */
-int dig_type_to_store(int);
-int dig_type_from_store(int);
-
/* spatial index */
+/* spindex.c */
+int dig_spidx_init(struct Plus_head *);
+void dig_spidx_free_nodes(struct Plus_head *);
+void dig_spidx_free_lines(struct Plus_head *);
+void dig_spidx_free_areas(struct Plus_head *);
+void dig_spidx_free_isles(struct Plus_head *);
+void dig_spidx_free(struct Plus_head *);
int dig_spidx_add_node(struct Plus_head *, int, double, double, double);
int dig_spidx_add_line(struct Plus_head *, int, struct bound_box *);
@@ -166,22 +194,23 @@
int dig_spidx_add_isle(struct Plus_head *, int, struct bound_box *);
int dig_spidx_del_node(struct Plus_head *, int);
-int dig_spidx_del_line(struct Plus_head *, int);
+int dig_spidx_del_line(struct Plus_head *, int, double, double, double);
int dig_spidx_del_area(struct Plus_head *, int);
int dig_spidx_del_isle(struct Plus_head *, int);
int dig_select_nodes(struct Plus_head *, const struct bound_box *, struct ilist *);
int dig_select_lines(struct Plus_head *, const struct bound_box *, struct ilist *);
+int dig_select_lines_with_box(struct Plus_head *, const struct bound_box *, struct boxlist *);
int dig_select_areas(struct Plus_head *, const struct bound_box *, struct ilist *);
+int dig_select_areas_with_box(struct Plus_head *, const struct bound_box *, struct boxlist *);
int dig_select_isles(struct Plus_head *, const struct bound_box *, struct ilist *);
+int dig_select_isles_with_box(struct Plus_head *, const struct bound_box *, struct boxlist *);
int dig_find_node(struct Plus_head *, double, double, double);
+int dig_find_line_box(const struct Plus_head *, struct boxlist *);
+int dig_find_area_box(const struct Plus_head *, struct boxlist *);
+int dig_find_isle_box(const struct Plus_head *, struct boxlist *);
-int dig_spidx_init(struct Plus_head *);
-void dig_spidx_free_nodes(struct Plus_head *);
-void dig_spidx_free_lines(struct Plus_head *);
-void dig_spidx_free_areas(struct Plus_head *);
-void dig_spidx_free_isles(struct Plus_head *);
-void dig_spidx_free(struct Plus_head *);
+/* spindex_rw.c */
int dig_Rd_spidx_head(struct gvfile *, struct Plus_head *);
int dig_Wr_spidx_head(struct gvfile *, struct Plus_head *);
int dig_Wr_spidx(struct gvfile *, struct Plus_head *);
@@ -192,32 +221,7 @@
int rtree_search(struct RTree *, struct Rect *, SearchHitCallback ,
void *, struct Plus_head *);
-/* category index */
-int dig_cidx_init(struct Plus_head *);
-void dig_cidx_free(struct Plus_head *);
-int dig_cidx_add_cat(struct Plus_head *, int, int, int, int);
-int dig_cidx_add_cat_sorted(struct Plus_head *, int, int, int, int);
-int dig_cidx_del_cat(struct Plus_head *, int, int, int, int);
-void dig_cidx_sort(struct Plus_head *);
-
-int dig_write_cidx_head(struct gvfile *, struct Plus_head *);
-int dig_read_cidx_head(struct gvfile *, struct Plus_head *);
-int dig_write_cidx(struct gvfile *, struct Plus_head *);
-int dig_read_cidx(struct gvfile *, struct Plus_head *, int);
-
-/* int dig_in_line_bbox (struct P_line *, double, double); */
-int dig_check_dist(struct Map_info *, int, double, double, double *);
-int dig__check_dist(struct Map_info *, struct line_pnts *, double, double,
- double *);
-/* int dig_center_check (struct P_line *, int, int, double, double); */
-int dig_point_by_line(struct Map_info *, double, double, double, double,
- char);
-/* int dig_by_line_bbox (struct P_line *, double, double, double, double); */
-int dig_prune(struct line_pnts *, double);
-int dig_write_head_ascii(FILE *, struct dig_head *);
-int dig_read_head_ascii(FILE *, struct dig_head *);
-int dig_write_frmt_ascii(FILE *, struct Format_info *, int);
-int dig_read_frmt_ascii(FILE *, struct Format_info *);
+/* struct_alloc.c */
int dig_node_alloc_line(struct P_node *, int add);
int dig_alloc_nodes(struct Plus_head *, int);
int dig_alloc_lines(struct Plus_head *, int);
@@ -225,6 +229,7 @@
int dig_alloc_isles(struct Plus_head *, int);
struct P_node *dig_alloc_node();
struct P_line *dig_alloc_line();
+void *dig_alloc_topo(char);
struct P_area *dig_alloc_area();
struct P_isle *dig_alloc_isle();
void dig_free_node(struct P_node *);
@@ -237,32 +242,88 @@
int dig_area_alloc_isle(struct P_area *, int);
int dig_isle_alloc_line(struct P_isle *, int);
int dig_out_of_memory(void);
+
+/* type.c */
+/* conversion of types */
+int dig_type_to_store(int);
+int dig_type_from_store(int);
+
+/* update.c */
+/* unused */
+/* list of updated */
+void dig_line_reset_updated(struct Plus_head *Plus);
+void dig_line_add_updated(struct Plus_head *Plus, int line);
+void dig_node_reset_updated(struct Plus_head *Plus);
+void dig_node_add_updated(struct Plus_head *Plus, int node);
+
+
+
+
+/*********************************************************************
+ * unused/removed functions
+ *********************************************************************/
+
+
+char *color_name(int); /* pass it an int, returns the name of the color */
+
+char *dig_float_point(char *, int, double);
+
+/* double dig_point_in_area (struct Map_info *, double, double, struct P_area *); */
+
+double dig_unit_conversion(void);
+
+/* portable data routines - only to be called by library routines! */
+double *dig__double_convert(double *, double *, int, struct dig_head *);
+float *dig__float_convert(float *, float *, int, struct dig_head *);
+short *dig__short_convert(short *in, short *out, int, struct dig_head *);
+long *dig__long_convert(long *, long *, int, struct dig_head *);
+long *dig__int_convert(int *, long *, int, struct dig_head *);
+long *dig__plus_t_convert(plus_t *, long *, int, struct dig_head *);
+int *dig__long_convert_to_int(long *, int *, int, struct dig_head *);
+plus_t *dig__long_convert_to_plus_t(long *, plus_t *, int, struct dig_head *);
+char *dig__convert_buffer(int);
+
+plus_t **dig_get_cont_lines(struct Map_info *, plus_t, double, int);
+plus_t dig_get_next_cont_line(struct Map_info *, plus_t, double, int);
+
+struct dig_head *dig_get_head(void);
+struct dig_head *dig__get_head(void);
+
+
+/* int dig_check_nodes (struct Map_info *, struct new_node *, struct line_pnts *);
+ int dig_in_area_bbox (struct P_area *, double, double); */
+int dig_start_clock(long *);
+int dig_stop_clock(long *);
+char *dig_stop_clock_str(long *);
+int dig_write_file_checks(struct gvfile *, struct Plus_head *);
+int dig_do_file_checks(struct Map_info *, char *, char *);
+
+/* int dig_find_area (struct Map_info *, struct P_area *, double *, double *, double *, double);
+ int dig_find_area2 (struct Map_info *, struct P_area *, double *); */
+
+int dig_map_to_head(struct Map_info *, struct Plus_head *);
+int dig_head_to_map(struct Plus_head *, struct Map_info *);
+int dig_spindex_init(struct Plus_head *);
+
+/* int dig_snap_line_to_node (struct Map_info *, int, int, struct line_pnts *); */
+
+/* int dig_node_del_line (struct Plus_head *plus, int node, int line);
+ int dig_add_line_to_node (int, int, char, struct Map_info *, struct line_pnts *); */
+int dig_point_to_area(struct Map_info *, double, double);
+int dig_point_to_next_area(struct Map_info *, double, double, double *);
+int dig_point_to_line(struct Map_info *, double, double, char);
+
+/* int dig_in_line_bbox (struct P_line *, double, double); */
+int dig_check_dist(struct Map_info *, int, double, double, double *);
+int dig__check_dist(struct Map_info *, struct line_pnts *, double, double,
+ double *);
+/* int dig_center_check (struct P_line *, int, int, double, double); */
+int dig_point_by_line(struct Map_info *, double, double, double, double,
+ char);
+/* int dig_by_line_bbox (struct P_line *, double, double, double, double); */
+int dig_write_head_ascii(FILE *, struct dig_head *);
+int dig_read_head_ascii(FILE *, struct dig_head *);
+
int dig_struct_copy(void *, void *, int);
int dig_rmcr(char *);
-int dig_write_plus_file(struct gvfile *, struct Plus_head *);
-int dig_write_nodes(struct gvfile *, struct Plus_head *);
-int dig_write_lines(struct gvfile *, struct Plus_head *);
-int dig_write_areas(struct gvfile *, struct Plus_head *);
-int dig_write_isles(struct gvfile *, struct Plus_head *);
-int dig_Rd_P_node(struct Plus_head *, int i, struct gvfile *);
-int dig_Wr_P_node(struct Plus_head *, int i, struct gvfile *);
-int dig_Rd_P_line(struct Plus_head *, int i, struct gvfile *);
-int dig_Wr_P_line(struct Plus_head *, int i, struct gvfile *);
-int dig_Rd_P_area(struct Plus_head *, int i, struct gvfile *);
-int dig_Wr_P_area(struct Plus_head *, int i, struct gvfile *);
-int dig_Rd_P_isle(struct Plus_head *, int i, struct gvfile *);
-int dig_Wr_P_isle(struct Plus_head *, int i, struct gvfile *);
-int dig_Rd_Plus_head(struct gvfile *, struct Plus_head *);
-int dig_Wr_Plus_head(struct gvfile *, struct Plus_head *);
-
-/* file loaded to memory */
-off_t dig_ftell(struct gvfile * file);
-int dig_fseek(struct gvfile * file, off_t offset, int whence);
-void dig_rewind(struct gvfile * file);
-int dig_fflush(struct gvfile * file);
-size_t dig_fread(void *ptr, size_t size, size_t nmemb, struct gvfile * file);
-size_t dig_fwrite(const void *ptr, size_t size, size_t nmemb, struct gvfile * file);
-void dig_file_init(struct gvfile * file);
-int dig_file_load(struct gvfile * file);
-void dig_file_free(struct gvfile * file);
Modified: grass/trunk/include/vect/dig_structs.h
===================================================================
--- grass/trunk/include/vect/dig_structs.h 2011-07-01 08:27:49 UTC (rev 46897)
+++ grass/trunk/include/vect/dig_structs.h 2011-07-01 08:52:08 UTC (rev 46898)
@@ -5,6 +5,7 @@
\author Written by Dave Gerdes (CERL) 5/1988
\author Updated to GRASS 5.7 by Radim Blazek (2001)
+ \author Updated to GRASS 7.0 by Markus Metz (2011)
\author Doxygenized by Martin Landa <landa.martin gmail.com> (2011)
*/
#include <grass/config.h>
@@ -31,7 +32,7 @@
/*!
\brief plus_t size
- 3.10 changes plus_t to ints. This assumes that any reasonable
+ 3.10 changes plus_t to int. This assumes that any reasonable
machine will use 4 bytes to store an int. The diglib code is not
guaranteed to work if plus_t is changed to a type that is larger
than an int.
@@ -98,7 +99,7 @@
*/
FILE *file;
/*!
- \brief Pointer to beginnig of the file in the memory
+ \brief Pointer to beginning of the file in the memory
*/
char *start;
/*!
@@ -127,16 +128,16 @@
};
/*!
- \brief Field (layer) information
+ \brief Layer (old: field) information
*/
struct field_info
{
/*!
- \brief Field number
+ \brief Layer number
*/
int number;
/*!
- \brief Field name (optional)
+ \brief Layer name (optional)
*/
char *name;
/*!
@@ -146,13 +147,13 @@
/*!
brief Name of database
*/
- char *database;
+ char *database;
/*!
\brief Name of DB table
*/
char *table;
/*!
- \brief Name of key column (usually 'cat')
+ \brief Name of key column (usualy 'cat')
*/
char *key;
};
@@ -165,13 +166,13 @@
/*!
\brief Pointer to the first field_info structure
*/
- struct field_info *field;
+ struct field_info *field;
/*!
\brief Number of allocated slots
*/
int alloc_fields;
/*!
- \brief Number of available fields (layers)
+ \brief Number of available layers (old: fields)
*/
int n_fields;
};
@@ -193,66 +194,66 @@
int off_t_size;
/*!
- \brief Vonversion matrices between file and native byte order (double)
+ \brief Conversion matrices between file and native byte order (double)
*/
unsigned char dbl_cnvrt[PORT_DOUBLE];
/*!
- \brief Vonversion matrices between file and native byte order (float)
+ \brief Conversion matrices between file and native byte order (float)
*/
unsigned char flt_cnvrt[PORT_FLOAT];
/*!
- \brief Vonversion matrices between file and native byte order (long)
+ \brief Conversion matrices between file and native byte order (long)
*/
unsigned char lng_cnvrt[PORT_LONG];
/*!
- \brief Vonversion matrices between file and native byte order (int)
+ \brief Conversion matrices between file and native byte order (int)
*/
unsigned char int_cnvrt[PORT_INT];
/*!
- \brief Vonversion matrices between file and native byte order (short)
+ \brief Conversion matrices between file and native byte order (short)
*/
unsigned char shrt_cnvrt[PORT_SHORT];
/*!
- \brief Vonversion matrices between file and native byte order (off_t)
+ \brief Conversion matrices between file and native byte order (off_t)
*/
unsigned char off_t_cnvrt[PORT_OFF_T];
/*!
- \brief Byte order for dbl
+ \brief Quick reading flag for double
Specify if native byte order of that type is the same
as byte order of vector file (TRUE) or not (FALSE)
*/
int dbl_quick;
/*!
- \brief Byte order for dbl
+ \brief Quick reading flag for float
Specify if native byte order of that type is the same
as byte order of vector file (TRUE) or not (FALSE)
*/
int flt_quick;
/*!
- \brief Byte order for lng
+ \brief Quick reading flag for long
Specify if native byte order of that type is the same
as byte order of vector file (TRUE) or not (FALSE)
*/
int lng_quick;
/*!
- \brief Byte order for int
+ \brief Quick reading flag for int
Specify if native byte order of that type is the same
as byte order of vector file (TRUE) or not (FALSE)
*/
int int_quick;
/*!
- \brief Byte order for shrt
+ \brief Quick reading flag for short
Specify if native byte order of that type is the same
as byte order of vector file (TRUE) or not (FALSE)
*/
int shrt_quick;
/*!
- \brief Byte order for off_t
+ \brief Quick reading flag for off_t
Specify if native byte order of that type is the same
as byte order of vector file (TRUE) or not (FALSE)
@@ -290,7 +291,7 @@
/*!
\brief User name
*/
- char *your_name;
+ char *user_name;
/*!
\brief Map name
*/
@@ -306,7 +307,9 @@
/*!
\brief Comments
*/
- char *line_3;
+ char *comment;
+ int proj; /* projection */
+
/*!
\brief Zone (UTM only)
*/
@@ -342,7 +345,7 @@
- zero for 2D data
- non-zero for 3D data
*/
- int with_z;
+ int with_z;
/*!
\brief Coor file size
@@ -418,7 +421,7 @@
/*!
\brief Pointer to OGRLayer
*/
- OGRLayerH layer;
+ OGRLayerH layer;
#else
void *driver;
void *ds;
@@ -512,11 +515,11 @@
/*!
\brief id?
*/
- int i;
+ int i;
/*!
\brief OGR info
*/
- struct Format_info_ogr ogr;
+ struct Format_info_ogr ogr;
};
/*!
@@ -629,14 +632,14 @@
- WITH_Z
- WITHOUT_Z
*/
- int with_z;
+ int with_z;
/*!
\brief 2D/3D spatial index
- WITH_Z
- WITHOUT_Z
*/
- int spidx_with_z;
+ int spidx_with_z;
/*!
\brief Offset size
@@ -644,7 +647,7 @@
Because Plus_head is available to all releveant
functions
*/
- int off_t_size;
+ int off_t_size;
/*** file header size ***/
@@ -662,7 +665,7 @@
long cidx_head_size;
/*!
- \brief Release memory occupied by support
+ \brief Release memory occupied by support structures
(topo, spatial, category)
*/
int release_support;
@@ -676,14 +679,13 @@
/*!
\brief Portability information for spatial index
*/
- struct Port_info spidx_port;
+ struct Port_info spidx_port;
/*!
- \brief Portability information for
- category index
+ \brief Portability information for category index
*/
struct Port_info cidx_port;
/*!
- \brie Access mode
+ \brief Access mode
- GV_MODE_READ
- GV_MODE_WRITE
@@ -709,89 +711,96 @@
/*** topology ***/
/*!
- \brief Array topo nodes
+ \brief Array of nodes
*/
struct P_node **Node;
/*!
- \brief Array topo lines/edges
+ \brief Array of vector geometries
*/
struct P_line **Line;
/*!
- \brief Array topo areas
+ \brief Array of areas
*/
struct P_area **Area;
/*!
- \brief Array topo isles
+ \brief Array of isles
*/
struct P_isle **Isle;
/* add here P_FACE, P_VOLUME, P_HOLE */
-
+
/*!
- \brief Current number of nodes
+ \brief Current number of vector geometries
*/
- plus_t n_nodes;
/*!
- \brief Current number of edges
+ \brief Current number of points
*/
- plus_t n_edges;
+ plus_t n_plines;
/*!
\brief Current number of lines
*/
- plus_t n_lines;
+ plus_t n_llines;
/*!
- \brief Current number of areas
+ \brief Current number of boundaries
*/
- plus_t n_areas;
+ plus_t n_blines;
/*!
- \brief Current number of isles
+ \brief Current number of centroids
*/
- plus_t n_isles;
+ plus_t n_clines;
/*!
\brief Current number of faces
*/
- plus_t n_faces;
+ plus_t n_flines;
/*!
- \brief Current number of volumes
+ \brief Current number of kernels
*/
- plus_t n_volumes;
+ plus_t n_klines;
/*!
- \brief Current number of holes
+ \brief Current number of volume faces
*/
- plus_t n_holes;
-
+ plus_t n_vfaces;
/*!
- \brief Current number of points
+ \brief Current number of hole faces
*/
- plus_t n_plines;
+ plus_t n_hfaces;
+
/*!
+ \brief Current number of topological features derived from vector
+ geometries
+ */
+ /*!
+ \brief Current number of nodes
+ */
+ plus_t n_nodes;
+ /*!
+ \brief Current number of edges
+ */
+ plus_t n_edges;
+ /*!
\brief Current number of lines
*/
- plus_t n_llines;
+ plus_t n_lines;
/*!
- \brief Current number of boundaries
+ \brief Current number of areas
*/
- plus_t n_blines;
+ plus_t n_areas;
/*!
- \brief Current number of centroids
+ \brief Current number of isles
*/
- plus_t n_clines;
+ plus_t n_isles;
/*!
\brief Current number of faces
*/
- plus_t n_flines;
+ plus_t n_faces;
/*!
- \brief Current number of kernels
+ \brief Current number of volumes
*/
- plus_t n_klines;
+ plus_t n_volumes;
/*!
- \brief Current number of volume faces
+ \brief Current number of holes
*/
- plus_t n_vfaces;
- /*!
- \brief Current number of hole faces
- */
- plus_t n_hfaces;
+ plus_t n_holes;
/*!
\brief Number of allocated nodes
@@ -804,7 +813,7 @@
i.e. array size - 1
*/
- plus_t alloc_edges;
+ plus_t alloc_edges;
/*!
\brief Number of allocated lines
@@ -849,19 +858,19 @@
/*!
\brief Offset of array of edges in topo file
*/
- off_t Edge_offset;
+ off_t Edge_offset;
/*!
- \brief Offset of array of lines in topo file
+ \brief Offset of array of vector geometries in topo file
*/
- off_t Line_offset;
+ off_t Line_offset;
/*!
\brief Offset of array of areas in topo file
*/
- off_t Area_offset;
+ off_t Area_offset;
/*!
\brief Offset of array of isles in topo file
*/
- off_t Isle_offset;
+ off_t Isle_offset;
/*!
\brief Offset of array of volumes in topo file
*/
@@ -869,7 +878,7 @@
/*!
\brief Offset of array of holes in topo file
*/
- off_t Hole_offset;
+ off_t Hole_offset;
/*** spatial index ***/
/*!
@@ -883,18 +892,18 @@
Set to 1 if new spatial index will be generated
*/
- int Spidx_new;
+ int Spidx_new;
/*!
\brief Build new spatial index in file
Set to 1 to build new indices in file
*/
- int Spidx_file;
+ int Spidx_file;
/*!
\brief Spatial index file pointer
*/
- struct gvfile spidx_fp;
+ struct gvfile spidx_fp;
/*!
\brief Offset of nodes in sidx file
@@ -903,27 +912,27 @@
/*!
\brief Offset of lines in sidx file
*/
- off_t Line_spidx_offset;
+ off_t Line_spidx_offset;
/*!
\brief Offset of areas in sidx file
*/
- off_t Area_spidx_offset;
+ off_t Area_spidx_offset;
/*!
\brief Offset of isles in sidx file
*/
- off_t Isle_spidx_offset;
+ off_t Isle_spidx_offset;
/*!
\brief Offset of faces in sidx file
*/
- off_t Face_spidx_offset;
+ off_t Face_spidx_offset;
/*!
\brief Offset of volumes in sidx file
*/
- off_t Volume_spidx_offset;
+ off_t Volume_spidx_offset;
/*!
\brief Offset of holes in sidx file
*/
- off_t Hole_spidx_offset;
+ off_t Hole_spidx_offset;
/*!
\brief Node spatial index
@@ -932,27 +941,27 @@
/*!
\brief Line spatial index
*/
- struct RTree *Line_spidx;
+ struct RTree *Line_spidx;
/*!
\brief Area spatial index
*/
- struct RTree *Area_spidx;
+ struct RTree *Area_spidx;
/*!
\brief Isles spatial index
*/
- struct RTree *Isle_spidx;
+ struct RTree *Isle_spidx;
/*!
\brief Faces spatial index
*/
- struct RTree *Face_spidx;
+ struct RTree *Face_spidx;
/*!
\brief Volumes spatial index
*/
- struct RTree *Volume_spidx;
+ struct RTree *Volume_spidx;
/*!
\brief Holes spatial index
*/
- struct RTree *Hole_spidx;
+ struct RTree *Hole_spidx;
/*** category index ***/
/*!
@@ -960,7 +969,7 @@
By default, category index is not updated
*/
- int update_cidx;
+ int update_cidx;
/*!
\brief Number of category indexes (one for each field/layer)
@@ -1056,7 +1065,7 @@
struct dblinks *dblnk;
/*!
- \brief Header info
+ \brief Topology info
*/
struct Plus_head plus;
@@ -1115,7 +1124,7 @@
*/
int level;
/*!
- \brie Open only header
+ \brief Open only header
Non-zero code to open only header of vector map
*/
@@ -1138,7 +1147,7 @@
/*!
\brief Mapset name
*/
- char *mapset;
+ char *mapset;
/* location and gisdbase is usefull if changed (v.proj or external apps) */
/*!
\brief Location name
@@ -1164,30 +1173,10 @@
*/
int Constraint_type_flag;
/*!
- \brief Constraints for reading features (north)
+ \brief Constraints for reading features (bounding box)
*/
- double Constraint_N;
+ struct bound_box Constraint_box;
/*!
- \brief Constraints for reading features (south)
- */
- double Constraint_S;
- /*!
- \brief Constraints for reading features (east)
- */
- double Constraint_E;
- /*!
- \brief Constraints for reading features (west)
- */
- double Constraint_W;
- /*!
- \brief Constraints for reading features (top)
- */
- double Constraint_T;
- /*!
- \brief Constraints for reading features (bottom)
- */
- double Constraint_B;
- /*!
\brief Constraints for reading features (type)
*/
int Constraint_type;
@@ -1205,7 +1194,7 @@
/*!
\brief Coor file header info (native format only)
*/
- struct dig_head head;
+ struct dig_head head;
/* non native */
/*!
@@ -1247,7 +1236,7 @@
};
/*!
- \brief Topological primitive - node
+ \brief Topological feature - node
*/
struct P_node
{
@@ -1279,7 +1268,7 @@
*/
plus_t *lines;
/*!
- \brief List of respected angles
+ \brief List of angles of connected lines
Angles for lines/boundaries are in radians between -PI and
PI. Value for points or lines with identical points
@@ -1288,62 +1277,92 @@
float *angles;
};
-/*!
- \brief Topological primitive - line (edge)
+/*!
+ \brief Line topology
*/
-struct P_line
+struct P_topo_l
{
- /*!
+ /*!
\brief Start node
*/
plus_t N1;
- /*!
+ /*!
\brief End node
*/
plus_t N2;
- /*!
- \brief Area/isle number to left
+};
- - negative for isle
- - area number for centroid (negative for duplicate centroid)
+/*!
+ \brief Boundary topology
+*/
+struct P_topo_b
+{
+ /*!
+ \brief Start node
*/
+ plus_t N1;
+ /*!
+ \brief End node
+ */
+ plus_t N2;
+ /*!
+ \brief Area number to the left, negative for isle
+ */
plus_t left;
- /*!
- \brief Area/isle number to right
-
- - negative for isle
+ /*!
+ \brief Area number to the right, negative for isle
*/
plus_t right;
- /*!
- \brief Line bounding box - north
+};
+
+/*!
+ \brief Centroid topology
+*/
+struct P_topo_c
+{
+ /*!
+ \brief Area number, negative for duplicate centroid
*/
- double N;
- /*!
- \brief Line bounding box - south
+ plus_t area;
+};
+
+/*!
+ \brief Face topology
+*/
+struct P_topo_f
+{
+ /* TODO */
+ /*!
+ \brief Array of edges
*/
- double S;
- /*!
- \brief Line bounding box - east
+ plus_t E[3];
+ /*!
+ \brief Volume number to the left, negative for hole
*/
- double E;
- /*!
- \brief Line bounding box - west
+ plus_t left;
+ /*!
+ \brief Volume number to the right, negative for hole
*/
- double W;
- /*!
- \brief Line bounding box - top (3D data only)
+ plus_t right;
+};
+
+/*!
+ \brief Kernel topology
+*/
+struct P_topo_k
+{
+ /*!
+ \brief Volume number, negative for duplicate kernel
*/
- double T;
- /*!
- \brief Line bounding box - bottom (3D data only)
- */
- double B;
+ plus_t volume;
+};
+/*!
+ \brief Vector geometry
+*/
+struct P_line
+{
/*!
- \brief Offset in coor file for line
- */
- off_t offset;
- /*!
\brief Line type
- GV_POINT
@@ -1355,39 +1374,23 @@
- GV_AREA
- GV_VOLUME
*/
- int type;
+ char type;
+ /*!
+ \brief Offset in coor file for line
+ */
+ off_t offset;
+ /*!
+ \brief Topology info
+ */
+ void *topo;
};
/*!
- \brief Topological primitive - area
+ \brief Area (topology) info
*/
struct P_area
{
/*!
- \brief Area bounding box - north
- */
- double N;
- /*!
- \brief Area bounding box - south
- */
- double S;
- /*!
- \brief Area bounding box - east
- */
- double E;
- /*!
- \brief Area bounding box - west
- */
- double W;
- /*!
- \brief Area bounding box - top
- */
- double T;
- /*!
- \brief Area bounding box - bottom
- */
- double B;
- /*!
\brief Number of boundary lines
*/
plus_t n_lines;
@@ -1424,35 +1427,11 @@
};
/*!
- \brief Topological primitive - isle
+ \brief Isle (topology) info
*/
struct P_isle
{
/*!
- \brief Isle bounding box - north
- */
- double N;
- /*!
- \brief Isle bounding box - south
- */
- double S;
- /*!
- \brief Isle bounding box - east
- */
- double E;
- /*!
- \brief Isle bounding box - west
- */
- double W;
- /*!
- \brief Isle bounding box - top
- */
- double T;
- /*!
- \brief Isle bounding box - bottom
- */
- double B;
- /*!
\brief Number of boundary lines
*/
plus_t n_lines;
@@ -1477,14 +1456,14 @@
};
/*!
- \brief Feature geometry info
+ \brief Feature geometry info - coordinates
*/
struct line_pnts
{
/*!
\brief Array of X coordinates
*/
- double *x;
+ double *x;
/*!
\brief Array of Y coordinates
*/
@@ -1509,7 +1488,7 @@
struct line_cats
{
/*!
- \brief Array of fields (layers)
+ \brief Array of layers (fields)
*/
int *field;
/*!
@@ -1530,11 +1509,11 @@
struct cat_list
{
/*!
- \brief Category field (layer)
+ \brief Category layer (field)
*/
int field;
/*!
- \brief Array of minimun values
+ \brief Array of minimum values
*/
int *min;
/*!
@@ -1542,7 +1521,7 @@
*/
int *max;
/*!
- \brie Number of ranges
+ \brief Number of ranges
*/
int n_ranges;
/*!
@@ -1563,7 +1542,7 @@
*/
int *value;
/*!
- \brief Number of values in the array
+ \brief Number of values in the list
*/
int n_values;
/*!
@@ -1573,6 +1552,29 @@
};
/*!
+ \brief List of bounding boxes with id
+*/
+struct boxlist
+{
+ /*!
+ \brief Array of ids
+ */
+ int *id;
+ /*!
+ \brief Array of bounding boxes
+ */
+ struct bound_box *box;
+ /*!
+ \brief Number of items in the list
+ */
+ int n_values;
+ /*!
+ \brief Allocated space for items
+ */
+ int alloc_values;
+};
+
+/*!
\brief Vector array
Space allocated is size + 1
@@ -1600,13 +1602,13 @@
struct spatial_index
{
/*!
- \brief Pointer to the search tree (R*Tree)
+ \brief Pointer to the search tree (R*-Tree)
*/
- struct RTree *si_tree;
+ struct RTree *si_tree;
/*!
- \brief Name (used ?)
+ \brief Name of file to store the search tree
*/
- char *name;
+ char *name;
};
#endif /* DIG___STRUCTS___ */
Modified: grass/trunk/include/vector.h
===================================================================
--- grass/trunk/include/vector.h 2011-07-01 08:27:49 UTC (rev 46897)
+++ grass/trunk/include/vector.h 2011-07-01 08:52:08 UTC (rev 46898)
@@ -128,6 +128,16 @@
int Vect_reset_list(struct ilist *);
void Vect_destroy_list(struct ilist *);
+/* List of bounding boxes with ids */
+struct boxlist *Vect_new_boxlist(void);
+int Vect_boxlist_append(struct boxlist *, int, struct bound_box);
+int Vect_boxlist_append_list(struct boxlist *, const struct boxlist *);
+int Vect_boxlist_delete(struct boxlist *, int);
+int Vect_boxlist_delete_boxlist(struct boxlist *, const struct boxlist *);
+int Vect_val_in_boxlist(const struct boxlist *, int);
+int Vect_reset_boxlist(struct boxlist *);
+void Vect_destroy_boxlist(struct boxlist *);
+
/* Bounding box (MBR) */
int Vect_point_in_box(double, double, double, const struct bound_box *);
int Vect_box_overlap(const struct bound_box *, const struct bound_box *);
@@ -192,6 +202,7 @@
/* Get map level 2 informations */
int Vect_level(const struct Map_info *);
+int Vect_get_line_type(const struct Map_info *, int);
plus_t Vect_get_num_nodes(const struct Map_info *);
plus_t Vect_get_num_primitives(const struct Map_info *, int);
plus_t Vect_get_num_lines(const struct Map_info *);
@@ -295,8 +306,12 @@
/* Selecting features */
int Vect_select_lines_by_box(struct Map_info *, const struct bound_box *, int,
struct ilist *);
+int Vect_select_lines_by_box_with_box(struct Map_info *, const struct bound_box *,
+ int, struct boxlist *);
int Vect_select_areas_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
+int Vect_select_areas_by_box_with_box(struct Map_info *, const struct bound_box *, struct boxlist *);
int Vect_select_isles_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
+int Vect_select_isles_by_box_with_box(struct Map_info *, const struct bound_box *, struct boxlist *);
int Vect_select_nodes_by_box(struct Map_info *, const struct bound_box *, struct ilist *);
int Vect_find_node(struct Map_info *, double, double, double, double, int);
int Vect_find_line(struct Map_info *, double, double, double, int, double,
@@ -324,8 +339,8 @@
struct line_pnts *);
int Vect_get_point_in_poly(const struct line_pnts *, double *, double *);
int Vect_point_in_poly(double, double, const struct line_pnts *);
-int Vect_point_in_area_outer_ring(double, double, const struct Map_info *, int);
-int Vect_point_in_island(double, double, const struct Map_info *, int);
+int Vect_point_in_area_outer_ring(double, double, const struct Map_info *, int, struct bound_box);
+int Vect_point_in_island(double, double, const struct Map_info *, int, struct bound_box);
/* Cleaning */
void Vect_break_lines(struct Map_info *, int, struct Map_info *);
More information about the grass-commit
mailing list