26 #include <grass/gis.h>
27 #include <grass/Vect.h>
28 #include <grass/glocale.h>
31 Vect__Read_line_nat(
struct Map_info *,
32 struct line_pnts *,
struct line_cats *,
long);
49 struct line_pnts *Points,
50 struct line_cats *Cats,
long offset)
52 return Vect__Read_line_nat(Map, Points, Cats, offset);
69 struct line_pnts *line_p,
struct line_cats *line_c)
75 G_debug(3,
"V1_read_next_line_nat()");
77 if (Map->Constraint_region_flag)
82 itype = Vect__Read_line_nat(Map, line_p, line_c, offset);
92 if (Map->Constraint_type_flag) {
93 if (!(itype & Map->Constraint_type))
98 if (Map->Constraint_region_flag) {
125 struct line_pnts *line_p,
struct line_cats *line_c,
int line)
129 G_debug(3,
"V2_read_line_nat(): line = %d", line);
132 Line = Map->plus.Line[line];
136 _(
"Attempt to read dead line"), line);
138 return Vect__Read_line_nat(Map, line_p, line_c, Line->offset);
155 struct line_pnts *line_p,
struct line_cats *line_c)
158 register P_LINE *Line;
159 BOUND_BOX lbox, mbox;
161 G_debug(3,
"V2_read_next_line_nat()");
163 if (Map->Constraint_region_flag)
167 line = Map->next_line;
169 if (line > Map->plus.n_lines)
172 Line = Map->plus.Line[line];
178 if ((Map->Constraint_type_flag &&
179 !(Line->type & Map->Constraint_type))) {
184 if (Map->Constraint_region_flag) {
212 Vect__Read_line_nat(
struct Map_info *
Map,
213 struct line_pnts *p,
struct line_cats *c,
long offset)
223 G_debug(3,
"Vect__Read_line_nat: offset = %ld", offset);
225 Map->head.last_offset = offset;
246 G_debug(3,
" type = %d, do_cats = %d dead = %d", type, do_cats, dead);
252 if (Map->head.Version_Minor == 1) {
261 G_debug(3,
" n_cats = %d", n_cats);
269 if (Map->head.Version_Minor == 1) {
275 for (i = 0; i < n_cats; i++) {
278 c->field[i] = (
int)field;
287 if (Map->head.Version_Minor == 1) {
288 size = (2 * PORT_INT) * n_cats;
291 size = (PORT_SHORT + PORT_INT) * n_cats;
294 dig_fseek(&(Map->dig_fp), size, SEEK_CUR);
298 if (type & GV_POINTS) {
306 G_debug(3,
" n_points = %d", n_points);
312 p->n_points = n_points;
318 if (Map->head.with_z) {
323 for (i = 0; i < n_points; i++)
328 if (Map->head.with_z)
329 size = n_points * 3 * PORT_DOUBLE;
331 size = n_points * 2 * PORT_DOUBLE;
333 dig_fseek(&(Map->dig_fp), size, SEEK_CUR);
int V1_read_next_line_nat(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c)
Read next line from coor file.
int dig_set_cur_port(struct Port_info *port)
int Vect_line_box(struct line_pnts *Points, BOUND_BOX *Box)
Get bounding box of line.
int Vect_get_constraint_box(struct Map_info *Map, BOUND_BOX *Box)
Get constraint box.
int dig__fread_port_S(short *buf, int cnt, GVFILE *fp)
int V2_read_line_nat(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c, int line)
Reads any specified line, this is NOT affected by constraints.
int Vect_box_overlap(BOUND_BOX *A, BOUND_BOX *B)
Tests for overlap of two boxes.
int V2_read_next_line_nat(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c)
Reads next unread line each time called. Use Vect_rewind to reset.
int dig_alloc_cats(struct line_cats *cats, int num)
int dig_fseek(GVFILE *file, long offset, int whence)
Set GVFILE position.
int dig_alloc_points(struct line_pnts *points, int num)
int dig_type_from_store(int stype)
Convert type from store type.
int dig__fread_port_D(double *buf, int cnt, GVFILE *fp)
int dig__fread_port_C(char *buf, int cnt, GVFILE *fp)
int V1_read_line_nat(struct Map_info *Map, struct line_pnts *Points, struct line_cats *Cats, long offset)
Read line from coor file on given offset.
int G_debug(int level, const char *msg,...)
Print debugging message.
int Vect_get_line_box(struct Map_info *Map, int line, BOUND_BOX *Box)
Get boundary box of line.
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
long dig_ftell(GVFILE *file)
Get GVFILE position.
int dig__fread_port_I(int *buf, int cnt, GVFILE *fp)