[GRASS-SVN] r58514 - grass/branches/releasebranch_6_4/vector/v.vol.rst

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Dec 23 08:33:04 PST 2013


Author: annakrat
Date: 2013-12-23 08:33:03 -0800 (Mon, 23 Dec 2013)
New Revision: 58514

Modified:
   grass/branches/releasebranch_6_4/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 (merged from trunk, r58513)

Modified: grass/branches/releasebranch_6_4/vector/v.vol.rst/user1.c
===================================================================
--- grass/branches/releasebranch_6_4/vector/v.vol.rst/user1.c	2013-12-23 16:31:17 UTC (rev 58513)
+++ grass/branches/releasebranch_6_4/vector/v.vol.rst/user1.c	2013-12-23 16:33:03 UTC (rev 58514)
@@ -65,7 +65,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;
@@ -366,12 +366,13 @@
 	cellmask = G_allocate_cell_buf();
 	cfmask = G_open_cell_old(maskmap, mapsetm);
 	for (i = 0; i < nsizr; i++) {
+	    irev = nsizr - i - 1;
 	    G_get_map_row(cfmask, cellmask, i);
 	    for (j = 0; j < nsizc; j++) {
 		if ((cellmask[j] == 0) || G_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];
@@ -491,10 +492,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];
@@ -542,10 +543,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];
@@ -593,10 +594,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];
@@ -644,10 +645,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];
@@ -695,10 +696,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];
@@ -746,10 +747,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