GRASS GIS 7 Programmer's Manual
7.9.dev(2021)-e5379bbd7
|
Vector library - write/modify/delete vector feature (native format) More...
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include "local_proto.h"
Go to the source code of this file.
Functions | |
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) More... | |
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) More... | |
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) More... | |
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) More... | |
int | V1_delete_line_nat (struct Map_info *Map, off_t offset) |
Deletes feature at level 1 (internal use only) More... | |
int | V2_delete_line_nat (struct Map_info *Map, off_t line) |
Deletes feature at topological level (internal use only) More... | |
int | V1_restore_line_nat (struct Map_info *Map, off_t offset, off_t line) |
Restores feature at level 1 (internal use only) More... | |
int | V2_restore_line_nat (struct Map_info *Map, off_t offset, off_t line) |
Restores feature at topological level (internal use only) More... | |
int | V2__delete_line_from_topo_nat (struct Map_info *Map, int line, int type, const struct line_pnts *points, const struct line_cats *cats) |
Delete feature from topology (internal use only) More... | |
int | V2__add_line_to_topo_nat (struct Map_info *Map, off_t offset, int type, const struct line_pnts *points, const struct line_cats *cats, int restore_line, int(*external_routine)(const struct Map_info *, int)) |
Add feature (line) to topology (internal use only) More... | |
Vector library - write/modify/delete vector feature (native format)
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2015 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.
Definition in file write_nat.c.
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 239 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, dig_head::port, and PRI_OFF_T.
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 340 of file write_nat.c.
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 101 of file write_nat.c.
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 43 of file write_nat.c.
int V2__add_line_to_topo_nat | ( | struct Map_info * | Map, |
off_t | offset, | ||
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats, | ||
int | restore_line, | ||
int(*)(const struct Map_info *, int) | external_routine | ||
) |
Add feature (line) to topology (internal use only)
Also updates category index if requested.
Update areas. Areas are modified if:
1) first or/and last point are existing nodes ->
Question: may be by adding line created new area/isle which doesn't go through nodes of this line
old new line +----+----+ +----+----+ +----+----+ | A1 | A2 | + / -> | A1 | /| or + \ -> | A1 | A2 | \ | | | | | | | | | +----+----+ +----+----+ +----+----+ I1 I1 I1 I1
2) line is closed ring (node at the end is new, so it is not case above)
Note that 1) and 2) is done by the same code.
Map | pointer to Map_info structure |
offset | feature offset to be added |
points | pointer to line_pnts structure (feature's geometry) |
cats | pointer to line_cats structure (feature's categories) |
restore_line | feature id to be restored (>0) or added (<=0) |
external_routine | pointer to external routine (used by PostGIS Topology) |
Definition at line 871 of file write_nat.c.
int V2__delete_line_from_topo_nat | ( | struct Map_info * | Map, |
int | line, | ||
int | type, | ||
const struct line_pnts * | points, | ||
const struct line_cats * | cats | ||
) |
Delete feature from topology (internal use only)
Note: This function requires build level >= GV_BUILD_BASE.
Also updates category index if requested.
Calls G_warning() on error.
Map | pointer to Map_info struct |
line | feature id to be removed |
Points | feature geometry (pointer to line_pnts struct) |
external_routine | external subroutine to execute (used by PostGIS Topology) |
Definition at line 636 of file write_nat.c.
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 281 of file write_nat.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 385 of file write_nat.c.
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 156 of file write_nat.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 64 of file write_nat.c.