[GRASS-SVN] r39173 - grass/trunk/lib/vector/diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Sep 13 07:00:12 EDT 2009


Author: mmetz
Date: 2009-09-13 07:00:12 -0400 (Sun, 13 Sep 2009)
New Revision: 39173

Modified:
   grass/trunk/lib/vector/diglib/plus.c
   grass/trunk/lib/vector/diglib/plus_struct.c
   grass/trunk/lib/vector/diglib/spindex.c
   grass/trunk/lib/vector/diglib/spindex_rw.c
Log:
3D initialization, cosmetics

Modified: grass/trunk/lib/vector/diglib/plus.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus.c	2009-09-13 10:58:56 UTC (rev 39172)
+++ grass/trunk/lib/vector/diglib/plus.c	2009-09-13 11:00:12 UTC (rev 39173)
@@ -39,7 +39,6 @@
     Plus->Version_Minor = 0;
     Plus->Back_Major = 0;
     Plus->Back_Minor = 0;
-    Plus->with_z = 0;
 
     Plus->off_t_size = 0;
 

Modified: grass/trunk/lib/vector/diglib/plus_struct.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_struct.c	2009-09-13 10:58:56 UTC (rev 39172)
+++ grass/trunk/lib/vector/diglib/plus_struct.c	2009-09-13 11:00:12 UTC (rev 39173)
@@ -175,12 +175,12 @@
     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 @@
 	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 @@
 
     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 @@
     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 @@
 	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 @@
     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 @@
     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 @@
     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 @@
     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))

Modified: grass/trunk/lib/vector/diglib/spindex.c
===================================================================
--- grass/trunk/lib/vector/diglib/spindex.c	2009-09-13 10:58:56 UTC (rev 39172)
+++ grass/trunk/lib/vector/diglib/spindex.c	2009-09-13 11:00:12 UTC (rev 39173)
@@ -35,10 +35,9 @@
 {
     int ndims;
 
-    ndims = Plus->with_z ? 3 : 2;
+    ndims = (Plus->with_z != 0) ? 3 : 2;
+    Plus->spidx_with_z = (Plus->with_z != 0);
 
-    G_debug(1, "dig_spidx_init()");
-
     Plus->Node_spidx = RTreeNewIndex(ndims);
     Plus->Line_spidx = RTreeNewIndex(ndims);
     Plus->Area_spidx = RTreeNewIndex(ndims);

Modified: grass/trunk/lib/vector/diglib/spindex_rw.c
===================================================================
--- grass/trunk/lib/vector/diglib/spindex_rw.c	2009-09-13 10:58:56 UTC (rev 39172)
+++ grass/trunk/lib/vector/diglib/spindex_rw.c	2009-09-13 11:00:12 UTC (rev 39173)
@@ -883,7 +883,8 @@
 {
     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);



More information about the grass-commit mailing list