[GRASS-SVN] r58478 - grass/trunk/vector/v.vol.rst

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 17 07:21:39 PST 2013


Author: annakrat
Date: 2013-12-17 07:21:38 -0800 (Tue, 17 Dec 2013)
New Revision: 58478

Modified:
   grass/trunk/vector/v.vol.rst/user1.c
Log:
v.vol.rst: fixed masking with 2D raster: mask rows were intentionally flipped, reason unknown, it does not seem to be related to changes for #1389 (major g3d lib review in G7) because the same problem is in G64.

Modified: grass/trunk/vector/v.vol.rst/user1.c
===================================================================
--- grass/trunk/vector/v.vol.rst/user1.c	2013-12-16 22:16:24 UTC (rev 58477)
+++ grass/trunk/vector/v.vol.rst/user1.c	2013-12-17 15:21:38 UTC (rev 58478)
@@ -67,7 +67,7 @@
     struct quadruple *point;
     double x, y, z, w, nz = 0., sm;
     double c1, c2, c3, c4, c5, c6, nsg;
-    int i, j, k = 0, a, irev, cfmask;
+    int i, j, k = 0, a, cfmask;
     int ddisk = 0;
     double deltx, delty, deltz;
     int first_time = 1;
@@ -368,13 +368,12 @@
 	cellmask = Rast_allocate_c_buf();
 	cfmask = Rast_open_old(maskmap, mapsetm);
 	for (i = 0; i < nsizr; i++) {
-	    irev = nsizr - i - 1;
 	    Rast_get_c_row(cfmask, cellmask, i);
 	    for (j = 0; j < nsizc; j++) {
 		if ((cellmask[j] == 0) || Rast_is_c_null_value(&cellmask[j]))
-		    BM_set(bitmask, j, irev, 0);
+		    BM_set(bitmask, j, i, 0);
 		else
-		    BM_set(bitmask, j, irev, 1);
+		    BM_set(bitmask, j, i, 1);
 	    }
 	}
 	G_message("bitmap mask created");
@@ -441,7 +440,7 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
+	    for (y = 0; y < nsizr; y++) {
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
 			bmask = BM_get(bitmask, x, y);
@@ -491,7 +490,7 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
+	    for (y = 0; y < nsizr; y++) {
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
 			bmask = BM_get(bitmask, x, y);
@@ -541,7 +540,7 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
+	    for (y = 0; y < nsizr; y++) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
 			bmask = BM_get(bitmask, x, y);
@@ -591,7 +590,7 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
+	    for (y = 0; y < nsizr; y++) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
 			bmask = BM_get(bitmask, x, y);
@@ -641,7 +640,7 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
+	    for (y = 0; y < nsizr; y++) {
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
 			bmask = BM_get(bitmask, x, y);
@@ -691,7 +690,7 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
+	    for (y = 0; y < nsizr; y++) {
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
 			bmask = BM_get(bitmask, x, y);
@@ -741,7 +740,7 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
+	    for (y = 0; y < nsizr; y++) {
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
 			bmask = BM_get(bitmask, x, y);



More information about the grass-commit mailing list