[GRASS-SVN] r62620 - grass/branches/releasebranch_6_4/raster/r.li/r.li.edgedensity
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Nov 5 11:15:55 PST 2014
Author: mmetz
Date: 2014-11-05 11:15:55 -0800 (Wed, 05 Nov 2014)
New Revision: 62620
Modified:
grass/branches/releasebranch_6_4/raster/r.li/r.li.edgedensity/edgedensity.c
Log:
r.li.edgedensity: fix edge count
Modified: grass/branches/releasebranch_6_4/raster/r.li/r.li.edgedensity/edgedensity.c
===================================================================
--- grass/branches/releasebranch_6_4/raster/r.li/r.li.edgedensity/edgedensity.c 2014-11-05 18:36:16 UTC (rev 62619)
+++ grass/branches/releasebranch_6_4/raster/r.li/r.li.edgedensity/edgedensity.c 2014-11-05 19:15:55 UTC (rev 62620)
@@ -197,59 +197,40 @@
if (masked && mask_buf[j] == 0) {
G_set_c_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
G_set_c_null_value(&supCell, 1);
}
- if (!G_is_c_null_value(&ptype)) {
- /* only one patch type */
- if (!G_is_c_null_value(&corrCell) && corrCell == ptype) {
- if (corrCell != precCell)
+ if (!G_is_c_null_value(&corrCell)) {
+ area++;
+ if (G_is_c_null_value(&ptype) || corrCell == ptype) {
+
+ if (G_is_c_null_value(&precCell) || precCell != corrCell) {
nedges++;
- if (corrCell != supCell)
+ }
+ if (G_is_c_null_value(&supCell) || supCell != corrCell) {
nedges++;
+ }
/* right and bottom */
if (i == ad->rl - 1)
nedges++;
if (j == ad->cl - 1)
nedges++;
}
- if (!G_is_c_null_value(&precCell) && precCell == ptype) {
- if (corrCell != precCell)
- nedges++;
- }
- if (!G_is_c_null_value(&supCell) && supCell == ptype) {
- if (corrCell != supCell)
- nedges++;
- }
}
- else {
- /* all patch types */
- if (!G_is_c_null_value(&corrCell)) {
- if (corrCell != precCell) {
+ else /* corrCell == NULL */ {
+ if (!G_is_c_null_value(&precCell)) {
+ if (G_is_c_null_value(&ptype) || precCell == ptype) {
nedges++;
}
- if (corrCell != supCell) {
+ }
+ if (!G_is_c_null_value(&supCell)) {
+ if (G_is_c_null_value(&ptype) || supCell == ptype) {
nedges++;
}
- /* right and bottom */
- if (i == ad->rl - 1)
- nedges++;
- if (j == ad->cl - 1)
- nedges++;
}
- if (!G_is_c_null_value(&precCell) && corrCell != precCell) {
- nedges++;
- }
- if (!G_is_c_null_value(&supCell) && corrCell != supCell) {
- nedges++;
- }
}
precCell = corrCell;
}
@@ -375,59 +356,40 @@
if (masked && mask_buf[j] == 0) {
G_set_d_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
G_set_d_null_value(&supCell, 1);
}
- if (!G_is_d_null_value(&ptype)) {
- /* only one patch type */
- if (!G_is_d_null_value(&corrCell) && corrCell == ptype) {
- if (corrCell != precCell)
+ if (!G_is_d_null_value(&corrCell)) {
+ area++;
+ if (G_is_d_null_value(&ptype) || corrCell == ptype) {
+
+ if (G_is_d_null_value(&precCell) || precCell != corrCell) {
nedges++;
- if (corrCell != supCell)
+ }
+ if (G_is_d_null_value(&supCell) || supCell != corrCell) {
nedges++;
+ }
/* right and bottom */
if (i == ad->rl - 1)
nedges++;
if (j == ad->cl - 1)
nedges++;
}
- if (!G_is_d_null_value(&precCell) && precCell == ptype) {
- if (corrCell != precCell)
- nedges++;
- }
- if (!G_is_d_null_value(&supCell) && supCell == ptype) {
- if (corrCell != supCell)
- nedges++;
- }
}
- else {
- /* all patch types */
- if (!G_is_d_null_value(&corrCell)) {
- if (corrCell != precCell) {
+ else /* corrCell == NULL */ {
+ if (!G_is_d_null_value(&precCell)) {
+ if (G_is_d_null_value(&ptype) || precCell == ptype) {
nedges++;
}
- if (corrCell != supCell) {
+ }
+ if (!G_is_d_null_value(&supCell)) {
+ if (G_is_d_null_value(&ptype) || supCell == ptype) {
nedges++;
}
- /* right and bottom */
- if (i == ad->rl - 1)
- nedges++;
- if (j == ad->cl - 1)
- nedges++;
}
- if (!G_is_d_null_value(&precCell) && corrCell != precCell) {
- nedges++;
- }
- if (!G_is_d_null_value(&supCell) && corrCell != supCell) {
- nedges++;
- }
}
precCell = corrCell;
}
@@ -553,59 +515,40 @@
if (masked && mask_buf[j] == 0) {
G_set_f_null_value(&corrCell, 1);
}
- else {
- /* total sample area */
- area++;
- }
supCell = buf_sup[j + ad->x];
if (masked && (mask_sup[j] == 0)) {
G_set_f_null_value(&supCell, 1);
}
- if (!G_is_f_null_value(&ptype)) {
- /* only one patch type */
- if (!G_is_f_null_value(&corrCell) && corrCell == ptype) {
- if (corrCell != precCell)
+ if (!G_is_f_null_value(&corrCell)) {
+ area++;
+ if (G_is_f_null_value(&ptype) || corrCell == ptype) {
+
+ if (G_is_f_null_value(&precCell) || precCell != corrCell) {
nedges++;
- if (corrCell != supCell)
+ }
+ if (G_is_f_null_value(&supCell) || supCell != corrCell) {
nedges++;
+ }
/* right and bottom */
if (i == ad->rl - 1)
nedges++;
if (j == ad->cl - 1)
nedges++;
}
- if (!G_is_f_null_value(&precCell) && precCell == ptype) {
- if (corrCell != precCell)
- nedges++;
- }
- if (!G_is_f_null_value(&supCell) && supCell == ptype) {
- if (corrCell != supCell)
- nedges++;
- }
}
- else {
- /* all patch types */
- if (!G_is_f_null_value(&corrCell)) {
- if (corrCell != precCell) {
+ else /* corrCell == NULL */ {
+ if (!G_is_f_null_value(&precCell)) {
+ if (G_is_f_null_value(&ptype) || precCell == ptype) {
nedges++;
}
- if (corrCell != supCell) {
+ }
+ if (!G_is_f_null_value(&supCell)) {
+ if (G_is_f_null_value(&ptype) || supCell == ptype) {
nedges++;
}
- /* right and bottom */
- if (i == ad->rl - 1)
- nedges++;
- if (j == ad->cl - 1)
- nedges++;
}
- if (!G_is_f_null_value(&precCell) && corrCell != precCell) {
- nedges++;
- }
- if (!G_is_f_null_value(&supCell) && corrCell != supCell) {
- nedges++;
- }
}
precCell = corrCell;
}
More information about the grass-commit
mailing list