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

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 23 08:31:17 PST 2013


Author: annakrat
Date: 2013-12-23 08:31:17 -0800 (Mon, 23 Dec 2013)
New Revision: 58513

Modified:
   grass/trunk/vector/v.vol.rst/user1.c
Log:
v.vol.rst: finally fixed mask issue, although I still don't fully understand, see change between rev 58477 and this one

Modified: grass/trunk/vector/v.vol.rst/user1.c
===================================================================
--- grass/trunk/vector/v.vol.rst/user1.c	2013-12-23 16:14:36 UTC (rev 58512)
+++ grass/trunk/vector/v.vol.rst/user1.c	2013-12-23 16:31:17 UTC (rev 58513)
@@ -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, cfmask;
+    int i, j, k = 0, a, irev, cfmask;
     int ddisk = 0;
     double deltx, delty, deltz;
     int first_time = 1;
@@ -368,12 +368,13 @@
 	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, i, 0);
+		    BM_set(bitmask, j, irev, 0);
 		else
-		    BM_set(bitmask, j, i, 1);
+		    BM_set(bitmask, j, irev, 1);
 	    }
 	}
 	G_message("bitmap mask created");
@@ -440,10 +441,10 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {  /* changed by AV */
+	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
-			bmask = BM_get(bitmask, x, y);
+			bmask = BM_get(bitmask, x, nsizr - y - 1);
 		    else
 			bmask = 1;
 		    value = data[cnt];
@@ -490,10 +491,10 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {  /* changed by AV */
+	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
-			bmask = BM_get(bitmask, x, y);
+			bmask = BM_get(bitmask, x, nsizr - y - 1);
 		    else
 			bmask = 1;
 		    value = data[cnt];
@@ -540,10 +541,10 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {  /* changed by AV */
+	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
-			bmask = BM_get(bitmask, x, y);
+			bmask = BM_get(bitmask, x, nsizr - y - 1);
 		    else
 			bmask = 1;
 		    value = data[cnt];
@@ -590,10 +591,10 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {  /* changed by AV */
+	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
-			bmask = BM_get(bitmask, x, y);
+			bmask = BM_get(bitmask, x, nsizr - y - 1);
 		    else
 			bmask = 1;
 		    value = data[cnt];
@@ -640,10 +641,10 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {  /* changed by AV */
+	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
-			bmask = BM_get(bitmask, x, y);
+			bmask = BM_get(bitmask, x, nsizr - y - 1);
 		    else
 			bmask = 1;
 		    value = data[cnt];
@@ -690,10 +691,10 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {  /* changed by AV */
+	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
-			bmask = BM_get(bitmask, x, y);
+			bmask = BM_get(bitmask, x, nsizr - y - 1);
 		    else
 			bmask = 1;
 		    value = data[cnt];
@@ -740,10 +741,10 @@
 	cnt = 0;
 	for (iarc = 0; iarc < nsizl; iarc++) {
 
-	    for (y = nsizr - 1; y >= 0; y--) {  /* changed by AV */
+	    for (y = nsizr - 1; y >= 0; y--) {	/* changed by AV */
 		for (x = 0; x < nsizc; x++) {
 		    if (maskmap != NULL)
-			bmask = BM_get(bitmask, x, y);
+			bmask = BM_get(bitmask, x, nsizr - y - 1);
 		    else
 			bmask = 1;
 		    value = data[cnt];



More information about the grass-commit mailing list