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>"),