[GRASS-SVN] r62586 - grass/trunk/raster/r.li/r.li.edgedensity
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Nov 3 23:54:16 PST 2014
Author: mmetz
Date: 2014-11-03 23:54:15 -0800 (Mon, 03 Nov 2014)
New Revision: 62586
Modified:
grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c
Log:
r.li.edgedensity: fix edge count
Modified: grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c
===================================================================
--- grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c 2014-11-03 21:29:56 UTC (rev 62585)
+++ grass/trunk/raster/r.li/r.li.edgedensity/edgedensity.c 2014-11-04 07:54:15 UTC (rev 62586)
@@ -200,59 +200,40 @@
if (masked && mask_buf[j] == 0) {
Rast_set_c_null_value(&corrCell, 1);
}
- if (!Rast_is_c_null_value(&corrCell)) {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
Rast_set_c_null_value(&supCell, 1);
}
- if (!Rast_is_c_null_value(&ptype)) {
- /* only one patch type */
- if (!Rast_is_c_null_value(&corrCell) && corrCell == ptype) {
- if (corrCell != precCell)
+ if (!Rast_is_c_null_value(&corrCell)) {
+ area++;
+ if (Rast_is_c_null_value(&ptype) || corrCell == ptype) {
+
+ if (Rast_is_c_null_value(&precCell) || precCell != corrCell) {
nedges++;
- if (corrCell != supCell)
+ }
+ if (Rast_is_c_null_value(&supCell) || supCell != corrCell) {
nedges++;
+ }
/* right and bottom */
if (i == ad->rl - 1)
nedges++;
if (j == ad->cl - 1)
nedges++;
}
- if (!Rast_is_c_null_value(&precCell) && precCell == ptype) {
- if (corrCell != precCell)
- nedges++;
- }
- if (!Rast_is_c_null_value(&supCell) && supCell == ptype) {
- if (corrCell != supCell)
- nedges++;
- }
}
- else {
- /* all patch types */
- if (!Rast_is_c_null_value(&corrCell)) {
- if (corrCell != precCell) {
+ else /* corrCell == NULL */ {
+ if (!Rast_is_c_null_value(&precCell)) {
+ if (Rast_is_c_null_value(&ptype) || precCell == ptype) {
nedges++;
}
- if (corrCell != supCell) {
+ }
+ if (!Rast_is_c_null_value(&supCell)) {
+ if (Rast_is_c_null_value(&ptype) || supCell == ptype) {
nedges++;
}
- /* right and bottom */
- if (i == ad->rl - 1)
- nedges++;
- if (j == ad->cl - 1)
- nedges++;
}
- if (!Rast_is_c_null_value(&precCell) && corrCell != precCell) {
- nedges++;
- }
- if (!Rast_is_c_null_value(&supCell) && corrCell != supCell) {
- nedges++;
- }
}
precCell = corrCell;
}
@@ -378,59 +359,40 @@
if (masked && mask_buf[j] == 0) {
Rast_set_d_null_value(&corrCell, 1);
}
- if (!Rast_is_d_null_value(&corrCell)) {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
Rast_set_d_null_value(&supCell, 1);
}
- if (!Rast_is_d_null_value(&ptype)) {
- /* only one patch type */
- if (!Rast_is_d_null_value(&corrCell) && corrCell == ptype) {
- if (corrCell != precCell)
+ if (!Rast_is_d_null_value(&corrCell)) {
+ area++;
+ if (Rast_is_d_null_value(&ptype) || corrCell == ptype) {
+
+ if (Rast_is_d_null_value(&precCell) || precCell != corrCell) {
nedges++;
- if (corrCell != supCell)
+ }
+ if (Rast_is_d_null_value(&supCell) || supCell != corrCell) {
nedges++;
+ }
/* right and bottom */
if (i == ad->rl - 1)
nedges++;
if (j == ad->cl - 1)
nedges++;
}
- if (!Rast_is_d_null_value(&precCell) && precCell == ptype) {
- if (corrCell != precCell)
- nedges++;
- }
- if (!Rast_is_d_null_value(&supCell) && supCell == ptype) {
- if (corrCell != supCell)
- nedges++;
- }
}
- else {
- /* all patch types */
- if (!Rast_is_d_null_value(&corrCell)) {
- if (corrCell != precCell) {
+ else /* corrCell == NULL */ {
+ if (!Rast_is_d_null_value(&precCell)) {
+ if (Rast_is_d_null_value(&ptype) || precCell == ptype) {
nedges++;
}
- if (corrCell != supCell) {
+ }
+ if (!Rast_is_d_null_value(&supCell)) {
+ if (Rast_is_d_null_value(&ptype) || supCell == ptype) {
nedges++;
}
- /* right and bottom */
- if (i == ad->rl - 1)
- nedges++;
- if (j == ad->cl - 1)
- nedges++;
}
- if (!Rast_is_d_null_value(&precCell) && corrCell != precCell) {
- nedges++;
- }
- if (!Rast_is_d_null_value(&supCell) && corrCell != supCell) {
- nedges++;
- }
}
precCell = corrCell;
}
@@ -556,59 +518,40 @@
if (masked && mask_buf[j] == 0) {
Rast_set_f_null_value(&corrCell, 1);
}
- if (!Rast_is_f_null_value(&corrCell)) {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
Rast_set_f_null_value(&supCell, 1);
}
- if (!Rast_is_f_null_value(&ptype)) {
- /* only one patch type */
- if (!Rast_is_f_null_value(&corrCell) && corrCell == ptype) {
- if (corrCell != precCell)
+ if (!Rast_is_f_null_value(&corrCell)) {
+ area++;
+ if (Rast_is_f_null_value(&ptype) || corrCell == ptype) {
+
+ if (Rast_is_f_null_value(&precCell) || precCell != corrCell) {
nedges++;
- if (corrCell != supCell)
+ }
+ if (Rast_is_f_null_value(&supCell) || supCell != corrCell) {
nedges++;
+ }
/* right and bottom */
if (i == ad->rl - 1)
nedges++;
if (j == ad->cl - 1)
nedges++;
}
- if (!Rast_is_f_null_value(&precCell) && precCell == ptype) {
- if (corrCell != precCell)
- nedges++;
- }
- if (!Rast_is_f_null_value(&supCell) && supCell == ptype) {
- if (corrCell != supCell)
- nedges++;
- }
}
- else {
- /* all patch types */
- if (!Rast_is_f_null_value(&corrCell)) {
- if (corrCell != precCell) {
+ else /* corrCell == NULL */ {
+ if (!Rast_is_f_null_value(&precCell)) {
+ if (Rast_is_f_null_value(&ptype) || precCell == ptype) {
nedges++;
}
- if (corrCell != supCell) {
+ }
+ if (!Rast_is_f_null_value(&supCell)) {
+ if (Rast_is_f_null_value(&ptype) || supCell == ptype) {
nedges++;
}
- /* right and bottom */
- if (i == ad->rl - 1)
- nedges++;
- if (j == ad->cl - 1)
- nedges++;
}
- if (!Rast_is_f_null_value(&precCell) && corrCell != precCell) {
- nedges++;
- }
- if (!Rast_is_f_null_value(&supCell) && corrCell != supCell) {
- nedges++;
- }
}
precCell = corrCell;
}
More information about the grass-commit
mailing list