Browse Source

Fix bogus raster output with cover= (bug https://trac.osgeo.org/grass/ticket/1082)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@43716 15284696-431f-4ddb-bdfa-cd5b030d7da7
Glynn Clements 14 năm trước cách đây
mục cha
commit
5ded376ad4
1 tập tin đã thay đổi với 5 bổ sung11 xóa
  1. 5 11
      raster/r.random/random.c

+ 5 - 11
raster/r.random/random.c

@@ -130,15 +130,9 @@ int execute_random(struct rr_state *theState)
 	}
 
 	for (col = 0; col < ncols && nt; col++) {
-	    if (!theState->use_nulls && is_null_value(theState->buf, col))
-		continue;
-	    if (theState->docover == TRUE) {	/* skip no data cover points */
-		if (!theState->use_nulls &&
-		    is_null_value(theState->cover, col))
-		    continue;
-	    }
-
-	    if (make_rand() % nc < nt) {
+	    if ((theState->use_nulls || !is_null_value(theState->buf, col)) &&
+		(!theState->docover || theState->use_nulls || !is_null_value(theState->cover, col)) &&
+		(make_rand() % nc < nt)) {
 		nt--;
 		if (is_null_value(theState->buf, col))
 		    cpvalue(&theState->nulls, 0, &theState->buf, col);
@@ -190,14 +184,14 @@ int execute_random(struct rr_state *theState)
 		    cat++;
 		}
 		G_percent((theState->nRand - nt), theState->nRand, 2);
+
+		nc--;
 	    }
 	    else {
 		set_to_null(&theState->buf, col);
 		if (theState->docover == 1)
 		    set_to_null(&theState->cover, col);
 	    }
-
-	    nc--;
 	}
 
 	while (col < ncols) {