GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72846
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vector/Vlib/write.c File Reference

Vector library - write vector features. More...

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

Go to the source code of this file.

Functions

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. More...
 
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) More...
 
int Vect_delete_line (struct Map_info *Map, off_t line)
 Delete existing feature (topological level required) More...
 
int Vect_restore_line (struct Map_info *Map, off_t offset, off_t line)
 Restore previously deleted feature (topological level required) More...
 

Detailed Description

Vector library - write vector features.

Higher level functions for reading/writing/manipulating vectors.

Supported operations:

  • Write a new feature
  • Rewrite existing feature
  • Delete existing feature
  • Restore deleted feature

(C) 2001-2010, 2012-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
Radim Blazek
Updated by Martin Landa <landa.martin gmail.com> (restore lines, OGR & PostGIS support)

Definition in file vector/Vlib/write.c.

Function Documentation

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.

Parameters
Mappointer to Map_info structure
linefeature id (level 2) or feature offset (level 1)
Returns
0 on success
-1 on error

Definition at line 253 of file vector/Vlib/write.c.

References _, Map_info::format, G_debug(), G_warning(), Map_info::level, Map_info::name, PRI_OFF_T, and Vect_get_name().

Referenced by Vect_break_polygons_file(), Vect_break_polygons_mem(), Vect_clean_small_angles_at_nodes(), Vect_merge_lines(), Vect_remove_duplicates(), Vect_remove_small_areas_ext(), Vect_remove_small_areas_nat(), Vedit_bulk_labeling(), Vedit_delete_area(), Vedit_delete_lines(), and Vedit_merge_lines().

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.

Parameters
Mappointer to Map_info structure
offsetfeature offset to be restored
linefeature id to be restored (used only on level 2)
Returns
0 on success
-1 on error

Definition at line 286 of file vector/Vlib/write.c.

References _, Map_info::format, G_debug(), G_warning(), Map_info::level, Map_info::name, PRI_OFF_T, and Vect_get_name().

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.

Parameters
Mappointer to Map_info structure
linefeature id (level 2) or feature offset (level 1)
typefeature type (GV_POINT, GV_LINE, ...)
pointsfeature geometry
catsfeature categories
Returns
new feature id (on level 2) (or 0 when build level < GV_BUILD_BASE)
offset into file where the feature starts (on level 1)
-1 on error

Definition at line 220 of file vector/Vlib/write.c.

References _, Map_info::format, G_debug(), G_warning(), Map_info::level, Map_info::name, PRI_OFF_T, and Vect_get_name().

Referenced by Vect_break_polygons_file(), Vect_break_polygons_mem(), Vect_clean_small_angles_at_nodes(), Vect_remove_duplicates(), Vedit_add_vertex(), Vedit_bulk_labeling(), Vedit_chtype_lines(), Vedit_flip_lines(), Vedit_merge_lines(), Vedit_modify_cats(), Vedit_move_lines(), Vedit_move_vertex(), Vedit_remove_vertex(), Vedit_snap_lines(), and Vedit_split_lines().

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.

Parameters
Mappointer to Map_info structure
typefeature type (see dig_defines.h for supported types)
pointspointer to line_pnts structure (feature geometry)
catspointer to line_cats structure (feature categories)
Returns
new feature id (on level 2) (or 0 when build level < GV_BUILD_BASE)
offset into file where the feature starts (on level 1)
-1 on error

Definition at line 178 of file vector/Vlib/write.c.

References _, Map_info::format, G_debug(), G_warning(), Map_info::level, Map_info::name, and Vect_get_name().

Referenced by IL_check_at_points_2d(), NetA_add_point_on_node(), P_Aux_to_Vector(), P_Sparse_Points(), Vect_break_polygons_file(), Vect_break_polygons_mem(), Vect_clean_small_angles_at_nodes(), Vect_copy_map_lines_field(), Vect_merge_lines(), Vect_overlay_and(), Vect_read_ascii(), Vect_remove_duplicates(), Vect_remove_small_areas_ext(), Vect_remove_small_areas_nat(), Vect_topo_check(), Vedit_bulk_labeling(), Vedit_copy_lines(), and Vedit_split_lines().