grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

read.c File Reference

Vector library - read features. More...

#include <sys/types.h>
#include <grass/vector.h>
#include <grass/glocale.h>
Include dependency graph for read.c:

Go to the source code of this file.

Functions

static int read_dummy ()
 
static int format ()
 
int Vect_get_next_line_id (const struct Map_info *Map)
 Get line id for sequential reading. More...
 
int Vect_read_next_line (const struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c)
 Read next vector feature. More...
 
int Vect_read_line (const struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c, int line)
 Read vector feature (topological level required) More...
 
int Vect_line_alive (const struct Map_info *Map, int line)
 Check if feature is alive or dead (topological level required) More...
 
int Vect_node_alive (const struct Map_info *Map, int node)
 Check if node is alive or dead (topological level required) More...
 
int Vect_area_alive (const struct Map_info *Map, int area)
 Check if area is alive or dead (topological level required) More...
 
int Vect_isle_alive (const struct Map_info *Map, int isle)
 Check if isle is alive or dead (topological level required) More...
 
off_t Vect_get_line_offset (const struct Map_info *Map, int line)
 Get feature offset (topological level required) More...
 

Variables

static int(* Read_next_line_array [][3])()
 
static int(* Read_line_array [])()
 

Detailed Description

Vector library - read features.

Higher level functions for reading/writing/manipulating vectors.

(C) 2001-2009, 2011-2013 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Original author CERL, probably Dave Gerdes or Mike Higgins.
Update to GRASS 5.7 Radim Blazek and David D. Gray.
Update to GRASS 7 Martin Landa <landa.martin gmail.com>

Definition in file read.c.

Function Documentation

◆ format()

static int format ( )
static

Definition at line 30 of file read.c.

References _, and G_fatal_error().

◆ read_dummy()

static int read_dummy ( )
static

Definition at line 22 of file read.c.

References _, and G_warning().

◆ Vect_area_alive()

int Vect_area_alive ( const 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

Parameters
Mappointer to Map_info structure
areaarea id
Returns
1 area alive
0 area is dead or index is out of range

Definition at line 245 of file read.c.

References _, Plus_head::Area, G_warning(), Plus_head::n_areas, NULL, and Map_info::plus.

Referenced by draw_area(), Vect_build_partial(), Vect_remove_small_areas_ext(), Vect_remove_small_areas_nat(), Vect_topo_check(), Vect_write_ascii(), vector2perimeters(), and Vedit_delete_areas_cat().

◆ Vect_get_line_offset()

off_t Vect_get_line_offset ( const 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().

Parameters
Mappointer to Map_info structure
linefeature id
Returns
feature offset
-1 on error

Definition at line 295 of file read.c.

References Plus_head::Line, line(), Plus_head::n_lines, NULL, P_line::offset, and Map_info::plus.

◆ Vect_get_next_line_id()

int Vect_get_next_line_id ( const 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().

Parameters
Mappointer to Map_info struct
Returns
feature id
-1 on error

Definition at line 88 of file read.c.

References _, G_debug(), G_warning(), Map_info::next_line, and VECT_OPEN.

◆ Vect_isle_alive()

int Vect_isle_alive ( const 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

Parameters
Mappointer to Map_info structure
isleisle id
Returns
1 isle alive
0 isle is dead or index is out of range

Definition at line 269 of file read.c.

References _, G_warning(), Plus_head::Isle, Plus_head::n_isles, NULL, and Map_info::plus.

Referenced by draw_area().

◆ Vect_line_alive()

◆ Vect_node_alive()

int Vect_node_alive ( const 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

Parameters
Mappointer to Map_info structure
nodenode id
Returns
1 node alive
0 node is dead or index is out of range

Definition at line 221 of file read.c.

References _, G_warning(), Plus_head::n_nodes, Plus_head::Node, NULL, and Map_info::plus.

Referenced by dangles(), and Vect_clean_small_angles_at_nodes().

◆ Vect_read_line()

int Vect_read_line ( const 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. Constraits are ignored.

Note: Topology must be built at level >= GV_BUILD_BASE

A warning is printed on failure.

Parameters
Mappointer to vector map
[out]line_pfeature geometry (pointer to line_pnts struct)
[out]line_cfeature categories (pointer to line_cats struct)
linefeature id (starts at 1)
Returns
feature type
-1 on failure
-2 nothing to read

Definition at line 160 of file read.c.

References _, Map_info::format, G_debug(), G_warning(), line(), Plus_head::n_lines, Map_info::plus, Read_line_array, Vect_get_full_name(), and VECT_OPEN.

Referenced by break_lines(), connect_lines(), copy_lines_2(), dangles(), draw_line(), extend_lines(), find_shortest_path_coor(), NetA_get_node_costs(), NetA_initialise_varray(), NetA_varray_to_nodes(), remove_bridges(), select_by_query(), V2__delete_area_cats_from_cidx_nat(), Vect__get_area_points_nat(), Vect_break_polygons_file(), Vect_break_polygons_mem(), Vect_build_nat(), Vect_clean_small_angles_at_nodes(), Vect_find_line_list(), Vect_get_area_cats(), Vect_get_line_box(), Vect_get_line_cat(), Vect_merge_lines(), Vect_net_build_graph(), Vect_net_nearest_nodes(), Vect_net_ttb_build_graph(), Vect_net_ttb_shortest_path(), Vect_overlay_and(), Vect_point_in_area_outer_ring(), Vect_point_in_island(), Vect_read_line_to_wkb(), Vect_remove_duplicates(), Vect_remove_small_areas_ext(), Vect_remove_small_areas_nat(), Vect_select_lines_by_polygon(), Vect_set_varray_from_cat_list(), Vect_set_varray_from_db(), Vect_snap_line(), Vect_snap_lines(), Vect_snap_lines_list_kdtree(), Vect_snap_lines_list_rtree(), Vect_topo_check(), Vedit_add_vertex(), Vedit_bulk_labeling(), Vedit_chtype_lines(), Vedit_copy_lines(), Vedit_flip_lines(), Vedit_merge_lines(), Vedit_modify_cats(), Vedit_move_lines(), Vedit_move_vertex(), Vedit_remove_vertex(), Vedit_snap_lines(), Vedit_snap_point(), and Vedit_split_lines().

◆ Vect_read_next_line()

int Vect_read_next_line ( const 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.

Parameters
Mappointer Map_info struct
[out]line_pfeature geometry (pointer to line_pnts struct)
[out]line_cfeature categories (pointer to line_cats struct)
Returns
feature type (GV_POINT, GV_LINE, ...)
-1 on error
-2 nothing to read

Definition at line 121 of file read.c.

References _, Map_info::format, G_debug(), G_warning(), Map_info::level, Map_info::next_line, Read_next_line_array, Vect_get_full_name(), and VECT_OPEN.

Referenced by copy_lines_1(), Gp_load_sites(), Gv_load_vect(), IL_vector_input_data_2d(), P_estimate_splinestep(), P_Read_Vector_Region_Map(), Vect_build_nat(), Vect_copy_map_lines_field(), Vect_get_map_box1(), and Vect_write_ascii().

Variable Documentation

◆ Read_line_array

int(* Read_line_array[])() ( )
static
Initial value:
= {
}
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.
Definition: read_nat.c:136
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.
Definition: read_sfa.c:40
static int format()
Definition: read.c:30

Definition at line 60 of file read.c.

Referenced by Vect_read_line().

◆ Read_next_line_array

int(* Read_next_line_array[][3])() ( )
static
Initial value:
= {
{
, {
, {
, {
}
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.
Definition: read_nat.c:72
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.
Definition: read_nat.c:178
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).
Definition: read_ogr.c:50
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.
Definition: read_ogr.c:76
static int read_dummy()
Definition: read.c:22

Definition at line 37 of file read.c.

Referenced by Vect_read_next_line().