19 #include <grass/gis.h>
20 #include <grass/Vect.h>
21 #include <grass/version.h>
114 G_debug(3,
" node is dead -> write 0 only");
163 Plus->Line[
n] =
NULL;
170 G_debug(5,
" line type %d -> %d", tp, ptr->type);
176 if (ptr->type & (GV_POINTS |
GV_LINES | GV_KERNEL))
181 if (ptr->type & (GV_LINE | GV_BOUNDARY)) {
185 else if (ptr->type & (GV_POINTS | GV_KERNEL))
189 if (ptr->type & (GV_BOUNDARY | GV_CENTROID))
194 if (ptr->type & GV_BOUNDARY)
198 if ((ptr->type & GV_FACE) && Plus->with_z) {
211 if ((ptr->type & GV_KERNEL) && Plus->with_z)
216 if (ptr->type & (GV_LINE | GV_BOUNDARY | GV_FACE)) {
238 Node = Plus->Node[ptr->N1];
253 int n_edges = 0, vol = 0;
257 G_debug(4,
"dig_Wr_P_line() line = %d", n);
263 G_debug(3,
" line is dead -> write 0 only");
271 G_debug(5,
" line type %d -> %d", ptr->type, ch);
278 if (ptr->type & (GV_POINTS |
GV_LINES | GV_KERNEL))
283 if (ptr->type & (GV_LINE | GV_BOUNDARY))
288 if (ptr->type & (GV_BOUNDARY | GV_CENTROID))
293 if (ptr->type & GV_BOUNDARY)
297 if ((ptr->type & GV_FACE) && Plus->with_z) {
310 if ((ptr->type & GV_KERNEL) && Plus->with_z)
315 if (ptr->type & (GV_LINE | GV_BOUNDARY | GV_FACE)) {
342 G_debug(3,
"dig_Rd_P_area(): n = %d", n);
349 Plus->Area[
n] =
NULL;
472 Plus->Isle[
n] =
NULL;
569 unsigned char buf[5];
577 ptr->Version_Major = buf[0];
578 ptr->Version_Minor = buf[1];
579 ptr->Back_Major = buf[2];
580 ptr->Back_Minor = buf[3];
584 "Topo header: file version %d.%d , supported from GRASS version %d.%d",
585 ptr->Version_Major, ptr->Version_Minor, ptr->Back_Major,
588 G_debug(2,
" byte order %d", byte_order);
591 if (ptr->Version_Major > GV_TOPO_VER_MAJOR ||
592 ptr->Version_Minor > GV_TOPO_VER_MINOR) {
595 if (ptr->Back_Major > GV_TOPO_VER_MAJOR ||
596 ptr->Back_Minor > GV_TOPO_VER_MINOR) {
598 G_debug(1,
"Topology format version %d.%d",
599 ptr->Version_Major, ptr->Version_Minor);
601 (
"This version of GRASS (%d.%d) is too old to read this topology format."
602 " Try to rebuild topology or upgrade GRASS to at least version %d.",
603 GRASS_VERSION_MAJOR, GRASS_VERSION_MINOR, GRASS_VERSION_MAJOR + 1);
608 (
"Your GRASS version does not fully support topology format %d.%d of the vector."
609 " Consider to rebuild topology or upgrade GRASS.",
610 ptr->Version_Major, ptr->Version_Minor);
619 G_debug(2,
" header size %ld", ptr->head_size);
624 ptr->with_z = buf[0];
625 G_debug(2,
" with_z %d", ptr->with_z);
691 G_debug(2,
" coor size %ld", ptr->coor_size);
700 unsigned char buf[10];
707 buf[0] = GV_TOPO_VER_MAJOR;
708 buf[1] = GV_TOPO_VER_MINOR;
709 buf[2] = GV_TOPO_EARLIEST_MAJOR;
710 buf[3] = GV_TOPO_EARLIEST_MINOR;
711 buf[4] = ptr->port.byte_order;
720 buf[0] = ptr->with_z;
int dig_area_alloc_isle(P_AREA *area, int add)
int dig_Wr_Plus_head(GVFILE *fp, struct Plus_head *ptr)
int dig_set_cur_port(struct Port_info *port)
int dig__fread_port_P(plus_t *buf, int cnt, GVFILE *fp)
P_NODE * dig_alloc_node()
int dig__fwrite_port_D(double *buf, int cnt, GVFILE *fp)
int dig_Rd_P_area(struct Plus_head *Plus, int n, GVFILE *fp)
void dig_init_portable(struct Port_info *port, int byte_order)
int dig_Wr_P_line(struct Plus_head *Plus, int n, GVFILE *fp)
int dig__fread_port_L(long *buf, int cnt, GVFILE *fp)
int dig_Rd_P_node(struct Plus_head *Plus, int n, GVFILE *fp)
int dig_node_alloc_line(P_NODE *node, int add)
int dig_Wr_P_isle(struct Plus_head *Plus, int n, GVFILE *fp)
int dig_Rd_Plus_head(GVFILE *fp, struct Plus_head *ptr)
int dig__fwrite_port_I(int *buf, int cnt, GVFILE *fp)
int dig_fseek(GVFILE *file, long offset, int whence)
Set GVFILE position.
P_ISLE * dig_alloc_isle()
int dig_area_alloc_line(P_AREA *area, int add)
int dig_Rd_P_isle(struct Plus_head *Plus, int n, GVFILE *fp)
int dig__fwrite_port_P(plus_t *buf, int cnt, GVFILE *fp)
int dig__fwrite_port_L(long *buf, int cnt, GVFILE *fp)
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_F(float *buf, int cnt, GVFILE *fp)
int dig_isle_alloc_line(P_ISLE *isle, int add)
P_LINE * dig_alloc_line()
char buf[GNAME_MAX+sizeof(G3D_DIRECTORY)+2]
P_AREA * dig_alloc_area()
int dig__fread_port_C(char *buf, int cnt, GVFILE *fp)
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int dig_type_to_store(int type)
Convert type to store type.
int dig_Rd_P_line(struct Plus_head *Plus, int n, GVFILE *fp)
int G_debug(int level, const char *msg,...)
Print debugging message.
void dig_rewind(GVFILE *file)
Rewind GVFILE position.
int dig__fwrite_port_F(float *buf, int cnt, GVFILE *fp)
int dig__fwrite_port_C(char *buf, int cnt, GVFILE *fp)
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.
long dig_ftell(GVFILE *file)
Get GVFILE position.
int dig_Wr_P_node(struct Plus_head *Plus, int n, GVFILE *fp)
int dig_Wr_P_area(struct Plus_head *Plus, int n, GVFILE *fp)
int dig__fread_port_I(int *buf, int cnt, GVFILE *fp)