GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71769
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
dig_externs.h File Reference

Function prototypes for diglib (part of vector library) More...

#include <grass/gis.h>
Include dependency graph for dig_externs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void * dig_alloc_space (int, int *, int, void *, int)
 
void * dig__alloc_space (int, int *, int, void *, int)
 
void * dig_falloc (int, int)
 
void * dig_frealloc (void *, int, int, int)
 
void * dig__falloc (int, int)
 
void * dig__frealloc (void *, int, int, int)
 
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 *)
 
int dig_is_line_degenerate (const struct line_pnts *, double)
 
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_cidx_init (struct Plus_head *)
 Initialize Plus_head structure (cidx) More...
 
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 *)
 Read header of cidx file. More...
 
int dig_write_cidx (struct gvfile *, struct Plus_head *)
 
int dig_read_cidx (struct gvfile *, struct Plus_head *, int)
 Read spatial index file. More...
 
off_t dig_ftell (struct gvfile *file)
 Get struct gvfile position. More...
 
int dig_fseek (struct gvfile *file, off_t offset, int whence)
 Set struct gvfile position. More...
 
void dig_rewind (struct gvfile *file)
 Rewind file position. More...
 
int dig_fflush (struct gvfile *file)
 Flush struct gvfile. More...
 
size_t dig_fread (void *ptr, size_t size, size_t nmemb, struct gvfile *file)
 Read struct gvfile. More...
 
size_t dig_fwrite (const void *ptr, size_t size, size_t nmemb, struct gvfile *file)
 Write struct gvfile. More...
 
void dig_file_init (struct gvfile *file)
 Initialize gvfile strcuture. More...
 
int dig_file_load (struct gvfile *file)
 Load opened struct gvfile to memory. More...
 
void dig_file_free (struct gvfile *file)
 Free struct gvfile. More...
 
int dig_write_frmt_ascii (FILE *, struct Format_info *, int)
 
int dig_read_frmt_ascii (FILE *, struct Format_info *)
 Read external vector format file. More...
 
int dig__write_head (struct Map_info *)
 
int dig__read_head (struct Map_info *)
 
double dig_x_intersect (double, double, double, double, 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 *)
 
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)
 
int dig_init_boxlist (struct boxlist *, int)
 
int dig_boxlist_add (struct boxlist *, int, const struct bound_box *)
 
int dig_init_plus (struct Plus_head *)
 Initialize Plus_head structure. More...
 
void dig_free_plus_nodes (struct Plus_head *)
 Free Plus->Node structure. More...
 
void dig_free_plus_lines (struct Plus_head *)
 Free Plus->Line structure. More...
 
void dig_free_plus_areas (struct Plus_head *)
 Free Plus->Area structure. More...
 
void dig_free_plus_isles (struct Plus_head *)
 Free Plus->Isle structure. More...
 
void dig_free_plus (struct Plus_head *)
 Free Plus structure. More...
 
int dig_load_plus (struct Plus_head *, struct gvfile *, int)
 Reads topo file to topo structure. More...
 
int dig_write_plus_file (struct gvfile *, struct Plus_head *)
 Writes topo structure to topo file. More...
 
int dig_write_nodes (struct gvfile *, struct Plus_head *)
 Writes topo structure (nodes) to topo file. More...
 
int dig_write_lines (struct gvfile *, struct Plus_head *)
 Writes topo structure (lines) to topo file. More...
 
int dig_write_areas (struct gvfile *, struct Plus_head *)
 Writes topo structure (areas) to topo file. More...
 
int dig_write_isles (struct gvfile *, struct Plus_head *)
 Writes topo structure (isles) to topo file. More...
 
int dig_add_area (struct Plus_head *, int, plus_t *, struct bound_box *)
 Allocate space for new area and create boundary info from array. More...
 
int dig_area_add_isle (struct Plus_head *, int, int)
 Add isle to area if does not exist yet. More...
 
int dig_area_del_isle (struct Plus_head *, int, int)
 Delete isle from area. More...
 
int dig_del_area (struct Plus_head *, int)
 Delete area from Plus_head structure. More...
 
int dig_add_isle (struct Plus_head *, int, plus_t *, struct bound_box *)
 Allocate space for new island and create boundary info from array. More...
 
int dig_del_isle (struct Plus_head *, int)
 Delete island from Plus_head structure. More...
 
int dig_build_area_with_line (struct Plus_head *, plus_t, int, plus_t **)
 Build topo for area from lines. More...
 
int dig_angle_next_line (struct Plus_head *, plus_t, int, int, float *)
 Find number line of next angle to follow an line. More...
 
int dig_node_angle_check (struct Plus_head *, int, int)
 Checks if angles of adjacent lines differ. More...
 
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 *)
 
int dig_add_line (struct Plus_head *, int, const struct line_pnts *, const struct bound_box *, off_t)
 Add new line to Plus_head structure. More...
 
int dig_restore_line (struct Plus_head *, int, int, const struct line_pnts *, const struct bound_box *, off_t)
 Restore line in Plus_head structure. More...
 
int dig_del_line (struct Plus_head *, int, double, double, double)
 Delete line from Plus_head structure. More...
 
plus_t dig_line_get_area (struct Plus_head *, plus_t, int)
 Get area number on line side. More...
 
int dig_line_set_area (struct Plus_head *, plus_t, int, plus_t)
 Set area number on line side. More...
 
int dig_add_node (struct Plus_head *, double, double, double)
 Add new node to plus structure. More...
 
int dig_which_node (struct Plus_head *, double, double, double)
 Return actual index into node arrays of the first set of matching coordinates. More...
 
int dig_node_add_line (struct Plus_head *, int, int, const struct line_pnts *, int)
 Add line info to node. More...
 
float dig_node_line_angle (struct Plus_head *, int, int)
 Return line angle. More...
 
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 *)
 Read Plus_head from file. More...
 
int dig_Wr_Plus_head (struct gvfile *, struct Plus_head *)
 
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 *)
 
void dig_init_portable (struct Port_info *, int)
 Set Port_info structure to byte order of file. More...
 
int dig__byte_order_out ()
 Get byte order. More...
 
int dig_set_cur_port (struct Port_info *)
 Set current Port_info structure. More...
 
int dig__fread_port_D (double *, size_t, struct gvfile *)
 Read doubles from the Portable Vector Format. More...
 
int dig__fread_port_F (float *, size_t, struct gvfile *)
 Read floats from the Portable Vector Format. More...
 
int dig__fread_port_O (off_t *, size_t, struct gvfile *, size_t)
 Read off_ts from the Portable Vector Format. More...
 
int dig__fread_port_L (long *, size_t, struct gvfile *)
 Read longs from the Portable Vector Format. More...
 
int dig__fread_port_S (short *, size_t, struct gvfile *)
 Read shorts from the Portable Vector Format. More...
 
int dig__fread_port_I (int *, size_t, struct gvfile *)
 Read integers from the Portable Vector Format. More...
 
int dig__fread_port_P (plus_t *, size_t, struct gvfile *)
 Read plus_t from the Portable Vector Format. More...
 
int dig__fread_port_C (char *, size_t, struct gvfile *)
 Read chars from the Portable Vector Format. More...
 
int dig__fwrite_port_D (const double *, size_t, struct gvfile *)
 Write doubles to the Portable Vector Format. More...
 
int dig__fwrite_port_F (const float *, size_t, struct gvfile *)
 Write floats to the Portable Vector Format. More...
 
int dig__fwrite_port_O (const off_t *, size_t, struct gvfile *, size_t)
 Write off_ts to the Portable Vector Format. More...
 
int dig__fwrite_port_L (const long *, size_t, struct gvfile *)
 Write longs to the Portable Vector Format. More...
 
int dig__fwrite_port_S (const short *, size_t, struct gvfile *)
 Write shorts to the Portable Vector Format. More...
 
int dig__fwrite_port_I (const int *, size_t, struct gvfile *)
 Write integers to the Portable Vector Format. More...
 
int dig__fwrite_port_P (const plus_t *, size_t, struct gvfile *)
 Write plus_t to the Portable Vector Format. More...
 
int dig__fwrite_port_C (const char *, size_t, struct gvfile *)
 Write chars to the Portable Vector Format. More...
 
int dig_prune (struct line_pnts *, double)
 
int dig_spidx_init (struct Plus_head *)
 Initit spatial index (nodes, lines, areas, isles) More...
 
void dig_spidx_free_nodes (struct Plus_head *)
 Free spatial index for nodes. More...
 
void dig_spidx_free_lines (struct Plus_head *)
 Free spatial index for lines. More...
 
void dig_spidx_free_areas (struct Plus_head *)
 Reset spatial index for areas. More...
 
void dig_spidx_free_isles (struct Plus_head *)
 Reset spatial index for isles. More...
 
void dig_spidx_free (struct Plus_head *)
 Free spatial index (nodes, lines, areas, isles) More...
 
int dig_spidx_add_node (struct Plus_head *, int, double, double, double)
 Add new node to spatial index. More...
 
int dig_spidx_add_line (struct Plus_head *, int, const struct bound_box *)
 Add new line to spatial index. More...
 
int dig_spidx_add_area (struct Plus_head *, int, const struct bound_box *)
 Add new area to spatial index. More...
 
int dig_spidx_add_isle (struct Plus_head *, int, const struct bound_box *)
 Add new island to spatial index. More...
 
int dig_spidx_del_node (struct Plus_head *, int)
 Delete node from spatial index. More...
 
int dig_spidx_del_line (struct Plus_head *, int, double, double, double)
 Delete line from spatial index. More...
 
int dig_spidx_del_area (struct Plus_head *, int)
 Delete area from spatial index. More...
 
int dig_spidx_del_isle (struct Plus_head *, int)
 Delete isle from spatial index. More...
 
int dig_select_nodes (struct Plus_head *, const struct bound_box *, struct ilist *)
 Select nodes by bbox. More...
 
int dig_select_lines (struct Plus_head *, const struct bound_box *, struct boxlist *)
 Select lines with boxes by box. More...
 
int dig_select_areas (struct Plus_head *, const struct bound_box *, struct boxlist *)
 Select areas with boxes by box. More...
 
int dig_select_isles (struct Plus_head *, const struct bound_box *, struct boxlist *)
 Select isles with boxes by box. More...
 
int dig_find_node (struct Plus_head *, double, double, double)
 Find one node by coordinates. More...
 
int dig_find_line_box (struct Plus_head *, int, struct bound_box *)
 Find box for line. More...
 
int dig_find_area_box (struct Plus_head *, int, struct bound_box *)
 Find bounding box for given area. More...
 
int dig_find_isle_box (struct Plus_head *, int, struct bound_box *)
 Find box for isle. More...
 
int dig_Rd_spidx_head (struct gvfile *, struct Plus_head *)
 Read spatial index header from sidx file. More...
 
int dig_Wr_spidx_head (struct gvfile *, struct Plus_head *)
 Write spatial index header to file. More...
 
int dig_Wr_spidx (struct gvfile *, struct Plus_head *)
 Write spatial index to file. More...
 
int dig_Rd_spidx (struct gvfile *, struct Plus_head *)
 Read spatial index from sidx file Only needed when old vector is opened in update mode. More...
 
int dig_dump_spidx (FILE *, const struct Plus_head *)
 Dump spatial index. More...
 
int rtree_search (struct RTree *, struct RTree_Rect *, SearchHitCallback, void *, struct Plus_head *)
 Search spatial index file Can't use regular RTreeSearch() here because sidx must be read with dig__fread_port_*() functions. More...
 
int dig_node_alloc_line (struct P_node *, int)
 Allocate space in P_node struct. More...
 
int dig_alloc_nodes (struct Plus_head *, int)
 Reallocate array of pointers to nodes. More...
 
int dig_alloc_lines (struct Plus_head *, int)
 Reallocate array of pointers to lines. More...
 
int dig_alloc_areas (struct Plus_head *, int)
 Reallocate array of pointers to areas. More...
 
int dig_alloc_isles (struct Plus_head *, int)
 Reallocate array of pointers to isles. More...
 
struct P_nodedig_alloc_node ()
 Allocate new node structure. More...
 
struct P_linedig_alloc_line ()
 Allocate new line structure. More...
 
void * dig_alloc_topo (char)
 Allocate new topo struct. More...
 
struct P_areadig_alloc_area ()
 Allocate new area structure. More...
 
struct P_isledig_alloc_isle ()
 Allocate new isle structure. More...
 
void dig_free_node (struct P_node *)
 Free node structure. More...
 
void dig_free_line (struct P_line *)
 Free line structure. More...
 
void dig_free_area (struct P_area *)
 Free area structure. More...
 
void dig_free_isle (struct P_isle *)
 Free isle structure. More...
 
int dig_alloc_points (struct line_pnts *, int)
 allocate room for 'num' X and Y arrays in struct line_pnts More...
 
int dig_alloc_cats (struct line_cats *, int)
 Allocate room for 'num' fields and category arrays in struct line_cats. More...
 
int dig_area_alloc_line (struct P_area *, int)
 allocate space in P_area for add new lines More...
 
int dig_area_alloc_isle (struct P_area *, int)
 Allocate space in P_area for add new isles. More...
 
int dig_isle_alloc_line (struct P_isle *, int)
 Allocate space in P_isle for add new lines. More...
 
int dig_out_of_memory (void)
 For now just print message and return error code. More...
 
int dig_type_to_store (int)
 Convert type to store type. More...
 
int dig_type_from_store (int)
 Convert type from store type. More...
 
void dig_line_reset_updated (struct Plus_head *)
 Reset number of updated lines. More...
 
void dig_line_add_updated (struct Plus_head *, int, off_t)
 Add new line to updated. More...
 
void dig_node_reset_updated (struct Plus_head *)
 Reset number of updated nodes. More...
 
void dig_node_add_updated (struct Plus_head *, int)
 Add node to updated. More...
 
char * color_name (int)
 
char * dig_float_point (char *, int, double)
 
double dig_unit_conversion (void)
 
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 *)
 
intdig__long_convert_to_int (long *, int *, int, struct dig_head *)
 
plus_tdig__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_headdig_get_head (void)
 
struct dig_headdig__get_head (void)
 
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_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_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_check_dist (struct Map_info *, int, double, double, double *)
 
int dig__check_dist (struct Map_info *, struct line_pnts *, double, double, double *)
 
int dig_point_by_line (struct Map_info *, double, double, double, double, char)
 
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 *)
 

Detailed Description

Function prototypes for diglib (part of vector library)

Definition in file dig_externs.h.

Function Documentation

char* color_name ( int  )
void* dig__alloc_space ( int  ,
int ,
int  ,
void *  ,
int   
)

Definition at line 50 of file allocation.c.

References dig__frealloc().

Referenced by dig_alloc_cats(), dig_alloc_points(), and dig_alloc_space().

int dig__byte_order_out ( )

Get byte order.

Returns
ENDIAN_LITTLE
ENDIAN_BIG

Definition at line 1013 of file portable.c.

References dbl_order, ENDIAN_BIG, and ENDIAN_LITTLE.

Referenced by V1_open_new_nat(), Vect_cidx_save(), Vect_save_fidx(), Vect_save_sidx(), and Vect_save_topo().

int dig__check_dist ( struct Map_info ,
struct line_pnts ,
double  ,
double  ,
double *   
)
char* dig__convert_buffer ( int  )
double* dig__double_convert ( double *  ,
double *  ,
int  ,
struct dig_head  
)
void* dig__falloc ( int  ,
int   
)

Definition at line 118 of file allocation.c.

Referenced by dig_build_area_with_line(), and dig_falloc().

float* dig__float_convert ( float *  ,
float *  ,
int  ,
struct dig_head  
)
int dig__fread_port_C ( char *  buf,
size_t  cnt,
struct gvfile fp 
)

Read chars from the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
[out]bufdata buffer
cntnumber of members
fppointer to gvfile structure
Returns
0 error
1 OK

Definition at line 509 of file portable.c.

References dig_fread(), and PORT_CHAR.

Referenced by dig__read_head(), dig_Rd_P_line(), dig_Rd_Plus_head(), dig_Rd_spidx_head(), dig_read_cidx_head(), V1_delete_line_nat(), V1_restore_line_nat(), and Vect_open_fidx().

int dig__fread_port_D ( double *  buf,
size_t  cnt,
struct gvfile fp 
)

Read doubles from the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
[out]bufdata buffer
cntnumber of members
fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 79 of file portable.c.

References Port_info::dbl_cnvrt, Port_info::dbl_quick, dig_fread(), and PORT_DOUBLE.

Referenced by dig_Rd_P_node(), dig_Rd_Plus_head(), and rtree_search().

int dig__fread_port_F ( float *  buf,
size_t  cnt,
struct gvfile fp 
)

Read floats from the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
[out]bufdata buffer
cntnumber of members
fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 123 of file portable.c.

References dig_fread(), Port_info::flt_cnvrt, Port_info::flt_quick, and PORT_FLOAT.

Referenced by dig_Rd_P_node().

int dig__fread_port_I ( int buf,
size_t  cnt,
struct gvfile fp 
)

Read integers from the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
[out]bufdata buffer
cntnumber of members
fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 343 of file portable.c.

References Port_info::byte_order, dig_fread(), ENDIAN_LITTLE, int, Port_info::int_cnvrt, int_order, Port_info::int_quick, nat_int, and PORT_INT.

Referenced by dig__fread_port_P(), dig_Rd_P_line(), dig_Rd_spidx_head(), dig_read_cidx(), dig_read_cidx_head(), rtree_search(), and Vect_open_fidx().

int dig__fread_port_L ( long *  buf,
size_t  cnt,
struct gvfile fp 
)

Read longs from the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
[out]bufdata buffer
cntnumber of members
fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 260 of file portable.c.

References Port_info::byte_order, dig_fread(), ENDIAN_LITTLE, Port_info::lng_cnvrt, lng_order, Port_info::lng_quick, nat_lng, and PORT_LONG.

Referenced by dig__read_head(), dig_Rd_Plus_head(), dig_Rd_spidx_head(), dig_read_cidx_head(), and Vect_open_fidx().

int dig__fread_port_O ( off_t *  buf,
size_t  cnt,
struct gvfile fp,
size_t  port_off_t_size 
)

Read off_ts from the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
[out]bufdata buffer
cntnumber of members
fppointer to struct gvfile
port_off_t_sizeoffset
Returns
0 error
1 OK

Definition at line 167 of file portable.c.

References _, Port_info::byte_order, dig_fread(), ENDIAN_LITTLE, G_fatal_error(), nat_off_t, Port_info::off_t_cnvrt, off_t_order, and Port_info::off_t_quick.

Referenced by dig__read_head(), dig_Rd_P_line(), dig_Rd_Plus_head(), dig_Rd_spidx_head(), dig_read_cidx_head(), and rtree_search().

int dig__fread_port_P ( plus_t buf,
size_t  cnt,
struct gvfile fp 
)

Read plus_t from the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

plus_t is defined as int so we only retype pointer and use int function.

Parameters
[out]bufdata buffer
cntnumber of members
fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 535 of file portable.c.

References dig__fread_port_I().

Referenced by dig_Rd_P_area(), dig_Rd_P_isle(), dig_Rd_P_line(), dig_Rd_P_node(), and dig_Rd_Plus_head().

int dig__fread_port_S ( short *  buf,
size_t  cnt,
struct gvfile fp 
)

Read shorts from the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
[out]bufdata buffer
cntnumber of members
fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 426 of file portable.c.

References Port_info::byte_order, dig_fread(), ENDIAN_LITTLE, nat_shrt, PORT_SHORT, Port_info::shrt_cnvrt, shrt_order, and Port_info::shrt_quick.

void* dig__frealloc ( void *  ,
int  ,
int  ,
int   
)

Definition at line 133 of file allocation.c.

References b, and G_free().

Referenced by dig__alloc_space(), dig_build_area_with_line(), and dig_frealloc().

int dig__fwrite_port_C ( const char *  buf,
size_t  cnt,
struct gvfile fp 
)

Write chars to the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
bufdata buffer
cntnumber of members
[in,out]fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 890 of file portable.c.

References dig_fwrite(), and PORT_CHAR.

Referenced by dig__write_head(), dig_Wr_P_line(), dig_Wr_Plus_head(), dig_Wr_spidx_head(), dig_write_cidx_head(), V1_delete_line_nat(), V1_restore_line_nat(), and Vect_save_fidx().

int dig__fwrite_port_D ( const double *  buf,
size_t  cnt,
struct gvfile fp 
)

Write doubles to the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
bufdata buffer
cntnumber of members
[in,out]fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 557 of file portable.c.

References Port_info::dbl_cnvrt, Port_info::dbl_quick, dig_fwrite(), and PORT_DOUBLE.

Referenced by dig_Wr_P_node(), and dig_Wr_Plus_head().

int dig__fwrite_port_F ( const float *  buf,
size_t  cnt,
struct gvfile fp 
)

Write floats to the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
bufdata buffer
cntnumber of members
[in,out]fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 596 of file portable.c.

References dig_fwrite(), Port_info::flt_cnvrt, Port_info::flt_quick, and PORT_FLOAT.

Referenced by dig_Wr_P_node().

int dig__fwrite_port_I ( const int buf,
size_t  cnt,
struct gvfile fp 
)

Write integers to the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
bufdata buffer
cntnumber of members
[in,out]fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 758 of file portable.c.

References dig_fwrite(), ENDIAN_LITTLE, int, Port_info::int_cnvrt, int_order, Port_info::int_quick, nat_int, and PORT_INT.

Referenced by dig__fwrite_port_P(), dig_Wr_P_line(), dig_Wr_spidx_head(), dig_write_cidx(), dig_write_cidx_head(), and Vect_save_fidx().

int dig__fwrite_port_L ( const long *  buf,
size_t  cnt,
struct gvfile fp 
)

Write longs to the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
bufdata buffer
cntnumber of members
[in,out]fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 702 of file portable.c.

References dig_fwrite(), ENDIAN_LITTLE, Port_info::lng_cnvrt, lng_order, Port_info::lng_quick, nat_lng, and PORT_LONG.

Referenced by dig__write_head(), dig_Wr_Plus_head(), dig_Wr_spidx_head(), dig_write_cidx_head(), and Vect_save_fidx().

int dig__fwrite_port_O ( const off_t *  buf,
size_t  cnt,
struct gvfile fp,
size_t  port_off_t_size 
)

Write off_ts to the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
bufdata buffer
cntnumber of members
[in,out]fppointer to struct gvfile
port_off_t_size
Returns
0 error
1 OK

Definition at line 636 of file portable.c.

References _, dig_fwrite(), ENDIAN_LITTLE, G_fatal_error(), nat_off_t, Port_info::off_t_cnvrt, off_t_order, and Port_info::off_t_quick.

Referenced by dig__write_head(), dig_Wr_P_line(), dig_Wr_Plus_head(), dig_Wr_spidx_head(), and dig_write_cidx_head().

int dig__fwrite_port_P ( const plus_t buf,
size_t  cnt,
struct gvfile fp 
)

Write plus_t to the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
bufdata buffer
cntnumber of members
[in,out]fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 871 of file portable.c.

References dig__fwrite_port_I().

Referenced by dig_Wr_P_area(), dig_Wr_P_isle(), dig_Wr_P_line(), dig_Wr_P_node(), and dig_Wr_Plus_head().

int dig__fwrite_port_S ( const short *  buf,
size_t  cnt,
struct gvfile fp 
)

Write shorts to the Portable Vector Format.

These routines must handle any type size conversions between the portable format and the native machine.

Parameters
bufdata buffer
cntnumber of members
[in,out]fppointer to struct gvfile
Returns
0 error
1 OK

Definition at line 814 of file portable.c.

References dig_fwrite(), ENDIAN_LITTLE, nat_shrt, PORT_SHORT, Port_info::shrt_cnvrt, shrt_order, and Port_info::shrt_quick.

struct dig_head* dig__get_head ( void  )
long* dig__int_convert ( int ,
long *  ,
int  ,
struct dig_head  
)
long* dig__long_convert ( long *  ,
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  
)
long* dig__plus_t_convert ( plus_t ,
long *  ,
int  ,
struct dig_head  
)
short* dig__short_convert ( short *  in,
short *  out,
int  ,
struct dig_head  
)
int dig_add_area ( struct Plus_head plus,
int  n_lines,
plus_t lines,
struct bound_box box 
)

Allocate space for new area and create boundary info from array.

Then for each line in area, update line (right,left) info.

Neither islands nor centroids area filled.

Parameters
[in]pluspointer to Plus_head structure
[in]n_linesnumber of lines
[in]linesarray of lines, negative for reverse direction
[in]boxbounding box
Returns
number of new area
-1 on error

Definition at line 181 of file plus_area.c.

References _, Plus_head::alloc_areas, Plus_head::Area, P_area::centroid, dig_alloc_area(), dig_alloc_areas(), dig_area_alloc_line(), dig_spidx_add_area(), G_debug(), G_warning(), if(), P_topo_b::left, Plus_head::Line, P_area::lines, Plus_head::n_areas, P_area::n_lines, NULL, P_topo_b::right, and P_line::topo.

Referenced by Vect_build_line_area().

int dig_add_isle ( struct Plus_head plus,
int  n_lines,
plus_t lines,
struct bound_box box 
)

Allocate space for new island and create boundary info from array.

The order of input lines is expected to be counter clockwise. Then for each line in isle, update line (right,left) info.

Area number the island is within is not filled.

Parameters
[in]pluspointer to Plus_head structure
[in]n_linesnumber of lines
[in]linesarray of lines, negative for reverse direction
[in]boxbounding box
Returns
number of new isle
-1 on error

Definition at line 675 of file plus_area.c.

References _, Plus_head::alloc_isles, P_isle::area, dig_alloc_isle(), dig_alloc_isles(), dig_isle_alloc_line(), dig_spidx_add_isle(), G_debug(), G_warning(), if(), Plus_head::Isle, P_topo_b::left, Plus_head::Line, P_isle::lines, Plus_head::n_isles, P_isle::n_lines, NULL, P_topo_b::right, and P_line::topo.

Referenced by Vect_build_line_area().

int dig_add_line ( struct Plus_head plus,
int  type,
const struct line_pnts Points,
const struct bound_box box,
off_t  offset 
)

Add new line to Plus_head structure.

Parameters
[in,out]pluspointer to Plus_head structure
typefeature type
Pointsline geometry
boxbounding box
offsetline offset
Returns
-1 on error
line id

Definition at line 135 of file plus_line.c.

References Plus_head::alloc_lines, dig_alloc_lines(), GV_BOUNDARY, GV_FACE, GV_KERNEL, GV_LINE, Plus_head::n_blines, Plus_head::n_clines, Plus_head::n_flines, Plus_head::n_klines, Plus_head::n_lines, Plus_head::n_llines, and Plus_head::n_plines.

Referenced by V2__add_line_to_topo_nat(), V2_write_line_sfa(), and Vect_build_nat().

int dig_add_node ( struct Plus_head plus,
double  x,
double  y,
double  z 
)

Add new node to plus structure.

Parameters
[in]pluspointer to Plus_head structure
[in]x,y,zcoordinates
Returns
-1 on error
number of node

Definition at line 103 of file plus_node.c.

References Plus_head::alloc_nodes, dig_alloc_node(), dig_alloc_nodes(), dig_spidx_add_node(), G_debug(), Plus_head::n_nodes, Plus_head::Node, x, P_node::x, P_node::y, and P_node::z.

struct P_area* dig_alloc_area ( )

Allocate new area structure.

Returns
pointer to allocated P_area struct
NULL on error

Definition at line 263 of file struct_alloc.c.

References G_zero(), and NULL.

Referenced by dig_add_area(), and dig_Rd_P_area().

int dig_alloc_areas ( struct Plus_head Plus,
int  add 
)

Reallocate array of pointers to areas.

Parameters
Pluspointer to Plus_head structure
addspace for 'add' number of areas is added
Returns
0 on success
-1 on error

Definition at line 215 of file struct_alloc.c.

References Plus_head::alloc_areas, Plus_head::Area, and NULL.

Referenced by dig_add_area(), and dig_load_plus().

int dig_alloc_cats ( struct line_cats cats,
int  num 
)

Allocate room for 'num' fields and category arrays in struct line_cats.

Parameters
catspointer to line_cats struct
numnumber of cats
Returns
0 on success
returns -1 on out of memory

Definition at line 380 of file struct_alloc.c.

References line_cats::alloc_cats, line_cats::cat, dig__alloc_space(), dig_out_of_memory(), and line_cats::field.

Referenced by Vect_cat_set().

struct P_isle* dig_alloc_isle ( )

Allocate new isle structure.

Returns
pointer to allocated P_isle struct
NULL on error

Definition at line 298 of file struct_alloc.c.

References G_zero(), and NULL.

Referenced by dig_add_isle(), and dig_Rd_P_isle().

int dig_alloc_isles ( struct Plus_head Plus,
int  add 
)

Reallocate array of pointers to isles.

Parameters
Pluspointer to Plus_head structure
addspace for 'add' number of isles is added.
Returns
0 on success
-1 on error

Definition at line 240 of file struct_alloc.c.

References Plus_head::alloc_isles, G_debug(), Plus_head::Isle, and NULL.

Referenced by dig_add_isle(), and dig_load_plus().

struct P_line* dig_alloc_line ( )

Allocate new line structure.

Returns
pointer to allocated P_node struct
NULL on error

Definition at line 124 of file struct_alloc.c.

References G_zero(), and NULL.

Referenced by dig_Rd_P_line().

int dig_alloc_lines ( struct Plus_head Plus,
int  add 
)

Reallocate array of pointers to lines.

Parameters
Pluspointer to Plus_head structure
addspace for 'add' number of lines is added.
Returns
0 on success
-1 on error

Definition at line 190 of file struct_alloc.c.

References Plus_head::alloc_lines, Plus_head::Line, and NULL.

Referenced by dig_add_line(), and dig_load_plus().

struct P_node* dig_alloc_node ( )

Allocate new node structure.

Returns
pointer to allocated P_node struct
NULL on error

Definition at line 30 of file struct_alloc.c.

References G_zero(), and NULL.

Referenced by dig_add_node(), and dig_Rd_P_node().

int dig_alloc_nodes ( struct Plus_head Plus,
int  add 
)

Reallocate array of pointers to nodes.

Parameters
Pluspointer to Plus_head structure
addnumber of nodes to be added
Returns
0 on success
-1 on error

Definition at line 102 of file struct_alloc.c.

References Plus_head::alloc_nodes, Plus_head::Node, and NULL.

Referenced by dig_add_node(), and dig_load_plus().

int dig_alloc_points ( struct line_pnts points,
int  num 
)

allocate room for 'num' X and Y arrays in struct line_pnts

Parameters
pointspointer to line_pnts struct
numnumber of points
Returns
0 on success
returns -1 on out of memory

Definition at line 333 of file struct_alloc.c.

References line_pnts::alloc_points, dig__alloc_space(), dig_out_of_memory(), line_pnts::x, line_pnts::y, and line_pnts::z.

Referenced by dig_get_poly_points(), Vect_append_point(), Vect_append_points(), Vect_copy_xyz_to_pnts(), and Vect_line_insert_point().

void* dig_alloc_space ( int  ,
int ,
int  ,
void *  ,
int   
)

Definition at line 33 of file allocation.c.

References dig__alloc_space(), and NULL.

void* dig_alloc_topo ( char  type)

Allocate new topo struct.

Parameters
typeto of struct to allocate

Definition at line 142 of file struct_alloc.c.

References GV_BOUNDARY, GV_CENTROID, GV_FACE, GV_KERNEL, GV_LINE, and NULL.

Referenced by dig_Rd_P_line().

int dig_angle_next_line ( struct Plus_head plus,
plus_t  current_line,
int  side,
int  type,
float *  angle 
)

Find number line of next angle to follow an line.

Assume that lines are sorted in increasing angle order and angles of points and degenerated lines are set to -9 (ignored).

Parameters
[in]pluspointer to Plus_head structure
[in]current_linecurrent line id, negative if request for end node
[in]sideside GV_RIGHT or GV_LEFT
[in]typeline type (GV_LINE, GV_BOUNDARY or both)
[in]angle
Returns
line number of next angle to follow an line (negative if connected by end node) (number of current line may be return if dangle - this is used in build)
0 on error or not found

Definition at line 464 of file plus_area.c.

References P_node::angles, G_debug(), G_getenv_nofatal(), GV_BOUNDARY, GV_LINE, GV_LINES, GV_RIGHT, Plus_head::Line, P_node::lines, P_topo_l::N1, P_topo_b::N1, P_topo_l::N2, P_topo_b::N2, P_node::n_lines, Plus_head::Node, NULL, P_line::topo, and P_line::type.

Referenced by dig_build_area_with_line(), dig_node_angle_check(), V2__add_line_to_topo_nat(), and V2__delete_line_from_topo_nat().

int dig_area_add_isle ( struct Plus_head plus,
int  area,
int  isle 
)

Add isle to area if does not exist yet.

Parameters
[in]pluspointer to Plus_head structure
[in]areaarea id
[in]isleisle id
Returns
0

Definition at line 255 of file plus_area.c.

References _, P_area::alloc_isles, Plus_head::Area, dig_area_alloc_isle(), G_debug(), G_fatal_error(), G_getenv_nofatal(), G_warning(), P_area::isles, P_area::n_isles, and NULL.

Referenced by Vect_attach_isle(), and Vect_remove_small_areas_nat().

int dig_area_alloc_isle ( struct P_area area,
int  add 
)

Allocate space in P_area for add new isles.

Parameters
areapointer to P_area struct
addnumber of isle to be added
Returns
0 on success
-1 on error

Definition at line 442 of file struct_alloc.c.

References P_area::alloc_isles, G_debug(), P_area::isles, NULL, and num.

Referenced by dig_area_add_isle(), and dig_Rd_P_area().

int dig_area_alloc_line ( struct P_area area,
int  add 
)

allocate space in P_area for add new lines

Parameters
areapointer to P_area struct
addnumber of lines to be added
Returns
0 on success
-1 on error

Definition at line 416 of file struct_alloc.c.

References P_area::alloc_lines, P_area::lines, NULL, and num.

Referenced by dig_add_area(), and dig_Rd_P_area().

int dig_area_del_isle ( struct Plus_head plus,
int  area,
int  isle 
)

Delete isle from area.

Parameters
[in]pluspointer to Plus_head structure
[in]areaarea id
[in]isleisle id
Returns
0

Definition at line 304 of file plus_area.c.

References _, Plus_head::Area, G_debug(), G_fatal_error(), P_area::isles, P_area::n_isles, and NULL.

Referenced by dig_del_isle(), and Vect_attach_isles().

int dig_area_get_box ( struct Plus_head ,
plus_t  ,
struct bound_box  
)
int dig_box_copy ( struct bound_box ,
struct bound_box  
)
int dig_box_extend ( struct bound_box ,
struct bound_box  
)
int dig_boxlist_add ( struct boxlist ,
int  ,
const struct bound_box  
)
int dig_build_area_with_line ( struct Plus_head plus,
plus_t  first_line,
int  side,
plus_t **  lines 
)

Build topo for area from lines.

Area is built in clockwise order. Take a given line and start off to the RIGHT/LEFT and try to complete an area.

Possible Scenarios:

  • I. path runs into first line. : AREA!
  • II. path runs into a dead end (no other area lines at node) : no area
  • III. path runs into a previous line that is not 1st line or to 1st line but not to start node : no area

After we find an area then we call point_in_area() to see if the specified point is w/in the area

Old returns -1: error 0: no area (1: point in area) -2: island !!

Parameters
[in]pluspointer to Plus_head structure
[in]first_lineline id of first line
[in]sideside of line to build area on (GV_LEFT | GV_RIGHT)
[in]linespointer to array of lines
Returns
-1 on error
0 no area
number of lines

Definition at line 51 of file plus_area.c.

References dig__falloc(), dig__frealloc(), dig_angle_next_line(), dig_node_angle_check(), dig_node_line_angle(), dig_out_of_memory(), G_debug(), G_getenv_nofatal(), GV_BOUNDARY, GV_LEFT, GV_RIGHT, if(), Plus_head::Line, P_topo_b::N1, P_isle::n_lines, NULL, P_line::topo, and P_line::type.

Referenced by Vect_build_line_area().

float dig_calc_begin_angle ( const struct line_pnts ,
double   
)

Definition at line 31 of file angle.c.

References dig_line_degenerate(), line_pnts::n_points, line_pnts::x, and line_pnts::y.

Referenced by dig_node_add_line().

float dig_calc_end_angle ( const struct line_pnts ,
double   
)

Definition at line 82 of file angle.c.

References dig_line_degenerate(), line_pnts::n_points, line_pnts::x, and line_pnts::y.

Referenced by dig_node_add_line().

int dig_check_dist ( struct Map_info ,
int  ,
double  ,
double  ,
double *   
)
int dig_cidx_del_cat ( struct Plus_head ,
int  ,
int  ,
int  ,
int   
)
int dig_cidx_init ( struct Plus_head Plus)

Initialize Plus_head structure (cidx)

Parameters
Pluspointer to Plus_head structure
Returns
1 OK
0 on error

Definition at line 29 of file diglib/cindex.c.

References Plus_head::a_cidx, Plus_head::cidx, Plus_head::cidx_up_to_date, G_debug(), and Plus_head::n_cidx.

Referenced by dig_init_plus(), dig_read_cidx(), and Vect_build_partial().

int dig_del_area ( struct Plus_head plus,
int  area 
)

Delete area from Plus_head structure.

This function deletes area from the topo structure and resets references to this area in lines, isles (within) to 0. Possible new area is not created by this function, so that old boundaries participating in this area are left without area information even if form new area. Not enabled now: If area is inside other area, area info for islands within deleted area is reset to that area outside. (currently area info of isles is set to 0)

Parameters
[in]pluspointer to Plus_head structure
[in]areaarea id
Returns
0 on error
1 on success

Definition at line 355 of file plus_area.c.

References _, Plus_head::Area, P_topo_c::area, P_isle::area, P_area::centroid, dig_free_area(), dig_spidx_del_area(), G_debug(), G_fatal_error(), G_warning(), if(), Plus_head::Isle, P_area::isles, P_topo_b::left, Plus_head::Line, P_area::lines, P_area::n_isles, P_area::n_lines, NULL, P_topo_b::right, and P_line::topo.

Referenced by V2__add_line_to_topo_nat(), V2__delete_line_from_topo_nat(), and Vect_remove_small_areas_nat().

int dig_del_isle ( struct Plus_head plus,
int  isle 
)

Delete island from Plus_head structure.

Reset references to it in lines and area outside.

Parameters
[in]pluspointer to Plus_head structure
[in]isleisle id
Returns
1

Definition at line 750 of file plus_area.c.

References _, Plus_head::Area, P_isle::area, dig_area_del_isle(), dig_free_isle(), dig_spidx_del_isle(), G_debug(), G_fatal_error(), if(), Plus_head::Isle, P_topo_b::left, Plus_head::Line, P_isle::lines, P_isle::n_lines, NULL, P_topo_b::right, and P_line::topo.

Referenced by V2__add_line_to_topo_nat(), V2__delete_line_from_topo_nat(), and Vect_remove_small_areas_nat().

int dig_del_line ( struct Plus_head plus,
int  line,
double  x,
double  y,
double  z 
)

Delete line from Plus_head structure.

Doesn't update area/isle references (dig_del_area() or dig_del_isle()) must be run before the line is deleted if the line is part of such structure). Update is info about line in nodes. If this line is last in node then node is deleted.

Parameters
[in,out]pluspointer to Plus_head structure
[in]lineline id
[in]x,y,zcoordinates
Returns
-1 on error
0 OK

Definition at line 218 of file plus_line.c.

References P_node::angles, dig_free_line(), dig_free_node(), dig_line_add_updated(), dig_node_add_updated(), dig_spidx_del_line(), dig_spidx_del_node(), Plus_head::do_uplist, G_debug(), GV_BOUNDARY, GV_LINE, GV_LINES, Plus_head::Line, P_node::lines, P_topo_l::N1, P_topo_b::N1, P_topo_l::N2, P_topo_b::N2, P_node::n_lines, Plus_head::Node, NULL, P_line::offset, P_line::topo, P_line::type, and Plus_head::uplist.

Referenced by V2__delete_line_from_topo_nat(), V2_delete_line_sfa(), and Vect_remove_small_areas_nat().

double dig_distance2_point_to_line ( double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
int  ,
double *  ,
double *  ,
double *  ,
double *  ,
int  
)

Definition at line 45 of file vector/diglib/line_dist.c.

References st, t, x, and ZERO.

Referenced by Vect_line_distance(), Vect_line_geodesic_distance(), and Vect_snap_line().

int dig_do_file_checks ( struct Map_info ,
char *  ,
char *   
)
int dig_dump_spidx ( FILE *  fp,
const struct Plus_head Plus 
)

Dump spatial index.

Parameters
[out]fppointer to FILE
Pluspointer to Plus_head structure
Returns
0

Definition at line 1272 of file spindex_rw.c.

References Plus_head::Area_spidx, RTree::fd, Plus_head::Isle_spidx, Plus_head::Line_spidx, Plus_head::Node_spidx, RTree::root, RTree::rootpos, RTreeFlushBuffer(), and Plus_head::with_z.

Referenced by Vect_sidx_dump().

void* dig_falloc ( int  ,
int   
)

Definition at line 91 of file allocation.c.

References dig__falloc(), G_sleep(), and NULL.

int dig_fflush ( struct gvfile file)

Flush struct gvfile.

Parameters
filepointer to struct gvfile structure
Returns
0

Definition at line 104 of file file.c.

References gvfile::file, and gvfile::loaded.

Referenced by dig_Wr_spidx(), dig_write_plus_file(), V1_delete_line_nat(), and V1_restore_line_nat().

void dig_file_free ( struct gvfile file)

Free struct gvfile.

Parameters
filepointer to struct gvfile structure

Definition at line 266 of file file.c.

References gvfile::alloc, G_free(), gvfile::loaded, and gvfile::start.

Referenced by V1_close_nat().

void dig_file_init ( struct gvfile file)

Initialize gvfile strcuture.

Parameters
[in,out]filepointer to gvfile structure

Definition at line 170 of file file.c.

References G_zero().

Referenced by V1_open_new_nat(), V1_open_old_nat(), Vect_cidx_open(), Vect_cidx_save(), Vect_open_fidx(), Vect_open_sidx(), Vect_open_topo(), Vect_save_fidx(), Vect_save_sidx(), and Vect_save_topo().

int dig_file_load ( struct gvfile file)

Load opened struct gvfile to memory.

Warning: position in file is set to the beginning.

Parameters
filepointer to struct gvfile structure
Returns
1 loaded
0 not loaded
-1 error

Definition at line 187 of file file.c.

References _, gvfile::alloc, gvfile::current, gvfile::end, gvfile::file, G_debug(), G_free(), G_fseek(), G_getenv_nofatal(), G_strcasecmp(), G_warning(), GV_MEMORY_ALWAYS, GV_MEMORY_AUTO, GV_MEMORY_NEVER, gvfile::loaded, NULL, gvfile::size, and gvfile::start.

Referenced by V1_open_old_nat().

int dig_find_area_box ( struct Plus_head Plus,
int  area,
struct bound_box box 
)

Find bounding box for given area.

Parameters
Pluspointer to Plus_head structure
areaarea id
[out]boxbounding box
Returns
> 0 bounding box for area found
0 not found

Definition at line 903 of file spindex.c.

References Plus_head::Area, Plus_head::Area_spidx, RTree_Rect::boundary, G_debug(), if(), Plus_head::Line, P_area::lines, P_topo_b::N1, Plus_head::Node, rtree_search(), RTreeSearch(), Plus_head::Spidx_new, P_line::topo, P_node::x, P_node::y, and P_node::z.

Referenced by Vect_get_area_box().

int dig_find_area_poly ( struct line_pnts ,
double *   
)

Definition at line 100 of file diglib/poly.c.

References line_pnts::n_points, x, line_pnts::x, and line_pnts::y.

Referenced by Vect_build_line_area(), and Vect_isle_find_area().

int dig_find_intersection ( double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double *  ,
double *   
)

Definition at line 185 of file linecros.c.

References D, D1, D2, and t.

int dig_find_isle_box ( struct Plus_head Plus,
int  isle,
struct bound_box box 
)

Find box for isle.

Parameters
Pluspointer to Plus_head structure
isleisle id
[out]boxbounding box
Returns
> 0 bounding box for isle found
0 not found

Definition at line 997 of file spindex.c.

References RTree_Rect::boundary, G_debug(), if(), Plus_head::Isle, Plus_head::Isle_spidx, Plus_head::Line, P_isle::lines, P_topo_b::N1, Plus_head::Node, rtree_search(), RTreeSearch(), Plus_head::Spidx_new, P_line::topo, P_node::x, P_node::y, and P_node::z.

Referenced by Vect_get_isle_box().

int dig_find_line_box ( struct Plus_head Plus,
int  line,
struct bound_box box 
)

Find box for line.

Parameters
Pluspointer to Plus_head structure
lineline id
[out]boxbounding box
Returns
> 0 bounding box for line found
0 not found

Definition at line 791 of file spindex.c.

References RTree_Rect::boundary, G_debug(), G_fatal_error(), GV_BOUNDARY, GV_LINE, GV_LINES, Plus_head::Line, Plus_head::Line_spidx, P_topo_l::N1, P_topo_b::N1, Plus_head::Node, NULL, rtree_search(), RTreeSearch(), Plus_head::Spidx_new, P_line::topo, P_line::type, P_node::x, P_node::y, and P_node::z.

Referenced by Vect_get_line_box().

int dig_find_node ( struct Plus_head Plus,
double  x,
double  y,
double  z 
)

Find one node by coordinates.

Parameters
Pluspointer to Plus_head structure
x,y,zcoordinates
Returns
number of node
0 not found

Definition at line 710 of file spindex.c.

References RTree_Rect::boundary, G_debug(), Plus_head::Node_spidx, rtree_search(), RTreeSearch(), Plus_head::Spidx_new, and x.

double dig_find_poly_orientation ( struct line_pnts )

Definition at line 139 of file diglib/poly.c.

References line_pnts::n_points, x, line_pnts::x, and line_pnts::y.

char* dig_float_point ( char *  ,
int  ,
double   
)
size_t dig_fread ( void *  ptr,
size_t  size,
size_t  nmemb,
struct gvfile file 
)

Read struct gvfile.

Parameters
[out]ptrdata buffer
sizebuffer size
nmembnumber of members
filepointer to struct gvfile structure
Returns
number of read members

Definition at line 124 of file file.c.

References gvfile::current, gvfile::end, gvfile::file, int, and gvfile::loaded.

Referenced by dig__fread_port_C(), dig__fread_port_D(), dig__fread_port_F(), dig__fread_port_I(), dig__fread_port_L(), dig__fread_port_O(), and dig__fread_port_S().

void* dig_frealloc ( void *  ,
int  ,
int  ,
int   
)

Definition at line 103 of file allocation.c.

References dig__frealloc(), G_sleep(), and NULL.

void dig_free_area ( struct P_area Area)

Free area structure.

Parameters
Areapointer to P_area struct to be freed

Definition at line 281 of file struct_alloc.c.

References P_area::alloc_isles, P_area::alloc_lines, free(), G_free(), P_area::isles, and P_area::lines.

Referenced by dig_del_area(), and dig_free_plus_areas().

void dig_free_isle ( struct P_isle Isle)

Free isle structure.

Parameters
Islepointer to P_isle struct to be freed

Definition at line 316 of file struct_alloc.c.

References P_isle::alloc_lines, G_free(), and P_isle::lines.

Referenced by dig_del_isle(), and dig_free_plus_isles().

void dig_free_line ( struct P_line Line)

Free line structure.

Parameters
pointerto P_line struct to be freed

Definition at line 174 of file struct_alloc.c.

References G_free(), and P_line::topo.

Referenced by dig_del_line(), and dig_free_plus_lines().

void dig_free_node ( struct P_node Node)

Free node structure.

Parameters
Nodepointer to P_node struct to be freed

Definition at line 48 of file struct_alloc.c.

References P_node::alloc_lines, P_node::angles, G_free(), and P_node::lines.

Referenced by dig_del_line(), and dig_free_plus_nodes().

void dig_free_plus ( struct Plus_head Plus)

Free Plus structure.

Structure is not inited and dig_init_plus() should follow.

Parameters
[in]Pluspointer to Plus_head structure

Definition at line 174 of file plus.c.

References dig_cidx_free(), dig_free_plus_areas(), dig_free_plus_isles(), dig_free_plus_lines(), dig_free_plus_nodes(), dig_spidx_free(), and G_debug().

Referenced by dig_load_plus(), Vect__open_old(), and Vect_close().

void dig_free_plus_areas ( struct Plus_head Plus)

Free Plus->Area structure.

Parameters
[in]Pluspointer to Plus_head structure

Definition at line 115 of file plus.c.

References Plus_head::alloc_areas, Plus_head::Area, dig_free_area(), G_debug(), G_free(), Plus_head::n_areas, and NULL.

Referenced by dig_free_plus(), and Vect__build_downgrade().

void dig_free_plus_isles ( struct Plus_head Plus)

Free Plus->Isle structure.

Parameters
[in]Pluspointer to Plus_head structure

Definition at line 143 of file plus.c.

References Plus_head::alloc_isles, dig_free_isle(), G_debug(), G_free(), Plus_head::Isle, Plus_head::n_isles, and NULL.

Referenced by dig_free_plus(), and Vect__build_downgrade().

void dig_free_plus_lines ( struct Plus_head Plus)
void dig_free_plus_nodes ( struct Plus_head Plus)

Free Plus->Node structure.

Parameters
[in]Pluspointer to Plus_head structure

Definition at line 51 of file plus.c.

References Plus_head::alloc_nodes, dig_free_node(), G_debug(), G_free(), Plus_head::n_nodes, Plus_head::Node, and NULL.

Referenced by dig_free_plus(), and Vect__build_downgrade().

int dig_fseek ( struct gvfile file,
off_t  offset,
int  whence 
)

Set struct gvfile position.

Start positions:

  • SEEK_SET (start)
  • SEEK_CUR (current position)
  • SEEK_END (end)
Parameters
filepointer to struct gvfile structure
offsetoffset position
whencestart position
Returns
0 OK
-1 error

Definition at line 60 of file file.c.

References gvfile::current, gvfile::file, G_fseek(), gvfile::loaded, gvfile::size, and gvfile::start.

Referenced by dig__read_head(), dig__write_head(), dig_load_plus(), dig_Rd_Plus_head(), dig_Rd_spidx_head(), dig_read_cidx(), dig_read_cidx_head(), rtree_search(), V1_delete_line_nat(), V1_restore_line_nat(), V1_rewind_nat(), and Vect_coor_info().

off_t dig_ftell ( struct gvfile file)

Get struct gvfile position.

Parameters
filepointer to struct gvfile structure
Returns
current file position

Definition at line 36 of file file.c.

References gvfile::current, gvfile::file, G_ftell(), gvfile::loaded, and gvfile::start.

Referenced by dig__write_head(), dig_Wr_Plus_head(), dig_Wr_spidx(), dig_Wr_spidx_head(), dig_write_areas(), dig_write_cidx(), dig_write_cidx_head(), dig_write_isles(), dig_write_lines(), dig_write_nodes(), V1_read_next_line_nat(), and Vect_coor_info().

size_t dig_fwrite ( const void *  ptr,
size_t  size,
size_t  nmemb,
struct gvfile file 
)

Write struct gvfile.

Parameters
ptrdata buffer
sizebuffer size
nmembnumber of members
[out]filepointer to struct gvfile structure
Returns
number of items written

Definition at line 156 of file file.c.

References _, gvfile::file, G_fatal_error(), and gvfile::loaded.

Referenced by dig__fwrite_port_C(), dig__fwrite_port_D(), dig__fwrite_port_F(), dig__fwrite_port_I(), dig__fwrite_port_L(), dig__fwrite_port_O(), and dig__fwrite_port_S().

plus_t** dig_get_cont_lines ( struct Map_info ,
plus_t  ,
double  ,
int   
)
struct dig_head* dig_get_head ( void  )
plus_t dig_get_next_cont_line ( struct Map_info ,
plus_t  ,
double  ,
int   
)
int dig_get_poly_points ( int  ,
struct line_pnts **  ,
int ,
struct line_pnts  
)

Definition at line 37 of file diglib/poly.c.

References dig_alloc_points(), line_pnts::n_points, line_pnts::x, and line_pnts::y.

int dig_head_to_map ( struct Plus_head ,
struct Map_info  
)
int dig_init_plus ( struct Plus_head Plus)

Initialize Plus_head structure.

Parameters
[in,out]Pluspointer to Plus_head structure
Returns
1

Definition at line 31 of file plus.c.

References Plus_head::built, dig_cidx_init(), dig_spidx_init(), G_debug(), G_zero(), and GV_BUILD_NONE.

Referenced by dig_load_plus(), Vect__open_old(), and Vect__open_topo_pg().

int dig_is_line_degenerate ( const struct line_pnts ,
double   
)

Definition at line 135 of file angle.c.

References line_pnts::n_points, line_pnts::x, and line_pnts::y.

int dig_isle_alloc_line ( struct P_isle isle,
int  add 
)

Allocate space in P_isle for add new lines.

Parameters
islepointer to P_area struct
addnumber of isle to be added
Returns
0 on success
-1 on error

Definition at line 468 of file struct_alloc.c.

References P_isle::alloc_lines, G_debug(), P_isle::lines, NULL, and num.

Referenced by dig_add_isle(), and dig_Rd_P_isle().

int dig_isle_get_box ( struct Plus_head ,
plus_t  ,
struct bound_box  
)
void dig_line_add_updated ( struct Plus_head Plus,
int  line,
off_t  offset 
)

Add new line to updated.

Parameters
Pluspointer to Plus_head structure
lineline id
offsetline offset (negative offset is ignored)

Definition at line 37 of file vector/diglib/update.c.

References Plus_head::alloc_uplines, G_debug(), Plus_head::n_uplines, Plus_head::uplines, Plus_head::uplines_offset, and Plus_head::uplist.

Referenced by dig_del_line().

int dig_line_degenerate ( const struct line_pnts )
plus_t dig_line_get_area ( struct Plus_head plus,
plus_t  line,
int  side 
)

Get area number on line side.

Parameters
[in]pluspointer Plus_head structure
[in]lineline id
[in]sideside id (GV_LEFT || GV_RIGHT)
Returns
area number
0 no area
-1 on error

Definition at line 334 of file plus_line.c.

References G_debug(), GV_BOUNDARY, GV_LEFT, GV_RIGHT, if(), P_topo_b::left, Plus_head::Line, P_topo_b::right, P_line::topo, and P_line::type.

Referenced by Vect_build_line_area().

void dig_line_reset_updated ( struct Plus_head Plus)

Reset number of updated lines.

Parameters
Pluspointer to Plus_head structure

Definition at line 25 of file vector/diglib/update.c.

References Plus_head::n_uplines, and Plus_head::uplist.

Referenced by Vect_reset_updated().

int dig_line_set_area ( struct Plus_head plus,
plus_t  line,
int  side,
plus_t  area 
)

Set area number on line side.

Parameters
[in]pluspointer Plus_head structure
[in]lineline id
[in]sideside id (GV_LEFT || GV_RIGHT)
[in]areaarea id
Returns
1

Definition at line 375 of file plus_line.c.

References GV_BOUNDARY, GV_LEFT, GV_RIGHT, if(), P_topo_b::left, Plus_head::Line, P_topo_b::right, P_line::topo, and P_line::type.

int dig_load_plus ( struct Plus_head Plus,
struct gvfile plus,
int  head_only 
)
int dig_map_to_head ( struct Map_info ,
struct Plus_head  
)
int dig_node_add_line ( struct Plus_head plus,
int  nodeid,
int  lineid,
const struct line_pnts points,
int  type 
)

Add line info to node.

Line will be negative if END node

'node' must of course already exist space will be alloced to add 'line' to array

Lines are sorted in increasing angle order and degenerated lines are set to -9 (ignored).

Parameters
[in]pluspointer to Plus_head structure
[in]nodeidnode id
[in]lineidline id
[in]pointsline geometry
[in]typeline type
Returns
-1 on error
0 line not added (degenerate)
new number of lines in node

Definition at line 45 of file plus_node.c.

References P_node::angles, dig_calc_begin_angle(), dig_calc_end_angle(), dig_node_alloc_line(), G_debug(), GV_LINES, P_node::lines, P_node::n_lines, and Plus_head::Node.

void dig_node_add_updated ( struct Plus_head Plus,
int  node 
)

Add node to updated.

Parameters
Pluspointer to Plus_head structure
nodenode id

Definition at line 87 of file vector/diglib/update.c.

References Plus_head::alloc_upnodes, G_debug(), Plus_head::n_upnodes, Plus_head::uplist, and Plus_head::upnodes.

Referenced by dig_del_line().

int dig_node_alloc_line ( struct P_node node,
int  add 
)

Allocate space in P_node struct.

Lines and angles arrays to add 'add' more lines

Parameters
nodepointer to P_node struct
addnumber lines to be added
Returns
0 on success
-1 on error

Definition at line 69 of file struct_alloc.c.

References P_node::alloc_lines, P_node::angles, G_debug(), P_node::lines, P_node::n_lines, NULL, and num.

Referenced by dig_node_add_line(), and dig_Rd_P_node().

int dig_node_angle_check ( struct Plus_head plus,
plus_t  line,
int  type 
)

Checks if angles of adjacent lines differ.

Negative line number for end point. Assume that lines are sorted in increasing angle order and angles of points and degenerated lines are set to 9 (ignored).

Parameters
[in]pluspointer to Plus_head structure
[in]linecurrent line id, negative if request for node 2
[in]typeline type (GV_LINE, GV_BOUNDARY or both)
Returns
1 angles differ
0 angle of a line up or down is identical

Definition at line 600 of file plus_area.c.

References dig_angle_next_line(), dig_node_line_angle(), G_debug(), GV_BOUNDARY, GV_LEFT, GV_LINE, GV_LINES, GV_RIGHT, Plus_head::Line, P_topo_l::N1, P_topo_b::N1, P_topo_l::N2, P_topo_b::N2, P_line::topo, and P_line::type.

Referenced by dig_build_area_with_line().

float dig_node_line_angle ( struct Plus_head plus,
int  nodeid,
int  lineid 
)

Return line angle.

Lines is specified by line id in topology, NOT by order number. Negative id if looking for line end point.

Parameters
[in]pluspointer to Plus_head structure
[in]nodeidnode id
[in]lineidline id
Returns
line angle <-PI,PI>
0 not reached

Definition at line 199 of file plus_node.c.

References _, P_node::angles, G_debug(), G_fatal_error(), P_node::lines, P_node::n_lines, and Plus_head::Node.

Referenced by dig_build_area_with_line(), and dig_node_angle_check().

void dig_node_reset_updated ( struct Plus_head Plus)

Reset number of updated nodes.

Parameters
Pluspointer to Plus_head structure

Definition at line 76 of file vector/diglib/update.c.

References Plus_head::n_upnodes, and Plus_head::uplist.

Referenced by Vect_reset_updated().

int dig_out_of_memory ( void  )

For now just print message and return error code.

Definition at line 489 of file struct_alloc.c.

References _, and G_warning().

Referenced by dig_alloc_cats(), dig_alloc_points(), and dig_build_area_with_line().

int dig_point_by_line ( struct Map_info ,
double  ,
double  ,
double  ,
double  ,
char   
)
int dig_point_to_area ( struct Map_info ,
double  ,
double   
)
int dig_point_to_line ( struct Map_info ,
double  ,
double  ,
char   
)
int dig_point_to_next_area ( struct Map_info ,
double  ,
double  ,
double *   
)
int dig_prune ( struct line_pnts ,
double   
)

Definition at line 74 of file prune.c.

References cur_x, cur_y, line_pnts::n_points, t, line_pnts::x, and line_pnts::y.

Referenced by Vect_line_prune_thresh().

int dig_Rd_P_isle ( struct Plus_head ,
int  i,
struct gvfile  
)
int dig_Rd_spidx ( struct gvfile fp,
struct Plus_head Plus 
)

Read spatial index from sidx file Only needed when old vector is opened in update mode.

Parameters
fppointer to struct gvfile
[in,out]Pluspointer to Plus_head structure
Returns
0

Definition at line 1228 of file spindex_rw.c.

References Plus_head::Area_spidx, Plus_head::Area_spidx_offset, dig_Rd_spidx_head(), dig_rewind(), dig_set_cur_port(), dig_spidx_free(), dig_spidx_init(), G_debug(), Plus_head::Isle_spidx, Plus_head::Isle_spidx_offset, Plus_head::Line_spidx, Plus_head::Line_spidx_offset, Plus_head::Node_spidx, Plus_head::Node_spidx_offset, Port_info::off_t_size, and Plus_head::spidx_port.

Referenced by Vect_open_sidx().

int dig_read_cidx ( struct gvfile fp,
struct Plus_head plus,
int  head_only 
)

Read spatial index file.

Parameters
fppointer to gvfile structure
[in,out]pluspointer to Plus_head structure
head_onlynon-zero to read only head
Returns
0 OK
1 error

Definition at line 291 of file cindex_rw.c.

References Cat_index::a_cats, Cat_index::cat, Plus_head::cidx, Plus_head::cidx_port, Plus_head::cidx_up_to_date, dig__fread_port_I(), dig_cidx_free(), dig_cidx_init(), dig_fseek(), dig_read_cidx_head(), dig_rewind(), dig_set_cur_port(), dig_type_from_store(), G_debug(), Cat_index::n_cats, Plus_head::n_cidx, and Cat_index::offset.

Referenced by Vect_cidx_open().

int dig_read_frmt_ascii ( FILE *  dascii,
struct Format_info finfo 
)
int dig_read_head_ascii ( FILE *  ,
struct dig_head  
)
int dig_restore_line ( struct Plus_head plus,
int  lineid,
int  type,
const struct line_pnts Points,
const struct bound_box box,
off_t  offset 
)

Restore line in Plus_head structure.

Parameters
[in,out]pluspointer to Plus_head structure
typefeature type
Pointsline geometry
boxbounding box
offsetline offset
Returns
-1 on error
line id

Definition at line 191 of file plus_line.c.

References Plus_head::n_lines.

Referenced by V2__add_line_to_topo_nat().

void dig_rewind ( struct gvfile file)
int dig_rmcr ( char *  )
int dig_select_areas ( struct Plus_head Plus,
const struct bound_box box,
struct boxlist list 
)

Select areas with boxes by box.

Parameters
Pluspointer to Plus_head structure
boxbounding box
listboxlist of selected areas
Returns
number of selected areas

Definition at line 862 of file spindex.c.

References Plus_head::Area_spidx, bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), bound_box::N, boxlist::n_values, rtree_search(), RTreeSearch(), bound_box::S, Plus_head::Spidx_new, bound_box::T, and bound_box::W.

Referenced by Vect_select_areas_by_box().

int dig_select_isles ( struct Plus_head Plus,
const struct bound_box box,
struct boxlist list 
)

Select isles with boxes by box.

Parameters
Pluspointer to Plus_head structure
boxbounding box
listboxlist of selected isles
Returns
number of selected isles

Definition at line 956 of file spindex.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), Plus_head::Isle_spidx, bound_box::N, boxlist::n_values, rtree_search(), RTreeSearch(), bound_box::S, Plus_head::Spidx_new, bound_box::T, and bound_box::W.

Referenced by Vect_select_isles_by_box().

int dig_select_lines ( struct Plus_head Plus,
const struct bound_box box,
struct boxlist list 
)

Select lines with boxes by box.

Parameters
Pluspointer to Plus_head structure
boxbounding box
listboxlist of selected lines
Returns
number of selected lines
0 not found

Definition at line 750 of file spindex.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), Plus_head::Line_spidx, bound_box::N, boxlist::n_values, rtree_search(), RTreeSearch(), bound_box::S, Plus_head::Spidx_new, bound_box::T, and bound_box::W.

Referenced by Vect_select_lines_by_box().

int dig_select_nodes ( struct Plus_head Plus,
const struct bound_box box,
struct ilist list 
)

Select nodes by bbox.

Parameters
Pluspointer to Plus_head structure
boxbounding box
listlist of selected lines
Returns
number of selected nodes
-1 on error

Definition at line 663 of file spindex.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), bound_box::N, ilist::n_values, Plus_head::Node_spidx, rtree_search(), RTreeSearch(), bound_box::S, Plus_head::Spidx_new, bound_box::T, and bound_box::W.

Referenced by Vect_select_nodes_by_box().

int dig_set_distance_to_line_tolerance ( double  )

Definition at line 24 of file vector/diglib/line_dist.c.

References t, and TOLERANCE.

int dig_spidx_add_area ( struct Plus_head Plus,
int  area,
const struct bound_box box 
)

Add new area to spatial index.

Parameters
Pluspointer to Plus_head structure
areaarea id
boxbounding box
Returns
0

Definition at line 353 of file spindex.c.

References Plus_head::Area_spidx, bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), bound_box::N, RTreeInsertRect(), bound_box::S, bound_box::T, and bound_box::W.

Referenced by dig_add_area().

int dig_spidx_add_isle ( struct Plus_head Plus,
int  isle,
const struct bound_box box 
)

Add new island to spatial index.

Parameters
Pluspointer to Plus_head structure
isleisle id
boxbounding box
Returns
0

Definition at line 388 of file spindex.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), Plus_head::Isle_spidx, bound_box::N, RTreeInsertRect(), bound_box::S, bound_box::T, and bound_box::W.

Referenced by dig_add_isle().

int dig_spidx_add_line ( struct Plus_head Plus,
int  line,
const struct bound_box box 
)

Add new line to spatial index.

Parameters
Pluspointer to Plus_head structure
lineline id
boxbounding box
Returns
0

Definition at line 319 of file spindex.c.

References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), Plus_head::Line_spidx, bound_box::N, RTreeInsertRect(), bound_box::S, bound_box::T, and bound_box::W.

int dig_spidx_add_node ( struct Plus_head Plus,
int  node,
double  x,
double  y,
double  z 
)

Add new node to spatial index.

Parameters
Pluspointer to Plus_head structure
nodenode id
x,y,znode coordinates
Returns
1 OK
0 on error

Definition at line 284 of file spindex.c.

References RTree_Rect::boundary, G_debug(), Plus_head::Node_spidx, RTreeInsertRect(), and x.

Referenced by dig_add_node().

int dig_spidx_del_area ( struct Plus_head Plus,
int  area 
)

Delete area from spatial index.

G_fatal_error() called on error.

Parameters
Pluspointer to Plus_head structure
areaarea id
Returns
0

Definition at line 508 of file spindex.c.

References _, Plus_head::Area, Plus_head::Area_spidx, RTree_Rect::boundary, G_debug(), G_fatal_error(), Plus_head::Line, P_area::lines, P_topo_b::N1, Plus_head::Node, NULL, RTreeDeleteRect(), P_line::topo, P_node::x, P_node::y, and P_node::z.

Referenced by dig_del_area().

int dig_spidx_del_isle ( struct Plus_head Plus,
int  isle 
)

Delete isle from spatial index.

G_fatal_error() called on error.

Parameters
Pluspointer to Plus_head structure
isleisle id
Returns
0

Definition at line 561 of file spindex.c.

References _, RTree_Rect::boundary, G_debug(), G_fatal_error(), Plus_head::Isle, Plus_head::Isle_spidx, Plus_head::Line, P_isle::lines, P_topo_b::N1, Plus_head::Node, RTreeDeleteRect(), P_line::topo, P_node::x, P_node::y, and P_node::z.

Referenced by dig_del_isle().

int dig_spidx_del_line ( struct Plus_head Plus,
int  line,
double  x,
double  y,
double  z 
)

Delete line from spatial index.

G_fatal_error() called on error.

Parameters
Pluspointer to Plus_head structure
lineline id
x,y,zcoordinates
Returns
0

Definition at line 466 of file spindex.c.

References _, RTree_Rect::boundary, G_debug(), G_fatal_error(), Plus_head::Line_spidx, RTreeDeleteRect(), and x.

Referenced by dig_del_line().

int dig_spidx_del_node ( struct Plus_head Plus,
int  node 
)

Delete node from spatial index.

G_fatal_error() called on error.

Parameters
Pluspointer to Plus_head structure
nodenode id
Returns
0

Definition at line 423 of file spindex.c.

References _, RTree_Rect::boundary, G_debug(), G_fatal_error(), Plus_head::Node, Plus_head::Node_spidx, RTreeDeleteRect(), P_node::x, P_node::y, and P_node::z.

Referenced by dig_del_line().

void dig_spidx_free ( struct Plus_head Plus)

Free spatial index (nodes, lines, areas, isles)

Parameters
Pluspointer to Plus_head structure

Definition at line 235 of file spindex.c.

References Plus_head::Area_spidx, close(), RTree::fd, Plus_head::Isle_spidx, Plus_head::Line_spidx, Plus_head::Node_spidx, RTreeDestroyTree(), and Plus_head::Spidx_new.

Referenced by dig_free_plus(), dig_Rd_spidx(), and Vect_open_sidx().

void dig_spidx_free_areas ( struct Plus_head Plus)

Reset spatial index for areas.

Parameters
Pluspointer to Plus_head structure

Definition at line 171 of file spindex.c.

References Plus_head::Area_spidx, close(), fd, RTree::fd, G_tempfile(), RTreeCreateTree(), RTreeDestroyTree(), Plus_head::Spidx_new, and Plus_head::with_z.

Referenced by Vect__build_downgrade().

void dig_spidx_free_isles ( struct Plus_head Plus)

Reset spatial index for isles.

Parameters
Pluspointer to Plus_head structure

Definition at line 203 of file spindex.c.

References close(), fd, RTree::fd, G_tempfile(), Plus_head::Isle_spidx, RTreeCreateTree(), RTreeDestroyTree(), Plus_head::Spidx_new, and Plus_head::with_z.

Referenced by Vect__build_downgrade().

void dig_spidx_free_lines ( struct Plus_head Plus)

Free spatial index for lines.

Parameters
Pluspointer to Plus_head structure

Definition at line 139 of file spindex.c.

References close(), fd, RTree::fd, G_tempfile(), Plus_head::Line_spidx, RTreeCreateTree(), RTreeDestroyTree(), Plus_head::Spidx_new, and Plus_head::with_z.

Referenced by Vect__build_downgrade().

void dig_spidx_free_nodes ( struct Plus_head Plus)

Free spatial index for nodes.

Parameters
Pluspointer to Plus_head structure

Definition at line 107 of file spindex.c.

References close(), fd, RTree::fd, G_tempfile(), Plus_head::Node_spidx, RTreeCreateTree(), RTreeDestroyTree(), Plus_head::Spidx_new, and Plus_head::with_z.

Referenced by Vect__build_downgrade().

int dig_spindex_init ( struct Plus_head )
int dig_start_clock ( long *  )
int dig_stop_clock ( long *  )
char* dig_stop_clock_str ( long *  )
int dig_struct_copy ( void *  ,
void *  ,
int   
)
int dig_test_for_intersection ( double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double  ,
double   
)

Definition at line 58 of file linecros.c.

References D, D1, D2, and t.

int dig_type_from_store ( int  stype)
int dig_type_to_store ( int  type)

Convert type to store type.

Parameters
typefeature type
Returns
store type

Definition at line 26 of file vector/diglib/type.c.

References GV_AREA, GV_BOUNDARY, GV_CENTROID, GV_FACE, GV_KERNEL, GV_LINE, GV_POINT, GV_STORE_AREA, GV_STORE_BOUNDARY, GV_STORE_CENTROID, GV_STORE_FACE, GV_STORE_KERNEL, GV_STORE_LINE, GV_STORE_POINT, GV_STORE_VOLUME, and GV_VOLUME.

Referenced by dig_Wr_P_line(), dig_write_cidx(), and dig_write_cidx_head().

double dig_unit_conversion ( void  )
int dig_which_node ( struct Plus_head plus,
double  x,
double  y,
double  thresh 
)

Return actual index into node arrays of the first set of matching coordinates.

Parameters
[in]pluspointer to Plus_head structure
[in]x,ycoordinates
[in]threshthreshold value
Returns
node index
-1 if no node found

Definition at line 147 of file plus_node.c.

References Plus_head::n_nodes, Plus_head::Node, NULL, P_node::x, and P_node::y.

int dig_Wr_P_area ( struct Plus_head ,
int  i,
struct gvfile  
)
int dig_Wr_P_isle ( struct Plus_head ,
int  i,
struct gvfile  
)
int dig_Wr_spidx ( struct gvfile fp,
struct Plus_head Plus 
)
int dig_write_areas ( struct gvfile plus,
struct Plus_head Plus 
)

Writes topo structure (areas) to topo file.

Parameters
[in,out]plustopo file
[in]Pluspointer to Plus_head structure
Returns
0 on success
-1 on error

Definition at line 371 of file plus.c.

References Plus_head::Area_offset, dig_ftell(), dig_Wr_P_area(), and Plus_head::n_areas.

Referenced by dig_write_plus_file().

int dig_write_file_checks ( struct gvfile ,
struct Plus_head  
)
int dig_write_frmt_ascii ( FILE *  ,
struct Format_info ,
int   
)

Definition at line 157 of file frmt.c.

References G_debug(), and G_fatal_error().

int dig_write_head_ascii ( FILE *  ,
struct dig_head  
)
int dig_write_isles ( struct gvfile plus,
struct Plus_head Plus 
)

Writes topo structure (isles) to topo file.

Parameters
[in,out]plustopo file
[in]Pluspointer to Plus_head structure
Returns
0 on success
-1 on error

Definition at line 396 of file plus.c.

References dig_ftell(), dig_Wr_P_isle(), Plus_head::Isle_offset, and Plus_head::n_isles.

Referenced by dig_write_plus_file().

int dig_write_lines ( struct gvfile plus,
struct Plus_head Plus 
)

Writes topo structure (lines) to topo file.

Parameters
[in,out]plustopo file
[in]Pluspointer to Plus_head structure
Returns
0 on success
-1 on error

Definition at line 346 of file plus.c.

References dig_ftell(), dig_Wr_P_line(), Plus_head::Line_offset, and Plus_head::n_lines.

Referenced by dig_write_plus_file().

int dig_write_nodes ( struct gvfile plus,
struct Plus_head Plus 
)

Writes topo structure (nodes) to topo file.

Parameters
[in,out]plustopo file
[in]Pluspointer to Plus_head structure
Returns
0 on success
-1 on error

Definition at line 322 of file plus.c.

References dig_ftell(), dig_Wr_P_node(), Plus_head::n_nodes, and Plus_head::Node_offset.

Referenced by dig_write_plus_file().

int dig_write_plus_file ( struct gvfile fp_plus,
struct Plus_head Plus 
)

Writes topo structure to topo file.

Parameters
[in,out]fp_plustopo file
[in]Pluspointer to Plus_head structure
Returns
0 on success
-1 on error

Definition at line 272 of file plus.c.

References _, dig_fflush(), dig_rewind(), dig_set_cur_port(), dig_Wr_Plus_head(), dig_write_areas(), dig_write_isles(), dig_write_lines(), dig_write_nodes(), G_warning(), and Plus_head::port.

Referenced by Vect_save_topo().

double dig_x_intersect ( double  ,
double  ,
double  ,
double  ,
double   
)

Definition at line 21 of file inside.c.

References b.

int rtree_search ( struct RTree t,
struct RTree_Rect r,
SearchHitCallback  shcb,
void *  cbarg,
struct Plus_head Plus 
)

Search spatial index file Can't use regular RTreeSearch() here because sidx must be read with dig__fread_port_*() functions.

Parameters
tpointer to RTree
rsearch rectangle
shcbuser-provided callback
cbargargument for shcb
Pluspointer to Plus_head structure
Returns
number of qualifying rectangles

Definition at line 1396 of file spindex_rw.c.

References dig__fread_port_D(), dig__fread_port_I(), dig__fread_port_O(), dig_fseek(), dig_set_cur_port(), int, RTree::leafcard, RTree::nodecard, NUMSIDES, Port_info::off_t_size, RTree::rootlevel, RTree::rootpos, RTreeOverlap(), Plus_head::spidx_fp, and Plus_head::spidx_port.

Referenced by dig_find_area_box(), dig_find_isle_box(), dig_find_line_box(), dig_find_node(), dig_select_areas(), dig_select_isles(), dig_select_lines(), and dig_select_nodes().