GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-bea8435a9e
|
Go to the source code of this file.
Functions | |
struct line_pnts * | Vect_new_line_struct (void) |
Creates and initializes a line_pnts structure. More... | |
int | Vect_append_point (struct line_pnts *, double, double, double) |
Appends one point to the end of a line. More... | |
int | Vect_append_points (struct line_pnts *, const struct line_pnts *, int) |
Appends points to the end of a line. More... | |
int | Vect_line_insert_point (struct line_pnts *, int, double, double, double) |
Insert new point at index position and move all old points at that position and above up. More... | |
int | Vect_line_delete_point (struct line_pnts *, int) |
Delete point at given index and move all points above down. More... | |
int | Vect_line_get_point (const struct line_pnts *, int, double *, double *, double *) |
Get line point of given index. More... | |
int | Vect_get_num_line_points (const struct line_pnts *) |
Get number of line points. More... | |
int | Vect_line_prune (struct line_pnts *) |
Remove duplicate points, i.e. zero length segments. More... | |
int | Vect_line_prune_thresh (struct line_pnts *, double) |
Remove points in threshold. More... | |
void | Vect_line_reverse (struct line_pnts *) |
Reverse the order of vertices. More... | |
int | Vect_copy_xyz_to_pnts (struct line_pnts *, const double *, const double *, const double *, int) |
Copy points from array to line_pnts structure. More... | |
int | Vect_copy_pnts_to_xyz (const struct line_pnts *, double *, double *, double *, int *) |
Copy points from line structure to array. More... | |
void | Vect_reset_line (struct line_pnts *) |
Reset line. More... | |
void | Vect_destroy_line_struct (struct line_pnts *) |
Frees all memory associated with a line_pnts structure, including the structure itself. More... | |
int | Vect_point_on_line (const struct line_pnts *, double, double *, double *, double *, double *, double *) |
Find point on line in the specified distance. More... | |
int | Vect_line_segment (const struct line_pnts *, double, double, struct line_pnts *) |
Create line segment. More... | |
double | Vect_line_length (const struct line_pnts *) |
Calculate line length, 3D-length in case of 3D vector line. More... | |
double | Vect_line_geodesic_length (const struct line_pnts *) |
Calculate line length. More... | |
int | Vect_line_distance (const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *) |
Calculate distance of point to line. More... | |
int | Vect_line_geodesic_distance (const struct line_pnts *, double, double, double, int, double *, double *, double *, double *, double *, double *) |
Calculate geodesic distance of point to line in meters. More... | |
void | Vect_line_box (const struct line_pnts *, struct bound_box *) |
Get bounding box of line. More... | |
void | Vect_line_parallel (struct line_pnts *, double, double, int, struct line_pnts *) |
Create parallel line. More... | |
void | Vect_line_parallel2 (struct line_pnts *, double, double, double, int, int, double, struct line_pnts *) |
void | Vect_line_buffer (const struct line_pnts *, double, double, struct line_pnts *) |
Create buffer around the line line. More... | |
void | Vect_line_buffer2 (const struct line_pnts *, double, double, double, int, int, double, struct line_pnts **, struct line_pnts ***, int *) |
Creates buffer around line. More... | |
void | Vect_area_buffer2 (struct Map_info *, int, double, double, double, int, int, double, struct line_pnts **, struct line_pnts ***, int *) |
Creates buffer around area. More... | |
void | Vect_point_buffer2 (double, double, double, double, double, int, double, struct line_pnts **) |
Creates buffer around the point (px, py). More... | |
struct line_cats * | Vect_new_cats_struct (void) |
Creates and initializes line_cats structure. More... | |
int | Vect_cat_set (struct line_cats *, int, int) |
Add new field/cat to category structure if doesn't exist yet. More... | |
int | Vect_cat_get (const struct line_cats *, int, int *) |
Get first found category of given field. More... | |
int | Vect_cat_del (struct line_cats *, int) |
Delete all categories of given layer. More... | |
int | Vect_field_cat_del (struct line_cats *, int, int) |
Delete field/cat from line_cats structure. More... | |
int | Vect_field_cat_get (const struct line_cats *, int, struct ilist *) |
Get list of categories of given field. More... | |
int | Vect_cat_in_array (int, const int *, int) |
Check if category is in ordered array of integers. More... | |
int | Vect_reset_cats (struct line_cats *) |
Reset category structure to make sure cats structure is clean to be re-used. More... | |
void | Vect_destroy_cats_struct (struct line_cats *) |
Frees all memory associated with line_cats structure, including the struct itself. More... | |
int | Vect_get_area_cats (struct Map_info *, int, struct line_cats *) |
Get area categories. More... | |
int | Vect_get_area_cat (struct Map_info *, int, int) |
Find FIRST category of given field and area. More... | |
int | Vect_get_line_cat (struct Map_info *, int, int) |
Fetches FIRST category number for given vector line and field. More... | |
struct cat_list * | Vect_cats_set_constraint (struct Map_info *, int, char *, char *) |
Set category constraints using 'where' or 'cats' option and layer number. More... | |
int | Vect_cats_in_constraint (struct line_cats *, int, struct cat_list *) |
Check if categories match with category constraints. More... | |
struct cat_list * | Vect_new_cat_list (void) |
Allocate memory for cat_list structure. More... | |
int | Vect_str_to_cat_list (const char *, struct cat_list *) |
Converts string of categories and cat ranges separated by commas to cat_list. More... | |
int | Vect_array_to_cat_list (const int *, int, struct cat_list *) |
Convert ordered array of integers to cat_list structure. More... | |
int | Vect_cat_list_to_array (const struct cat_list *, int **, int *) |
Convert cat_list struct to ordered array of unique integers. More... | |
int | Vect_cat_in_cat_list (int, const struct cat_list *) |
Check if category number is in list. More... | |
void | Vect_destroy_cat_list (struct cat_list *) |
Frees allocated cat_list memory. More... | |
struct varray * | Vect_new_varray (int) |
Create new struct varray and allocate space for given number of items. More... | |
int | Vect_set_varray_from_cat_string (struct Map_info *, int, const char *, int, int, struct varray *) |
Set values in 'varray' to 'value' from category string. More... | |
int | Vect_set_varray_from_cat_list (struct Map_info *, int, struct cat_list *, int, int, struct varray *) |
Set values in 'varray' to 'value' from category list. More... | |
int | Vect_set_varray_from_db (struct Map_info *, int, const char *, int, int, struct varray *) |
Set values in 'varray' to 'value' from DB (where statement) More... | |
struct dblinks * | Vect_new_dblinks_struct (void) |
Create and init new dblinks structure. More... | |
void | Vect_reset_dblinks (struct dblinks *) |
Reset dblinks structure (number of fields) More... | |
int | Vect_add_dblink (struct dblinks *, int, const char *, const char *, const char *, const char *, const char *) |
Add new DB connection to dblinks structure. More... | |
int | Vect_check_dblink (const struct dblinks *, int, const char *) |
Check if DB connection exists in dblinks structure. More... | |
int | Vect_map_add_dblink (struct Map_info *, int, const char *, const char *, const char *, const char *, const char *) |
Add new db connection to Map_info structure. More... | |
int | Vect_map_del_dblink (struct Map_info *, int) |
Delete db connection from Map_info structure. More... | |
void | Vect_copy_map_dblinks (struct Map_info *, struct Map_info *, int) |
Copy DB links from input vector map to output vector map. More... | |
int | Vect_map_check_dblink (struct Map_info *, int, const char *) |
Check if DB connection exists in dblinks structure. More... | |
int | Vect_read_dblinks (struct Map_info *) |
Read dblinks to existing structure. More... | |
int | Vect_write_dblinks (struct Map_info *) |
Write dblinks to file. More... | |
struct field_info * | Vect_default_field_info (struct Map_info *, int, const char *, int) |
Get default information about link to database for new dblink. More... | |
struct field_info * | Vect_get_dblink (struct Map_info *, int) |
Get information about link to database. More... | |
struct field_info * | Vect_get_field (struct Map_info *, int) |
Get information about link to database (by layer number) More... | |
struct field_info * | Vect_get_field_by_name (struct Map_info *, const char *) |
Get information about link to database (by layer name) More... | |
struct field_info * | Vect_get_field2 (struct Map_info *, const char *) |
Get information about link to database (by layer number or layer name) More... | |
int | Vect_get_field_number (struct Map_info *, const char *) |
Get field number of given field. More... | |
void | Vect_set_db_updated (struct Map_info *) |
Rewrite 'dbln' file. More... | |
const char * | Vect_get_column_names (struct Map_info *, int) |
Fetches list of DB column names of vector map attribute table. More... | |
const char * | Vect_get_column_types (struct Map_info *, int) |
Fetches list of DB column types of vector map attribute table. More... | |
const char * | Vect_get_column_names_types (struct Map_info *, int) |
Fetches list of DB column names and types of vector map attribute table. More... | |
void | Vect_destroy_field_info (struct field_info *) |
Free a struct field_info and all memory associated with it. More... | |
struct ilist * | Vect_new_list (void) |
Creates and initializes a struct ilist. More... | |
int | Vect_list_append (struct ilist *, int) |
Append new item to the end of list if not yet present. More... | |
int | Vect_list_append_list (struct ilist *, const struct ilist *) |
Append new items to the end of list if not yet present. More... | |
int | Vect_list_delete (struct ilist *, int) |
Remove a given value (item) from list. More... | |
int | Vect_list_delete_list (struct ilist *, const struct ilist *) |
Delete list from existing list. More... | |
int | Vect_val_in_list (const struct ilist *, int) |
Find a given item in the list. More... | |
int | Vect_reset_list (struct ilist *) |
Reset ilist structure. More... | |
void | Vect_destroy_list (struct ilist *) |
Frees all memory associated with a struct ilist, including the struct itself. More... | |
struct boxlist * | Vect_new_boxlist (int) |
Creates and initializes a struct boxlist. More... | |
int | Vect_boxlist_append (struct boxlist *, int, const struct bound_box *) |
Append new item to the end of list if not yet present. More... | |
int | Vect_boxlist_append_boxlist (struct boxlist *, const struct boxlist *) |
Append new items to the end of list if not yet present. More... | |
int | Vect_boxlist_delete (struct boxlist *, int) |
Remove a given value (item) from list. More... | |
int | Vect_boxlist_delete_boxlist (struct boxlist *, const struct boxlist *) |
Delete list from existing list. More... | |
int | Vect_val_in_boxlist (const struct boxlist *, int) |
Find a given item in the list. More... | |
int | Vect_reset_boxlist (struct boxlist *) |
Reset boxlist structure. More... | |
void | Vect_destroy_boxlist (struct boxlist *) |
Frees all memory associated with a struct boxlist, including the struct itself. More... | |
int | Vect_point_in_box (double, double, double, const struct bound_box *) |
Tests if point is in 3D box. More... | |
int | Vect_point_in_box_2d (double, double, const struct bound_box *) |
Tests if point is in 2D box. More... | |
int | Vect_box_overlap (const struct bound_box *, const struct bound_box *) |
Tests for overlap of two boxes. More... | |
int | Vect_box_copy (struct bound_box *, const struct bound_box *) |
Copy box B to box A. More... | |
int | Vect_box_extend (struct bound_box *, const struct bound_box *) |
Extend box A by box B. More... | |
int | Vect_box_clip (double *, double *, double *, double *, const struct bound_box *) |
Clip coordinates to box, if necessary, lines extending outside of a box. More... | |
int | Vect_region_box (const struct Cell_head *, struct bound_box *) |
Copy region window to bounding box. More... | |
int | Vect_cidx_get_num_fields (struct Map_info *) |
Get number of layers in category index. More... | |
int | Vect_cidx_get_field_number (struct Map_info *, int) |
Get layer number for given index. More... | |
int | Vect_cidx_get_field_index (struct Map_info *, int) |
Get layer index for given layer number. More... | |
int | Vect_cidx_get_num_unique_cats_by_index (struct Map_info *, int) |
Get number of unique categories for given layer index. More... | |
int | Vect_cidx_get_num_cats_by_index (struct Map_info *, int) |
Get number of categories for given layer index. More... | |
int | Vect_cidx_get_num_types_by_index (struct Map_info *, int) |
Get number of feature types for given layer index. More... | |
int | Vect_cidx_get_type_count_by_index (struct Map_info *, int, int, int *, int *) |
Get count of feature types for given field and type index. More... | |
int | Vect_cidx_get_type_count (struct Map_info *, int, int) |
Get count of features of certain type by layer and type. More... | |
int | Vect_cidx_get_cat_by_index (struct Map_info *, int, int, int *, int *, int *) |
Get category, feature type and id for given layer and category index. More... | |
int | Vect_cidx_get_unique_cats_by_index (struct Map_info *, int, struct ilist *) |
Get list of unique categories for given layer index. More... | |
int | Vect_cidx_find_next (struct Map_info *, int, int, int, int, int *, int *) |
Find next line/area id for given category, start_index and type_mask. More... | |
void | Vect_cidx_find_all (struct Map_info *, int, int, int, struct ilist *) |
Find all line/area id's for given category. More... | |
int | Vect_cidx_dump (struct Map_info *, FILE *) |
Write (dump) category index in text form to file. More... | |
int | Vect_cidx_save (struct Map_info *) |
Save category index to binary file (cidx) More... | |
int | Vect_cidx_open (struct Map_info *, int) |
Read category index from cidx file if exists. More... | |
struct Map_info * | Vect_new_map_struct (void) |
Creates and initializes Map_info structure. More... | |
void | Vect_destroy_map_struct (struct Map_info *) |
Frees all memory associated with a Map_info structure, including the structure itself. More... | |
int | Vect_read_header (struct Map_info *) |
Read vector map header from map head file. More... | |
int | Vect_write_header (struct Map_info *) |
Write vector map header to map head file. More... | |
const char * | Vect_get_name (struct Map_info *) |
Get name of vector map. More... | |
const char * | Vect_get_mapset (struct Map_info *) |
Get name of mapset where vector map lives. More... | |
const char * | Vect_get_full_name (struct Map_info *) |
Get fully qualified name of vector map. More... | |
const char * | Vect_get_finfo_dsn_name (struct Map_info *) |
Get datasource name (relevant only for non-native formats) More... | |
char * | Vect_get_finfo_layer_name (struct Map_info *) |
Get layer name (relevant only for non-native formats) More... | |
const char * | Vect_get_finfo_format_info (struct Map_info *) |
Get format info as string (relevant only for non-native formats) More... | |
const char * | Vect_get_finfo_geometry_type (struct Map_info *) |
Get geometry type as string (relevant only for non-native formats) More... | |
const struct Format_info * | Vect_get_finfo (struct Map_info *) |
Get header info for non-native formats. More... | |
int | Vect_get_finfo_topology_info (struct Map_info *, char **, char **, int *) |
Get topology type (relevant only for non-native formats) More... | |
int | Vect_is_3d (struct Map_info *) |
Check if vector map is 3D. More... | |
int | Vect_set_organization (struct Map_info *, const char *) |
Set organization string in map header. More... | |
const char * | Vect_get_organization (struct Map_info *) |
Get organization string from map header. More... | |
int | Vect_set_date (struct Map_info *, const char *) |
Set date of digitization in map header. More... | |
const char * | Vect_get_date (struct Map_info *) |
Get date of digitization from map header. More... | |
int | Vect_set_person (struct Map_info *, const char *) |
Set name of user who digitized the map in map header. More... | |
const char * | Vect_get_person (struct Map_info *) |
Get user name string who digitized the map from map header. More... | |
int | Vect_set_map_name (struct Map_info *, const char *) |
Set map name in map header. More... | |
const char * | Vect_get_map_name (struct Map_info *) |
Get map name from map header. More... | |
int | Vect_set_map_date (struct Map_info *, const char *) |
Set date when the source map was originally produced in map header. More... | |
const char * | Vect_get_map_date (struct Map_info *) |
Get date when the source map was originally produced from map header. More... | |
int | Vect_set_comment (struct Map_info *, const char *) |
Set comment or other info string in map header. More... | |
const char * | Vect_get_comment (struct Map_info *) |
Get comment or other info string from map header. More... | |
int | Vect_set_scale (struct Map_info *, int) |
Set map scale in map header. More... | |
int | Vect_get_scale (struct Map_info *) |
Get map scale from map header. More... | |
int | Vect_set_zone (struct Map_info *, int) |
Set projection zone in map header. More... | |
int | Vect_get_zone (struct Map_info *) |
int | Vect_get_proj (struct Map_info *) |
Get projection from map header. More... | |
int | Vect_set_proj (struct Map_info *, int) |
Set projection in map header. More... | |
const char * | Vect_get_proj_name (struct Map_info *) |
Query cartographic projection name of pointer to Map_info structure. More... | |
int | Vect_set_thresh (struct Map_info *, double) |
Set threshold used for digitization in map header. More... | |
double | Vect_get_thresh (struct Map_info *) |
Get threshold used for digitization from map header. More... | |
int | Vect_get_constraint_box (struct Map_info *, struct bound_box *) |
Get constraint box. More... | |
int | Vect_level (struct Map_info *) |
Returns level that Map is opened at. More... | |
int | Vect_get_map_box1 (struct Map_info *, struct bound_box *) |
Get bounding box of map on level 1 (all features in the map) More... | |
int | Vect_get_line_type (struct Map_info *, int) |
Get line type. More... | |
plus_t | Vect_get_num_nodes (struct Map_info *) |
Get number of nodes in vector map. More... | |
plus_t | Vect_get_num_primitives (struct Map_info *, int) |
Get number of primitives in vector map. More... | |
plus_t | Vect_get_num_lines (struct Map_info *) |
Fetch number of features (points, lines, boundaries, centroids) in vector map. More... | |
plus_t | Vect_get_num_areas (struct Map_info *) |
Get number of areas in vector map. More... | |
plus_t | Vect_get_num_faces (struct Map_info *) |
Get number of faces in vector map. More... | |
plus_t | Vect_get_num_kernels (struct Map_info *) |
Fetch number of kernels in vector map. More... | |
plus_t | Vect_get_num_volumes (struct Map_info *) |
Fetch number of volumes in vector map. More... | |
plus_t | Vect_get_num_islands (struct Map_info *) |
Get number of islands in vector map. More... | |
plus_t | Vect_get_num_holes (struct Map_info *) |
Fetch number of holes in vector map. More... | |
int | Vect_get_line_box (struct Map_info *, int, struct bound_box *) |
Get bounding box of given feature. More... | |
int | Vect_get_area_box (struct Map_info *, int, struct bound_box *) |
Get bounding box of area. More... | |
int | Vect_get_isle_box (struct Map_info *, int, struct bound_box *) |
Get bounding box of isle. More... | |
int | Vect_get_map_box (struct Map_info *, struct bound_box *) |
Get bounding box of map (all features in the map) More... | |
int | V__map_overlap (struct Map_info *, double, double, double, double) |
void | Vect_set_release_support (struct Map_info *) |
Set spatial index to be released when vector is closed. More... | |
void | Vect_set_category_index_update (struct Map_info *) |
Set category index to be updated when vector is changed. More... | |
int | Vect_check_input_output_name (const char *, const char *, int) |
Check for input and output vector map name. More... | |
int | Vect_legal_filename (const char *) |
Check if output is legal vector name. More... | |
int | Vect_set_open_level (int) |
Predetermine level at which a vector map will be opened for reading. More... | |
int | Vect_open_old (struct Map_info *, const char *, const char *) |
Open existing vector map for reading. More... | |
int | Vect_open_tmp_old (struct Map_info *, const char *, const char *) |
Open existing temporary vector map for reading. More... | |
int | Vect_open_old2 (struct Map_info *, const char *, const char *, const char *) |
Open existing vector map for reading. More... | |
int | Vect_open_old_head (struct Map_info *, const char *, const char *) |
Reads only info about vector map (headers) More... | |
int | Vect_open_old_head2 (struct Map_info *, const char *, const char *, const char *) |
Reads only info about vector map (headers) More... | |
int | Vect_open_new (struct Map_info *, const char *, int) |
Create new vector map for reading/writing. More... | |
int | Vect_open_tmp_new (struct Map_info *, const char *, int) |
Create new temporary vector map. More... | |
int | Vect_open_update (struct Map_info *, const char *, const char *) |
Open existing vector map for reading/writing. More... | |
int | Vect_open_tmp_update (struct Map_info *, const char *, const char *) |
Open existing temporary vector map for reading/writing. More... | |
int | Vect_open_update2 (struct Map_info *, const char *, const char *, const char *) |
Open existing vector map for reading/writing. More... | |
int | Vect_open_update_head (struct Map_info *, const char *, const char *) |
Open header file of existing vector map for updating (mostly for database link updates) More... | |
int | Vect_copy_head_data (struct Map_info *, struct Map_info *) |
Copy header data from one to another map. More... | |
int | Vect_build (struct Map_info *) |
Build topology for vector map. More... | |
int | Vect_topo_check (struct Map_info *, struct Map_info *) |
Extensive tests for correct topology. More... | |
int | Vect_get_built (struct Map_info *) |
Return current highest built level (part) More... | |
int | Vect_build_partial (struct Map_info *, int) |
Build partial topology for vector map. More... | |
int | Vect_set_constraint_region (struct Map_info *, double, double, double, double, double, double) |
Set constraint region. More... | |
int | Vect_set_constraint_type (struct Map_info *, int) |
Set constraint type. More... | |
int | Vect_set_constraint_field (struct Map_info *, int) |
Set constraint field. More... | |
void | Vect_remove_constraints (struct Map_info *) |
Remove all constraints. More... | |
int | Vect_rewind (struct Map_info *) |
Rewind vector map to cause reads to start at beginning. More... | |
int | Vect_close (struct Map_info *) |
Close vector map. More... | |
void | Vect_set_error_handler_io (struct Map_info *, struct Map_info *) |
Define standard error handler for input and output vector maps. More... | |
int | Vect_get_next_line_id (struct Map_info *) |
Get line id for sequential reading. More... | |
int | Vect_read_next_line (struct Map_info *, struct line_pnts *, struct line_cats *) |
Read next vector feature. More... | |
off_t | Vect_write_line (struct Map_info *, int, const struct line_pnts *, const struct line_cats *) |
Writes a new feature. More... | |
off_t | Vect_rewrite_line (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *) |
Rewrites existing feature (topological level required) More... | |
int | Vect_delete_line (struct Map_info *, off_t) |
Delete existing feature (topological level required) More... | |
int | Vect_restore_line (struct Map_info *, off_t, off_t) |
Restore previously deleted feature (topological level required) More... | |
int | Vect_get_num_dblinks (struct Map_info *) |
Get number of defined dblinks. More... | |
int | Vect_read_line (struct Map_info *, struct line_pnts *, struct line_cats *, int) |
Read vector feature (topological level required) More... | |
int | Vect_line_alive (struct Map_info *, int) |
Check if feature is alive or dead (topological level required) More... | |
int | Vect_node_alive (struct Map_info *, int) |
Check if node is alive or dead (topological level required) More... | |
int | Vect_area_alive (struct Map_info *, int) |
Check if area is alive or dead (topological level required) More... | |
int | Vect_isle_alive (struct Map_info *, int) |
Check if isle is alive or dead (topological level required) More... | |
int | Vect_get_line_nodes (struct Map_info *, int, int *, int *) |
Get line nodes. More... | |
int | Vect_get_line_areas (struct Map_info *, int, int *, int *) |
Get area id on the left and right side of the boundary. More... | |
off_t | Vect_get_line_offset (struct Map_info *, int) |
Get feature offset (topological level required) More... | |
int | Vect_get_node_coor (struct Map_info *, int, double *, double *, double *) |
Get node coordinates. More... | |
int | Vect_get_node_n_lines (struct Map_info *, int) |
Get number of lines for node. More... | |
int | Vect_get_node_line (struct Map_info *, int, int) |
Get line id for node line index. More... | |
float | Vect_get_node_line_angle (struct Map_info *, int, int) |
Angle of segment of the line connected to the node. More... | |
int | Vect_get_area_points (struct Map_info *, int, struct line_pnts *) |
Returns polygon array of points (outer ring) of given area. More... | |
int | Vect_get_area_centroid (struct Map_info *, int) |
Returns centroid id for given area. More... | |
int | Vect_get_area_num_isles (struct Map_info *, int) |
Returns number of isles for given area. More... | |
int | Vect_get_area_isle (struct Map_info *, int, int) |
Returns isle id for area. More... | |
double | Vect_get_area_perimeter (struct Map_info *, int) |
Returns perimeter of area with perimeter of isles. More... | |
double | Vect_get_area_area (struct Map_info *, int) |
Returns area of area without areas of isles. More... | |
int | Vect_get_area_boundaries (struct Map_info *, int, struct ilist *) |
Creates list of boundaries for given area. More... | |
int | Vect_get_isle_points (struct Map_info *, int, struct line_pnts *) |
Returns polygon array of points for given isle. More... | |
int | Vect_get_isle_area (struct Map_info *, int) |
Returns area id for isle. More... | |
int | Vect_get_isle_boundaries (struct Map_info *, int, struct ilist *) |
Creates list of boundaries for given isle. More... | |
int | Vect_get_centroid_area (struct Map_info *, int) |
Get area id the centroid is within. More... | |
int | Vect_get_num_updated_lines (struct Map_info *) |
Get number of updated features. More... | |
int | Vect_get_updated_line (struct Map_info *, int) |
Get updated line by index. More... | |
off_t | Vect_get_updated_line_offset (struct Map_info *, int) |
Get updated line offset by index. More... | |
int | Vect_get_num_updated_nodes (struct Map_info *) |
Get number of updated nodes. More... | |
int | Vect_get_updated_node (struct Map_info *, int) |
Get updated (modified) node by index. More... | |
void | Vect_set_updated (struct Map_info *, int) |
Enable/disable maintenance of list of updated lines/nodes. More... | |
void | Vect_reset_updated (struct Map_info *) |
Reset list of updated lines/nodes. More... | |
int | Vect_hist_command (struct Map_info *) |
Write command info to history file. More... | |
int | Vect_hist_write (struct Map_info *, const char *) |
Write string to history file. More... | |
int | Vect_hist_copy (struct Map_info *, struct Map_info *) |
Copy history from one map to another. More... | |
void | Vect_hist_rewind (struct Map_info *) |
Rewind history file. More... | |
char * | Vect_hist_read (char *, int, struct Map_info *) |
Reads one line from history file without newline character. More... | |
int | Vect_select_lines_by_box (struct Map_info *, const struct bound_box *, int, struct boxlist *) |
Select lines with bounding boxes by box. More... | |
int | Vect_select_areas_by_box (struct Map_info *, const struct bound_box *, struct boxlist *) |
Select areas with bounding boxes by box. More... | |
int | Vect_select_isles_by_box (struct Map_info *, const struct bound_box *, struct boxlist *) |
Select isles with bounding boxes by box. More... | |
int | Vect_select_nodes_by_box (struct Map_info *, const struct bound_box *, struct ilist *) |
Select nodes by box. More... | |
int | Vect_find_node (struct Map_info *, double, double, double, double, int) |
Find the nearest node. More... | |
int | Vect_find_line (struct Map_info *, double, double, double, int, double, int, int) |
Find the nearest line. More... | |
int | Vect_find_line_list (struct Map_info *, double, double, double, int, double, int, const struct ilist *, struct ilist *) |
Find the nearest line(s). More... | |
int | Vect_find_area (struct Map_info *, double, double) |
Find the nearest area. More... | |
int | Vect_find_island (struct Map_info *, double, double) |
Find the nearest island. More... | |
int | Vect_select_lines_by_polygon (struct Map_info *, struct line_pnts *, int, struct line_pnts **, int, struct ilist *) |
Select lines by Polygon with optional isles. More... | |
int | Vect_select_areas_by_polygon (struct Map_info *, struct line_pnts *, int, struct line_pnts **, struct ilist *) |
Select areas by Polygon with optional isles. More... | |
int | Vect_tin_get_z (struct Map_info *, double, double, double *, double *, double *) |
int | Vect_find_poly_centroid (const struct line_pnts *, double *, double *) |
Get centroid of polygon. More... | |
int | Vect__intersect_line_with_poly (const struct line_pnts *, double, struct line_pnts *) |
int | Vect_get_point_in_area (struct Map_info *, int, double *, double *) |
Get point inside area and outside all islands. More... | |
int | Vect_get_point_in_poly (const struct line_pnts *, double *, double *) |
Get point inside polygon. More... | |
int | Vect_get_point_in_poly_isl (const struct line_pnts *, const struct line_pnts **, int, double *, double *) |
Get point inside polygon but outside the islands specifiled in IPoints. More... | |
int | Vect_point_in_area (double, double, struct Map_info *, int, struct bound_box *) |
Check if point is in area. More... | |
int | Vect_point_in_area_outer_ring (double, double, struct Map_info *, int, struct bound_box *) |
Determines if a point (X,Y) is inside an area outer ring. Islands are not considered. More... | |
int | Vect_point_in_island (double, double, struct Map_info *, int, struct bound_box *) |
Determines if a point (X,Y) is inside an island. More... | |
int | Vect_point_in_poly (double, double, const struct line_pnts *) |
Determines if a point (X,Y) is inside a polygon. More... | |
void | Vect_break_lines (struct Map_info *, int, struct Map_info *) |
Break lines in vector map at each intersection. More... | |
int | Vect_break_lines_list (struct Map_info *, struct ilist *, struct ilist *, int, struct Map_info *) |
Break selected lines in vector map at each intersection. More... | |
int | Vect_check_line_breaks (struct Map_info *, int, struct Map_info *) |
Check for and count intersecting lines, do not break. More... | |
int | Vect_check_line_breaks_list (struct Map_info *, struct ilist *, struct ilist *, int, struct Map_info *) |
Check for and count intersecting lines, do not break. More... | |
int | Vect_merge_lines (struct Map_info *, int, int *, struct Map_info *) |
Merge lines or boundaries in vector map. More... | |
void | Vect_break_polygons (struct Map_info *, int, struct Map_info *) |
Break polygons in vector map. More... | |
void | Vect_remove_duplicates (struct Map_info *, int, struct Map_info *) |
Remove duplicate features from vector map. More... | |
int | Vect_line_check_duplicate (const struct line_pnts *, const struct line_pnts *, int) |
Check for duplicate lines. More... | |
void | Vect_snap_lines (struct Map_info *, int, double, struct Map_info *) |
Snap lines in vector map to existing vertex in threshold. More... | |
void | Vect_snap_lines_list (struct Map_info *, const struct ilist *, double, struct Map_info *) |
Snap selected lines to existing vertex in threshold. More... | |
int | Vect_snap_line (struct Map_info *, struct ilist *, struct line_pnts *, double, int, int *, int *) |
Snap a line to reference lines in Map with threshold. More... | |
void | Vect_remove_dangles (struct Map_info *, int, double, struct Map_info *) |
Remove dangles from vector map. More... | |
void | Vect_chtype_dangles (struct Map_info *, double, struct Map_info *) |
Change boundary dangles to lines. More... | |
void | Vect_select_dangles (struct Map_info *, int, double, struct ilist *) |
Select dangles from vector map. More... | |
void | Vect_remove_bridges (struct Map_info *, struct Map_info *, int *, int *) |
Remove bridges from vector map. More... | |
void | Vect_chtype_bridges (struct Map_info *, struct Map_info *, int *, int *) |
Change type of bridges in vector map. More... | |
int | Vect_remove_small_areas (struct Map_info *, double, struct Map_info *, double *) |
Remove small areas from the map map. More... | |
int | Vect_clean_small_angles_at_nodes (struct Map_info *, int, struct Map_info *) |
Clean small angles at nodes. More... | |
int | Vect_overlay_str_to_operator (const char *) |
Get operator code from string. More... | |
int | Vect_overlay (struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *, int, struct ilist *, struct ilist *, int, struct Map_info *) |
Overlay 2 vector maps and create new one. More... | |
int | Vect_overlay_and (struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *, int, struct ilist *, struct ilist *, struct Map_info *) |
void | Vect_graph_init (dglGraph_s *, int) |
Initialize graph structure. More... | |
void | Vect_graph_build (dglGraph_s *) |
Build network graph. More... | |
void | Vect_graph_add_edge (dglGraph_s *, int, int, double, int) |
Add edge to graph. More... | |
void | Vect_graph_set_node_costs (dglGraph_s *, int, double) |
Set node costs. More... | |
int | Vect_graph_shortest_path (dglGraph_s *, int, int, struct ilist *, double *) |
Find shortest path. More... | |
int | Vect_net_build_graph (struct Map_info *, int, int, int, const char *, const char *, const char *, int, int) |
Build network graph. More... | |
int | Vect_net_ttb_build_graph (struct Map_info *, int, int, int, int, int, const char *, const char *, const char *, int, int) |
int | Vect_net_shortest_path (struct Map_info *, int, int, struct ilist *, double *) |
Find shortest path. More... | |
int | Vect_net_ttb_shortest_path (struct Map_info *, int, int, int, int, int, struct ilist *, double *) |
Find shortest path on network. More... | |
dglGraph_s * | Vect_net_get_graph (struct Map_info *) |
Get graph structure. More... | |
int | Vect_net_get_line_cost (struct Map_info *, int, int, double *) |
Returns in cost for given direction in *cost. More... | |
int | Vect_net_get_node_cost (struct Map_info *, int, double *) |
Get cost of node. More... | |
int | Vect_net_nearest_nodes (struct Map_info *, double, double, double, int, double, int *, int *, int *, double *, double *, struct line_pnts *, struct line_pnts *, double *) |
Find nearest node(s) on network. More... | |
int | Vect_net_shortest_path_coor (struct Map_info *, double, double, double, double, double, double, double, double, double *, struct line_pnts *, struct ilist *, struct ilist *, struct line_pnts *, struct line_pnts *, double *, double *) |
Find shortest path on network between 2 points given by coordinates. More... | |
int | Vect_net_ttb_shortest_path_coor (struct Map_info *, double, double, double, double, double, double, double, double, int, double *, struct line_pnts *, struct ilist *, struct ilist *, struct line_pnts *, struct line_pnts *, double *, double *) |
Find shortest path on network with turntable between 2 points given by coordinates. More... | |
int | Vect_topo_dump (struct Map_info *, FILE *) |
Dump topology to file. More... | |
double | Vect_points_distance (double, double, double, double, double, double, int) |
Calculate distance of 2 points. More... | |
int | Vect_option_to_types (const struct Option *) |
Get types from options. More... | |
int | Vect_copy_map_lines (struct Map_info *, struct Map_info *) |
Copy all alive vector features from input vector map to output vector map. More... | |
int | Vect_copy_map_lines_field (struct Map_info *, int, struct Map_info *) |
Copy all alive vector features from given layer from input vector map to output vector map. More... | |
int | Vect_copy (const char *, const char *, const char *) |
Copy vector map including attribute tables. More... | |
int | Vect_rename (const char *, const char *) |
Rename existing vector map (in the current mapset). More... | |
int | Vect_copy_table (struct Map_info *, struct Map_info *, int, int, const char *, int) |
Copy attribute table linked to vector map based on type. More... | |
int | Vect_copy_table_by_cat_list (struct Map_info *, struct Map_info *, int, int, const char *, int, const struct cat_list *) |
Copy attribute table linked to vector map based on category list. More... | |
int | Vect_copy_table_by_cats (struct Map_info *, struct Map_info *, int, int, const char *, int, int *, int) |
Copy attribute table linked to vector map based on category numbers. More... | |
int | Vect_copy_tables (struct Map_info *, struct Map_info *, int) |
Copy attribute tables linked to vector map. More... | |
int | Vect_delete (const char *) |
Delete vector map including attribute tables. More... | |
int | Vect_segment_intersection (double, double, double, double, double, double, double, double, double, double, double, double, double *, double *, double *, double *, double *, double *, int) |
Check for intersect of 2 line segments. More... | |
int | Vect_line_intersection (struct line_pnts *, struct line_pnts *, struct bound_box *, struct bound_box *, struct line_pnts ***, struct line_pnts ***, int *, int *, int) |
int | Vect_line_intersection2 (struct line_pnts *, struct line_pnts *, struct bound_box *, struct bound_box *, struct line_pnts ***, struct line_pnts ***, int *, int *, int) |
Intersect 2 lines. More... | |
int | Vect_line_check_intersection (struct line_pnts *, struct line_pnts *, int) |
Check if 2 lines intersect. More... | |
int | Vect_line_check_intersection2 (struct line_pnts *, struct line_pnts *, int) |
Check if 2 lines intersect. More... | |
int | Vect_line_get_intersections (struct line_pnts *, struct line_pnts *, struct line_pnts *, int) |
Get 2 lines intersection points. More... | |
int | Vect_line_get_intersections2 (struct line_pnts *, struct line_pnts *, struct line_pnts *, int) |
Get 2 lines intersection points. More... | |
char * | Vect_subst_var (const char *, struct Map_info *) |
Substitute variable in string. More... | |
void | Vect_spatial_index_init (struct spatial_index *, int) |
Initialize spatial index structure. More... | |
void | Vect_spatial_index_destroy (struct spatial_index *) |
Destroy existing spatial index. More... | |
void | Vect_spatial_index_add_item (struct spatial_index *, int, const struct bound_box *) |
Add a new item to spatial index structure. More... | |
void | Vect_spatial_index_del_item (struct spatial_index *, int, const struct bound_box *) |
Delete item from spatial index structure. More... | |
int | Vect_spatial_index_select (const struct spatial_index *, const struct bound_box *, struct ilist *) |
Select items by bounding box to list. More... | |
int | Vect_read_ascii (FILE *, struct Map_info *) |
Read data in GRASS ASCII vector format. More... | |
int | Vect_read_ascii_head (FILE *, struct Map_info *) |
Read header of GRASS ASCII vector format. More... | |
int | Vect_write_ascii (FILE *, FILE *, struct Map_info *, int, int, int, char *, int, int, int, const struct cat_list *, const char *, const char **, int) |
Write data to GRASS ASCII vector format. More... | |
void | Vect_write_ascii_head (FILE *, struct Map_info *) |
Write data to GRASS ASCII vector format. More... | |
SF_FeatureType | Vect_sfa_get_line_type (const struct line_pnts *, int, int) |
Get SF type of given vector feature. More... | |
int | Vect_sfa_get_type (SF_FeatureType) |
Get relevant GV type. More... | |
int | Vect_sfa_check_line_type (const struct line_pnts *, int, SF_FeatureType, int) |
Check SF type. More... | |
int | Vect_sfa_line_dimension (int) |
Get geometry dimension. More... | |
char * | Vect_sfa_line_geometry_type (const struct line_pnts *, int) |
Get geometry type (string) More... | |
int | Vect_sfa_line_astext (const struct line_pnts *, int, int, int, FILE *) |
Export geometry to Well-Known Text. More... | |
int | Vect_sfa_is_line_simple (const struct line_pnts *, int, int) |
int | Vect_sfa_is_line_closed (const struct line_pnts *, int, int) |
Check if feature is closed. More... | |
int | Vect_sfa_get_num_features (struct Map_info *) |
Get number of simple features. More... | |
int | Vect_print_header (struct Map_info *) |
Print vector map header to stdout. More... | |
void | Vect__init_head (struct Map_info *) |
Initialize Map_info head structure (dig_head) More... | |
int | Vect_coor_info (struct Map_info *, struct Coor_info *) |
Update Coor_info structure. More... | |
const char * | Vect_maptype_info (struct Map_info *) |
Gets vector map format (as string) More... | |
int | Vect_maptype (struct Map_info *) |
Gets vector map format. More... | |
int | Vect_open_topo (struct Map_info *, int) |
Open topology file ('topo') More... | |
int | Vect_save_topo (struct Map_info *) |
Save topology file for vector map. More... | |
int | Vect_open_sidx (struct Map_info *, int) |
Open spatial index file ('sidx') More... | |
int | Vect_save_sidx (struct Map_info *) |
Save spatial index file for vector map. More... | |
int | Vect_sidx_dump (struct Map_info *, FILE *) |
Dump spatial index to file. More... | |
int | Vect_build_sidx_from_topo (struct Map_info *) |
Create spatial index from topology if necessary (not longer supported) More... | |
int | Vect_build_sidx (struct Map_info *) |
Create spatial index if necessary. More... | |
int | Vect_open_fidx (struct Map_info *, struct Format_info_offset *) |
Open feature index file. More... | |
int | Vect_save_fidx (struct Map_info *, struct Format_info_offset *) |
Save feature index file for vector map. More... | |
int | Vect_fidx_dump (struct Map_info *, FILE *) |
Dump feature index to file. More... | |
int | Vect_save_frmt (struct Map_info *) |
Save format definition file for vector map. More... | |
int | Vect__write_head (struct Map_info *) |
Writes head information to text file (GV_HEAD_ELEMENT) More... | |
int | Vect__read_head (struct Map_info *) |
Reads head information from text file (GV_HEAD_ELEMENT) - for internal use only. More... | |
int | V1_open_old_nat (struct Map_info *, int) |
Open existing vector map (level 1) More... | |
int | V1_open_old_ogr (struct Map_info *, int) |
Open existing OGR layer on non-topological level. More... | |
int | V1_open_old_pg (struct Map_info *, int) |
int | V2_open_old_ogr (struct Map_info *) |
Open existing OGR layer on topological level. More... | |
int | V2_open_old_pg (struct Map_info *) |
int | V1_open_new_nat (struct Map_info *, const char *, int) |
Create new vector map (level 1) More... | |
int | V1_open_new_ogr (struct Map_info *, const char *, int) |
Prepare OGR datasource for creating new OGR layer (level 1) More... | |
int | V1_open_new_pg (struct Map_info *, const char *, int) |
int | V1_rewind_nat (struct Map_info *) |
Rewind vector map to cause reads to start at beginning on non-topological level (level 1) - native format - internal use only. More... | |
int | V1_rewind_ogr (struct Map_info *) |
Rewind vector map (OGR layer) to cause reads to start at beginning (level 1) More... | |
int | V1_rewind_pg (struct Map_info *) |
Rewind vector map (PostGIS layer) to cause reads to start at beginning (level 1) More... | |
int | V2_rewind_nat (struct Map_info *) |
Rewind vector map to cause reads to start at beginning on topological level (level 2) - native format - internal use only. More... | |
int | V2_rewind_ogr (struct Map_info *) |
Rewind vector map (OGR layer) to cause reads to start at beginning on topological level (level 2) More... | |
int | V2_rewind_pg (struct Map_info *) |
Rewind vector map (PostGIS layer) to cause reads to start at beginning on topological level (level 2) More... | |
int | V1_close_nat (struct Map_info *) |
Close vector map. More... | |
int | V1_close_ogr (struct Map_info *) |
Close vector map (OGR dsn & layer) on level 1. More... | |
int | V1_close_pg (struct Map_info *) |
int | V2_close_ogr (struct Map_info *) |
Close vector map on topological level (write out fidx file) More... | |
int | V2_close_pg (struct Map_info *) |
int | V1_read_line_nat (struct Map_info *, struct line_pnts *, struct line_cats *, off_t) |
Read vector feature on non-topological level (level 1) - native format - internal use only. More... | |
int | V1_read_line_ogr (struct Map_info *, struct line_pnts *, struct line_cats *, off_t) |
Read feature from OGR layer at given offset (level 1 without topology) More... | |
int | V1_read_line_pg (struct Map_info *, struct line_pnts *, struct line_cats *, off_t) |
int | V2_read_line_nat (struct Map_info *, struct line_pnts *, struct line_cats *, int) |
Read vector feature on topological level (level 2) - native format - internal use only. More... | |
int | V2_read_line_sfa (struct Map_info *, struct line_pnts *, struct line_cats *, int) |
Reads feature from OGR/PostGIS layer on topological level. More... | |
int | V2_read_line_pg (struct Map_info *, struct line_pnts *, struct line_cats *, int) |
int | V1_read_next_line_nat (struct Map_info *, struct line_pnts *, struct line_cats *) |
Read next vector feature on non-topological level (level 1) - native format - internal use only. More... | |
int | V1_read_next_line_ogr (struct Map_info *, struct line_pnts *, struct line_cats *) |
Read next feature from OGR layer. Skip empty features (level 1 without topology). More... | |
int | V1_read_next_line_pg (struct Map_info *, struct line_pnts *, struct line_cats *) |
int | V2_read_next_line_nat (struct Map_info *, struct line_pnts *, struct line_cats *) |
Read next vector feature on topological level (level 2) - native format - internal use only. More... | |
int | V2_read_next_line_ogr (struct Map_info *, struct line_pnts *, struct line_cats *) |
Read next feature from OGR layer on topological level. More... | |
int | V2_read_next_line_pg (struct Map_info *, struct line_pnts *, struct line_cats *) |
int | V1_delete_line_nat (struct Map_info *, off_t) |
Deletes feature at level 1 (internal use only) More... | |
int | V1_delete_line_ogr (struct Map_info *, off_t) |
Deletes feature at the given offset on level 1 (OGR interface) More... | |
int | V1_delete_line_pg (struct Map_info *, off_t) |
int | V2_delete_line_nat (struct Map_info *, off_t) |
Deletes feature at topological level (internal use only) More... | |
int | V2_delete_line_sfa (struct Map_info *, off_t) |
Deletes feature on level 2 (OGR/PostGIS interface) More... | |
int | V2_delete_line_pg (struct Map_info *, off_t) |
int | V1_restore_line_nat (struct Map_info *, off_t, off_t) |
Restores feature at level 1 (internal use only) More... | |
int | V2_restore_line_nat (struct Map_info *, off_t, off_t) |
Restores feature at topological level (internal use only) More... | |
off_t | V1_write_line_nat (struct Map_info *, int, const struct line_pnts *, const struct line_cats *) |
Writes feature to 'coor' file at level 1 (internal use only) More... | |
off_t | V1_write_line_ogr (struct Map_info *, int, const struct line_pnts *, const struct line_cats *) |
Writes feature on level 1 (OGR interface) More... | |
off_t | V1_write_line_pg (struct Map_info *, int, const struct line_pnts *, const struct line_cats *) |
off_t | V2_write_line_nat (struct Map_info *, int, const struct line_pnts *, const struct line_cats *) |
Writes feature to 'coor' file at topological level (internal use only) More... | |
off_t | V2_write_line_sfa (struct Map_info *, int, const struct line_pnts *, const struct line_cats *) |
Writes feature on level 2 (OGR/PostGIS interface, pseudo-topological level) More... | |
off_t | V2_write_line_pg (struct Map_info *, int, const struct line_pnts *, const struct line_cats *) |
off_t | V1_rewrite_line_nat (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *) |
Rewrites feature to 'coor' file at level 1 (internal use only) More... | |
off_t | V1_rewrite_line_ogr (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *) |
Rewrites feature at the given offset on level 1 (OGR interface) More... | |
off_t | V1_rewrite_line_pg (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *) |
off_t | V2_rewrite_line_nat (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *) |
Rewrites feature to 'coor' file at topological level (internal use only) More... | |
off_t | V2_rewrite_line_sfa (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *) |
Rewrites feature at the given offset on level 2 (OGR/PostGIS interface, pseudo-topological level) More... | |
off_t | V2_rewrite_line_pg (struct Map_info *, off_t, int, const struct line_pnts *, const struct line_cats *) |
int | Vect_build_nat (struct Map_info *, int) |
Build topology. More... | |
void | Vect__build_downgrade (struct Map_info *, int) |
Downgrade build level (for internal use only) More... | |
int | Vect__build_sfa (struct Map_info *, int) |
Build pseudo-topology (for simple features) - internal use only. More... | |
int | Vect_build_ogr (struct Map_info *, int) |
Build pseudo-topology (simple features) for OGR layer. More... | |
int | Vect_build_pg (struct Map_info *, int) |
int | Vect_build_line_area (struct Map_info *, int, int) |
Build area on given side of line (GV_LEFT or GV_RIGHT) More... | |
int | Vect_isle_find_area (struct Map_info *, int, const struct bound_box *) |
Find area outside island. More... | |
int | Vect_attach_isle (struct Map_info *, int, const struct bound_box *) |
(Re)Attach isle to area More... | |
int | Vect_attach_isles (struct Map_info *, const struct bound_box *) |
(Re)Attach isles in given bounding box to areas More... | |
int | Vect_attach_centroids (struct Map_info *, const struct bound_box *) |
(Re)Attach centroids in given bounding box to areas More... | |
GEOSGeometry * | Vect_read_line_geos (struct Map_info *, int, int *) |
Read vector feature and stores it as GEOSGeometry instance. More... | |
GEOSGeometry * | Vect_line_to_geos (const struct line_pnts *, int, int) |
Create GEOSGeometry of given type from feature points. More... | |
GEOSGeometry * | Vect_read_area_geos (struct Map_info *, int) |
Read vector area and stores it as GEOSGeometry instance (polygon) More... | |
GEOSCoordSequence * | Vect_get_area_points_geos (struct Map_info *, int) |
Returns the polygon array of points, i.e. outer ring (shell) More... | |
GEOSCoordSequence * | Vect_get_isle_points_geos (struct Map_info *, int) |
Returns the polygon (isle) array of points (inner ring) More... | |
char * | Vect_line_to_wkt (const struct line_pnts *, int, bool) |
Create a Well Known Text (WKT) representation of given feature type from points. More... | |
char * | Vect_line_to_wkt2 (const struct line_pnts *, int, bool, bool) |
Create a Well Known Text (WKT) representation of given feature type from points. More... | |
unsigned char * | Vect_line_to_wkb (const struct line_pnts *, int, int, size_t *) |
Create a Well Known Binary (WKB) representation of given feature type from points. More... | |
char * | Vect_read_area_to_wkt (struct Map_info *, int) |
Read vector area and return it as Well Known Text (WKT) unsigned char array. More... | |
char * | Vect_read_area_to_wkt2 (struct Map_info *, int, bool) |
Read vector area and return it as Well Known Text (WKT) unsigned char array. More... | |
unsigned char * | Vect_read_area_to_wkb (struct Map_info *, int, size_t *) |
Read vector area and return it as Well Known Binary (WKB) unsigned char array. More... | |
unsigned char * | Vect_read_line_to_wkb (struct Map_info *, struct line_pnts *, struct line_cats *, int, size_t *, int *) |
Read a Well Known Binary (WKB) representation of a given feature id. More... | |
int | Vect_read_colors (const char *, const char *, struct Colors *) |
Read color table of vector map. More... | |
int | Vect_remove_colors (const char *, const char *) |
Remove color table of raster map. More... | |
void | Vect_write_colors (const char *, const char *, struct Colors *) |
Write color table for vector map. More... | |
int | RTreeSearch2 (struct RTree *, struct RTree_Rect *, struct ilist *) |
int RTreeSearch2 | ( | struct RTree * | t, |
struct RTree_Rect * | r, | ||
struct ilist * | list | ||
) |
Search in an index tree for all data rectangles that overlap the argument rectangle.
t | The RTree |
r | The argument rectangle |
list | The list to store the ids of overlapping rectangles |
Definition at line 40 of file rtree_search.c.
References assert, G_init_ilist(), r, and t.
int V1_close_nat | ( | struct Map_info * | Map | ) |
Close vector map.
Map | vector map to be closed |
Definition at line 34 of file close_nat.c.
References _, dig__write_head(), dig_file_free(), Map_info::dig_fp, gvfile::file, G_debug(), G_fatal_error(), G_file_name(), G_mkdir(), G_recursive_copy(), G_strcasecmp(), GPATH_MAX, GV_DIRECTORY, GV_MODE_RW, GV_MODE_WRITE, Map_info::head, Map_info::mapset, Map_info::mode, Map_info::name, NULL, dig_head::size, Coor_info::size, Map_info::temporary, TRUE, Vect__get_element_path(), Vect__write_head(), Vect_coor_info(), VECT_OPEN, and Vect_write_dblinks().
int V1_close_ogr | ( | struct Map_info * | Map | ) |
Close vector map (OGR dsn & layer) on level 1.
Map | pointer to Map_info structure |
Definition at line 35 of file close_ogr.c.
References _, Format_info_ogr::cache, db_close_database_shutdown_driver(), Format_info_ogr::dbdriver, Format_info_ogr::driver_name, Format_info_ogr::ds, Format_info_ogr::dsn, Format_info_ogr::feature_cache, Map_info::fInfo, Map_info::format, G_debug(), G_fatal_error(), G_find_file2(), G_free(), G_free_tokens(), G_mapset(), GV_FORMAT_OGR_DIRECT, GV_MODE_RW, GV_MODE_WRITE, Format_info_ogr::layer_name, Format_info_ogr::layer_options, Map_info::mapset, Map_info::mode, Map_info::name, Format_info::ogr, Vect__free_cache(), Vect__write_head(), VECT_OPEN, and Vect_save_frmt().
int V1_close_pg | ( | struct Map_info * | ) |
int V1_delete_line_nat | ( | struct Map_info * | Map, |
off_t | offset | ||
) |
Deletes feature at level 1 (internal use only)
Map | pointer Map_info structure |
offset | feature offset |
Definition at line 248 of file write_nat.c.
References dig__fread_port_C(), dig__fwrite_port_C(), dig_fflush(), Map_info::dig_fp, dig_fseek(), dig_set_cur_port(), G_debug(), Map_info::head, and dig_head::port.
int V1_delete_line_ogr | ( | struct Map_info * | Map, |
off_t | offset | ||
) |
Deletes feature at the given offset on level 1 (OGR interface)
Map | pointer Map_info structure |
offset | offset of feature to be deleted |
Definition at line 119 of file write_ogr.c.
References _, Format_info_offset::array, Format_info_offset::array_num, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), Format_info_ogr::layer, Format_info_ogr::offset, and Format_info::ogr.
int V1_delete_line_pg | ( | struct Map_info * | , |
off_t | |||
) |
int V1_open_new_nat | ( | struct Map_info * | Map, |
const char * | name, | ||
int | with_z | ||
) |
Create new vector map (level 1)
[out] | Map | pointer to Map_info structure |
name | vector map name to be created | |
with_z | 2D or 3D (unused?) |
Definition at line 96 of file open_nat.c.
References Version_info::back_major, Version_info::back_minor, dig_head::coor_version, dig__byte_order_out(), dig__write_head(), dig_file_init(), Map_info::dig_fp, dig_init_portable(), gvfile::file, G_debug(), G_fopen_modify(), G_fopen_new(), GPATH_MAX, GV_COOR_EARLIEST_MAJOR, GV_COOR_EARLIEST_MINOR, GV_COOR_ELEMENT, GV_COOR_VER_MAJOR, GV_COOR_VER_MINOR, GV_TOPO_ELEMENT, Map_info::head, Version_info::major, Version_info::minor, name, NULL, dig_head::port, Map_info::temporary, Vect__get_element_path(), and Vect__get_path().
int V1_open_new_ogr | ( | struct Map_info * | Map, |
const char * | name, | ||
int | with_z | ||
) |
Prepare OGR datasource for creating new OGR layer (level 1)
New OGR layer is created when writing features by Vect_wrile_line().
[out] | Map | pointer to Map_info structure |
name | name of OGR layer to create | |
with_z | WITH_Z for 3D vector data otherwise WITHOUT_Z |
Definition at line 180 of file open_ogr.c.
References _, Format_info_ogr::driver, Format_info_ogr::driver_name, Format_info_ogr::ds, Format_info_ogr::dsn, Map_info::fInfo, G_debug(), G_fatal_error(), G_get_overwrite(), G_warning(), Format_info_ogr::layer, Format_info_ogr::layer_name, name, NULL, and Format_info::ogr.
int V1_open_new_pg | ( | struct Map_info * | , |
const char * | , | ||
int | |||
) |
int V1_open_old_nat | ( | struct Map_info * | Map, |
int | update | ||
) |
Open existing vector map (level 1)
Map->name and Map->mapset must be set before.
Map | pointer to Map_info structure |
update | non-zero for write mode, otherwise read-only |
Definition at line 40 of file open_nat.c.
References _, dig__read_head(), dig_file_init(), Map_info::dig_fp, gvfile::file, G_debug(), G_fopen_modify(), G_fopen_old(), G_warning(), GPATH_MAX, GV_COOR_ELEMENT, Map_info::head, Map_info::mapset, Map_info::name, NULL, dig_head::size, Coor_info::size, Vect__get_path(), Vect_coor_info(), and Vect_get_full_name().
int V1_open_old_ogr | ( | struct Map_info * | Map, |
int | update | ||
) |
Open existing OGR layer on non-topological level.
Note: Map->name, Map->mapset, Map->fInfo.ogr.dsn and Map->fInfo.ogr.layer_name must be set before.
[in,out] | Map | pointer to Map_info structure |
update | TRUE for write mode, otherwise read-only |
Definition at line 43 of file open_ogr.c.
References _, Format_info_ogr::cache, Format_info_ogr::ds, Format_info_ogr::dsn, FALSE, Format_info_cache::fid, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), Map_info::head, Format_info_ogr::layer, Format_info_ogr::layer_name, NULL, Format_info::ogr, WITH_Z, dig_head::with_z, and WITHOUT_Z.
int V1_open_old_pg | ( | struct Map_info * | , |
int | |||
) |
int V1_read_line_nat | ( | struct Map_info * | Map, |
struct line_pnts * | Points, | ||
struct line_cats * | Cats, | ||
off_t | offset | ||
) |
Read vector feature on non-topological level (level 1) - native format - internal use only.
This function implements random access for native format, constraints are ignored!
Map | pointer to Map_info struct | |
[out] | Points | container used to store line points within (pointer to line_pnts struct) |
[out] | Cats | container used to store line categories within (pointer to line_cats struct) |
offset | given offset |
Definition at line 43 of file read_nat.c.
int V1_read_line_ogr | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c, | ||
off_t | offset | ||
) |
Read feature from OGR layer at given offset (level 1 without topology)
This function implements random access on level 1.
Map | pointer to Map_info structure | |
[out] | line_p | container used to store line points within (pointer line_pnts struct) |
[out] | line_c | container used to store line categories within (pointer line_cats struct) |
offset | given offset |
Definition at line 179 of file read_ogr.c.
int V1_read_next_line_nat | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c | ||
) |
Read next vector feature on non-topological level (level 1) - native format - internal use only.
This function implements sequential access, constraints are reflected, see Vect_set_constraint_region(), Vect_set_constraint_type(), or Vect_set_constraint_field().
Dead features are skipped.
Vect_rewind() can be used to reset reading.
Map | pointer to Map_info struct | |
[out] | line_p | container used to store line points within (pointer to line_pnts struct) |
[out] | line_c | container used to store line categories within (pointer to line_cats struct) |
Definition at line 71 of file read_nat.c.
References Map_info::constraint, Map_info::dig_fp, dig_ftell(), G_debug(), Map_info::region_flag, TRUE, and Vect_get_constraint_box().
int V1_read_next_line_ogr | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c | ||
) |
Read next feature from OGR layer. Skip empty features (level 1 without topology).
This function implements sequential access.
The action of this routine can be modified by:
Map | pointer to Map_info structure | |
[out] | line_p | container used to store line points within |
[out] | line_c | container used to store line categories within |
Definition at line 49 of file read_ogr.c.
int V1_restore_line_nat | ( | struct Map_info * | Map, |
off_t | offset, | ||
off_t | line | ||
) |
Restores feature at level 1 (internal use only)
Map | pointer to Map_info structure |
offset | feature offset |
line | feature id (not used) |
Definition at line 350 of file write_nat.c.
int V1_rewind_nat | ( | struct Map_info * | Map | ) |
Rewind vector map to cause reads to start at beginning on non-topological level (level 1) - native format - internal use only.
Map | pointer to Map_info struct |
Definition at line 27 of file rewind_nat.c.
References Map_info::dig_fp, dig_fseek(), Map_info::head, and dig_head::head_size.
Referenced by V2_rewind_nat().
int V1_rewind_ogr | ( | struct Map_info * | Map | ) |
Rewind vector map (OGR layer) to cause reads to start at beginning (level 1)
Map | pointer to Map_info structure |
Definition at line 32 of file rewind_ogr.c.
References _, Format_info_ogr::cache, Map_info::fInfo, G_debug(), G_fatal_error(), Format_info_ogr::layer, Format_info_cache::lines_next, Format_info_cache::lines_num, Map_info::name, and Format_info::ogr.
Referenced by V2_rewind_ogr().
int V1_rewind_pg | ( | struct Map_info * | Map | ) |
Rewind vector map (PostGIS layer) to cause reads to start at beginning (level 1)
Map | pointer to Map_info structure |
Definition at line 34 of file rewind_pg.c.
References _, Format_info_pg::cache, Format_info_cache::ctype, Format_info_cache::fid, Map_info::fInfo, G_debug(), G_fatal_error(), Format_info_cache::lines_next, Format_info_cache::lines_num, Map_info::name, Format_info_pg::next_line, Format_info::pg, and Vect__close_cursor_pg().
Referenced by V2_rewind_pg().
off_t V1_rewrite_line_nat | ( | struct Map_info * | Map, |
off_t | offset, | ||
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Rewrites feature to 'coor' file at level 1 (internal use only)
If the number of points or cats differs from the original one or the type is changed: GV_POINTS -> GV_LINES or GV_LINES -> GV_POINTS, the old one is deleted and the new is appended to the end of the file.
Old feature is deleted (marked as dead), and a new feature written.
Map | pointer to Map_info structure |
offset | feature offset |
type | feature type (GV_POINT, GV_LINE, ...) |
points | feature geometry |
cats | feature categories |
Definition at line 105 of file write_nat.c.
off_t V1_rewrite_line_ogr | ( | struct Map_info * | Map, |
off_t | offset, | ||
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Rewrites feature at the given offset on level 1 (OGR interface)
This function simply calls V1_delete_line_ogr() and V1_write_line_ogr().
Map | pointer to Map_info structure |
offset | feature offset |
type | feature type (see V1_write_line_ogr() for supported types) |
points | pointer to line_pnts structure (feature geometry) |
cats | pointer to line_cats structure (feature categories) |
Definition at line 89 of file write_ogr.c.
off_t V1_rewrite_line_pg | ( | struct Map_info * | , |
off_t | , | ||
int | , | ||
const struct line_pnts * | , | ||
const struct line_cats * | |||
) |
off_t V1_write_line_nat | ( | struct Map_info * | Map, |
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Writes feature to 'coor' file at level 1 (internal use only)
Map | pointer to Map_info structure |
type | feature type (GV_POINT, GV_LINE, ...) |
points | feature geometry |
cats | feature categories |
Definition at line 45 of file write_nat.c.
off_t V1_write_line_ogr | ( | struct Map_info * | Map, |
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Writes feature on level 1 (OGR interface)
Note:
Supported feature types:
Map | pointer to Map_info structure |
type | feature type |
points | pointer to line_pnts structure (feature geometry) |
cats | pointer to line_cats structure (feature categories) |
Definition at line 63 of file write_ogr.c.
off_t V1_write_line_pg | ( | struct Map_info * | , |
int | , | ||
const struct line_pnts * | , | ||
const struct line_cats * | |||
) |
int V2_close_ogr | ( | struct Map_info * | Map | ) |
Close vector map on topological level (write out fidx file)
Map | pointer to Map_info structure |
Definition at line 90 of file close_ogr.c.
References _, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), Map_info::mapset, Map_info::name, Format_info_ogr::offset, Format_info::ogr, Vect__free_offset(), VECT_OPEN, and Vect_save_fidx().
int V2_close_pg | ( | struct Map_info * | ) |
int V2_delete_line_nat | ( | struct Map_info * | Map, |
off_t | line | ||
) |
Deletes feature at topological level (internal use only)
Note: requires topology level >= GV_BUILD_BASE.
pointer | to Map_info structure |
line | feature id |
Definition at line 290 of file write_nat.c.
int V2_delete_line_pg | ( | struct Map_info * | , |
off_t | |||
) |
int V2_delete_line_sfa | ( | struct Map_info * | Map, |
off_t | line | ||
) |
Deletes feature on level 2 (OGR/PostGIS interface)
Note: Topology must be built at level >= GV_BUILD_BASE
pointer | to Map_info structure |
line | feature id to be deleted |
Definition at line 193 of file write_sfa.c.
int V2_open_old_ogr | ( | struct Map_info * | Map | ) |
Open existing OGR layer on topological level.
This functions reads feature index (fidx) file required for pseudo-topology.
[in,out] | Map | pointer to Map_info structure |
Definition at line 145 of file open_ogr.c.
References _, Map_info::fInfo, G_debug(), G_fatal_error(), G_warning(), G_zero(), Map_info::mapset, Map_info::name, Format_info_ogr::next_line, Format_info_ogr::offset, Format_info::ogr, Vect_get_full_name(), and Vect_open_fidx().
int V2_open_old_pg | ( | struct Map_info * | ) |
int V2_read_line_nat | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c, | ||
int | line | ||
) |
Read vector feature on topological level (level 2) - native format - internal use only.
This function implements random access for native format, constraints are ignored!
Note: Topology must be built at level >= GV_BUILD_BASE
Map | pointer to Map_info struct | |
[out] | Points | container used to store line points within (pointer to line_pnts struct) |
[out] | Cats | container used to store line categories within (pointer to line_cats struct) |
line | feature id to read (starts at 1) |
Definition at line 136 of file read_nat.c.
int V2_read_line_sfa | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c, | ||
int | line | ||
) |
Reads feature from OGR/PostGIS layer on topological level.
This function implements random access on level 2.
Note: Topology must be built at level >= GV_BUILD_BASE
Map | pointer to Map_info structure | |
[out] | line_p | container used to store line points within (pointer to line_pnts struct) |
[out] | line_c | container used to store line categories within (pointer to line_cats struct) |
line | feature id (starts at 1) |
Definition at line 40 of file read_sfa.c.
int V2_read_next_line_nat | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c | ||
) |
Read next vector feature on topological level (level 2) - native format - internal use only.
This function implements sequential access, constraints are reflected, see Vect_set_constraint_region(), Vect_set_constraint_type(), or Vect_set_constraint_field().
Use Vect_rewind() to reset reading.
Dead feature are skipped.
Map | pointer to Map_info struct | |
[out] | line_p | container used to store line points within (pointer to line_pnts struct) |
[out] | line_c | container used to store line categories within (pointer to line_cats struct) |
Definition at line 178 of file read_nat.c.
int V2_read_next_line_ogr | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c | ||
) |
Read next feature from OGR layer on topological level.
This function implements sequential access.
Map | pointer to Map_info structure | |
[out] | line_p | container used to store line points within (pointer to line_pnts struct) |
[out] | line_c | container used to store line categories within (pointer to line_cats struct) |
Definition at line 75 of file read_ogr.c.
int V2_restore_line_nat | ( | struct Map_info * | Map, |
off_t | offset, | ||
off_t | line | ||
) |
Restores feature at topological level (internal use only)
Note: requires topology level >= GV_BUILD_BASE.
Map | pointer to Map_info structure |
offset | feature offset to be restored |
line | feature id to be restored |
Definition at line 398 of file write_nat.c.
int V2_rewind_nat | ( | struct Map_info * | Map | ) |
Rewind vector map to cause reads to start at beginning on topological level (level 2) - native format - internal use only.
Map | pointer to Map_info struct |
Definition at line 40 of file rewind_nat.c.
References Map_info::next_line, and V1_rewind_nat().
int V2_rewind_ogr | ( | struct Map_info * | Map | ) |
Rewind vector map (OGR layer) to cause reads to start at beginning on topological level (level 2)
Map | pointer to Map_info structure |
Definition at line 61 of file rewind_ogr.c.
References _, G_debug(), G_fatal_error(), Map_info::name, Map_info::next_line, and V1_rewind_ogr().
int V2_rewind_pg | ( | struct Map_info * | Map | ) |
Rewind vector map (PostGIS layer) to cause reads to start at beginning on topological level (level 2)
Map | pointer to Map_info structure |
Definition at line 70 of file rewind_pg.c.
References _, G_debug(), G_fatal_error(), Map_info::name, Map_info::next_line, and V1_rewind_pg().
off_t V2_rewrite_line_nat | ( | struct Map_info * | Map, |
off_t | line, | ||
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Rewrites feature to 'coor' file at topological level (internal use only)
Note: requires topology level >= GV_BUILD_BASE.
Note: Function returns feature id, but is defined as off_t for compatibility with level 1 functions.
Map | pointer to Map_info structure |
line | feature id to be rewritten |
type | feature type (GV_POINT, GV_LINE, ...) |
points | feature geometry |
cats | feature categories |
Definition at line 161 of file write_nat.c.
off_t V2_rewrite_line_pg | ( | struct Map_info * | , |
off_t | , | ||
int | , | ||
const struct line_pnts * | , | ||
const struct line_cats * | |||
) |
off_t V2_rewrite_line_sfa | ( | struct Map_info * | Map, |
off_t | line, | ||
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Rewrites feature at the given offset on level 2 (OGR/PostGIS interface, pseudo-topological level)
Note: Topology must be built at level >= GV_BUILD_BASE
Map | pointer to Map_info structure |
line | feature id to be rewritten |
type | feature type (see V1_write_line_ogr() for supported types) |
points | pointer to line_pnts structure (feature geometry) |
cats | pointer to line_cats structure feature categories |
Definition at line 152 of file write_sfa.c.
off_t V2_write_line_nat | ( | struct Map_info * | Map, |
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Writes feature to 'coor' file at topological level (internal use only)
Note: Function returns feature id, but is defined as off_t for compatibility with level 1 functions.
Map | pointer to Map_info structure |
type | feature type (GV_POINT, GV_LINE, ...) |
points | feature geometry |
cats | feature categories |
Definition at line 67 of file write_nat.c.
off_t V2_write_line_pg | ( | struct Map_info * | , |
int | , | ||
const struct line_pnts * | , | ||
const struct line_cats * | |||
) |
off_t V2_write_line_sfa | ( | struct Map_info * | Map, |
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Writes feature on level 2 (OGR/PostGIS interface, pseudo-topological level)
Map | pointer to Map_info structure |
type | feature type (see V1_write_line_ogr() for list of supported types) |
points | pointer to line_pnts structure (feature geometry) |
cats | pointer to line_cats structure (feature categories) |
Definition at line 52 of file write_sfa.c.
int V__map_overlap | ( | struct Map_info * | Map, |
double | n, | ||
double | s, | ||
double | e, | ||
double | w | ||
) |
void Vect__build_downgrade | ( | struct Map_info * | Map, |
int | build | ||
) |
Downgrade build level (for internal use only)
See Vect_build_nat(), Vect__build_sfa(), and Vect_build_pg() for implementation issues.
Map | pointer to Map_info |
build |
Definition at line 771 of file build.c.
Referenced by Vect__build_sfa().
int Vect__build_sfa | ( | struct Map_info * | Map, |
int | build | ||
) |
Build pseudo-topology (for simple features) - internal use only.
See Vect_build_ogr() and Vect_build_pg() for implementation issues.
Build levels:
Map | pointer to Map_info structure |
build | build level |
Definition at line 700 of file build_sfa.c.
References Plus_head::built, Map_info::format, GV_BUILD_BASE, GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, Map_info::plus, and Vect__build_downgrade().
Referenced by Vect_build_ogr(), and Vect_build_pg().
void Vect__init_head | ( | struct Map_info * | Map | ) |
Initialize Map_info head structure (dig_head)
[in,out] | Map | pointer to Map_info structure |
Definition at line 29 of file init_head.c.
References FALSE, G_date(), G_whoami(), G_zero(), Map_info::head, Map_info::plus, Plus_head::release_support, Plus_head::Spidx_built, Plus_head::update_cidx, Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), Vect_set_proj(), Vect_set_scale(), Vect_set_thresh(), and Vect_set_zone().
Referenced by Vect__read_head().
int Vect__read_head | ( | struct Map_info * | Map | ) |
Reads head information from text file (GV_HEAD_ELEMENT) - for internal use only.
Map | pointer to Map_info structure |
Definition at line 118 of file vector/Vlib/header.c.
References _, G_debug(), G_fopen_old(), G_getl2(), G_warning(), GPATH_MAX, GV_HEAD_ELEMENT, Map_info::mapset, Map_info::name, NULL, Vect__get_path(), Vect__init_head(), Vect_get_full_name(), Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), Vect_set_proj(), Vect_set_scale(), Vect_set_thresh(), and Vect_set_zone().
Referenced by Vect_read_header().
int Vect__write_head | ( | struct Map_info * | Map | ) |
Writes head information to text file (GV_HEAD_ELEMENT)
Map | pointer to Map_info structure |
Definition at line 79 of file vector/Vlib/header.c.
References _, G_fopen_new(), G_warning(), GPATH_MAX, GV_HEAD_ELEMENT, NULL, Vect__get_path(), Vect_get_comment(), Vect_get_date(), Vect_get_full_name(), Vect_get_map_date(), Vect_get_map_name(), Vect_get_organization(), Vect_get_person(), Vect_get_proj(), Vect_get_scale(), Vect_get_thresh(), and Vect_get_zone().
Referenced by V1_close_nat(), V1_close_ogr(), V1_close_pg(), and Vect_write_header().
int Vect_add_dblink | ( | struct dblinks * | p, |
int | number, | ||
const char * | name, | ||
const char * | table, | ||
const char * | key, | ||
const char * | db, | ||
const char * | driver | ||
) |
Add new DB connection to dblinks structure.
[in,out] | p | pointer to existing dblinks structure |
number | layer number (1 for OGR) | |
name | layer name (layer for OGR) - if not given use table name | |
table | table name (layer for OGR) | |
key | key name | |
db | database name (datasource for OGR) | |
driver | driver name (dbf, postgresql, ogr, ...) |
int Vect_append_point | ( | struct line_pnts * | Points, |
double | x, | ||
double | y, | ||
double | z | ||
) |
Appends one point to the end of a line.
If you are re-using a line struct, be sure to clear out old data first by calling Vect_reset_line().
Calls G_fatal_error() when out of memory.
Points | pointer to line_pnts structure |
x,y,z | point coordinates to be added |
Definition at line 148 of file line.c.
Referenced by IL_write_point_2d().
int Vect_append_points | ( | struct line_pnts * | Points, |
const struct line_pnts * | APoints, | ||
int | direction | ||
) |
Appends points to the end of a line.
Note, this will append to whatever is in line_pnts structure. If you are re-using a line struct, be sure to clear out old data first by calling Vect_reset_line().
Points | pointer to line_pnts structure |
APoints | points to be included |
direction | direction (GV_FORWARD, GV_BACKWARD) |
int Vect_area_alive | ( | struct Map_info * | Map, |
int | area | ||
) |
Check if area is alive or dead (topological level required)
Note: Topology must be built at level >= GV_BUILD_AREAS
Map | pointer to Map_info structure |
area | area id |
Definition at line 253 of file vector/Vlib/read.c.
References _, Plus_head::Area, G_warning(), Plus_head::n_areas, NULL, and Map_info::plus.
Referenced by vector2perimeters(), and Vedit_delete_areas_cat().
void Vect_area_buffer2 | ( | struct Map_info * | Map, |
int | area, | ||
double | da, | ||
double | db, | ||
double | dalpha, | ||
int | round, | ||
int | caps, | ||
double | tol, | ||
struct line_pnts ** | oPoints, | ||
struct line_pnts *** | iPoints, | ||
int * | inner_count | ||
) |
Creates buffer around area.
Map | vector map | |
area | area id | |
da | distance along major axis | |
db | distance along minor axis | |
dalpha | angle between 0x and major axis | |
round | make corners round | |
caps | add caps at line ends | |
tol | maximum distance between theoretical arc and output segments | |
[out] | oPoints | output polygon outer border (ccw order) |
[out] | inner_count | number of holes |
[out] | iPoints | array of output polygon's holes (cw order) |
int Vect_array_to_cat_list | ( | const int * | vals, |
int | nvals, | ||
struct cat_list * | list | ||
) |
(Re)Attach centroids in given bounding box to areas
Warning: If map is updated on level2, it may happen that previously correct island becomes incorrect. In that case, centroid of area forming the island is reattached to outer area, because island polygon is not excluded.
+-----------+ +-----------+ | 1 | | 1 | | +---+---+ | | +---+---+ | | | 2 | 3 | | | | 2 | | | | x | | | -> | | x | | | | | | | | | | | | +---+---+ | | +---+---+ | | | | | +-----------+ +-----------+ centroid is centroid is attached to 2 reattached to 1
Because of this, when the centroid is reattached to another area, it is always necessary to check if original area exist, unregister centroid from previous area. To simplify code, this is implemented so that centroid is always first unregistered and if new area is found, it is registered again.
Map | vector map |
box | bounding box |
(Re)Attach isle to area
Map | vector map |
isle | isle id |
box | isle bbox |
Definition at line 385 of file build.c.
References P_isle::area, Plus_head::box, dig_area_add_isle(), G_debug(), Plus_head::Isle, Map_info::plus, and Vect_isle_find_area().
Referenced by Vect_attach_isles().
(Re)Attach isles in given bounding box to areas
The warning for Vect_attach_centroids() applies here as well
Map | vector map |
box | bounding box |
Definition at line 427 of file build.c.
References P_isle::area, Plus_head::box, boxlist::box, dig_area_del_isle(), bound_box::E, G_debug(), boxlist::id, Plus_head::Isle, bound_box::N, boxlist::n_values, NULL, Map_info::plus, bound_box::S, TRUE, Vect_attach_isle(), Vect_get_area_box(), Vect_new_boxlist(), Vect_select_isles_by_box(), and bound_box::W.
int Vect_box_clip | ( | double * | x, |
double * | y, | ||
double * | c_x, | ||
double * | c_y, | ||
const struct bound_box * | Box | ||
) |
Clip coordinates to box, if necessary, lines extending outside of a box.
A line represented by the coordinates x, y and c_x, c_y is clipped to the window defined by s (south), n (north), w (west), and e (east). Note that the following constraints must be true: w <e s <n The x and c_x are values to be compared to w and e. The y and c_y are values to be compared to s and n. The x and c_x values returned lie between w and e. The y and c_y values returned lie between s and n.
x,y | coordinates (w, e) |
c_x,c_y | coordinates (s, n) |
Box | boundary box |
Definition at line 162 of file vector/Vlib/box.c.
Copy box B to box A.
A | boundary A |
B | boundary B |
Definition at line 101 of file vector/Vlib/box.c.
Referenced by Vect_get_map_box().
Extend box A by box B.
A | boundary A |
B | boundary B |
Definition at line 122 of file vector/Vlib/box.c.
Tests for overlap of two boxes.
A | boundary box A |
B | boundary box B |
Definition at line 82 of file vector/Vlib/box.c.
Append new item to the end of list if not yet present.
[in,out] | list | pointer to ilist structure |
id | new item to append to the end of list | |
box | bounding box |
Definition at line 287 of file vector/Vlib/list.c.
References G_realloc, and NULL.
Referenced by Vect_boxlist_append_boxlist().
Append new items to the end of list if not yet present.
[in,out] | alist | pointer to boxlist structure where items will be appended |
blist | pointer to boxlist structure with new items |
Definition at line 330 of file vector/Vlib/list.c.
References bound_box::B, boxlist::box, bound_box::E, boxlist::have_boxes, boxlist::id, bound_box::N, boxlist::n_values, NULL, bound_box::S, bound_box::T, Vect_boxlist_append(), and bound_box::W.
int Vect_boxlist_delete | ( | struct boxlist * | list, |
int | id | ||
) |
Remove a given value (item) from list.
[in,out] | list | pointer to boxlist structure |
id | to remove |
Definition at line 362 of file vector/Vlib/list.c.
References NULL.
Referenced by Vect_boxlist_delete_boxlist().
Delete list from existing list.
[in,out] | alist | pointer to original boxlist structure, |
blist | pointer to boxlist structure with items to delete |
Definition at line 394 of file vector/Vlib/list.c.
References boxlist::id, boxlist::n_values, NULL, and Vect_boxlist_delete().
Break lines in vector map at each intersection.
For details see Vect_break_lines_list().
Map | input vector map | |
type | feature type | |
[out] | Err | vector map where points at intersections will be written or NULL |
Definition at line 33 of file break_lines.c.
int Vect_break_lines_list | ( | struct Map_info * | Map, |
struct ilist * | List_break, | ||
struct ilist * | List_ref, | ||
int | type, | ||
struct Map_info * | Err | ||
) |
Break selected lines in vector map at each intersection.
Breaks selected lines specified by type in vector map. Points at intersections may be optionally written to error map. Input vector map must be opened on level 2 for update at least on GV_BUILD_BASE.
The function also breaks lines forming collapsed loop, for example 0,0;1,0;0,0 is broken at 1,0.
If reference lines are given (List_ref) break only lines which intersect reference lines.
Map | input vector map | |
List_break | list of lines (NULL for all lines in vector map) | |
List_ref | list of reference lines or NULL | |
type | feature type | |
[out] | Err | vector map where points at intersections will be written or NULL |
Definition at line 63 of file break_lines.c.
Break polygons in vector map.
Breaks lines specified by type in vector map. Points at intersections may be optionally written to error map. Input vector map must be opened on level 2 for update at least on GV_BUILD_BASE.
Function is optimized for closed polygons rings (e.g. imported from OGR) but with clean geometry - adjacent polygons mostly have identical boundary. Function creates database of ALL points in the vector map, and then is looking for those where polygons should be broken. Lines may be broken only at points existing in input vector map!
Map | input map where polygons will be broken |
type | type of line to be broken (GV_LINE or GV_BOUNDARY) |
Err | vector map where points at intersections will be written or NULL |
Definition at line 685 of file break_polygons.c.
int Vect_build | ( | struct Map_info * | Map | ) |
Build topology for vector map.
Map | vector map |
Definition at line 586 of file build.c.
References GV_BUILD_ALL, and Vect_build_partial().
Referenced by Vect_close().
int Vect_build_line_area | ( | struct Map_info * | Map, |
int | iline, | ||
int | side | ||
) |
Build area on given side of line (GV_LEFT or GV_RIGHT)
Map | pointer to Map_info structure |
iline | line id |
side | side (GV_LEFT or GV_RIGHT) |
Definition at line 79 of file build.c.
References _, dig_add_area(), dig_add_isle(), dig_build_area_with_line(), dig_find_area_poly(), dig_line_box(), dig_line_get_area(), G_debug(), G_fatal_error(), G_warning(), line_pnts::n_points, NULL, Map_info::plus, Vect__get_area_points(), Vect_line_prune(), and Vect_new_line_struct().
int Vect_build_nat | ( | struct Map_info * | Map, |
int | build | ||
) |
Build topology.
Map | vector map |
build | build level |
Definition at line 34 of file build_nat.c.
int Vect_build_ogr | ( | struct Map_info * | Map, |
int | build | ||
) |
Build pseudo-topology (simple features) for OGR layer.
Build levels:
Map | pointer to Map_info structure |
build | build level |
Definition at line 49 of file build_ogr.c.
References _, Format_info_offset::array, Plus_head::built, Format_info_ogr::ds, Format_info_ogr::dsn, Map_info::fInfo, G_debug(), G_fatal_error(), G_free(), G_message(), G_warning(), G_zero(), GV_BUILD_BASE, GV_BUILD_NONE, Format_info_ogr::layer, Format_info_ogr::layer_name, Format_info_ogr::offset, Format_info::ogr, Map_info::plus, Vect__build_sfa(), Vect_get_finfo_format_info(), and Vect_get_finfo_geometry_type().
int Vect_build_partial | ( | struct Map_info * | Map, |
int | build | ||
) |
Build partial topology for vector map.
Should only be used in special cases of vector processing.
This functions optionally builds only some parts of topology. Highest level is specified by build parameter which may be:
If functions is called with build lower than current value of the Map, the level is downgraded to requested value.
All calls to Vect_write_line(), Vect_rewrite_line(), Vect_delete_line() respect the last value of build used in this function.
Note that the functions has effect only if requested level is higher than current level, to rebuild part of topology, call first downgrade and then upgrade, for example:
Map | vector map |
build | highest level of build |
Definition at line 861 of file build.c.
References _, Plus_head::built, dig_cidx_free(), dig_cidx_init(), Map_info::fInfo, Map_info::format, G_debug(), G_fatal_error(), G_message(), GV_BUILD_ALL, GV_BUILD_NONE, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Map_info::head, Map_info::level, LEVEL_1, Format_info::pg, Map_info::plus, Plus_head::Spidx_built, Plus_head::spidx_with_z, Map_info::support_updated, Map_info::temporary, Format_info_pg::toposchema_name, TRUE, Vect_get_full_name(), Vect_open_sidx(), dig_head::with_z, and Plus_head::with_z.
Referenced by Vect_build().
int Vect_build_pg | ( | struct Map_info * | , |
int | |||
) |
int Vect_build_sidx | ( | struct Map_info * | Map | ) |
Create spatial index if necessary.
To be used in modules. Map must be opened on level 2.
[in,out] | Map | pointer to vector map |
Definition at line 1224 of file build.c.
References _, G_fatal_error(), Map_info::level, Map_info::plus, Plus_head::Spidx_built, and Vect_build_sidx_from_topo().
int Vect_build_sidx_from_topo | ( | struct Map_info * | Map | ) |
Create spatial index from topology if necessary (not longer supported)
Map | pointer to vector map |
Definition at line 1244 of file build.c.
References _, G_debug(), G_warning(), and Vect_get_full_name().
Referenced by Vect_build_sidx(), and Vect_sidx_dump().
int Vect_cat_del | ( | struct line_cats * | Cats, |
int | field | ||
) |
Delete all categories of given layer.
[in,out] | Cats | line_cats structure |
field | layer number |
Definition at line 222 of file vector/Vlib/cats.c.
References line_cats::cat, line_cats::field, and line_cats::n_cats.
Referenced by Vect_field_cat_del().
int Vect_cat_get | ( | const struct line_cats * | Cats, |
int | field, | ||
int * | cat | ||
) |
Get first found category of given field.
cat is set to first category found or -1 if field was not found
Cats | pointer line_cats structure | |
field | layer number | |
[out] | cat | pointer to variable where cat will be written (can be NULL) |
Definition at line 156 of file vector/Vlib/cats.c.
References line_cats::cat, line_cats::field, GV_FIELD_MAX, and line_cats::n_cats.
Referenced by NetA_initialise_varray().
int Vect_cat_in_array | ( | int | cat, |
const int * | array, | ||
int | ncats | ||
) |
Check if category is in ordered array of integers.
cat | category number |
array | ordered array of integers |
ncats | number of categories in array |
Definition at line 710 of file vector/Vlib/cats.c.
int Vect_cat_in_cat_list | ( | int | cat, |
const struct cat_list * | list | ||
) |
Check if category number is in list.
cat | category number |
list | cat_list structure |
Definition at line 544 of file vector/Vlib/cats.c.
References FALSE, max, and TRUE.
Referenced by Vect_cats_in_constraint().
int Vect_cat_list_to_array | ( | const struct cat_list * | list, |
int ** | vals, | ||
int * | nvals | ||
) |
Convert cat_list struct to ordered array of unique integers.
Output array do not contain duplicate items.
Allocated array should be freed by G_free().
Definition at line 489 of file vector/Vlib/cats.c.
int Vect_cat_set | ( | struct line_cats * | Cats, |
int | field, | ||
int | cat | ||
) |
Add new field/cat to category structure if doesn't exist yet.
[in,out] | Cats | line_cats structure |
[in] | field | layer number |
[in] | cat | category number |
Definition at line 103 of file vector/Vlib/cats.c.
References _, line_cats::alloc_cats, line_cats::cat, dig_alloc_cats(), line_cats::field, G_fatal_error(), GV_NCATS_MAX, and line_cats::n_cats.
Referenced by IL_write_point_2d().
Check if categories match with category constraints.
Definition at line 671 of file vector/Vlib/cats.c.
References _, line_cats::cat, line_cats::field, G_warning(), line_cats::n_cats, and Vect_cat_in_cat_list().
struct cat_list* Vect_cats_set_constraint | ( | struct Map_info * | Map, |
int | layer, | ||
char * | where, | ||
char * | catstr | ||
) |
Set category constraints using 'where' or 'cats' option and layer number.
Map | pointer to Map_info structure |
layer | layer number |
where | where statement |
catstr | category list as string |
Definition at line 566 of file vector/Vlib/cats.c.
References _, field_info::database, db_close_database_shutdown_driver(), db_select_int(), db_start_driver_open_database(), field_info::driver, G_fatal_error(), G_verbose_message(), G_warning(), field_info::key, list, n_, NULL, field_info::table, and Vect_get_field().
int Vect_check_dblink | ( | const struct dblinks * | p, |
int | field, | ||
const char * | name | ||
) |
Check if DB connection exists in dblinks structure.
p | pointer to existing dblinks structure |
field | layer number |
name | layer name |
Definition at line 252 of file field.c.
References dblinks::field, G_debug(), dblinks::n_fields, field_info::name, name, NULL, and field_info::number.
Referenced by Vect_map_check_dblink().
int Vect_check_input_output_name | ( | const char * | input, |
const char * | output, | ||
int | error | ||
) |
Check for input and output vector map name.
Check
input | input name |
output | output name |
error | error type G_FATAL_EXIT, G_FATAL_PRINT, G_FATAL_RETURN |
Definition at line 93 of file legal_vname.c.
Check for and count intersecting lines, do not break.
For details see Vect_check_line_breaks_list().
Map | input vector map | |
type | feature type | |
[out] | Err | vector map where points at intersections will be written or NULL |
Definition at line 82 of file break_lines.c.
int Vect_check_line_breaks_list | ( | struct Map_info * | Map, |
struct ilist * | List_break, | ||
struct ilist * | List_ref, | ||
int | type, | ||
struct Map_info * | Err | ||
) |
Check for and count intersecting lines, do not break.
If List_break is given, only lines in the list are checked for intersections.
If reference lines are given (List_ref) break only lines which intersect reference lines.
Map | input vector map | |
List_break | list of lines (NULL for all lines in vector map) | |
List_ref | list of reference lines or NULL | |
type | feature type | |
[out] | Err | vector map where points at intersections will be written or NULL |
Definition at line 105 of file break_lines.c.
void Vect_chtype_bridges | ( | struct Map_info * | Map, |
struct Map_info * | Err, | ||
int * | lines_changed, | ||
int * | bridges_changed | ||
) |
Change type of bridges in vector map.
Change the type of bridges (type boundary) connecting areas to islands or 2 islands. Islands and areas must be already clean, i.e. without dangles. Bridge may be formed by more lines. Optionally changed bridges are written to error map. Input map must be opened on level 2 for update at least on level GV_BUILD_BASE.
Map | input map where bridges are changed |
Err | vector map where changed bridges are written or NULL |
lines_changed | number of lines changed |
bridges_changed | Err number of bridges changed |
Change boundary dangles to lines.
Change boundary dangles to lines.
Boundary is considered to be a dangle if on at least one end node is no other boundary. If a dangle is formed by more boundaries, such string of boundaries is taken as one dangle.
Optionally deleted dangles are written to error map.
Input map must be opened on level 2 for update at least on GV_BUILD_BASE.
Map | input map where have to be deleted | |
maxlength | maxlength of dangles or -1 for all dangles | |
[out] | Err | vector map where deleted dangles are written or NULL |
int Vect_cidx_dump | ( | struct Map_info * | Map, |
FILE * | out | ||
) |
Write (dump) category index in text form to file.
Map | pointer to Map_info structure | |
[out] | out | output file |
Definition at line 420 of file Vlib/cindex.c.
References Cat_index::field, and G_debug().
void Vect_cidx_find_all | ( | struct Map_info * | Map, |
int | layer, | ||
int | type_mask, | ||
int | cat, | ||
struct ilist * | lines | ||
) |
Find all line/area id's for given category.
Map | pointer to Map_info structure | |
layer | layer number | |
type_mask | feature type of objects to search for | |
cat | category number | |
[out] | lines | array of ids of found lines/points |
Definition at line 373 of file Vlib/cindex.c.
int Vect_cidx_find_next | ( | struct Map_info * | Map, |
int | field_index, | ||
int | cat, | ||
int | type_mask, | ||
int | start_index, | ||
int * | type, | ||
int * | id | ||
) |
Find next line/area id for given category, start_index and type_mask.
Map | pointer to Map_info structure | |
field_index | layer index | |
cat | category number | |
type_mask | requested feature type | |
start_index | start search at this index (0 - whole category index) | |
[out] | type | returned type |
[out] | id | returned line/area id |
Definition at line 327 of file Vlib/cindex.c.
int Vect_cidx_get_cat_by_index | ( | struct Map_info * | Map, |
int | field_index, | ||
int | cat_index, | ||
int * | cat, | ||
int * | type, | ||
int * | id | ||
) |
Get category, feature type and id for given layer and category index.
Map | pointer to Map_info structure | |
field_index | layer index | |
cat_index | category index | |
[out] | cat | category number |
[out] | type | feature type |
[out] | id | feature id |
Definition at line 262 of file Vlib/cindex.c.
int Vect_cidx_get_field_index | ( | struct Map_info * | Map, |
int | field | ||
) |
Get layer index for given layer number.
Map | pointer to Map_info structure |
field | layer number |
Definition at line 115 of file Vlib/cindex.c.
References G_debug().
int Vect_cidx_get_field_number | ( | struct Map_info * | Map, |
int | index | ||
) |
Get layer number for given index.
G_fatal_error() is called when index not found.
Map | pointer to Map_info structure |
index | layer index: from 0 to Vect_cidx_get_num_fields() - 1 |
Definition at line 98 of file Vlib/cindex.c.
int Vect_cidx_get_num_cats_by_index | ( | struct Map_info * | Map, |
int | index | ||
) |
Get number of categories for given layer index.
Map | pointer to Map_info structure |
index | layer index |
Definition at line 161 of file Vlib/cindex.c.
int Vect_cidx_get_num_fields | ( | struct Map_info * | Map | ) |
Get number of layers in category index.
Map | pointer to Map_info structure |
Definition at line 81 of file Vlib/cindex.c.
int Vect_cidx_get_num_types_by_index | ( | struct Map_info * | Map, |
int | field_index | ||
) |
Get number of feature types for given layer index.
G_fatal_error() is called when index not found.
Map | pointer to Map_info structure |
field_index | layer index |
Definition at line 180 of file Vlib/cindex.c.
int Vect_cidx_get_num_unique_cats_by_index | ( | struct Map_info * | Map, |
int | index | ||
) |
Get number of unique categories for given layer index.
G_fatal_error() is called when index not found.
Map | pointer to Map_info structure |
index | layer index (starts at 0) |
Definition at line 144 of file Vlib/cindex.c.
int Vect_cidx_get_type_count | ( | struct Map_info * | Map, |
int | field, | ||
int | type | ||
) |
Get count of features of certain type by layer and type.
Map | pointer to Map_info structure |
field | layer number |
type | feature type |
Definition at line 223 of file Vlib/cindex.c.
int Vect_cidx_get_type_count_by_index | ( | struct Map_info * | Map, |
int | field_index, | ||
int | type_index, | ||
int * | type, | ||
int * | count | ||
) |
Get count of feature types for given field and type index.
Map | pointer to Map_info structure | |
field_index | layer index | |
type_index | type index | |
[out] | type | feature type (GV_POINT, ...) |
[out] | count | number of features or NULL |
Definition at line 200 of file Vlib/cindex.c.
int Vect_cidx_get_unique_cats_by_index | ( | struct Map_info * | Map, |
int | field_index, | ||
struct ilist * | list | ||
) |
Get list of unique categories for given layer index.
Map | pointer to Map_info structure | |
field_index | layer index | |
[out] | list | output list of cats |
Definition at line 288 of file Vlib/cindex.c.
int Vect_cidx_open | ( | struct Map_info * | Map, |
int | head_only | ||
) |
Read category index from cidx file if exists.
Map | pointer to Map_info structure |
head_only | read only header of the file |
Definition at line 522 of file Vlib/cindex.c.
References _, dig_file_init(), dig_read_cidx(), gvfile::file, G_debug(), G_fopen_old(), G_warning(), GPATH_MAX, GV_CIDX_ELEMENT, Map_info::mapset, Map_info::name, NULL, Map_info::plus, Vect__get_element_path(), Vect__get_path(), and Vect_get_full_name().
int Vect_cidx_save | ( | struct Map_info * | Map | ) |
Save category index to binary file (cidx)
Map | pointer to Map_info structure |
Definition at line 478 of file Vlib/cindex.c.
Clean small angles at nodes.
It may happen that even if the angle between 2 boundaries at node is very small, the calculated angle is 0 because of representation error. The map must be built at least on level GV_BUILD_BASE
Map | input map | |
otype | feature type | |
[out] | Err | vector map where error line segments are written |
Definition at line 33 of file clean_nodes.c.
int Vect_close | ( | struct Map_info * | Map | ) |
Close vector map.
Map | pointer to Map_info |
Definition at line 72 of file vector/Vlib/close.c.
References _, Plus_head::built, Format_info_pg::conninfo, Format_info_ogr::dsn, FALSE, Map_info::fInfo, Map_info::format, G_debug(), G_find_file2(), G_find_key_value(), G_fopen_old(), G_fread_key_value(), G_free(), G_mapset(), G_store(), G_strcasecmp(), G_warning(), GV_BUILD_ALL, GV_FORMAT_OGR, GV_FORMAT_POSTGIS, Map_info::level, Map_info::mapset, Map_info::name, Format_info::ogr, Format_info::pg, Map_info::plus, Map_info::support_updated, Map_info::temporary, TRUE, Vect_build(), Vect_close(), Vect_copy_head_data(), Vect_copy_map_dblinks(), Vect_copy_map_lines_field(), Vect_get_name(), Vect_hist_copy(), Vect_is_3d(), Vect_map_del_dblink(), and Vect_open_new().
Referenced by Vect_close().
Update Coor_info structure.
Definition at line 1010 of file vector/Vlib/open.c.
References _, Map_info::dig_fp, dig_fseek(), dig_ftell(), Map_info::format, G_debug(), G_warning(), GPATH_MAX, GV_COOR_ELEMENT, GV_FORMAT_NATIVE, GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Coor_info::mtime, Map_info::open, Coor_info::size, Vect__get_element_path(), and VECT_OPEN_CODE.
Referenced by V1_close_nat(), V1_open_old_nat(), and Vect_open_topo().
int Vect_copy | ( | const char * | in, |
const char * | mapset, | ||
const char * | out | ||
) |
Copy vector map including attribute tables.
Note: Output vector map is overwritten if exists!
in | name if vector map to be copied |
mapset | mapset name where the input map is located |
out | name for output vector map (new map is created in current mapset) |
Definition at line 125 of file map.c.
References _, G_debug(), G_fatal_error(), G_file_name(), G_find_vector2(), G_make_mapset_dir_object(), G_mapset(), G_name_is_fully_qualified(), G_warning(), GMAPSET_MAX, GNAME_MAX, GPATH_MAX, GV_CIDX_ELEMENT, GV_COOR_ELEMENT, GV_DIRECTORY, GV_FRMT_ELEMENT, GV_HEAD_ELEMENT, GV_HIST_ELEMENT, GV_SIDX_ELEMENT, GV_TOPO_ELEMENT, Map_info::mapset, NULL, Vect_delete(), and Vect_legal_filename().
Referenced by M_do_copy().
Copy header data from one to another map.
from | target vector map | |
[out] | to | destination vector map |
Definition at line 77 of file init_head.c.
References Vect_get_comment(), Vect_get_date(), Vect_get_map_date(), Vect_get_map_name(), Vect_get_organization(), Vect_get_person(), Vect_get_scale(), Vect_get_thresh(), Vect_get_zone(), Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), Vect_set_scale(), Vect_set_thresh(), and Vect_set_zone().
Referenced by Vect_close().
Copy DB links from input vector map to output vector map.
In | pointer to Map_info structure (input) |
Out | pointer to Map_info structure (output) |
first_only | TRUE to copy only first link otherwise all DB links are copied |
Definition at line 205 of file field.c.
References _, field_info::database, field_info::driver, G_warning(), field_info::key, field_info::name, field_info::number, field_info::table, Vect_get_dblink(), Vect_get_num_dblinks(), and Vect_map_add_dblink().
Referenced by Vect_close().
Copy all alive vector features from input vector map to output vector map.
In | input vector map | |
[out] | Out | output vector map |
Definition at line 63 of file vector/Vlib/copy.c.
References Vect_copy_map_lines_field().
Copy all alive vector features from given layer from input vector map to output vector map.
Note: Try to copy on level 2 otherwise level 1 is used.
In | input vector map | |
field | layer number (-1 for all layers) | |
[out] | Out | output vector map |
Definition at line 81 of file vector/Vlib/copy.c.
Referenced by Vect_close(), and Vect_copy_map_lines().
int Vect_copy_pnts_to_xyz | ( | const struct line_pnts * | Points, |
double * | x, | ||
double * | y, | ||
double * | z, | ||
int * | n | ||
) |
int Vect_copy_table | ( | struct Map_info * | In, |
struct Map_info * | Out, | ||
int | field_in, | ||
int | field_out, | ||
const char * | field_name, | ||
int | type | ||
) |
Copy attribute table linked to vector map based on type.
In | input vector map | |
[out] | Out | output vector map |
field_in | input layer number | |
field_out | output layer number | |
field_name | layer name (can be NULL) | |
type | how many tables are linked to map: GV_1TABLE / GV_MTABLE |
Definition at line 686 of file vector/Vlib/copy.c.
int Vect_copy_table_by_cat_list | ( | struct Map_info * | In, |
struct Map_info * | Out, | ||
int | field_in, | ||
int | field_out, | ||
const char * | field_name, | ||
int | type, | ||
const struct cat_list * | cat_list | ||
) |
Copy attribute table linked to vector map based on category list.
If cat_list is NULL, then Vect_copy_table() is called.
In | input vector map | |
[out] | Out | output vector map |
field_in | input layer number | |
field_out | output layer number | |
field_name | layer name (can be NULL) | |
type | how many tables are linked to map: GV_1TABLE / GV_MTABLE | |
cat_list | pointer to cat_list struct (can be NULL) |
Definition at line 710 of file vector/Vlib/copy.c.
int Vect_copy_table_by_cats | ( | struct Map_info * | In, |
struct Map_info * | Out, | ||
int | field_in, | ||
int | field_out, | ||
const char * | field_name, | ||
int | type, | ||
int * | cats, | ||
int | ncats | ||
) |
Copy attribute table linked to vector map based on category numbers.
In | input vector map | |
[out] | Out | output vector map |
field_in | input layer number | |
field_out | output layer number | |
field_name | layer name (can be NULL) | |
type | how many tables are linked to map: GV_1TABLE / GV_MTABLE | |
cats | pointer to array of cats or NULL | |
ncats | number of cats in 'cats' |
Definition at line 750 of file vector/Vlib/copy.c.
Copy attribute tables linked to vector map.
Copy all attribute tables linked to the vector map if field is 0, or selected attribute table defined by given field if field > 0.
Notice, that if input vector map has no tables defined, it will copy nothing and return 0 (success).
In | input vector map | |
[out] | Out | output vector map |
field | layer number (0 for all tables linked to the vector map) |
Definition at line 632 of file vector/Vlib/copy.c.
int Vect_copy_xyz_to_pnts | ( | struct line_pnts * | Points, |
const double * | x, | ||
const double * | y, | ||
const double * | z, | ||
int | n | ||
) |
struct field_info* Vect_default_field_info | ( | struct Map_info * | Map, |
int | field, | ||
const char * | field_name, | ||
int | type | ||
) |
Get default information about link to database for new dblink.
Map | pointer to Map_info structure |
field | layer number |
field_name | layer name |
type | how many tables are linked to map: GV_1TABLE / GV_MTABLE |
int Vect_delete | ( | const char * | map | ) |
Delete vector map including attribute tables.
Vector map must be located in current mapset.
map | name of vector map to be delete |
Definition at line 367 of file map.c.
References FALSE, and Vect__delete().
Referenced by M_do_remove(), and Vect_copy().
int Vect_delete_line | ( | struct Map_info * | Map, |
off_t | line | ||
) |
Delete existing feature (topological level required)
Note: Topology must be built at level >= GV_BUILD_BASE
A warning is printed on error.
Map | pointer to Map_info structure |
line | feature id (level 2) or feature offset (level 1) |
Definition at line 275 of file vector/Vlib/write.c.
void Vect_destroy_boxlist | ( | struct boxlist * | list | ) |
Frees all memory associated with a struct boxlist, including the struct itself.
[in,out] | list | pointer to ilist structure |
Definition at line 264 of file vector/Vlib/list.c.
void Vect_destroy_cat_list | ( | struct cat_list * | p | ) |
Frees allocated cat_list memory.
p | pointer to line_cats structure |
Definition at line 327 of file vector/Vlib/cats.c.
References G_free(), cat_list::max, cat_list::min, and cat_list::n_ranges.
void Vect_destroy_cats_struct | ( | struct line_cats * | p | ) |
Frees all memory associated with line_cats structure, including the struct itself.
p | line_cats structure |
Definition at line 79 of file vector/Vlib/cats.c.
References line_cats::cat, line_cats::field, G_free(), and line_cats::n_cats.
Referenced by NetA_initialise_varray().
void Vect_destroy_field_info | ( | struct field_info * | fi | ) |
Free a struct field_info and all memory associated with it.
[in,out] | fi | pointer to field_info structure |
Definition at line 633 of file field.c.
References field_info::database, field_info::driver, G_free(), field_info::key, field_info::name, NULL, and field_info::table.
void Vect_destroy_line_struct | ( | struct line_pnts * | p | ) |
Frees all memory associated with a line_pnts structure, including the structure itself.
p | pointer to line_pnts structure |
Definition at line 77 of file line.c.
References line_pnts::alloc_points, G_free(), line_pnts::x, line_pnts::y, and line_pnts::z.
Referenced by Vect__free_cache(), and vector2perimeters().
void Vect_destroy_list | ( | struct ilist * | list | ) |
Frees all memory associated with a struct ilist, including the struct itself.
[in,out] | list | pointer to ilist structure |
Definition at line 69 of file vector/Vlib/list.c.
void Vect_destroy_map_struct | ( | struct Map_info * | p | ) |
int Vect_fidx_dump | ( | struct Map_info * | Map, |
FILE * | out | ||
) |
Dump feature index to file.
Map | pointer to Map_info struct |
out | file for output (stdout/stderr for example) |
Definition at line 750 of file build_sfa.c.
References _, Format_info_offset::array, Format_info_offset::array_num, Map_info::fInfo, Map_info::format, G_warning(), GV_FORMAT_OGR, GV_FORMAT_POSTGIS, Format_info_ogr::offset, Format_info_pg::offset, Format_info::ogr, Format_info::pg, Format_info_pg::toposchema_name, Vect_get_finfo_geometry_type(), Vect_get_num_lines(), Vect_maptype(), and Vect_maptype_info().
int Vect_field_cat_del | ( | struct line_cats * | Cats, |
int | field, | ||
int | cat | ||
) |
Delete field/cat from line_cats structure.
[in,out] | Cats | line_cats structure |
field | layer number | |
cat | category to be deleted or -1 to delete all cats of given field |
Definition at line 257 of file vector/Vlib/cats.c.
References line_cats::cat, line_cats::field, line_cats::n_cats, and Vect_cat_del().
Get list of categories of given field.
Cats | line_cats structure | |
field | layer number | |
[out] | cats | pointer to list where cats will be written |
Definition at line 192 of file vector/Vlib/cats.c.
References line_cats::cat, line_cats::field, GV_FIELD_MAX, line_cats::n_cats, ilist::n_values, Vect_list_append(), and Vect_reset_list().
int Vect_find_area | ( | struct Map_info * | Map, |
double | x, | ||
double | y | ||
) |
Find the nearest area.
Map | vector map |
x,y | point coordinates |
Definition at line 258 of file vector/Vlib/find.c.
References bound_box::B, boxlist::box, bound_box::E, G_debug(), G_malloc, G_realloc, boxlist::id, bound_box::N, boxlist::n_values, NULL, Map_info::plus, PORT_DOUBLE_MAX, bound_box::S, bound_box::T, Vect_new_boxlist(), Vect_select_areas_by_box(), bound_box::W, and x.
int Vect_find_island | ( | struct Map_info * | Map, |
double | x, | ||
double | y | ||
) |
Find the nearest island.
Map | vector map |
x,y | points coordinates |
Definition at line 362 of file vector/Vlib/find.c.
int Vect_find_line | ( | struct Map_info * | map, |
double | ux, | ||
double | uy, | ||
double | uz, | ||
int | type, | ||
double | maxdist, | ||
int | with_z, | ||
int | exclude | ||
) |
Find the nearest line.
map | vector map |
ux,uy,uz | points coordinates |
type | feature type (GV_LINE, GV_POINT, GV_BOUNDARY or GV_CENTROID) if only want to search certain types of lines or -1 if search all lines |
maxdist | max distance from the line |
with_z | 3D (WITH_Z, WITHOUT_Z) |
exclude | if > 0 number of line which should be excluded from selection. May be useful if we need line nearest to other one. |
Definition at line 126 of file vector/Vlib/find.c.
int Vect_find_line_list | ( | struct Map_info * | map, |
double | ux, | ||
double | uy, | ||
double | uz, | ||
int | type, | ||
double | maxdist, | ||
int | with_z, | ||
const struct ilist * | exclude, | ||
struct ilist * | found | ||
) |
Find the nearest line(s).
map | vector map |
ux,uy,uz | points coordinates |
type | feature type (GV_LINE, GV_POINT, GV_BOUNDARY or GV_CENTROID) if only want to search certain types of lines or -1 if search all lines |
maxdist | max distance from the line |
with_z | 3D (WITH_Z, WITHOUT_Z) |
exclude | list of lines which should be excluded from selection |
found | list of found lines (or NULL) |
Definition at line 159 of file vector/Vlib/find.c.
int Vect_find_node | ( | struct Map_info * | Map, |
double | ux, | ||
double | uy, | ||
double | uz, | ||
double | maxdist, | ||
int | with_z | ||
) |
Find the nearest node.
Map | vector map |
ux,uy,uz | point coordinates |
maxdist | max distance from the line |
with_z | 3D (WITH_Z, WITHOUT_Z) |
Definition at line 56 of file vector/Vlib/find.c.
References bound_box::B, bound_box::E, G_debug(), HUGE_VAL, bound_box::N, PORT_DOUBLE_MAX, bound_box::S, bound_box::T, ilist::value, Vect_get_node_coor(), Vect_new_list(), Vect_points_distance(), Vect_select_nodes_by_box(), bound_box::W, and x.
int Vect_find_poly_centroid | ( | const struct line_pnts * | points, |
double * | cent_x, | ||
double * | cent_y | ||
) |
Get centroid of polygon.
points | polygon | |
[out] | cent_x,cent_y | centroid coordinates |
Definition at line 355 of file Vlib/poly.c.
References line_pnts::n_points, line_pnts::x, and line_pnts::y.
double Vect_get_area_area | ( | struct Map_info * | Map, |
int | area | ||
) |
Returns area of area without areas of isles.
Map | pointer to Map_info structure |
area | area id |
Definition at line 375 of file vector/Vlib/area.c.
Creates list of boundaries for given area.
Note that ids in List can be negative. The sign indicates in which direction the boundary should be read (negative for backward).
Map | pointer to Map_info structure | |
area | area id | |
[out] | List | pointer to list of boundaries |
Definition at line 139 of file vector/Vlib/area.c.
Get bounding box of area.
Vector map must be open at topological level and built with level >= GV_BUILD_AREAS.
Map | vector map | |
area | area id | |
[out] | Box | bounding box |
Definition at line 300 of file vector/Vlib/box.c.
References _, Plus_head::Area, Box, dig_find_area_box(), G_warning(), Plus_head::n_areas, NULL, Map_info::plus, PORT_DOUBLE_MAX, and Vect_is_3d().
Referenced by Vect__insert_face_pg(), and Vect_attach_isles().
int Vect_get_area_cat | ( | struct Map_info * | Map, |
int | area, | ||
int | field | ||
) |
Find FIRST category of given field and area.
Map | pointer to Map_info structure |
area | area id |
field | layer number |
Definition at line 450 of file vector/Vlib/area.c.
References line_cats::cat, line_cats::field, line_cats::n_cats, NULL, Vect_get_area_cats(), Vect_new_cats_struct(), and Vect_reset_cats().
Referenced by vector2perimeters(), and Vedit_delete_areas_cat().
Get area categories.
Map | pointer to Map_info structure | |
area | area id | |
[out] | Cats | list of categories |
Definition at line 423 of file vector/Vlib/area.c.
References NULL, Vect_get_area_centroid(), Vect_read_line(), and Vect_reset_cats().
Referenced by Vect_get_area_cat().
int Vect_get_area_centroid | ( | struct Map_info * | Map, |
int | area | ||
) |
Returns centroid id for given area.
Map | pointer to Map_info structure |
area | area id |
Definition at line 110 of file vector/Vlib/area.c.
References _, Plus_head::Area, P_area::centroid, G_debug(), G_fatal_error(), NULL, and Map_info::plus.
Referenced by Vect_get_area_cats().
int Vect_get_area_isle | ( | struct Map_info * | Map, |
int | area, | ||
int | isle | ||
) |
Returns isle id for area.
Map | pointer to Map_info structure |
area | area id |
isle | isle index (0 .. nisles - 1) |
Definition at line 236 of file vector/Vlib/area.c.
References _, Plus_head::Area, G_debug(), G_fatal_error(), P_area::isles, NULL, and Map_info::plus.
int Vect_get_area_num_isles | ( | struct Map_info * | Map, |
int | area | ||
) |
Returns number of isles for given area.
Map | pointer to Map_info structure |
area | area id |
Definition at line 208 of file vector/Vlib/area.c.
References _, Plus_head::Area, G_debug(), G_fatal_error(), P_area::n_isles, NULL, and Map_info::plus.
double Vect_get_area_perimeter | ( | struct Map_info * | Map, |
int | area | ||
) |
Returns perimeter of area with perimeter of isles.
Map | pointer to Map_info structure |
area | area id |
Definition at line 290 of file vector/Vlib/area.c.
Returns polygon array of points (outer ring) of given area.
Map | pointer to Map_info structure | |
area | area id | |
[out] | BPoints | points array |
Definition at line 37 of file vector/Vlib/area.c.
References _, Plus_head::Area, G_debug(), G_warning(), P_area::lines, P_area::n_lines, NULL, Map_info::plus, Vect__get_area_points(), and Vect_reset_line().
Referenced by vector2perimeters().
GEOSCoordSequence* Vect_get_area_points_geos | ( | struct Map_info * | Map, |
int | area | ||
) |
Returns the polygon array of points, i.e. outer ring (shell)
You should free allocated memory by GEOSCoordSeq_destroy().
See also Vect_get_area_points().
Map | pointer to Map_info |
area | area id |
Definition at line 411 of file geos.c.
References _, Plus_head::Area, G_debug(), G_warning(), NULL, and Map_info::plus.
int Vect_get_built | ( | struct Map_info * | Map | ) |
Return current highest built level (part)
Map | vector map |
Definition at line 757 of file build.c.
References Plus_head::built, and Map_info::plus.
int Vect_get_centroid_area | ( | struct Map_info * | Map, |
int | centroid | ||
) |
Get area id the centroid is within.
Map | pointer to Map_info struct |
centroid | centroid id |
Definition at line 429 of file level_two.c.
Referenced by Vedit_delete_area_centroid().
const char* Vect_get_column_names | ( | struct Map_info * | Map, |
int | field | ||
) |
Fetches list of DB column names of vector map attribute table.
Map | vector map |
field | layer number |
Definition at line 37 of file dbcolumns.c.
const char* Vect_get_column_names_types | ( | struct Map_info * | Map, |
int | field | ||
) |
Fetches list of DB column names and types of vector map attribute table.
Map | vector map |
field | layer number |
Definition at line 149 of file dbcolumns.c.
const char* Vect_get_column_types | ( | struct Map_info * | Map, |
int | field | ||
) |
Fetches list of DB column types of vector map attribute table.
Map | vector map |
field | layer number |
Definition at line 92 of file dbcolumns.c.
const char* Vect_get_comment | ( | struct Map_info * | Map | ) |
Get comment or other info string from map header.
Map | pointer to Map_info structure |
Definition at line 453 of file vector/Vlib/header.c.
References dig_head::comment, and Map_info::head.
Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().
Get constraint box.
Constraint box can be defined by Vect_set_constraint_region().
Map | vector map | |
[out] | Box | bounding box |
Definition at line 79 of file constraint.c.
References bound_box::B, Map_info::box, Box, Map_info::constraint, bound_box::E, bound_box::N, Map_info::region_flag, bound_box::S, bound_box::T, and bound_box::W.
Referenced by V1_read_next_line_nat().
const char* Vect_get_date | ( | struct Map_info * | Map | ) |
Get date of digitization from map header.
Map | pointer to Map_info structure |
Definition at line 314 of file vector/Vlib/header.c.
References dig_head::date, and Map_info::head.
Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().
struct field_info* Vect_get_dblink | ( | struct Map_info * | Map, |
int | link | ||
) |
Get information about link to database.
Variables are substituted by values, link is index to array of dblinks.
Map | pointer to Map_info structure |
link | link id |
Definition at line 475 of file field.c.
References _, field_info::database, Map_info::dblnk, field_info::driver, dblinks::field, G_debug(), G_malloc, G_store(), G_warning(), field_info::key, dblinks::n_fields, field_info::name, NULL, field_info::number, field_info::table, and Vect_subst_var().
Referenced by Vect_copy_map_dblinks(), Vect_get_field(), Vect_get_field2(), and Vect_get_field_by_name().
struct field_info* Vect_get_field | ( | struct Map_info * | Map, |
int | field | ||
) |
Get information about link to database (by layer number)
Variables are substituted by values, field is number of requested field.
Map | pointer to Map_info structure |
field | layer number |
Definition at line 515 of file field.c.
References Map_info::dblnk, dblinks::field, G_debug(), dblinks::n_fields, NULL, field_info::number, and Vect_get_dblink().
Referenced by Vect_cats_set_constraint(), and Vect_get_field2().
struct field_info* Vect_get_field2 | ( | struct Map_info * | Map, |
const char * | field | ||
) |
Get information about link to database (by layer number or layer name)
Note: if field is -1 then the function returns the first dblink or NULL
Map | pointer to Map_info structure |
field | layer number or name |
Definition at line 571 of file field.c.
References G_debug(), NULL, Vect_get_dblink(), Vect_get_field(), Vect_get_field_by_name(), and Vect_get_num_dblinks().
Referenced by Vect_get_field_number().
struct field_info* Vect_get_field_by_name | ( | struct Map_info * | Map, |
const char * | field | ||
) |
Get information about link to database (by layer name)
Map | pointer to Map_info structure |
field | layer name |
Definition at line 541 of file field.c.
References Map_info::dblnk, dblinks::field, G_debug(), dblinks::n_fields, field_info::name, NULL, and Vect_get_dblink().
Referenced by Vect_get_field2().
int Vect_get_field_number | ( | struct Map_info * | Map, |
const char * | field | ||
) |
Get field number of given field.
Map | pointer to Map_info structure |
field | layer name |
Definition at line 608 of file field.c.
References G_debug(), field_info::number, Vect_get_field2(), and Vect_get_num_dblinks().
Referenced by vector2perimeters().
const struct Format_info* Vect_get_finfo | ( | struct Map_info * | Map | ) |
Get header info for non-native formats.
Map | pointer to Map_info structure |
Definition at line 224 of file header_finfo.c.
References Format_info_pg::conninfo, Format_info_ogr::driver_name, Map_info::fInfo, NULL, Format_info::ogr, and Format_info::pg.
const char* Vect_get_finfo_dsn_name | ( | struct Map_info * | Map | ) |
Get datasource name (relevant only for non-native formats)
Returns:
Map | pointer to Map_info structure |
Definition at line 37 of file header_finfo.c.
References _, Format_info_pg::db_name, Format_info_ogr::dsn, Map_info::fInfo, Map_info::format, G_debug(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, NULL, Format_info::ogr, Format_info::pg, and Vect_get_full_name().
const char* Vect_get_finfo_format_info | ( | struct Map_info * | Map | ) |
Get format info as string (relevant only for non-native formats)
Map | pointer to Map_info structure |
Definition at line 108 of file header_finfo.c.
References _, Format_info_ogr::ds, Map_info::fInfo, Map_info::format, G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, NULL, and Format_info::ogr.
Referenced by Vect_build_ogr(), and Vect_build_pg().
const char* Vect_get_finfo_geometry_type | ( | struct Map_info * | Map | ) |
Get geometry type as string (relevant only for non-native formats)
Note: All inner spaces are removed, function returns feature type in lowercase.
Map | pointer to Map_info structure |
Definition at line 143 of file header_finfo.c.
References _, Format_info_pg::conn, DB_SQL_MAX, Map_info::fInfo, Map_info::format, G_debug(), G_free(), G_malloc, G_store(), G_str_replace(), G_str_to_lower(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Format_info_ogr::layer, NULL, Format_info::ogr, Format_info::pg, Format_info_pg::res, Format_info_pg::schema_name, and Format_info_pg::table_name.
Referenced by Vect_build_ogr(), Vect_build_pg(), and Vect_fidx_dump().
char* Vect_get_finfo_layer_name | ( | struct Map_info * | Map | ) |
Get layer name (relevant only for non-native formats)
Returns:
Note: allocated string should be freed by G_free()
Map | pointer to Map_info structure |
Definition at line 73 of file header_finfo.c.
References _, Map_info::fInfo, Map_info::format, G_asprintf(), G_debug(), G_store(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Format_info_ogr::layer_name, name, NULL, Format_info::ogr, Format_info::pg, Format_info_pg::schema_name, Format_info_pg::table_name, and Vect_get_full_name().
int Vect_get_finfo_topology_info | ( | struct Map_info * | Map, |
char ** | toposchema, | ||
char ** | topogeom, | ||
int * | topo_geo_only | ||
) |
Get topology type (relevant only for non-native formats)
Map | pointer to Map_info structure | |
[out] | toposchema | Topology schema name or NULL |
[out] | topogeom | TopoGeometry column name or NULL |
[out] | topo_geo_only | TRUE for Topo-Geo data model or NULL |
Definition at line 247 of file header_finfo.c.
References _, Map_info::fInfo, Map_info::format, G_store(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, GV_TOPO_NATIVE, GV_TOPO_POSTGIS, GV_TOPO_PSEUDO, Format_info::pg, Format_info_pg::topo_geo_only, Format_info_pg::topogeom_column, and Format_info_pg::toposchema_name.
const char* Vect_get_full_name | ( | struct Map_info * | Map | ) |
Get fully qualified name of vector map.
Allocated string should be freed by G_free().
Map | pointer to Map_info structure |
Definition at line 221 of file vector/Vlib/header.c.
References Format_info_ogr::dsn, Map_info::fInfo, Map_info::format, G_malloc, GV_FORMAT_OGR_DIRECT, Format_info_ogr::layer_name, Map_info::mapset, Map_info::name, and Format_info::ogr.
Referenced by V1_open_old_nat(), V2_open_old_ogr(), V2_open_old_pg(), Vect__read_head(), Vect__write_head(), Vect_build_partial(), Vect_build_sidx_from_topo(), Vect_cidx_open(), Vect_get_finfo_dsn_name(), Vect_get_finfo_layer_name(), Vect_open_fidx(), and Vect_sfa_get_num_features().
int Vect_get_isle_area | ( | struct Map_info * | Map, |
int | isle | ||
) |
Returns area id for isle.
Map | vector |
isle | isle number (0 .. nisles - 1) |
Definition at line 263 of file vector/Vlib/area.c.
References _, P_isle::area, G_debug(), G_fatal_error(), Plus_head::Isle, NULL, and Map_info::plus.
Creates list of boundaries for given isle.
Note that ids in List can be negative. The sign indicates in which direction the boundary should be read (negative for forward).
Map | pointer to Map_info structure | |
isle | island number | |
[out] | List | pointer to list where boundaries are stored |
Definition at line 175 of file vector/Vlib/area.c.
Get bounding box of isle.
Vector map must be open at topological level and built with level >= GV_BUILD_AREAS.
Map | vector map | |
isle | isle id | |
[out] | Box | bounding box |
Definition at line 345 of file vector/Vlib/box.c.
References _, Box, dig_find_isle_box(), G_warning(), Plus_head::Isle, Plus_head::n_isles, NULL, Map_info::plus, PORT_DOUBLE_MAX, and Vect_is_3d().
Referenced by Vect__insert_face_pg().
Returns polygon array of points for given isle.
Map | pointer to Map_info structure | |
isle | island id | |
[out] | BPoints | points array |
Definition at line 68 of file vector/Vlib/area.c.
References _, Format_info_pg::cache, Format_info_cache::ctype, Map_info::fInfo, Map_info::format, G_debug(), G_fatal_error(), G_warning(), GV_FORMAT_POSTGIS, Plus_head::Isle, P_isle::lines, P_isle::n_lines, NULL, Format_info::pg, Map_info::plus, Format_info_pg::toposchema_name, Vect__get_area_points_nat(), Vect__get_area_points_pg(), and Vect_reset_line().
GEOSCoordSequence* Vect_get_isle_points_geos | ( | struct Map_info * | Map, |
int | isle | ||
) |
Returns the polygon (isle) array of points (inner ring)
You should free allocated memory by GEOSCoordSeq_destroy().
See also Vect_get_isle_points().
Map | pointer to Map_info |
isle | isel id |
Definition at line 442 of file geos.c.
References G_debug(), Plus_head::Isle, and Map_info::plus.
int Vect_get_line_areas | ( | struct Map_info * | Map, |
int | line, | ||
int * | left, | ||
int * | right | ||
) |
Get area id on the left and right side of the boundary.
Negative area id indicates an isle.
Map | pointer to Map_info struct | |
line | line id | |
[out] | left,right | area id on the left and right side |
Definition at line 346 of file level_two.c.
Get bounding box of given feature.
Vector map must be open at topological level and built with level >= GV_BUILD_BASE.
Map | vector map | |
line | feature id | |
[out] | Box | bounding box |
Definition at line 235 of file vector/Vlib/box.c.
int Vect_get_line_cat | ( | struct Map_info * | Map, |
int | line, | ||
int | field | ||
) |
int Vect_get_line_nodes | ( | struct Map_info * | Map, |
int | line, | ||
int * | n1, | ||
int * | n2 | ||
) |
Get line nodes.
Map | pointer to Map_info struct |
line | line id |
n1 | (start node), n2 (end node) ids of line nodes (or NULL) |
Definition at line 303 of file level_two.c.
off_t Vect_get_line_offset | ( | struct Map_info * | Map, |
int | line | ||
) |
Get feature offset (topological level required)
Note: Topology must be built at level >= GV_BUILD_BASE
Used for Vect_restore_line().
Map | pointer to Map_info structure |
line | feature id |
Definition at line 303 of file vector/Vlib/read.c.
int Vect_get_line_type | ( | struct Map_info * | Map, |
int | line | ||
) |
Get line type.
Map | pointer to Map_info struct |
line | line id |
Definition at line 254 of file level_two.c.
Get bounding box of map (all features in the map)
Requires level 2. On level 1 error code is returned.
Map | vector map | |
[out] | Box | bounding box |
Definition at line 388 of file vector/Vlib/box.c.
References Plus_head::box, Box, Map_info::plus, Vect_box_copy(), and Vect_level().
Get bounding box of map on level 1 (all features in the map)
This subroutine determines bounding box by reading all features sequentially.
Map | vector map | |
[out] | Box | bounding box |
Definition at line 413 of file vector/Vlib/box.c.
const char* Vect_get_map_date | ( | struct Map_info * | Map | ) |
Get date when the source map was originally produced from map header.
Map | pointer to Map_info structure |
Definition at line 398 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::source_date.
Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().
const char* Vect_get_map_name | ( | struct Map_info * | Map | ) |
Get map name from map header.
Map | pointer to Map_info structure |
Definition at line 370 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::map_name.
Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().
const char* Vect_get_mapset | ( | struct Map_info * | Map | ) |
Get name of mapset where vector map lives.
Map | pointer to Map_info structure |
Definition at line 204 of file vector/Vlib/header.c.
References Map_info::mapset.
const char* Vect_get_name | ( | struct Map_info * | Map | ) |
Get name of vector map.
Map | pointer to Map_info structure |
Definition at line 192 of file vector/Vlib/header.c.
References Map_info::name.
Referenced by Vect_close(), Vect_save_sidx(), and Vect_write_dblinks().
int Vect_get_next_line_id | ( | struct Map_info * | Map | ) |
Get line id for sequential reading.
This function returns id of feature which has been read by calling Vect_read_next_line().
Map | pointer to Map_info struct |
Definition at line 97 of file vector/Vlib/read.c.
References _, G_debug(), G_warning(), Map_info::next_line, and VECT_OPEN.
int Vect_get_node_coor | ( | struct Map_info * | Map, |
int | num, | ||
double * | x, | ||
double * | y, | ||
double * | z | ||
) |
Get node coordinates.
Map | pointer to Map_info struct | |
num | node id (starts at 1) | |
[out] | x,y,z | coordinates values (for 2D coordinates z is NULL) |
Definition at line 274 of file level_two.c.
References _, G_warning(), Plus_head::n_nodes, Plus_head::Node, NULL, Map_info::plus, P_node::x, x, P_node::y, and P_node::z.
Referenced by Vect_find_node().
int Vect_get_node_line | ( | struct Map_info * | Map, |
int | node, | ||
int | line | ||
) |
Get line id for node line index.
Map | pointer to Map_info struct |
node | node id |
line | line index (range: 0 - Vect_get_node_n_lines()) |
Definition at line 396 of file level_two.c.
float Vect_get_node_line_angle | ( | struct Map_info * | Map, |
int | node, | ||
int | line | ||
) |
Angle of segment of the line connected to the node.
Map | pointer to Map_info struct |
node | node number |
line | line index (range: 0 - Vect_get_node_n_lines()) |
Definition at line 412 of file level_two.c.
int Vect_get_node_n_lines | ( | struct Map_info * | Map, |
int | node | ||
) |
Get number of lines for node.
Map | pointer to Map_info struct |
node | node id |
Definition at line 380 of file level_two.c.
Get number of areas in vector map.
Map | pointer to Map_info struct |
Definition at line 87 of file level_two.c.
References Plus_head::n_areas, and Map_info::plus.
Referenced by vector2perimeters(), and Vedit_delete_areas_cat().
int Vect_get_num_dblinks | ( | struct Map_info * | Map | ) |
Get number of defined dblinks.
Map | pointer to Map_info struct |
Definition at line 159 of file level_two.c.
References Map_info::dblnk, and dblinks::n_fields.
Referenced by Vect_copy_map_dblinks(), Vect_get_field2(), and Vect_get_field_number().
Get number of faces in vector map.
Map | pointer to Map_info struct |
Definition at line 111 of file level_two.c.
References Plus_head::n_flines, and Map_info::plus.
Fetch number of holes in vector map.
Map | pointer to Map_info struct |
Definition at line 147 of file level_two.c.
References Plus_head::n_holes, and Map_info::plus.
Get number of islands in vector map.
Map | pointer to Map_info struct |
Definition at line 135 of file level_two.c.
References Plus_head::n_isles, and Map_info::plus.
Fetch number of kernels in vector map.
Map | pointer to Map_info struct |
Definition at line 99 of file level_two.c.
References Plus_head::n_klines, and Map_info::plus.
int Vect_get_num_line_points | ( | const struct line_pnts * | Points | ) |
Fetch number of features (points, lines, boundaries, centroids) in vector map.
Map | pointer to Map_info struct |
Definition at line 75 of file level_two.c.
References Plus_head::n_lines, and Map_info::plus.
Referenced by NetA_initialise_varray(), and Vect_fidx_dump().
Get number of nodes in vector map.
Map | pointer to Map_info struct |
Definition at line 34 of file level_two.c.
References Plus_head::n_nodes, and Map_info::plus.
Get number of primitives in vector map.
Map | pointer to Map_info struct |
type | feature type |
Definition at line 47 of file level_two.c.
int Vect_get_num_updated_lines | ( | struct Map_info * | Map | ) |
Get number of updated features.
Note: Vect_set_updated() must be called to maintain list of updated features
Map | pointer to Map_info struct |
Definition at line 175 of file level_two.c.
References Plus_head::n_uplines, Map_info::plus, and Plus_head::uplist.
int Vect_get_num_updated_nodes | ( | struct Map_info * | Map | ) |
Get number of updated nodes.
Map | pointer to Map_info struct |
Definition at line 219 of file level_two.c.
References Plus_head::n_upnodes, Map_info::plus, and Plus_head::uplist.
Fetch number of volumes in vector map.
Map | pointer to Map_info struct |
Definition at line 123 of file level_two.c.
References Plus_head::n_volumes, and Map_info::plus.
const char* Vect_get_organization | ( | struct Map_info * | Map | ) |
Get organization string from map header.
Map | pointer to Map_info structure |
Definition at line 283 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::organization.
Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().
const char* Vect_get_person | ( | struct Map_info * | Map | ) |
Get user name string who digitized the map from map header.
Map | pointer to Map_info structure |
Definition at line 342 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::user_name.
Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().
int Vect_get_point_in_area | ( | struct Map_info * | Map, |
int | area, | ||
double * | X, | ||
double * | Y | ||
) |
Get point inside area and outside all islands.
Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUT of the polygon. Pick the largest IN segment and take the midpoint.
Map | vector map | |
area | area id | |
[out] | X,Y | point coordinateds |
Definition at line 55 of file Vlib/poly.c.
int Vect_get_point_in_poly | ( | const struct line_pnts * | Points, |
double * | X, | ||
double * | Y | ||
) |
Get point inside polygon.
This does NOT consider ISLANDS!
Points | polygon | |
[out] | X,Y | point coordinates |
Definition at line 208 of file Vlib/poly.c.
int Vect_get_point_in_poly_isl | ( | const struct line_pnts * | Points, |
const struct line_pnts ** | IPoints, | ||
int | n_isles, | ||
double * | att_x, | ||
double * | att_y | ||
) |
Get point inside polygon but outside the islands specifiled in IPoints.
Take a line and intersect it with the polygon and any islands. sort the list of X values from these intersections. This will be a list of segments alternating IN/OUT/IN/OUT of the polygon. Pick the largest IN segment and take the midpoint.
Points | polygon (boundary) | |
IPoints | isles (list of isle boundaries) | |
n_isles | number of isles | |
[out] | att_x,att_y | point coordinates |
Definition at line 449 of file Vlib/poly.c.
int Vect_get_proj | ( | struct Map_info * | Map | ) |
Get projection from map header.
Map | pointer to Map_info structure |
Definition at line 519 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::proj.
Referenced by Vect__write_head(), and Vect_get_proj_name().
const char* Vect_get_proj_name | ( | struct Map_info * | Map | ) |
Query cartographic projection name of pointer to Map_info structure.
Returns a pointer to a string which is a printable name for projection code proj (as returned by Vect_get_proj()).
Map | pointer to Map_info structure |
Definition at line 536 of file vector/Vlib/header.c.
References _, G_database_projection_name(), G_debug(), G_projection_name(), G_store(), name, PROJECTION_LL, PROJECTION_OTHER, PROJECTION_UTM, PROJECTION_XY, strcpy, and Vect_get_proj().
int Vect_get_scale | ( | struct Map_info * | Map | ) |
Get map scale from map header.
Map | pointer to Map_info structure |
Definition at line 425 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::orig_scale.
Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().
double Vect_get_thresh | ( | struct Map_info * | Map | ) |
Get threshold used for digitization from map header.
Map | pointer to Map_info structure |
Definition at line 585 of file vector/Vlib/header.c.
References dig_head::digit_thresh, and Map_info::head.
Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().
int Vect_get_updated_line | ( | struct Map_info * | Map, |
int | idx | ||
) |
Get updated line by index.
Note: Vect_set_updated() must be called to maintain list of updated features
Map | pointer to Map_info struct |
idx | index |
Definition at line 191 of file level_two.c.
References Map_info::plus, Plus_head::uplines, and Plus_head::uplist.
off_t Vect_get_updated_line_offset | ( | struct Map_info * | Map, |
int | idx | ||
) |
Get updated line offset by index.
Note: Vect_set_updated() must be called to maintain list of updated features
Map | pointer to Map_info struct |
idx | index |
Definition at line 207 of file level_two.c.
References Map_info::plus, Plus_head::uplines_offset, and Plus_head::uplist.
int Vect_get_updated_node | ( | struct Map_info * | Map, |
int | idx | ||
) |
Get updated (modified) node by index.
Note: Vect_set_updated() must be called to maintain list of updated features
Negative id:
Map | pointer to Map_info struct |
idx | index |
Definition at line 241 of file level_two.c.
References Map_info::plus, Plus_head::uplist, and Plus_head::upnodes.
int Vect_get_zone | ( | struct Map_info * | ) |
Referenced by Vect_copy_head_data(), and Vect_write_ascii_head().
void Vect_graph_add_edge | ( | dglGraph_s * | graph, |
int | from, | ||
int | to, | ||
double | costs, | ||
int | id | ||
) |
Add edge to graph.
Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000. Costs -1 for infinity i.e. arc or node is closed and cannot be traversed.
graph | pointer to graph structure |
from | from node |
to | to node |
costs | costs value |
id | edge id |
Definition at line 124 of file vector/Vlib/graph.c.
References _, dglAddEdge(), G_debug(), and G_fatal_error().
void Vect_graph_build | ( | dglGraph_s * | graph | ) |
Build network graph.
Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000. Costs -1 for infinity i.e. arc or node is closed and cannot be traversed.
graph | pointer to graph structure |
Definition at line 98 of file vector/Vlib/graph.c.
References _, dglFlatten(), G_debug(), and G_fatal_error().
void Vect_graph_init | ( | dglGraph_s * | graph, |
int | nodes_costs | ||
) |
Initialize graph structure.
graph | pointer to graph structure |
nodes_costs | use node costs |
Definition at line 72 of file vector/Vlib/graph.c.
References dglInitialize(), and G_debug().
void Vect_graph_set_node_costs | ( | dglGraph_s * | graph, |
int | node, | ||
double | costs | ||
) |
Set node costs.
Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000. Costs -1 for infinity i.e. arc or node is closed and cannot be traversed.
graph | pointer to graph structure |
node | node id |
costs | costs value |
Definition at line 154 of file vector/Vlib/graph.c.
References dglGetNode(), dglNodeSet_Attr(), and G_debug().
int Vect_graph_shortest_path | ( | dglGraph_s * | graph, |
int | from, | ||
int | to, | ||
struct ilist * | List, | ||
double * | cost | ||
) |
Find shortest path.
Costs for 'from' and 'to' nodes are not considered (SP found even if 'from' or 'to' are 'closed' (costs = -1) and costs of these nodes are not added to SP costs result.
graph | pointer to graph structure |
from | from node |
to | to node |
List | list of line ids |
cost | costs value |
Definition at line 183 of file vector/Vlib/graph.c.
int Vect_hist_command | ( | struct Map_info * | Map | ) |
Write command info to history file.
Map | pointer to Map_info structure |
Definition at line 29 of file hist.c.
References G_date(), G_debug(), G_gisdbase(), G_location(), G_mapset(), G_recreate_command(), G_whoami(), GPATH_MAX, and Vect_hist_write().
Copy history from one map to another.
In | input vector map | |
[out] | Out | output vector map |
Definition at line 131 of file hist.c.
References G_debug(), G_fseek(), G_ftell(), Map_info::hist_fp, NULL, and Vect_hist_write().
Referenced by Vect_close().
char* Vect_hist_read | ( | char * | s, |
int | size, | ||
struct Map_info * | Map | ||
) |
void Vect_hist_rewind | ( | struct Map_info * | Map | ) |
Rewind history file.
Map | vector map |
Definition at line 114 of file hist.c.
References G_debug(), Map_info::hist_fp, and NULL.
int Vect_hist_write | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Write string to history file.
Map | pointer to Map_info structure |
str | string to write |
Definition at line 65 of file hist.c.
References G_debug(), and Map_info::hist_fp.
Referenced by Vect_hist_command(), and Vect_hist_copy().
int Vect_is_3d | ( | struct Map_info * | Map | ) |
Check if vector map is 3D.
Check vector map header.
Map | pointer to Map_info structure |
Definition at line 255 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::with_z.
Referenced by Vect_close(), Vect_get_area_box(), and Vect_get_isle_box().
int Vect_isle_alive | ( | struct Map_info * | Map, |
int | isle | ||
) |
Check if isle is alive or dead (topological level required)
Note: Topology must be built at level >= GV_BUILD_AREAS
Map | pointer to Map_info structure |
isle | isle id |
Definition at line 277 of file vector/Vlib/read.c.
References _, G_warning(), Plus_head::Isle, Plus_head::n_isles, NULL, and Map_info::plus.
Find area outside island.
Map | vector map |
isle | isle id |
box | isle bbox |
Definition at line 179 of file build.c.
Referenced by Vect_attach_isle().
int Vect_legal_filename | ( | const char * | s | ) |
Check if output is legal vector name.
Rule: [A-Za-z][A-Za-z0-9_]*
Check also for SQL keywords.
s | filename to be checked |
Definition at line 32 of file legal_vname.c.
Referenced by Vect_copy().
int Vect_level | ( | struct Map_info * | Map | ) |
Returns level that Map is opened at.
Map | vector map |
Definition at line 29 of file level.c.
References _, G_warning(), Map_info::level, Map_info::open, VECT_CLOSED_CODE, and VECT_OPEN_CODE.
Referenced by Vect_get_map_box().
int Vect_line_alive | ( | struct Map_info * | Map, |
int | line | ||
) |
Check if feature is alive or dead (topological level required)
Note: Topology must be built at level >= GV_BUILD_BASE
Map | pointer to Map_info structure |
line | feature id |
Definition at line 205 of file vector/Vlib/read.c.
void Vect_line_buffer | ( | const struct line_pnts * | InPoints, |
double | distance, | ||
double | tolerance, | ||
struct line_pnts * | OutPoints | ||
) |
Create buffer around the line line.
This function is replaced by Vect_line_buffer().
Buffer is closed counter clockwise polygon. Warning: output line may contain loops!
InPoints | input line | |
distance | create buffer in distance | |
tolerance | maximum distance between theoretical arc and polygon segments | |
[out] | OutPoints | output line |
void Vect_line_buffer2 | ( | const struct line_pnts * | Points, |
double | da, | ||
double | db, | ||
double | dalpha, | ||
int | round, | ||
int | caps, | ||
double | tol, | ||
struct line_pnts ** | oPoints, | ||
struct line_pnts *** | iPoints, | ||
int * | inner_count | ||
) |
Creates buffer around line.
See also Vect_line_buffer().
Shape of buffer endings is managed by two parameters - round and cap. Setting round=1, cap=1 gives "classical" buffer, while round=0, cap=1 gives square end, but cap=0 – butt. See v.buffer manual or SVG stroke-linecap for examples.
To get "classical" buffer, set db equal to da, and dalpha to 0.
Points | input line geometry | |
da | distance along major axis | |
db | distance along minor axis | |
dalpha | angle between 0x and major axis | |
round | make corners round (0 - square, not 0 - round) | |
caps | add caps at line ends (0 - butt, not 0 - caps) | |
tol | maximum distance between theoretical arc and output segments | |
[out] | oPoints | output polygon outer border (ccw order) |
[out] | iPoints | array of output polygon's holes (cw order) |
[out] | inner_count | number of holes |
int Vect_line_check_duplicate | ( | const struct line_pnts * | APoints, |
const struct line_pnts * | BPoints, | ||
int | with_z | ||
) |
Check for duplicate lines.
Note that lines must be pruned with Vect_line_prune() before passed to Vect_line_check_duplicate(), as done by Vect_remove_duplicates()
APoints | first line geometry |
BPoints | second line geometry |
Definition at line 219 of file remove_duplicates.c.
References line_pnts::n_points, line_pnts::x, line_pnts::y, and line_pnts::z.
int Vect_line_check_intersection | ( | struct line_pnts * | APoints, |
struct line_pnts * | BPoints, | ||
int | with_z | ||
) |
Check if 2 lines intersect.
Points (Points->n_points == 1) are also supported.
Superseded by the faster Vect_line_check_intersection2() Kept as reference implementation
APoints | first input line |
BPoints | second input line |
with_z | 3D, not supported (only if one or both are points)! |
Definition at line 1466 of file vector/Vlib/intersect.c.
int Vect_line_check_intersection2 | ( | struct line_pnts * | APoints, |
struct line_pnts * | BPoints, | ||
int | with_z | ||
) |
Check if 2 lines intersect.
Points (Points->n_points == 1) are also supported.
simplified Bentley–Ottmann Algorithm: similar to Vect_line_check_intersection(), but faster
APoints | first input line |
BPoints | second input line |
with_z | 3D, not supported (only if one or both are points)! |
Definition at line 1540 of file intersect2.c.
References line_check_intersection2().
int Vect_line_delete_point | ( | struct line_pnts * | Points, |
int | index | ||
) |
int Vect_line_distance | ( | const struct line_pnts * | points, |
double | ux, | ||
double | uy, | ||
double | uz, | ||
int | with_z, | ||
double * | px, | ||
double * | py, | ||
double * | pz, | ||
double * | dist, | ||
double * | spdist, | ||
double * | lpdist | ||
) |
Calculate distance of point to line.
Sets (if not null):
points | pointer to line_pnts structure | |
ux,uy,uz | point coordinates | |
with_z | flag if to use z coordinate (3D calculation) | |
[out] | px,py,pz | point on line |
[out] | dist | distance to line |
[out] | spdist | distance to point on line from segment beginning |
[out] | lpdist | distance to point on line from line beginning along line |
Definition at line 648 of file line.c.
References dig_distance2_point_to_line(), line_pnts::n_points, NULL, line_pnts::x, line_pnts::y, and line_pnts::z.
int Vect_line_geodesic_distance | ( | const struct line_pnts * | points, |
double | ux, | ||
double | uy, | ||
double | uz, | ||
int | with_z, | ||
double * | px, | ||
double * | py, | ||
double * | pz, | ||
double * | dist, | ||
double * | spdist, | ||
double * | lpdist | ||
) |
Calculate geodesic distance of point to line in meters.
Sets (if not null):
points | pointer to line_pnts structure | |
ux,uy,uz | point coordinates | |
with_z | flag if to use z coordinate (3D calculation) | |
[out] | px,py,pz | point on line |
[out] | dist | distance to line |
[out] | spdist | distance to point on line from segment beginning |
[out] | lpdist | distance to point on line from line beginning along line |
Definition at line 751 of file line.c.
References dig_distance2_point_to_line(), G_begin_distance_calculations(), G_distance(), line_pnts::n_points, NULL, line_pnts::x, line_pnts::y, and line_pnts::z.
double Vect_line_geodesic_length | ( | const struct line_pnts * | Points | ) |
int Vect_line_get_intersections | ( | struct line_pnts * | APoints, |
struct line_pnts * | BPoints, | ||
struct line_pnts * | IPoints, | ||
int | with_z | ||
) |
Get 2 lines intersection points.
A wrapper around Vect_line_check_intersection() function.
Superseded by the faster Vect_line_get_intersections2() Kept as reference implementation
APoints | first input line | |
BPoints | second input line | |
[out] | IPoints | output with intersection points |
with_z | 3D, not supported (only if one or both are points)! |
Definition at line 1489 of file vector/Vlib/intersect.c.
int Vect_line_get_intersections2 | ( | struct line_pnts * | APoints, |
struct line_pnts * | BPoints, | ||
struct line_pnts * | IPoints, | ||
int | with_z | ||
) |
Get 2 lines intersection points.
A wrapper around Vect_line_check_intersection2() function.
simplified Bentley–Ottmann Algorithm: similar to Vect_line_get_intersections(), but faster
APoints | first input line | |
BPoints | second input line | |
[out] | IPoints | output with intersection points |
with_z | 3D, not supported (only if one or both are points)! |
Definition at line 1562 of file intersect2.c.
int Vect_line_get_point | ( | const struct line_pnts * | Points, |
int | index, | ||
double * | x, | ||
double * | y, | ||
double * | z | ||
) |
Get line point of given index.
Calls G_fatal_error() when index is not range in.
Points | pointer to line_pnts structure |
index | point index (from 0 to Points->n_points-1) |
x | pointer to x coordinate or NULL |
y | pointer to y coordinate or NULL |
z | pointer to z coordinate or NULL |
int Vect_line_insert_point | ( | struct line_pnts * | Points, |
int | index, | ||
double | x, | ||
double | y, | ||
double | z | ||
) |
int Vect_line_intersection | ( | struct line_pnts * | , |
struct line_pnts * | , | ||
struct bound_box * | , | ||
struct bound_box * | , | ||
struct line_pnts *** | , | ||
struct line_pnts *** | , | ||
int * | , | ||
int * | , | ||
int | |||
) |
int Vect_line_intersection2 | ( | struct line_pnts * | APoints, |
struct line_pnts * | BPoints, | ||
struct bound_box * | pABox, | ||
struct bound_box * | pBBox, | ||
struct line_pnts *** | ALines, | ||
struct line_pnts *** | BLines, | ||
int * | nalines, | ||
int * | nblines, | ||
int | with_z | ||
) |
Intersect 2 lines.
Creates array of new lines created from original A line, by intersection with B line. Points (Points->n_points == 1) are not supported. If B line is NULL, A line is intersected with itself.
simplified Bentley–Ottmann Algorithm: similar to Vect_line_intersection(), but faster additionally, self-intersections of a line are handled more efficiently
APoints | first input line | |
BPoints | second input line or NULL | |
[out] | ALines | array of new lines created from original A line |
[out] | BLines | array of new lines created from original B line |
[out] | nalines | number of new lines (ALines) |
[out] | nblines | number of new lines (BLines) |
with_z | 3D, not supported! |
Definition at line 675 of file intersect2.c.
References l.
double Vect_line_length | ( | const struct line_pnts * | Points | ) |
Calculate line length, 3D-length in case of 3D vector line.
For Lat-Long use Vect_line_geodesic_length() instead.
Points | pointer to line_pnts structure geometry |
void Vect_line_parallel | ( | struct line_pnts * | InPoints, |
double | distance, | ||
double | tolerance, | ||
int | rm_end, | ||
struct line_pnts * | OutPoints | ||
) |
Create parallel line.
This function is replaced by Vect_line_parallel2().
InPoints | input line | |
distance | create parallel line in distance | |
tolerance | maximum distance between theoretical arc and polygon segments | |
rm_end | remove end points falling into distance | |
[out] | OutPoints | output line |
void Vect_line_parallel2 | ( | struct line_pnts * | InPoints, |
double | da, | ||
double | db, | ||
double | dalpha, | ||
int | side, | ||
int | round, | ||
double | tol, | ||
struct line_pnts * | OutPoints | ||
) |
Definition at line 1191 of file buffer2.c.
References G_debug(), and line_pnts::n_points.
int Vect_line_prune | ( | struct line_pnts * | Points | ) |
Remove duplicate points, i.e. zero length segments.
Points | pointer to line_pnts structure |
Definition at line 279 of file line.c.
Referenced by Vect_build_line_area().
int Vect_line_prune_thresh | ( | struct line_pnts * | Points, |
double | threshold | ||
) |
void Vect_line_reverse | ( | struct line_pnts * | Points | ) |
int Vect_line_segment | ( | const struct line_pnts * | InPoints, |
double | start, | ||
double | end, | ||
struct line_pnts * | OutPoints | ||
) |
Create line segment.
Creates segment of InPoints from start to end measured along the line and write it to OutPoints.
If the distance is greater than line length or negative, error is returned.
InPoints | input line |
start | segment number |
end | segment number |
OutPoints | output line |
GEOSGeometry* Vect_line_to_geos | ( | const struct line_pnts * | points, |
int | type, | ||
int | with_z | ||
) |
Create GEOSGeometry of given type from feature points.
Supported types:
You should free allocated memory by GEOSGeom_destroy().
points | pointer to line_pnts structure |
type | feature type (see supported types) |
with_z | Set to 1 if the feature is 3d, 0 otherwise |
unsigned char* Vect_line_to_wkb | ( | const struct line_pnts * | points, |
int | type, | ||
int | with_z, | ||
size_t * | size | ||
) |
Create a Well Known Binary (WKB) representation of given feature type from points.
This function is not thread safe, it uses static variables for speedup.
Supported feature types:
points | pointer to line_pnts structure |
type | feature type (see supported types) |
with_z | Set to 1 if the feature is 3d, 0 otherwise |
size | The size of the returned byte array |
Definition at line 223 of file geos_to_wktb.c.
char* Vect_line_to_wkt | ( | const struct line_pnts * | points, |
int | type, | ||
bool | with_z | ||
) |
Create a Well Known Text (WKT) representation of given feature type from points.
Calls Vect_line_to_wkt2() with trim set to false.
Definition at line 259 of file geos_to_wktb.c.
char* Vect_line_to_wkt2 | ( | const struct line_pnts * | points, |
int | type, | ||
bool | with_z, | ||
bool | trim | ||
) |
Create a Well Known Text (WKT) representation of given feature type from points.
This function is not thread safe, it uses static variables for speedup.
Supported types:
points | pointer to line_pnts structure |
type | feature type (see supported types) |
with_z | Set to true if the feature is 3d, false otherwise |
trim | Set the number trimming option on, With trim set to true, the writer will strip trailing 0's from the output coordinates. |
Definition at line 285 of file geos_to_wktb.c.
int Vect_list_append | ( | struct ilist * | list, |
int | val | ||
) |
Append new item to the end of list if not yet present.
[in,out] | list | pointer to ilist structure |
val | new item to append to the end of list |
Definition at line 89 of file vector/Vlib/list.c.
References G_realloc, and NULL.
Referenced by Vect_field_cat_get(), and Vect_list_append_list().
Append new items to the end of list if not yet present.
[in,out] | alist | pointer to ilist structure where items will be appended |
blist | pointer to ilist structure with new items |
Definition at line 123 of file vector/Vlib/list.c.
References ilist::n_values, NULL, ilist::value, and Vect_list_append().
int Vect_list_delete | ( | struct ilist * | list, |
int | val | ||
) |
Remove a given value (item) from list.
[in,out] | list | pointer to ilist structure |
val | to remove |
Definition at line 145 of file vector/Vlib/list.c.
References NULL.
Referenced by Vect_list_delete_list().
Delete list from existing list.
[in,out] | alist | pointer to original ilist structure, |
blist | pointer to ilist structure with items to delete |
Definition at line 174 of file vector/Vlib/list.c.
References ilist::n_values, NULL, ilist::value, and Vect_list_delete().
int Vect_map_add_dblink | ( | struct Map_info * | Map, |
int | number, | ||
const char * | name, | ||
const char * | table, | ||
const char * | key, | ||
const char * | db, | ||
const char * | driver | ||
) |
Add new db connection to Map_info structure.
Map | pointer to Map_info structure |
number | layer number |
name | layer name (if not given use table name) |
table | table name |
key | key name |
db | database name |
driver | driver name |
Definition at line 120 of file field.c.
Referenced by Vect_copy_map_dblinks().
int Vect_map_check_dblink | ( | struct Map_info * | Map, |
int | field, | ||
const char * | name | ||
) |
Check if DB connection exists in dblinks structure.
Map | pointer to Map_info structure |
field | layer number |
name | layer name |
Definition at line 237 of file field.c.
References Map_info::dblnk, name, and Vect_check_dblink().
int Vect_map_del_dblink | ( | struct Map_info * | Map, |
int | field | ||
) |
Delete db connection from Map_info structure.
Map | pointer to Map_info structure |
field | layer number (-1 to delete all dblinks) |
Definition at line 160 of file field.c.
References _, field_info::database, Map_info::dblnk, field_info::driver, dblinks::field, G_debug(), G_warning(), field_info::key, dblinks::n_fields, field_info::name, field_info::number, field_info::table, and Vect_write_dblinks().
Referenced by Vect_close().
int Vect_maptype | ( | struct Map_info * | Map | ) |
Gets vector map format.
Currently are implemented:
Map | pointer to Map_info structure |
Definition at line 1104 of file vector/Vlib/open.c.
References Format_info_pg::conninfo, Format_info_ogr::driver_name, Map_info::fInfo, Map_info::format, GV_FORMAT_OGR, GV_FORMAT_POSTGIS, Format_info::ogr, Format_info::pg, and Map_info::temporary.
Referenced by Vect_fidx_dump().
const char* Vect_maptype_info | ( | struct Map_info * | Map | ) |
Gets vector map format (as string)
Note: string is allocated by G_store(). Free allocated memory with G_free().
Currently are implemented:
Map | pointer to Map_info structure |
Definition at line 1068 of file vector/Vlib/open.c.
References _, Map_info::format, G_store(), GV_FORMAT_NATIVE, GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, and GV_FORMAT_POSTGIS.
Referenced by Vect_fidx_dump().
Merge lines or boundaries in vector map.
Merges lines specified by type in vector map. Useful for generalization and smoothing. Adjacent boundaries are merged as long as topology is maintained. Adjacent lines are merged as long as there are exactly two different lines with identical categories connected at a given node. Zero-length lines need to be removed first. GV_BUILD_BASE as topo build level is sufficient, areas need not be built.
Map | input vector map | |
type | feature type | |
[out] | Err | vector map where merged lines/boundaries will be written or NULL |
new_lines | pointer to where number of new lines/boundaries is stored or NULL |
Definition at line 79 of file merge_lines.c.
int Vect_net_build_graph | ( | struct Map_info * | Map, |
int | ltype, | ||
int | afield, | ||
int | nfield, | ||
const char * | afcol, | ||
const char * | abcol, | ||
const char * | ncol, | ||
int | geo, | ||
int | version | ||
) |
Build network graph.
Internal format for edge costs is integer, costs are multiplied before conversion to int by 1000 and for lengths LL without geo flag by
Map | vector map |
ltype | line type for arcs |
afield | arc costs field (if 0, use length) |
nfield | node costs field (if 0, do not use node costs) |
afcol | column with forward costs for arc |
abcol | column with backward costs for arc (if NULL, back costs = forward costs), |
ncol | column with costs for nodes (if NULL, do not use node costs), |
geo | use geodesic calculation for length (LL), |
version | graph version to create (1, 2, 3) |
Definition at line 695 of file net_build.c.
dglGraph_s* Vect_net_get_graph | ( | struct Map_info * | Map | ) |
Get graph structure.
Graph is built by Vect_net_build_graph().
Returns NULL when graph is not built.
Map | pointer to Map_info struct |
Definition at line 397 of file net_analyze.c.
References Map_info::dgraph, and Graph_info::graph_s.
int Vect_net_get_line_cost | ( | struct Map_info * | Map, |
int | line, | ||
int | direction, | ||
double * | cost | ||
) |
Returns in cost for given direction in *cost.
cost is set to -1 if closed.
Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
line | line id | |
direction | direction (GV_FORWARD, GV_BACKWARD) | |
[out] | cost |
Definition at line 414 of file net_analyze.c.
int Vect_net_get_node_cost | ( | struct Map_info * | Map, |
int | node, | ||
double * | cost | ||
) |
Get cost of node.
Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
node | node id | |
[out] | cost | costs value |
Definition at line 468 of file net_analyze.c.
References Map_info::dgraph, G_debug(), and Graph_info::node_costs.
int Vect_net_nearest_nodes | ( | struct Map_info * | Map, |
double | x, | ||
double | y, | ||
double | z, | ||
int | direction, | ||
double | maxdist, | ||
int * | node1, | ||
int * | node2, | ||
int * | ln, | ||
double * | costs1, | ||
double * | costs2, | ||
struct line_pnts * | Points1, | ||
struct line_pnts * | Points2, | ||
double * | distance | ||
) |
Find nearest node(s) on network.
Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
x,y,z | point coordinates (z coordinate NOT USED !) | |
direction | (GV_FORWARD - from point to net, GV_BACKWARD - from net to point) | |
maxdist | maximum distance to the network | |
[out] | node1 | pointer where to store the node number (or NULL) |
[out] | node2 | pointer where to store the node number (or NULL) |
[out] | ln | pointer where to store the nearest line number (or NULL) |
[out] | costs1 | pointer where to store costs on nearest line to node1 (not costs from x,y,z to the line) (or NULL) |
[out] | costs2 | pointer where to store costs on nearest line to node2 (not costs from x,y,z to the line) (or NULL) |
[out] | Points1 | pointer to structure where to store vertices on nearest line to node1 (or NULL) |
[out] | Points2 | pointer to structure where to store vertices on nearest line to node2 (or NULL) |
[out] | pointer | where to distance to the line (or NULL) |
[out] | distance |
Definition at line 499 of file net_analyze.c.
int Vect_net_shortest_path | ( | struct Map_info * | Map, |
int | from, | ||
int | to, | ||
struct ilist * | List, | ||
double * | cost | ||
) |
Find shortest path.
Costs for 'from' and 'to' nodes are not considered (SP found even if 'from' or 'to' are 'closed' (costs = -1) and costs of these nodes are not added to SP costs result.
Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
from | from node | |
to | to node | |
[out] | List | list of line ids (path) |
[out] | cost | costs value |
Definition at line 380 of file net_analyze.c.
int Vect_net_shortest_path_coor | ( | struct Map_info * | Map, |
double | fx, | ||
double | fy, | ||
double | fz, | ||
double | tx, | ||
double | ty, | ||
double | tz, | ||
double | fmax, | ||
double | tmax, | ||
double * | costs, | ||
struct line_pnts * | Points, | ||
struct ilist * | List, | ||
struct ilist * | NodesList, | ||
struct line_pnts * | FPoints, | ||
struct line_pnts * | TPoints, | ||
double * | fdist, | ||
double * | tdist | ||
) |
Find shortest path on network between 2 points given by coordinates.
Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) |
fx,fy,fz | from point x coordinate (z ignored) |
tx,ty,tz | to point x coordinate (z ignored) |
fmax | maximum distance to the network from 'from' |
tmax | maximum distance to the network from 'to' |
costs | pointer where to store costs on the network (or NULL) |
Points | pointer to the structure where to store vertices of shortest path (or NULL) |
List | pointer to the structure where list of lines on the network is stored (or NULL) |
NodesList | pointer to the structure where list of nodes on the network is stored (or NULL) |
FPoints | pointer to the structure where to store line from 'from' to first network node (or NULL) |
TPoints | pointer to the structure where to store line from last network node to 'to' (or NULL) |
fdist | distance from 'from' to the net (or NULL) |
tdist | distance from 'to' to the net (or NULL) |
Definition at line 1016 of file net_analyze.c.
int Vect_net_ttb_build_graph | ( | struct Map_info * | , |
int | , | ||
int | , | ||
int | , | ||
int | , | ||
int | , | ||
const char * | , | ||
const char * | , | ||
const char * | , | ||
int | , | ||
int | |||
) |
int Vect_net_ttb_shortest_path | ( | struct Map_info * | Map, |
int | from, | ||
int | from_type, | ||
int | to, | ||
int | to_type, | ||
int | tucfield, | ||
struct ilist * | List, | ||
double * | cost | ||
) |
Find shortest path on network.
Costs for 'from' and 'to' nodes are not considered (SP found even if 'from' or 'to' are 'closed' (costs = -1) and costs of these nodes are not added to SP costs result.
Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) | |
from | start of the path | |
from_type | if 0 - node id (intersection), if 1 - line unique cat | |
to | end of the path | |
to_type | if 0 - node id (intersection), if 1 - line unique cat | |
tucfield | field with unique categories used in the turntable | |
[out] | List | list of line ids (path) |
[out] | cost | costs value |
Definition at line 260 of file net_analyze.c.
int Vect_net_ttb_shortest_path_coor | ( | struct Map_info * | Map, |
double | fx, | ||
double | fy, | ||
double | fz, | ||
double | tx, | ||
double | ty, | ||
double | tz, | ||
double | fmax, | ||
double | tmax, | ||
int | tucfield, | ||
double * | costs, | ||
struct line_pnts * | Points, | ||
struct ilist * | List, | ||
struct ilist * | NodesList, | ||
struct line_pnts * | FPoints, | ||
struct line_pnts * | TPoints, | ||
double * | fdist, | ||
double * | tdist | ||
) |
Find shortest path on network with turntable between 2 points given by coordinates.
Map | vector map with build graph (see Vect_net_ttb_build_graph and Vect_net_build_graph) |
fx,fy,fz | from point x coordinate (z ignored) |
tx,ty,tz | to point x coordinate (z ignored) |
fmax | maximum distance to the network from 'from' |
tmax | maximum distance to the network from 'to' |
tucfield | field with unique categories used in the turntable |
costs | pointer where to store costs on the network (or NULL) |
Points | pointer to the structure where to store vertices of shortest path (or NULL) |
List | pointer to the structure where list of lines on the network is stored (or NULL) |
NodesList | pointer to the structure where list of nodes on the network is stored (or NULL) |
FPoints | pointer to the structure where to store line from 'from' to first network node (or NULL) |
TPoints | pointer to the structure where to store line from last network node to 'to' (or NULL) |
fdist | distance from 'from' to the net (or NULL) |
tdist | distance from 'to' to the net (or NULL) |
Definition at line 1052 of file net_analyze.c.
struct boxlist* Vect_new_boxlist | ( | int | have_boxes | ) |
Creates and initializes a struct boxlist.
This structure is used as container for bounding boxes with id. The library routines handle all memory allocation.
have_boxes | if set to 0, the list will hold only ids and no boxes |
Definition at line 224 of file vector/Vlib/list.c.
References boxlist::alloc_values, boxlist::box, G_malloc, boxlist::have_boxes, boxlist::id, boxlist::n_values, and NULL.
Referenced by Vect_attach_isles(), and Vect_find_area().
struct cat_list* Vect_new_cat_list | ( | void | ) |
Allocate memory for cat_list structure.
Definition at line 309 of file vector/Vlib/cats.c.
struct line_cats* Vect_new_cats_struct | ( | void | ) |
Creates and initializes line_cats structure.
This structure is used for reading and writing vector cats. The library routines handle all memory allocation.
To free allocated memory call Vect_destroy_cats_struct().
Definition at line 39 of file vector/Vlib/cats.c.
References NULL.
Referenced by NetA_initialise_varray(), and Vect_get_area_cat().
struct dblinks* Vect_new_dblinks_struct | ( | void | ) |
struct line_pnts* Vect_new_line_struct | ( | void | ) |
Creates and initializes a line_pnts structure.
This structure is used for reading and writing vector lines and polygons. The library routines handle all memory allocation. If 3 lines in memory are needed at the same time, then simply 3 line_pnts structures have to be used.
To free allocated memory call Vect_destroy_line_struct().
Calls G_fatal_error() on error.
Definition at line 45 of file line.c.
References _, G_fatal_error(), NULL, and Vect__new_line_struct().
Referenced by Vect__reallocate_cache(), Vect_build_line_area(), Vect_point_buffer2(), and vector2perimeters().
struct ilist* Vect_new_list | ( | void | ) |
Creates and initializes a struct ilist.
This structure is used as container for integer values. The library routines handle all memory allocation.
Definition at line 31 of file vector/Vlib/list.c.
References ilist::alloc_values, G_malloc, ilist::n_values, NULL, and ilist::value.
Referenced by NetA_betweenness_closeness(), Vect_find_node(), Vect_select_areas_by_polygon(), and Vedit_extend_lines().
struct Map_info* Vect_new_map_struct | ( | void | ) |
Creates and initializes Map_info structure.
To free allocated memory call Vect_destroy_map_struct().
Definition at line 41 of file map.c.
References _, G_fatal_error(), G_zero(), malloc(), and NULL.
struct varray* Vect_new_varray | ( | int | size | ) |
Create new struct varray and allocate space for given number of items.
Space allocated is 'size + 1' so that lines are accessed by line id. Array values are set to 0.
size | size of array |
Definition at line 39 of file array.c.
References varray::c, G_calloc, G_free(), G_malloc, NULL, and varray::size.
Referenced by NetA_initialise_varray().
int Vect_node_alive | ( | struct Map_info * | Map, |
int | node | ||
) |
Check if node is alive or dead (topological level required)
Note: Topology must be built at level >= GV_BUILD_BASE
Map | pointer to Map_info structure |
node | node id |
Definition at line 229 of file vector/Vlib/read.c.
References _, G_warning(), Plus_head::n_nodes, Plus_head::Node, NULL, and Map_info::plus.
int Vect_open_fidx | ( | struct Map_info * | Map, |
struct Format_info_offset * | offset | ||
) |
Open feature index file.
[in,out] | Map | pointer to Map_info struct |
[out] | offset | pointer to Format_info_offset (OGR or PG) |
Definition at line 254 of file open_ogr.c.
References _, Format_info_offset::array, Format_info_offset::array_alloc, Format_info_offset::array_num, Port_info::byte_order, dig__fread_port_C(), dig__fread_port_I(), dig__fread_port_L(), dig_file_init(), dig_init_portable(), dig_set_cur_port(), gvfile::file, Map_info::format, G_debug(), G_fatal_error(), G_fopen_old(), G_fseek(), G_malloc, G_warning(), GPATH_MAX, GV_DIRECTORY, GV_FIDX_ELEMENT, Map_info::mapset, Map_info::name, NULL, and Vect_get_full_name().
Referenced by V2_open_old_ogr(), and V2_open_old_pg().
int Vect_open_new | ( | struct Map_info * | Map, |
const char * | name, | ||
int | with_z | ||
) |
Create new vector map for reading/writing.
By default list of updated features is not maintained, see Vect_set_updated() for details.
By default map format is native (GV_FORMAT_NATIVE). If OGR file is found in the current mapset then the map (ie. OGR layer) is created in given OGR datasource (GV_FORMAT_OGR). Similarly if PG file exists then the map (ie. PostGIS table) is created using PostGIS interface (GV_FORMAT_POSTGIS). The format of map is stored in Map->format.
[out] | Map | pointer to Map_info structure |
name | name of vector map to be created | |
with_z | WITH_Z for 3D vector data otherwise WITHOUT_Z |
Definition at line 955 of file vector/Vlib/open.c.
References G_debug().
Referenced by Vect_close().
int Vect_open_old | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset | ||
) |
Open existing vector map for reading.
This function is replaced by Vect_open_old2() to handle also direct OGR support.
Calls G_fatal_error() on failure.
[out] | Map | pointer to Map_info structure |
name | name of vector map to open | |
mapset | mapset name ("" for search path) |
Definition at line 597 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, NULL, and Vect__open_old().
int Vect_open_old2 | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset, | ||
const char * | layer | ||
) |
Open existing vector map for reading.
Calls G_fatal_error() on failure.
[out] | Map | pointer to Map_info structure |
name | name of vector map to open (datasource for direct OGR access) | |
mapset | mapset name ("" for search path, "OGR" for direct OGR access) | |
layer | layer name (OGR layer for direct OGR access) |
Definition at line 640 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, and Vect__open_old().
int Vect_open_old_head | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset | ||
) |
Reads only info about vector map (headers)
Reads from headers of 'head', 'dbln', 'topo' and 'cidx' file.
This function is replaced by Vect_open_old_head2() to handle also direct OGR support.
Calls G_fatal_error() on failure.
[out] | Map | pointer to Map_info structure |
name | name of vector map to read | |
mapset | mapset name ("" for search path) |
Definition at line 738 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().
int Vect_open_old_head2 | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset, | ||
const char * | layer | ||
) |
Reads only info about vector map (headers)
Reads from headers of 'head', 'dbln', 'topo' and 'cidx' file.
Calls G_fatal_error() on failure.
[out] | Map | pointer to Map_info structure |
name | name of vector map to read (dsn for OGR) | |
mapset | mapset name ("" for search path) | |
layer | layer name (OGR format) | |
[out] | Map | pointer to Map_info structure |
name | name of vector map to open (datasource for direct OGR access) | |
mapset | mapset name ("" for search path, "OGR" for direct OGR access) | |
layer | layer name (OGR layer for direct OGR access) |
Definition at line 765 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, TRUE, and Vect__open_old().
int Vect_open_sidx | ( | struct Map_info * | Map, |
int | mode | ||
) |
Open spatial index file ('sidx')
[in,out] | Map | pointer to Map_info |
mode | 0 old, 1 update, 2 new |
Definition at line 1212 of file vector/Vlib/open.c.
Referenced by Vect_build_partial().
int Vect_open_tmp_new | ( | struct Map_info * | Map, |
const char * | name, | ||
int | with_z | ||
) |
Create new temporary vector map.
Temporary vector maps are stored in the current mapset (directory .tmp/<hostname>/vector
). If the map already exists, it is overwritten.
Temporary vector maps are automatically deleted when closing the map (see Vect_close() for details).
If name is not given (is NULL), then the name is determined by process id (tmp_<pid>
).
[out] | Map | pointer to output Map_info struct |
name | name for new vector map (or NULL) | |
with_z | WITH_Z for 3D vector data otherwise WITHOUT_Z |
Definition at line 986 of file vector/Vlib/open.c.
int Vect_open_tmp_old | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset | ||
) |
Open existing temporary vector map for reading.
Temporary vector maps are stored in the current mapset (directory .tmp/<hostname>/vector
).
Calls G_fatal_error() on failure.
[out] | Map | pointer to Map_info structure |
name | name of vector map to open | |
mapset | mapset name ("" for search path) |
Definition at line 620 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().
int Vect_open_tmp_update | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset | ||
) |
Open existing temporary vector map for reading/writing.
Temporary vector maps are stored in the current mapset (directory .tmp/<hostname>/vector
).
By default list of updated features is not maintained, see Vect_set_updated() for details.
Calls G_fatal_error() on failure.
[out] | Map | pointer to Map_info structure |
name | name of vector map to update | |
mapset | mapset name |
Definition at line 691 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().
int Vect_open_topo | ( | struct Map_info * | Map, |
int | head_only | ||
) |
Open topology file ('topo')
[in,out] | Map | pointer to Map_info structure |
head_only | TRUE to read only header |
Definition at line 1131 of file vector/Vlib/open.c.
References _, Plus_head::coor_mtime, Plus_head::coor_size, dig_file_init(), dig_load_plus(), dig_Rd_Plus_head(), err(), gvfile::file, G_debug(), G_fopen_old(), G_warning(), GPATH_MAX, GV_TOPO_ELEMENT, Map_info::mapset, Map_info::name, NULL, Map_info::plus, Coor_info::size, Vect__get_element_path(), Vect__get_path(), and Vect_coor_info().
int Vect_open_update | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset | ||
) |
Open existing vector map for reading/writing.
This function is replaced by Vect_open_update2() to handle also direct OGR support.
By default list of updated features is not maintained, see Vect_set_updated() for details.
Calls G_fatal_error() on failure.
[out] | Map | pointer to Map_info structure |
name | name of vector map to update | |
mapset | mapset name |
Definition at line 665 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().
int Vect_open_update2 | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset, | ||
const char * | layer | ||
) |
Open existing vector map for reading/writing.
By default list of updated features is not maintained, see Vect_set_updated() for details.
Calls G_fatal_error() on failure.
[out] | Map | pointer to Map_info structure |
name | name of vector map to open (datasource for direct OGR access) | |
mapset | mapset name ("" for search path, "OGR" for direct OGR access) | |
layer | layer name (OGR layer for direct OGR access) |
Definition at line 714 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, TRUE, and Vect__open_old().
int Vect_open_update_head | ( | struct Map_info * | Map, |
const char * | name, | ||
const char * | mapset | ||
) |
Open header file of existing vector map for updating (mostly for database link updates)
[out] | Map | pointer to Map_info structure |
name | name of vector map to update | |
mapset | mapset name |
Definition at line 782 of file vector/Vlib/open.c.
References FALSE, Map_info::mapset, name, NULL, TRUE, and Vect__open_old().
int Vect_option_to_types | ( | const struct Option * | type_opt | ) |
Get types from options.
type_opt | Option structure |
Definition at line 26 of file vector/Vlib/type.c.
int Vect_overlay | ( | struct Map_info * | AMap, |
int | atype, | ||
struct ilist * | AList, | ||
struct ilist * | AAList, | ||
struct Map_info * | BMap, | ||
int | btype, | ||
struct ilist * | BList, | ||
struct ilist * | BAList, | ||
int | operator, | ||
struct Map_info * | OMap | ||
) |
Overlay 2 vector maps and create new one.
AMap | vector map A | |
atype | feature type for A | |
AList | unused ? | |
AAList | unused ? | |
BMap | vector map B | |
btype | feature type for B | |
BList | unused ? | |
BAList | unused ? | |
operator | operator code | |
[out] | OMap | output vector map |
Definition at line 62 of file overlay.c.
References _, G_fatal_error(), GV_O_AND, and Vect_overlay_and().
int Vect_overlay_and | ( | struct Map_info * | , |
int | , | ||
struct ilist * | , | ||
struct ilist * | , | ||
struct Map_info * | , | ||
int | , | ||
struct ilist * | , | ||
struct ilist * | , | ||
struct Map_info * | |||
) |
int Vect_overlay_str_to_operator | ( | const char * | str | ) |
Get operator code from string.
str | operator code string |
Definition at line 35 of file overlay.c.
References GV_O_AND, GV_O_OVERLAP, GV_ON_AND, and GV_ON_OVERLAP.
void Vect_point_buffer2 | ( | double | px, |
double | py, | ||
double | da, | ||
double | db, | ||
double | dalpha, | ||
int | round, | ||
double | tol, | ||
struct line_pnts ** | oPoints | ||
) |
Creates buffer around the point (px, py).
px | input point x-coordinate | |
py | input point y-coordinate | |
da | distance along major axis | |
db | distance along minor axis | |
dalpha | angle between 0x and major axis | |
round | make corners round | |
tol | maximum distance between theoretical arc and output segments | |
[out] | oPoints | output polygon outer border (ccw order) |
Definition at line 1141 of file buffer2.c.
References G_debug(), PI, and Vect_new_line_struct().
int Vect_point_in_area | ( | double | x, |
double | y, | ||
struct Map_info * | Map, | ||
int | area, | ||
struct bound_box * | box | ||
) |
Check if point is in area.
x,y | point coordinates |
Map | pointer to Map_info structure |
area | area id |
box | area bounding box |
Definition at line 334 of file vector/Vlib/area.c.
int Vect_point_in_area_outer_ring | ( | double | X, |
double | Y, | ||
struct Map_info * | Map, | ||
int | area, | ||
struct bound_box * | box | ||
) |
Determines if a point (X,Y) is inside an area outer ring. Islands are not considered.
X,Y | point coordinates |
Map | vector map |
area | area id |
box | area bounding box |
Definition at line 854 of file Vlib/poly.c.
int Vect_point_in_box | ( | double | x, |
double | y, | ||
double | z, | ||
const struct bound_box * | Box | ||
) |
Tests if point is in 3D box.
This function considers 3D point and 3D bounding box.
struct bound_box bbox; bbox.N = 135; bbox.S = 125; bbox.E = 220; bbox.W = 215; bbox.T = 340; bbox.B = 330; Vect_point_in_box(217, 130, 335, &bbox);
x | coordinate (W-E direction) |
y | coordinate (S-N direction) |
z | coordinate (B-T direction) |
Box | boundary box |
Definition at line 48 of file vector/Vlib/box.c.
Referenced by P_Mean_Calc().
int Vect_point_in_box_2d | ( | double | x, |
double | y, | ||
const struct bound_box * | Box | ||
) |
Tests if point is in 2D box.
Only x and y are tested. Top and bottom of the bounding box are ignored.
x | coordinate (W-E direction) |
y | coordinate (S-N direction) |
Box | boundary box (only W, E, S, N are used) |
Definition at line 67 of file vector/Vlib/box.c.
int Vect_point_in_island | ( | double | X, |
double | Y, | ||
struct Map_info * | Map, | ||
int | isle, | ||
struct bound_box * | box | ||
) |
Determines if a point (X,Y) is inside an island.
X,Y | point coordinates |
Map | vector map |
isle | isle id |
box | isle bounding box |
Definition at line 923 of file Vlib/poly.c.
int Vect_point_in_poly | ( | double | X, |
double | Y, | ||
const struct line_pnts * | Points | ||
) |
Determines if a point (X,Y) is inside a polygon.
X,Y | point coordinates |
Points | polygon |
Definition at line 824 of file Vlib/poly.c.
int Vect_point_on_line | ( | const struct line_pnts * | Points, |
double | distance, | ||
double * | x, | ||
double * | y, | ||
double * | z, | ||
double * | angle, | ||
double * | slope | ||
) |
Find point on line in the specified distance.
From the beginning, measured along line.
If the distance is greater than line length or negative, error is returned.
Points | pointer to line_pnts structure |
distance | distance value |
x,y,z | pointers to point coordinates or NULL |
angle | pointer to angle of line in that point (radians, counter clockwise from x axis) or NULL |
slope | pointer to slope angle in radians (positive up) |
double Vect_points_distance | ( | double | x1, |
double | y1, | ||
double | z1, | ||
double | x2, | ||
double | y2, | ||
double | z2, | ||
int | with_z | ||
) |
Calculate distance of 2 points.
Simply uses Pythagoras.
x1,y1,z1 | first point |
x2,y2,z2 | second point |
with_z | use z coordinate |
Definition at line 866 of file line.c.
Referenced by Vect_find_node(), and Vedit_get_min_distance().
int Vect_print_header | ( | struct Map_info * | Map | ) |
Print vector map header to stdout.
Map | pointer to Map_info structure |
Definition at line 33 of file vector/Vlib/header.c.
References Vect_get_map_date(), Vect_get_map_name(), Vect_get_organization(), and Vect_get_scale().
GEOSGeometry* Vect_read_area_geos | ( | struct Map_info * | Map, |
int | area | ||
) |
Read vector area and stores it as GEOSGeometry instance (polygon)
You should free allocated memory by GEOSGeom_destroy().
Map | pointer to Map_info structure |
area | area id |
Definition at line 84 of file geos.c.
Referenced by Vect_read_area_to_wkb(), and Vect_read_area_to_wkt2().
unsigned char* Vect_read_area_to_wkb | ( | struct Map_info * | Map, |
int | area, | ||
size_t * | size | ||
) |
Read vector area and return it as Well Known Binary (WKB) unsigned char array.
Map | pointer to Map_info structure |
area | area id |
size | The size of the returned unsigned char array |
Definition at line 34 of file geos_to_wktb.c.
References init(), NULL, and Vect_read_area_geos().
char* Vect_read_area_to_wkt | ( | struct Map_info * | Map, |
int | area | ||
) |
Read vector area and return it as Well Known Text (WKT) unsigned char array.
Calls Vect_read_area_to_wkt2() with trim set to false.
Definition at line 71 of file geos_to_wktb.c.
References Vect_read_area_to_wkt2().
char* Vect_read_area_to_wkt2 | ( | struct Map_info * | Map, |
int | area, | ||
bool | trim | ||
) |
Read vector area and return it as Well Known Text (WKT) unsigned char array.
Map | pointer to Map_info structure |
area | area id |
size | The size of the returned unsigned char array |
trim | Set the number trimming option on, With trim set to true, the writer will strip trailing 0's from the output coordinates. |
Definition at line 89 of file geos_to_wktb.c.
References G_store(), init(), NULL, and Vect_read_area_geos().
Referenced by Vect_read_area_to_wkt().
int Vect_read_ascii | ( | FILE * | ascii, |
struct Map_info * | Map | ||
) |
int Vect_read_ascii_head | ( | FILE * | dascii, |
struct Map_info * | Map | ||
) |
Read header of GRASS ASCII vector format.
dascii | pointer to the ASCII file |
Map | pointer to Map_info structure |
Definition at line 257 of file ascii.c.
References _, G_getl2(), G_warning(), Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), Vect_set_scale(), Vect_set_thresh(), and Vect_set_zone().
int Vect_read_colors | ( | const char * | name, |
const char * | mapset, | ||
struct Colors * | colors | ||
) |
Read color table of vector map.
The color table for the vector map name in the specified mapset is read into the colors structure.
Note: If a secondary color file for map name name exists in the current mapset, that color file is read. This allows the user to define their own color lookup tables for vector maps found in other mapsets.
Warning message is printed if the color file is missing or invalid.
name | vector map name | |
mapset | mapset name ("" for search path) | |
[out] | colors | pointer to Colors structure (can be NULL) |
Definition at line 42 of file vector/Vlib/color_read.c.
int Vect_read_dblinks | ( | struct Map_info * | Map | ) |
Read dblinks to existing structure.
Variables are not substituted by values.
Map | pointer to Map_info structure |
Definition at line 846 of file field.c.
References Map_info::dblnk, Map_info::format, G_debug(), GV_FORMAT_NATIVE, Map_info::mapset, Map_info::name, and Vect_reset_dblinks().
int Vect_read_header | ( | struct Map_info * | Map | ) |
Read vector map header from map head file.
Map | pointrt to Map_info structure |
Definition at line 51 of file vector/Vlib/header.c.
References Vect__read_head().
int Vect_read_line | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c, | ||
int | line | ||
) |
Read vector feature (topological level required)
This function implements random access. Constraints are ignored.
Note: Topology must be built at level >= GV_BUILD_BASE
A warning is printed on failure.
Map | pointer to vector map | |
[out] | line_p | feature geometry (pointer to line_pnts struct) |
[out] | line_c | feature categories (pointer to line_cats struct) |
line | feature id (starts at 1) |
Definition at line 168 of file vector/Vlib/read.c.
Referenced by NetA_initialise_varray(), and Vect_get_area_cats().
GEOSGeometry* Vect_read_line_geos | ( | struct Map_info * | Map, |
int | line, | ||
int * | type | ||
) |
Read vector feature and stores it as GEOSGeometry instance.
Supported feature types:
You should free allocated memory by GEOSGeom_destroy().
Map | pointer to Map_info structure | |
line | feature id | |
[out] | type | feature type or NULL |
unsigned char* Vect_read_line_to_wkb | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c, | ||
int | line, | ||
size_t * | size, | ||
int * | error | ||
) |
Read a Well Known Binary (WKB) representation of a given feature id.
This function reads a specific feature and converts it into a WKB representation. line_pnts and line_cats structures can be provided to store the result of the read operation. That is meaningful in case the category values of the feature are needed. This function is not thread safe, it uses static variables for speedup.
Supported feature types:
Map | pointer to Map_info structure |
line_p | pointer to line_pnts structure to use, or NULL |
line_c | pointer to line_cats structure to use, or NULL |
line | The id of the feature to read |
size | The size of the returned unsigned char array |
Definition at line 146 of file geos_to_wktb.c.
int Vect_read_next_line | ( | struct Map_info * | Map, |
struct line_pnts * | line_p, | ||
struct line_cats * | line_c | ||
) |
Read next vector feature.
This function implements sequential access, constraints are reflected, see Vect_set_constraint_region(), Vect_set_constraint_type(), or Vect_set_constraint_field() for details.
Use Vect_rewind() to reset reading. Topological level is not required.
A warning is printed on failure.
Map | pointer Map_info struct | |
[out] | line_p | feature geometry (pointer to line_pnts struct) |
[out] | line_c | feature categories (pointer to line_cats struct) |
Definition at line 130 of file vector/Vlib/read.c.
References _, G_debug(), G_warning(), Map_info::next_line, and VECT_OPEN.
Copy region window to bounding box.
Window | region structure (raster-based) | |
[out] | Box | boundary box (vector-based) |
Definition at line 461 of file vector/Vlib/box.c.
References Box, Cell_head::east, Cell_head::north, PORT_DOUBLE_MAX, Cell_head::south, and Cell_head::west.
Referenced by P_Mean_Calc().
void Vect_remove_bridges | ( | struct Map_info * | Map, |
struct Map_info * | Err, | ||
int * | lines_removed, | ||
int * | bridges_removed | ||
) |
Remove bridges from vector map.
Remove bridges (type boundary) connecting areas to islands or 2 islands. Islands and areas must be already clean, i.e. without dangles. Bridge may be formed by more lines. Optionally deleted bridges are written to error map. Input map must be opened on level 2 for update at least on level GV_BUILD_BASE
Map | input map where bridges are deleted |
Err | vector map where deleted bridges are written or NULL |
lines_removed | number of lines removed |
bridges_removed | Err number of bridges removed |
int Vect_remove_colors | ( | const char * | name, |
const char * | mapset | ||
) |
Remove color table of raster map.
name | name of raster map |
mapset | name of mapset |
Definition at line 29 of file vector/Vlib/color_remove.c.
References G_mapset(), G_name_is_fully_qualified(), G_remove(), GMAPSET_MAX, GNAME_MAX, GPATH_MAX, GV_COLR2_DIRECTORY, GV_COLR_ELEMENT, GV_DIRECTORY, and name.
void Vect_remove_constraints | ( | struct Map_info * | Map | ) |
Remove all constraints.
Map | pointer to Map_info struct |
Definition at line 122 of file constraint.c.
References Map_info::constraint, FALSE, Map_info::field_flag, Map_info::region_flag, and Map_info::type_flag.
void Vect_remove_dangles | ( | struct Map_info * | Map, |
int | type, | ||
double | maxlength, | ||
struct Map_info * | Err | ||
) |
Remove dangles from vector map.
Remove dangles of given type shorter than maxlength from vector map.
Line is considered to be a dangle if on at least one end node is no other line of given type(s). If a dangle is formed by more lines, such string of lines is taken as one dangle and either deleted are all parts or nothing.
Optionally deleted dangles are written to error map.
Input map must be opened on level 2 for update.
Map | input map where have to be deleted | |
type | type of dangles (GV_LINES, GV_LINE or GV_BOUNDARY) | |
maxlength | maxlength of dangles or -1 for all dangles | |
[out] | Err | vector map where deleted dangles are written or NULL |
Remove duplicate features from vector map.
Remove duplicate lines of given types from vector map. Duplicate lines may be optionally written to error map. Input map must be opened on level 2 for update. Categories are merged. GV_BUILD_BASE is sufficient.
[in,out] | Map | vector map where duplicate lines will be deleted |
type | type of line to be delete | |
[out] | Err | vector map where duplicate lines will be written or NULL |
Definition at line 69 of file remove_duplicates.c.
int Vect_remove_small_areas | ( | struct Map_info * | Map, |
double | thresh, | ||
struct Map_info * | Err, | ||
double * | removed_area | ||
) |
Remove small areas from the map map.
Centroid of the area and the longest boundary with adjacent area is removed. Map topology must be built GV_BUILD_CENTROIDS.
[in,out] | Map | vector map |
thresh | maximum area size for removed areas | |
[out] | Err | vector map where removed lines and centroids are written |
removed_area | pointer to where total size of removed area is stored or NULL |
Definition at line 41 of file remove_areas.c.
References Map_info::format, GV_FORMAT_NATIVE, Vect_remove_small_areas_ext(), and Vect_remove_small_areas_nat().
int Vect_rename | ( | const char * | in, |
const char * | out | ||
) |
Rename existing vector map (in the current mapset).
Attribute tables are created in the same database where input tables were stored.
The original format (native/OGR) is used.
Note: Output vector map is overwritten if exists!
in | name of vector map to be renamed |
out | name for output vector map |
Definition at line 233 of file map.c.
Referenced by M_do_rename().
int Vect_reset_boxlist | ( | struct boxlist * | list | ) |
Reset boxlist structure.
To make sure boxlist structure is clean to be re-used. List must have previously been created with Vect_new_boxlist().
[in,out] | list | pointer to struct boxlist |
Definition at line 251 of file vector/Vlib/list.c.
int Vect_reset_cats | ( | struct line_cats * | Cats | ) |
Reset category structure to make sure cats structure is clean to be re-used.
I.e. it has no cats associated with it. Cats must have previously been created with Vect_new_cats_struct()
[out] | Cats | line_cats structure |
Definition at line 296 of file vector/Vlib/cats.c.
References line_cats::n_cats.
Referenced by IL_write_point_2d(), Vect_get_area_cat(), and Vect_get_area_cats().
void Vect_reset_dblinks | ( | struct dblinks * | p | ) |
Reset dblinks structure (number of fields)
p | pointer to existing dblinks structure |
Definition at line 101 of file field.c.
References dblinks::n_fields.
Referenced by Vect_read_dblinks().
void Vect_reset_line | ( | struct line_pnts * | Points | ) |
Reset line.
Make sure line structure is clean to be re-used, i.e. it has no points associated with it Points must have previously been created with Vect_new_line_struct().
Points | pointer to line_pnts structure to be reset |
Definition at line 129 of file line.c.
Referenced by IL_write_point_2d(), Vect__get_area_points_pg(), Vect_get_area_points(), and Vect_get_isle_points().
int Vect_reset_list | ( | struct ilist * | list | ) |
Reset ilist structure.
To make sure ilist structure is clean to be re-used. List must have previously been created with Vect_new_list().
[in,out] | list | pointer to struct ilist |
Definition at line 56 of file vector/Vlib/list.c.
Referenced by Vect_field_cat_get(), Vect_select_areas_by_polygon(), Vect_select_nodes_by_box(), and Vect_spatial_index_select().
void Vect_reset_updated | ( | struct Map_info * | Map | ) |
Reset list of updated lines/nodes.
Map | pointer to Map_info struct |
Definition at line 469 of file level_two.c.
int Vect_restore_line | ( | struct Map_info * | Map, |
off_t | offset, | ||
off_t | line | ||
) |
Restore previously deleted feature (topological level required)
Note: Topology must be built at level >= GV_BUILD_BASE
A warning is printed on error.
Map | pointer to Map_info structure |
offset | feature offset to be restored |
line | feature id to be restored (used only on level 2) |
Definition at line 309 of file vector/Vlib/write.c.
int Vect_rewind | ( | struct Map_info * | Map | ) |
Rewind vector map to cause reads to start at beginning.
Map | pointer to Map_info structure |
Definition at line 62 of file vector/Vlib/rewind.c.
References G_debug(), Map_info::level, Map_info::name, and VECT_OPEN.
off_t Vect_rewrite_line | ( | struct Map_info * | Map, |
off_t | line, | ||
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Rewrites existing feature (topological level required)
Note: Topology must be built at level >= GV_BUILD_BASE
A warning is printed on error.
The number of points or cats or type may change. If necessary, the old feature is deleted and new is written.
Map | pointer to Map_info structure |
line | feature id (level 2) or feature offset (level 1) |
type | feature type (GV_POINT, GV_LINE, ...) |
points | feature geometry |
cats | feature categories |
Definition at line 238 of file vector/Vlib/write.c.
int Vect_save_fidx | ( | struct Map_info * | Map, |
struct Format_info_offset * | offset | ||
) |
Save feature index file for vector map.
Map | pointer to Map_info structure |
offset | pointer to Format_info_offset struct (see Format_info_ogr and Format_info_pg struct for implementation issues) |
Definition at line 116 of file build_ogr.c.
References _, Format_info_offset::array, Format_info_offset::array_num, Plus_head::built, dig__byte_order_out(), dig__fwrite_port_C(), dig__fwrite_port_I(), dig__fwrite_port_L(), dig_file_init(), dig_init_portable(), dig_set_cur_port(), FALSE, gvfile::file, G_debug(), G_fatal_error(), G_mapset(), G_warning(), GPATH_MAX, GV_BUILD_ALL, GV_DIRECTORY, GV_FIDX_ELEMENT, Map_info::mapset, Map_info::name, NULL, Map_info::plus, Map_info::support_updated, and Vect__get_element_path().
Referenced by V2_close_ogr(), and V2_close_pg().
int Vect_save_frmt | ( | struct Map_info * | Map | ) |
Save format definition file for vector map.
Map | pointer to Map_info structure |
Definition at line 243 of file vector/Vlib/close.c.
References _, Format_info_pg::conninfo, Format_info_ogr::dsn, Map_info::fInfo, Map_info::format, G_fatal_error(), G_fopen_new(), G_verbose_message(), G_warning(), GPATH_MAX, GV_DIRECTORY, GV_FORMAT_OGR, GV_FORMAT_POSTGIS, GV_FRMT_ELEMENT, Format_info_ogr::layer_name, Map_info::name, NULL, Format_info::ogr, Format_info::pg, Format_info_pg::schema_name, and Format_info_pg::table_name.
Referenced by V1_close_ogr(), and V1_close_pg().
int Vect_save_sidx | ( | struct Map_info * | Map | ) |
Save spatial index file for vector map.
Map | vector map |
Definition at line 1261 of file build.c.
References _, dig__byte_order_out(), dig_file_init(), dig_init_portable(), dig_Wr_spidx(), FALSE, gvfile::file, G_debug(), G_warning(), GPATH_MAX, GV_SIDX_ELEMENT, NULL, Map_info::plus, Plus_head::Spidx_built, Plus_head::spidx_fp, Plus_head::Spidx_new, Plus_head::spidx_port, TRUE, Vect__get_element_path(), and Vect_get_name().
int Vect_save_topo | ( | struct Map_info * | Map | ) |
Save topology file for vector map.
Map | pointer to Map_info structure |
Definition at line 1012 of file build.c.
References _, dig__byte_order_out(), dig_file_init(), dig_init_portable(), dig_write_plus_file(), gvfile::file, G_debug(), G_fopen_new(), G_warning(), GPATH_MAX, GV_TOPO_ELEMENT, Map_info::name, NULL, Map_info::plus, Plus_head::port, and Vect__get_path().
int Vect_segment_intersection | ( | double | ax1, |
double | ay1, | ||
double | az1, | ||
double | ax2, | ||
double | ay2, | ||
double | az2, | ||
double | bx1, | ||
double | by1, | ||
double | bz1, | ||
double | bx2, | ||
double | by2, | ||
double | bz2, | ||
double * | x1, | ||
double * | y1, | ||
double * | z1, | ||
double * | x2, | ||
double * | y2, | ||
double * | z2, | ||
int | with_z | ||
) |
Check for intersect of 2 line segments.
ax1,ay1,az1,ax2,ay2,az2 | input line a | |
bx1,by1,bz1,bx2,by2,bz2 | input line b | |
[out] | x1,y1,z1 | intersection point1 (case 2-4) |
[out] | x2,y2,z2 | intersection point2 (case 2-4) |
with_z | use z coordinate (3D) (TODO) |
Definition at line 111 of file vector/Vlib/intersect.c.
int Vect_select_areas_by_box | ( | struct Map_info * | Map, |
const struct bound_box * | Box, | ||
struct boxlist * | list | ||
) |
Select areas with bounding boxes by box.
Select areas whose boxes overlap specified box!!! It means that selected area may or may not overlap the box.
Map | vector map | |
Box | bounding box | |
[out] | output | list, must be initialized |
Definition at line 121 of file sindex.c.
Referenced by Vect_find_area().
int Vect_select_areas_by_polygon | ( | struct Map_info * | Map, |
struct line_pnts * | Polygon, | ||
int | nisles, | ||
struct line_pnts ** | Isles, | ||
struct ilist * | List | ||
) |
Select areas by Polygon with optional isles.
Polygons should be closed, i.e. first and last points must be identical.
Map | vector map | |
Polygon | outer ring | |
nisles | number of islands or 0 | |
Isles | array of islands or NULL | |
[out] | list | output list, must be initialised |
Definition at line 317 of file sindex.c.
References G_debug(), GV_BOUNDARY, ilist::n_values, NULL, Vect_new_list(), Vect_reset_list(), and Vect_select_lines_by_polygon().
Select dangles from vector map.
Remove dangles of given type shorter than maxlength from vector map.
Line is considered to be a dangle if on at least one end node is no other line of given type(s). If a dangle is formed by more lines, such string of lines is taken as one dangle.
Input map must be opened on level 2 for update.
Map | input map where have to be deleted | |
type | type of dangles (GV_LINES, GV_LINE or GV_BOUNDARY) | |
maxlength | maxlength of dangles or -1 for all dangles | |
[out] | List | list of selected features |
int Vect_select_isles_by_box | ( | struct Map_info * | Map, |
const struct bound_box * | Box, | ||
struct boxlist * | list | ||
) |
Select isles with bounding boxes by box.
Select isles whose boxes overlap specified box!!! It means that selected isle may or may not overlap the box.
Map | vector map | |
Box | bounding box | |
[out] | list | output list, must be initialized |
Definition at line 165 of file sindex.c.
References Box, dig_select_isles(), G_debug(), and Map_info::plus.
Referenced by Vect_attach_isles().
int Vect_select_lines_by_box | ( | struct Map_info * | Map, |
const struct bound_box * | Box, | ||
int | type, | ||
struct boxlist * | list | ||
) |
Select lines with bounding boxes by box.
Select lines whose boxes overlap specified box!!! It means that selected line may or may not overlap the box.
Map | vector map | |
Box | bounding box | |
type | line type | |
[out] | list | output list, must be initialized |
int Vect_select_lines_by_polygon | ( | struct Map_info * | Map, |
struct line_pnts * | Polygon, | ||
int | nisles, | ||
struct line_pnts ** | Isles, | ||
int | type, | ||
struct ilist * | List | ||
) |
Select lines by Polygon with optional isles.
Polygons should be closed, i.e. first and last points must be identical.
Map | vector map | |
Polygon | outer ring | |
nisles | number of islands or 0 | |
Isles | array of islands or NULL | |
type | line type | |
[out] | list | output list, must be initialised |
Definition at line 220 of file sindex.c.
Referenced by Vect_select_areas_by_polygon().
int Vect_select_nodes_by_box | ( | struct Map_info * | Map, |
const struct bound_box * | Box, | ||
struct ilist * | list | ||
) |
Select nodes by box.
Map | vector map | |
Box | bounding box | |
[out] | list | output list, must be initialized |
Definition at line 187 of file sindex.c.
References Box, dig_select_nodes(), G_debug(), Map_info::plus, and Vect_reset_list().
Referenced by Vect_find_node().
void Vect_set_category_index_update | ( | struct Map_info * | Map | ) |
Set category index to be updated when vector is changed.
By default, category index is not updated if vector is changed, this function sets category index update.
WARNING: currently only category for elements is updated not for areas
Map | vector map |
Definition at line 561 of file map.c.
References Map_info::plus, TRUE, and Plus_head::update_cidx.
int Vect_set_comment | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set comment or other info string in map header.
Map | pointer to Map_info structure |
str | comment or other info string |
Definition at line 438 of file vector/Vlib/header.c.
References dig_head::comment, G_free(), G_store(), and Map_info::head.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_constraint_field | ( | struct Map_info * | Map, |
int | field | ||
) |
Set constraint field.
Vect_read_next_line() will read only features of given type. Note that categories must be read otherwise this constraint is ignored. Constraint is ignored for random access - Vect_read_line().
Ignored for non-native vector formats.
Note: Field is called layer on user level.
Map | pointer to Map_info struct |
field | field number (-1 for all fields) |
Definition at line 147 of file constraint.c.
References _, Map_info::constraint, FALSE, Map_info::field, Map_info::field_flag, Map_info::format, G_warning(), GV_FORMAT_NATIVE, and TRUE.
int Vect_set_constraint_region | ( | struct Map_info * | Map, |
double | n, | ||
double | s, | ||
double | e, | ||
double | w, | ||
double | t, | ||
double | b | ||
) |
Set constraint region.
Vect_read_next_line() will read only features inside of given region or features with overlapping bounding box.
Map | pointer to Map_info struct |
n,s,e,w,t,b | bbox definition (north, south, east, west, top, and bottom coordinates) |
Definition at line 48 of file constraint.c.
int Vect_set_constraint_type | ( | struct Map_info * | Map, |
int | type | ||
) |
Set constraint type.
Vect_read_next_line() will read only features of given type. Constraint is ignored for random access - Vect_read_line().
Map | pointer to Map_info struct |
type | constraint feature type (GV_POINT, GV_LINE, ...) |
Definition at line 106 of file constraint.c.
int Vect_set_date | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set date of digitization in map header.
Map | pointer to Map_info structure |
str | date given as string |
Definition at line 299 of file vector/Vlib/header.c.
References dig_head::date, G_free(), G_store(), and Map_info::head.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
void Vect_set_db_updated | ( | struct Map_info * | Map | ) |
Rewrite 'dbln' file.
Should be used by GRASS modules which update database tables, so that other applications know that tables were changed and can reload data.
Map | pointer to Map_info structure |
Definition at line 990 of file field.c.
References _, G_fatal_error(), G_mapset(), G_strcasecmp(), Map_info::mapset, and Vect_write_dblinks().
Define standard error handler for input and output vector maps.
This handler:
Note: It's recommended to call this routine after Vect_open_old() or Vect_open_old2().
In | pointer in Map_info struct (input vector map) or NULL |
Out | pointer to Map_info struct (output vector map) or NULL |
Definition at line 58 of file vector/Vlib/handler.c.
int Vect_set_map_date | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set date when the source map was originally produced in map header.
Map | pointer to Map_info structure |
str | date given as a string |
Definition at line 383 of file vector/Vlib/header.c.
References G_free(), G_store(), Map_info::head, and dig_head::source_date.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_map_name | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set map name in map header.
Map | pointer to Map_info structure |
str | map name to be set |
Definition at line 355 of file vector/Vlib/header.c.
References G_free(), G_store(), Map_info::head, and dig_head::map_name.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_open_level | ( | int | level | ) |
Predetermine level at which a vector map will be opened for reading.
If it can't open that level, the open will fail. The specified level must be set before any call to open. The default is to try to open the highest level possible, and keep stepping down until success.
NOTE: This should only be used to set when you wish to force a lower level open. If you require a higher level, then just check the return to verify the level instead of forcing it. This is because future releases will have higher levels which will be downward compatible and which your programs should support by default.
level | vector access level |
Definition at line 138 of file vector/Vlib/open.c.
int Vect_set_organization | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set organization string in map header.
Map | pointer to Map_info structure |
str | organization name |
Definition at line 268 of file vector/Vlib/header.c.
References G_free(), G_store(), Map_info::head, and dig_head::organization.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_person | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set name of user who digitized the map in map header.
Map | pointer to Map_info structure |
str | user name |
Definition at line 327 of file vector/Vlib/header.c.
References G_free(), G_store(), Map_info::head, and dig_head::user_name.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_proj | ( | struct Map_info * | Map, |
int | proj | ||
) |
Set projection in map header.
Supported projections:
Map | pointer to Map_info structure |
proj | projection code |
Definition at line 503 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::proj.
Referenced by Vect__init_head(), and Vect__read_head().
void Vect_set_release_support | ( | struct Map_info * | Map | ) |
Set spatial index to be released when vector is closed.
By default, the memory occupied by spatial index is not released.
Map | vector map |
Definition at line 545 of file map.c.
References Map_info::plus, Plus_head::release_support, and TRUE.
int Vect_set_scale | ( | struct Map_info * | Map, |
int | scale | ||
) |
Set map scale in map header.
Map | pointer to Map_info structure |
scale | map scale |
Definition at line 411 of file vector/Vlib/header.c.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_thresh | ( | struct Map_info * | Map, |
double | thresh | ||
) |
Set threshold used for digitization in map header.
Map | pointer to Map_info structure |
thresh | threshold used for digitization |
Definition at line 571 of file vector/Vlib/header.c.
References dig_head::digit_thresh, G_debug(), and Map_info::head.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
void Vect_set_updated | ( | struct Map_info * | Map, |
int | enable | ||
) |
Enable/disable maintenance of list of updated lines/nodes.
See Plus_head.uplist for details.
Map | pointer to Map_info struct |
enable | TRUE/FALSE to enable/disable |
Definition at line 454 of file level_two.c.
References G_debug(), and Map_info::name.
int Vect_set_varray_from_cat_list | ( | struct Map_info * | Map, |
int | field, | ||
struct cat_list * | clist, | ||
int | type, | ||
int | value, | ||
struct varray * | varray | ||
) |
Set values in 'varray' to 'value' from category list.
If category of object of given type is in clist (category list). type may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID
Array is not reset to zero before, but old values (if any > 0) are overwritten. Array must be initialised by Vect_new_varray() call.
Map | vector map | |
field | layer number | |
clist | list of categories | |
type | feature type | |
value | value to set up | |
[out] | varray | varray structure to modify |
int Vect_set_varray_from_cat_string | ( | struct Map_info * | Map, |
int | field, | ||
const char * | cstring, | ||
int | type, | ||
int | value, | ||
struct varray * | varray | ||
) |
Set values in 'varray' to 'value' from category string.
If category of object of given type is in cstring (string representing category list like: '1,3,5-7'). type may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID
Array is not reset to zero before, but old values (if any > 0) are overwritten. Array must be initialised by Vect_new_varray() call.
Map | vector map | |
field | layer number | |
cstring | pointer to string with categories | |
type | feature type | |
value | value to set up | |
[out] | varray | varray structure to modify |
Definition at line 79 of file array.c.
Referenced by NetA_initialise_varray().
int Vect_set_varray_from_db | ( | struct Map_info * | Map, |
int | field, | ||
const char * | where, | ||
int | type, | ||
int | value, | ||
struct varray * | varray | ||
) |
Set values in 'varray' to 'value' from DB (where statement)
I category of object of given type is in categories selected from DB based on where statement (given without where). type may be either: GV_AREA or: GV_POINT | GV_LINE | GV_BOUNDARY | GV_CENTROID
Array is not reset to zero before, but old values (if any > 0) are overwritten. Array must be initialised by Vect_new_varray() call.
Map | vector map | |
field | layer number | |
where | where statement | |
type | feature type | |
value | value to set up | |
[out] | varray | varray structure to modify |
Definition at line 242 of file array.c.
Referenced by NetA_initialise_varray().
int Vect_set_zone | ( | struct Map_info * | Map, |
int | zone | ||
) |
Set projection zone in map header.
Map | pointer to Map_info structure |
zone | projection zone |
Definition at line 466 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::plani_zone.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_sfa_check_line_type | ( | const struct line_pnts * | Points, |
int | type, | ||
SF_FeatureType | sftype, | ||
int | with_z | ||
) |
Check SF type.
E.g. if type is GV_LINE with two or more segments and the start node is identical with the end node, and sftype is SF_LINEARRING, functions returns 1, otherwise 0.
Points | pointer to line_pnts structure |
type | feature type (GV_POINT, GV_LINE, ...) |
sftype | SF type to be checked (SF_POINT, SF_LINE, ...) |
with_z | non-zero value for 3D data |
Definition at line 114 of file simple_features.c.
SF_FeatureType Vect_sfa_get_line_type | ( | const struct line_pnts * | Points, |
int | type, | ||
int | with_z | ||
) |
Get SF type of given vector feature.
List of supported feature types:
Points | pointer to line_pnts structure |
type | feature type (see supported types above) |
with_z | WITH_Z for 3D data |
Definition at line 64 of file simple_features.c.
int Vect_sfa_get_num_features | ( | struct Map_info * | Map | ) |
Get number of simple features.
For native format or PostGIS Topology returns -1
Map | vector map |
Definition at line 300 of file simple_features.c.
References _, Format_info_pg::conn, DB_SQL_MAX, Map_info::fInfo, Map_info::format, G_fatal_error(), G_warning(), GV_FORMAT_OGR, GV_FORMAT_OGR_DIRECT, GV_FORMAT_POSTGIS, Format_info_ogr::layer, Format_info::ogr, Format_info::pg, Format_info_pg::schema_name, Format_info_pg::table_name, Format_info_pg::toposchema_name, TRUE, Vect__execute_get_value_pg(), and Vect_get_full_name().
int Vect_sfa_get_type | ( | SF_FeatureType | sftype | ) |
Get relevant GV type.
Map | pointer to Map_info structure |
type | SF geometry type (SF_POINT, SF_LINESTRING, ...) |
Definition at line 79 of file simple_features.c.
References GV_BOUNDARY, GV_LINE, GV_POINT, SF_LINEARRING, SF_LINESTRING, SF_LINESTRING25D, SF_POINT, SF_POINT25D, SF_POLYGON, and SF_POLYGON25D.
int Vect_sfa_is_line_closed | ( | const struct line_pnts * | Points, |
int | type, | ||
int | with_z | ||
) |
Check if feature is closed.
Points | pointer to line_pnts structure |
type | feature type (GV_LINE or GV_BOUNDARY) |
Definition at line 271 of file simple_features.c.
int Vect_sfa_is_line_simple | ( | const struct line_pnts * | , |
int | , | ||
int | |||
) |
int Vect_sfa_line_astext | ( | const struct line_pnts * | Points, |
int | type, | ||
int | with_z, | ||
int | precision, | ||
FILE * | file | ||
) |
Export geometry to Well-Known Text.
Points | pointer to line_pnts structure | |
type | feature type | |
with_z | non-zero value for 3D data | |
precision | floating number precision | |
[out] | file | file where to write the output |
Definition at line 188 of file simple_features.c.
int Vect_sfa_line_dimension | ( | int | type | ) |
Get geometry dimension.
Points | pointer to line_pnts structure |
type | feature type (GV_POINT, GV_LINE, ...) |
Definition at line 131 of file simple_features.c.
char* Vect_sfa_line_geometry_type | ( | const struct line_pnts * | Points, |
int | type | ||
) |
Get geometry type (string)
Supported types:
Note: Allocated string should be freed by G_free().
Points | pointer to line_pnts structure (feature geometry) |
type | feature type (see supported types above) |
Definition at line 160 of file simple_features.c.
int Vect_sidx_dump | ( | struct Map_info * | Map, |
FILE * | out | ||
) |
Dump spatial index to file.
Map | vector map |
out | file for output (stdout/stderr for example) |
Definition at line 1315 of file build.c.
References dig_dump_spidx(), Map_info::plus, Plus_head::Spidx_built, and Vect_build_sidx_from_topo().
int Vect_snap_line | ( | struct Map_info * | Map, |
struct ilist * | reflist, | ||
struct line_pnts * | Points, | ||
double | thresh, | ||
int | with_z, | ||
int * | nsnapped, | ||
int * | ncreated | ||
) |
Snap a line to reference lines in Map with threshold.
3D snapping is supported. The line to snap and the reference lines can but do not need to be in different vector maps.
Vect_snap_line() uses less memory, but is slower than Vect_snap_lines_list()
For details on snapping, see Vect_snap_lines_list()
[in] | Map | input map with reference lines |
[in] | reflist | list of reference lines |
[in,out] | Points | line points to snap |
[in] | thresh | threshold in which to snap vertices |
[in] | with_z | 2D or 3D snapping |
[in,out] | nsnapped | number of snapped vertices |
[in,out] | ncreated | number of new vertices (on segments) |
Definition at line 949 of file Vlib/snap.c.
Snap lines in vector map to existing vertex in threshold.
For details see Vect_snap_lines_list()
[in] | Map | input map where vertices will be snapped |
[in] | type | type of lines to snap |
[in] | thresh | threshold in which snap vertices |
[out] | Err | vector map where lines representing snap are written or NULL |
Definition at line 896 of file Vlib/snap.c.
void Vect_snap_lines_list | ( | struct Map_info * | Map, |
const struct ilist * | List_lines, | ||
double | thresh, | ||
struct Map_info * | Err | ||
) |
Snap selected lines to existing vertex in threshold.
Snap selected lines to existing vertices of other selected lines. 3D snapping is not supported.
Lines showing how vertices were snapped may be optionally written to error map. Input map must be opened on level 2 for update at least on GV_BUILD_BASE.
As mentioned above, lines are not necessarily snapped to nearest vertex! For example:
| | 1 line 3 is snapped to line 1, | then line 2 is not snapped to common node at lines 1 and 3, because it is already outside of threshold ----------- 3 | | 2 |
The algorithm selects anchor vertices and snaps non-anchor vertices to these anchors. The distance between anchor vertices is always > threshold. If there is more than one anchor vertex within threshold around a non-anchor vertex, this vertex is snapped to the nearest anchor vertex within threshold.
Map | input map where vertices will be snapped | |
List_lines | list of lines to snap | |
thresh | threshold in which snap vertices | |
[out] | Err | vector map where lines representing snap are written or NULL |
Definition at line 169 of file Vlib/snap.c.
void Vect_spatial_index_add_item | ( | struct spatial_index * | si, |
int | id, | ||
const struct bound_box * | box | ||
) |
Add a new item to spatial index structure.
[in,out] | si | pointer to spatial index structure |
id | item identifier | |
box | pointer to item bounding box |
Definition at line 62 of file vector/Vlib/select.c.
References bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_malloc, bound_box::N, RTree::nsides_alloc, RTreeInsertRect(), bound_box::S, spatial_index::si_tree, bound_box::T, and bound_box::W.
void Vect_spatial_index_del_item | ( | struct spatial_index * | si, |
int | id, | ||
const struct bound_box * | box | ||
) |
Delete item from spatial index structure.
[in,out] | si | pointer to spatial index structure |
id | item identifier |
Definition at line 92 of file vector/Vlib/select.c.
References _, bound_box::B, RTree_Rect::boundary, bound_box::E, G_debug(), G_fatal_error(), G_malloc, bound_box::N, RTree::nsides_alloc, RTreeDeleteRect(), bound_box::S, spatial_index::si_tree, bound_box::T, and bound_box::W.
void Vect_spatial_index_destroy | ( | struct spatial_index * | si | ) |
Destroy existing spatial index.
Vect_spatial_index_init() must be call before new use.
si | pointer to spatial index structure |
Definition at line 46 of file vector/Vlib/select.c.
References G_debug(), RTreeDestroyTree(), and spatial_index::si_tree.
void Vect_spatial_index_init | ( | struct spatial_index * | si, |
int | with_z | ||
) |
Initialize spatial index structure.
si | pointer to spatial index structure |
Definition at line 30 of file vector/Vlib/select.c.
References G_debug(), RTreeCreateTree(), and spatial_index::si_tree.
int Vect_spatial_index_select | ( | const struct spatial_index * | si, |
const struct bound_box * | box, | ||
struct ilist * | list | ||
) |
Select items by bounding box to list.
si | pointer to spatial index structure | |
box | bounding box | |
[out] | list | pointer to list where selected items are stored |
Definition at line 137 of file vector/Vlib/select.c.
References bound_box::B, RTree_Rect::boundary, bound_box::E, G_malloc, bound_box::N, RTree::nsides_alloc, RTreeSearch(), bound_box::S, spatial_index::si_tree, bound_box::T, Vect_reset_list(), and bound_box::W.
int Vect_str_to_cat_list | ( | const char * | str, |
struct cat_list * | list | ||
) |
Converts string of categories and cat ranges separated by commas to cat_list.
5,6,7 3-9 2,3,5-9,20
cat_list->field = 0 cat_list->n_ranges = 4 cat_list->min = {2, 3, 5, 20} cat_list->max = {2, 3, 9, 20}
str | category list as a string | |
[in,out] | list | pointer to cat_list structure |
Definition at line 368 of file vector/Vlib/cats.c.
char* Vect_subst_var | ( | const char * | in, |
struct Map_info * | Map | ||
) |
Substitute variable in string.
in | current string |
Map | pointer to Map_info structure |
Definition at line 931 of file field.c.
Referenced by Vect_get_dblink().
int Vect_tin_get_z | ( | struct Map_info * | , |
double | , | ||
double | , | ||
double * | , | ||
double * | , | ||
double * | |||
) |
Extensive tests for correct topology.
Map | vector map | |
[out] | Err | vector map where errors will be written or NULL |
int Vect_topo_dump | ( | struct Map_info * | Map, |
FILE * | out | ||
) |
int Vect_val_in_boxlist | ( | const struct boxlist * | list, |
int | id | ||
) |
Find a given item in the list.
list | pointer to boxlist structure |
id | value of item |
Definition at line 417 of file vector/Vlib/list.c.
References NULL.
int Vect_val_in_list | ( | const struct ilist * | list, |
int | val | ||
) |
Find a given item in the list.
list | pointer to ilist structure |
val | value of item |
Definition at line 196 of file vector/Vlib/list.c.
References NULL.
int Vect_write_ascii | ( | FILE * | ascii, |
FILE * | att, | ||
struct Map_info * | Map, | ||
int | ver, | ||
int | format, | ||
int | dp, | ||
char * | fs, | ||
int | region_flag, | ||
int | type, | ||
int | field, | ||
const struct cat_list * | Clist, | ||
const char * | where, | ||
const char ** | column_names, | ||
int | header | ||
) |
Write data to GRASS ASCII vector format.
Prints message if some features without category are skipped.
[out] | ascii | pointer to the output ASCII file |
[out] | att | att file (< version 5 only) |
Map | pointer to Map_info structure | |
ver | version number 4 or 5 | |
format | format GV_ASCII_FORMAT_POINT or GV_ASCII_FORMAT_STD | |
dp | number of significant digits | |
fs | field separator | |
region_flag | check region | |
type | feature type filter | |
field | field number | |
Clist | list of categories to filter features or NULL | |
where | SQL select where statement to filter features or NULL | |
column_names | array of columns to be included to the output or NULL "*" as the first item in the array indicates all columns | |
header | TRUE to print also header |
void Vect_write_ascii_head | ( | FILE * | dascii, |
struct Map_info * | Map | ||
) |
Write data to GRASS ASCII vector format.
[out] | dascii | pointer to the output ASCII file |
Map | pointer to Map_info structure |
Definition at line 945 of file ascii.c.
References HOST_NEWLINE, Vect_get_comment(), Vect_get_date(), Vect_get_map_date(), Vect_get_map_name(), Vect_get_organization(), Vect_get_person(), Vect_get_scale(), Vect_get_thresh(), and Vect_get_zone().
void Vect_write_colors | ( | const char * | name, |
const char * | mapset, | ||
struct Colors * | colors | ||
) |
Write color table for vector map.
The color table is written for the vector map name in the specified mapset from the colors structure.
The colors structure must be created properly, i.e., Rast_init_colors() to initialize the structure and Rast_add_c_color_rule() to set the category colors. These routines are called by higher level routines which read or create entire color tables, such as Rast_read_colors() or Rast_make_ramp_colors().
Note: The calling sequence for this function deserves special attention. The mapset parameter seems to imply that it is possible to overwrite the color table for a vector map which is in another mapset. However, this is not what actually happens. It is very useful for users to create their own color tables for vector maps in other mapsets, but without overwriting other users' color tables for the same raster map. If mapset is the current mapset, then the color file for name will be overwritten by the new color table. But if mapset is not the current mapset, then the color table is actually written in the current mapset under the colr2
element as: vector/name/colr2
.
The rules are written out using floating-point format, removing trailing zeros (possibly producing integers). The flag marking the colors as floating-point is not written.
If the environment variable FORCE_GRASS3_COLORS is set (to anything at all) then the output format is 3.0, even if the structure contains 4.0 rules. This allows users to create 3.0 color files for export to sites which don't yet have 4.0
name | vector map name |
mapset | mapset name |
colors | pointer to structure Colors which holds color info |
Definition at line 61 of file vector/Vlib/color_write.c.
int Vect_write_dblinks | ( | struct Map_info * | Map | ) |
Write dblinks to file.
Map | pointer to Map_info structure |
Definition at line 878 of file field.c.
References _, field_info::database, Map_info::dblnk, field_info::driver, dblinks::field, Map_info::format, G_debug(), G_fopen_new(), G_warning(), GPATH_MAX, GV_DBLN_ELEMENT, GV_FORMAT_NATIVE, field_info::key, Map_info::mapset, dblinks::n_fields, field_info::name, Map_info::name, NULL, field_info::number, field_info::table, Vect__get_path(), and Vect_get_name().
Referenced by V1_close_nat(), Vect_map_del_dblink(), and Vect_set_db_updated().
int Vect_write_header | ( | struct Map_info * | Map | ) |
Write vector map header to map head file.
Map | pointer to Map_info structure |
Definition at line 64 of file vector/Vlib/header.c.
References Vect__write_head().
off_t Vect_write_line | ( | struct Map_info * | Map, |
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Writes a new feature.
New feature is written to the end of file (in the case of native format). Topological level is not required.
A warning is printed on error.
Map | pointer to Map_info structure |
type | feature type (see dig_defines.h for supported types) |
points | pointer to line_pnts structure (feature geometry) |
cats | pointer to line_cats structure (feature categories) |
Definition at line 196 of file vector/Vlib/write.c.
Referenced by IL_write_point_2d().