Explorar el Código

3D initialization, cosmetics

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@39173 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz hace 15 años
padre
commit
2050081629

+ 0 - 1
lib/vector/diglib/plus.c

@@ -39,7 +39,6 @@ int dig_init_plus(struct Plus_head *Plus)
     Plus->Version_Minor = 0;
     Plus->Back_Major = 0;
     Plus->Back_Minor = 0;
-    Plus->with_z = 0;
 
     Plus->off_t_size = 0;
 

+ 11 - 7
lib/vector/diglib/plus_struct.c

@@ -175,12 +175,12 @@ int dig_Rd_P_line(struct Plus_head *Plus, int n, struct gvfile * fp)
     if (0 >= dig__fread_port_O(&(ptr->offset), 1, fp, Plus->off_t_size))
 	return (-1);
 
-    /* First node */
+    /* first node */
     if (ptr->type & (GV_POINTS | GV_LINES | GV_KERNEL))
 	if (0 >= dig__fread_port_P(&(ptr->N1), 1, fp))
 	    return -1;
 
-    /* Second node, for points/centroids not needed */
+    /* second node, for points/centroids not needed */
     if (ptr->type & (GV_LINE | GV_BOUNDARY)) {
 	if (0 >= dig__fread_port_P(&(ptr->N2), 1, fp))
 	    return -1;
@@ -215,7 +215,7 @@ int dig_Rd_P_line(struct Plus_head *Plus, int n, struct gvfile * fp)
 	if (0 >= dig__fread_port_P(&vol, 1, fp))
 	    return -1;
 
-    /* Bounding box */
+    /* bounding box */
     if (ptr->type & (GV_LINE | GV_BOUNDARY | GV_FACE)) {
 	if (0 >= dig__fread_port_D(&(ptr->N), 1, fp))
 	    return -1;
@@ -261,7 +261,7 @@ int dig_Wr_P_line(struct Plus_head *Plus, int n, struct gvfile * fp)
 
     ptr = Plus->Line[n];
 
-    /* If NULL i.e. dead write just 0 instead of type */
+    /* if NULL i.e. dead write just 0 instead of type */
     if (ptr == NULL) {
 	G_debug(3, "    line is dead -> write 0 only");
 	ch = 0;
@@ -280,12 +280,12 @@ int dig_Wr_P_line(struct Plus_head *Plus, int n, struct gvfile * fp)
     if (0 >= dig__fwrite_port_O(&(ptr->offset), 1, fp, Plus->off_t_size))
 	return (-1);
 
-    /* First node */
+    /* first node */
     if (ptr->type & (GV_POINTS | GV_LINES | GV_KERNEL))
 	if (0 >= dig__fwrite_port_P(&(ptr->N1), 1, fp))
 	    return (-1);
 
-    /* Second node, for points/centroids not needed */
+    /* second node, for points/centroids not needed */
     if (ptr->type & (GV_LINE | GV_BOUNDARY))
 	if (0 >= dig__fwrite_port_P(&(ptr->N2), 1, fp))
 	    return (-1);
@@ -317,7 +317,7 @@ int dig_Wr_P_line(struct Plus_head *Plus, int n, struct gvfile * fp)
 	if (0 >= dig__fwrite_port_P(&vol, 1, fp))
 	    return (-1);
 
-    /* Bounding box */
+    /* bounding box */
     if (ptr->type & (GV_LINE | GV_BOUNDARY | GV_FACE)) {
 	if (0 >= dig__fwrite_port_D(&(ptr->N), 1, fp))
 	    return (-1);
@@ -383,6 +383,7 @@ int dig_Rd_P_area(struct Plus_head *Plus, int n, struct gvfile * fp)
     if (0 >= dig__fread_port_P(&(ptr->centroid), 1, fp))
 	return -1;
 
+    /* bounding box */
     if (0 >= dig__fread_port_D(&(ptr->N), 1, fp))
 	return -1;
     if (0 >= dig__fread_port_D(&(ptr->S), 1, fp))
@@ -443,6 +444,7 @@ int dig_Wr_P_area(struct Plus_head *Plus, int n, struct gvfile * fp)
     if (0 >= dig__fwrite_port_P(&(ptr->centroid), 1, fp))
 	return (-1);
 
+    /* bounding box */
     if (0 >= dig__fwrite_port_D(&(ptr->N), 1, fp))
 	return (-1);
     if (0 >= dig__fwrite_port_D(&(ptr->S), 1, fp))
@@ -495,6 +497,7 @@ int dig_Rd_P_isle(struct Plus_head *Plus, int n, struct gvfile * fp)
     if (0 >= dig__fread_port_P(&(ptr->area), 1, fp))
 	return -1;
 
+    /* bounding box */
     if (0 >= dig__fread_port_D(&(ptr->N), 1, fp))
 	return -1;
     if (0 >= dig__fread_port_D(&(ptr->S), 1, fp))
@@ -547,6 +550,7 @@ int dig_Wr_P_isle(struct Plus_head *Plus, int n, struct gvfile * fp)
     if (0 >= dig__fwrite_port_P(&(ptr->area), 1, fp))
 	return (-1);
 
+    /* bounding box */
     if (0 >= dig__fwrite_port_D(&(ptr->N), 1, fp))
 	return (-1);
     if (0 >= dig__fwrite_port_D(&(ptr->S), 1, fp))

+ 2 - 3
lib/vector/diglib/spindex.c

@@ -35,9 +35,8 @@ int dig_spidx_init(struct Plus_head *Plus)
 {
     int ndims;
 
-    ndims = Plus->with_z ? 3 : 2;
-
-    G_debug(1, "dig_spidx_init()");
+    ndims = (Plus->with_z != 0) ? 3 : 2;
+    Plus->spidx_with_z = (Plus->with_z != 0);
 
     Plus->Node_spidx = RTreeNewIndex(ndims);
     Plus->Line_spidx = RTreeNewIndex(ndims);

+ 2 - 1
lib/vector/diglib/spindex_rw.c

@@ -883,7 +883,8 @@ int dig_Rd_spidx(struct gvfile * fp, struct Plus_head *Plus)
 {
     G_debug(1, "dig_read_spindx()");
 
-    /* TODO: free old tree */
+    /* free old trees, init new trees */
+    dig_spidx_free(Plus);
     dig_spidx_init(Plus);
 
     dig_rewind(fp);