19 #include <grass/gis.h>
20 #include <grass/Vect.h>
21 #include <grass/version.h>
33 buf[0] = GV_SIDX_VER_MAJOR;
34 buf[1] = GV_SIDX_VER_MINOR;
35 buf[2] = GV_SIDX_EARLIEST_MAJOR;
36 buf[3] = GV_SIDX_EARLIEST_MINOR;
37 buf[4] = ptr->spidx_port.byte_order;
46 buf[0] = ptr->spidx_with_z;
66 G_debug(3,
"spidx offset node = %ld line = %ld, area = %ld isle = %ld",
67 ptr->Node_spidx_offset, ptr->Line_spidx_offset,
68 ptr->Area_spidx_offset, ptr->Isle_spidx_offset);
91 ptr->spidx_Version_Major = buf[0];
92 ptr->spidx_Version_Minor = buf[1];
93 ptr->spidx_Back_Major = buf[2];
94 ptr->spidx_Back_Minor = buf[3];
98 "Sidx header: file version %d.%d , supported from GRASS version %d.%d",
99 ptr->spidx_Version_Major, ptr->spidx_Version_Minor,
100 ptr->spidx_Back_Major, ptr->spidx_Back_Minor);
102 G_debug(2,
" byte order %d", byte_order);
105 if (ptr->spidx_Version_Major > GV_SIDX_VER_MAJOR ||
106 ptr->spidx_Version_Minor > GV_SIDX_VER_MINOR) {
109 if (ptr->spidx_Back_Major > GV_SIDX_VER_MAJOR ||
110 ptr->spidx_Back_Minor > GV_SIDX_VER_MINOR) {
112 G_debug(1,
"Spatial index format version %d.%d",
113 ptr->spidx_Version_Major, ptr->spidx_Version_Minor);
115 (
"This version of GRASS (%d.%d) is too old to read this spatial index format."
116 " Try to rebuild topology or upgrade GRASS to at least version %d.",
117 GRASS_VERSION_MAJOR, GRASS_VERSION_MINOR, GRASS_VERSION_MAJOR + 1);
122 (
"Your GRASS version does not fully support spatial index format %d.%d of the vector."
123 " Consider to rebuild topology or upgrade GRASS.",
124 ptr->spidx_Version_Major, ptr->spidx_Version_Minor);
133 G_debug(2,
" header size %ld", ptr->spidx_head_size);
138 ptr->spidx_with_z = buf[0];
139 G_debug(2,
" with_z %d", ptr->spidx_with_z);
160 G_debug(2,
" coor size %ld", coor_size);
162 dig_fseek(fp, ptr->spidx_head_size, SEEK_SET);
177 fprintf(fp,
" id = %d ", (
int)b->
child);
193 fprintf(fp,
"Node level=%d count=%d\n", n->
level, n->
count);
200 for (i = 0; i < nn; i++) {
202 fprintf(fp,
" Branch %d", i);
259 for (i = 0; i < nn; i++) {
276 G_debug(3,
"rtree_read_branch()");
312 G_debug(3,
"rtree_read_node()");
324 for (i = 0; i <
count; i++) {
361 G_debug(1,
"dig_read_spindx()");
370 dig_fseek(fp, Plus->Node_spidx_offset, 0);
373 dig_fseek(fp, Plus->Line_spidx_offset, 0);
376 dig_fseek(fp, Plus->Area_spidx_offset, 0);
379 dig_fseek(fp, Plus->Isle_spidx_offset, 0);
389 fprintf(fp,
"Nodes\n");
392 fprintf(fp,
"Lines\n");
395 fprintf(fp,
"Areas\n");
398 fprintf(fp,
"Isles\n");