20 #include <grass/gis.h>
21 #include <grass/glocale.h>
22 #include <grass/Vect.h>
24 static long write_dummy()
27 _(
"for this format/level not supported"));
30 static int rewrite_dummy()
33 _(
"for this format/level not supported"));
36 static int delete_dummy()
39 _(
"for this format/level not supported"));
43 static int restore_dummy()
46 _(
"for this format/level not supported"));
53 G_fatal_error(_(
"Requested format is not compiled in this version"));
57 static long format_l()
59 G_fatal_error(_(
"Requested format is not compiled in this version"));
65 static long (*Write_line_array[][3]) () = {
70 write_dummy, write_dummy, write_dummy}
73 write_dummy, format_l, format_l}
77 static int (*Vect_rewrite_line_array[][3]) () = {
82 rewrite_dummy, rewrite_dummy, rewrite_dummy}
85 rewrite_dummy, format, format}
89 static int (*Vect_delete_line_array[][3]) () = {
94 delete_dummy, delete_dummy, delete_dummy}
97 delete_dummy, format, format}
101 static int (*Vect_restore_line_array[][3]) () = {
106 restore_dummy, restore_dummy, restore_dummy}
109 restore_dummy, format, format}
127 int type,
struct line_pnts *points,
struct line_cats *cats)
131 G_debug(3,
"Vect_write_line(): name = %s, format = %d, level = %d",
132 Map->name, Map->format, Map->level);
135 G_fatal_error(_(
"Unable to write feature, vector map is not opened"));
139 if (!(Map->plus.update_cidx)) {
140 Map->plus.cidx_up_to_date = 0;
144 (*Write_line_array[Map->format][Map->level]) (Map, type, points,
148 G_fatal_error(_(
"Unable to write feature (negative offset)"));
174 int type,
struct line_pnts *points,
struct line_cats *cats)
178 G_debug(3,
"Vect_rewrite_line(): name = %s, line = %d", Map->name, line);
181 G_fatal_error(_(
"Unable to rewrite feature, vector map is not opened"));
185 if (!(Map->plus.update_cidx)) {
186 Map->plus.cidx_up_to_date = 0;
190 (*Vect_rewrite_line_array[Map->format][Map->level]) (Map, line, type,
216 G_debug(3,
"Vect_delete_line(): name = %s, line = %d", Map->name, line);
218 if (Map->level < 2) {
220 "vector map <%s> is not opened on topology level"),
224 if (Map->mode != GV_MODE_RW && Map->mode != GV_MODE_WRITE) {
226 "vector map <%s> is not opened in 'write' mode"),
232 if (!(Map->plus.update_cidx)) {
233 Map->plus.cidx_up_to_date = 0;
236 ret = (*Vect_delete_line_array[Map->format][Map->level]) (Map, line);
239 G_fatal_error(_(
"Unable to delete feature %d from vector map <%s>"),
262 G_debug(3,
"Vect_restore_line(): name = %s, line = %d", Map->name, line);
264 if (Map->level < 2) {
266 "vector map <%s> is not opened on topology level"),
270 if (Map->mode != GV_MODE_RW && Map->mode != GV_MODE_WRITE) {
272 "vector map <%s> is not opened in 'write' mode"),
278 if (!(Map->plus.update_cidx)) {
279 Map->plus.cidx_up_to_date = 0;
282 ret = (*Vect_restore_line_array[Map->format][Map->level]) (Map, line, offset);
285 G_fatal_error(_(
"Unable to restore feature %d from vector map <%s>"),
int V2_restore_line_nat(struct Map_info *Map, int line, long offset)
Restores feature (topology level)
void dig_node_reset_updated(struct Plus_head *Plus)
Reset number of updated nodes.
int Vect_restore_line(struct Map_info *Map, int line, long offset)
Restore previously deleted feature.
long V2_write_line_nat(struct Map_info *Map, int type, struct line_pnts *points, struct line_cats *cats)
Writes feature to 'coor' file (topology level)
int Vect_rewrite_line(struct Map_info *Map, int line, int type, struct line_pnts *points, struct line_cats *cats)
Rewrites feature info at the given offset.
long V1_write_line_nat(struct Map_info *Map, int type, struct line_pnts *points, struct line_cats *cats)
Writes feature to 'coor' file.
int V2_rewrite_line_nat(struct Map_info *Map, int line, int type, struct line_pnts *points, struct line_cats *cats)
Rewrites feature (topology level)
void dig_line_reset_updated(struct Plus_head *Plus)
Reset number of updated lines.
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int G_debug(int level, const char *msg,...)
Print debugging message.
int Vect_delete_line(struct Map_info *Map, int line)
Delete feature.
long Vect_write_line(struct Map_info *Map, int type, struct line_pnts *points, struct line_cats *cats)
Writes new feature to the end of file (table)
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
int V2_delete_line_nat(struct Map_info *Map, int line)
Deletes feature (topology level).