check lakes before depressiong fill

This commit is contained in:
Azgaar 2021-06-09 00:24:57 +03:00
parent e7cf6e4f5a
commit 234814ee56
3 changed files with 39 additions and 3 deletions

View file

@ -795,11 +795,11 @@ function addLakesInDeepDepressions() {
for (const n of c[q]) {
if (checked[n]) continue;
if (h[n] >= treshold) continue;
if (h[n] < 20) {
deep = false;
break;
}
if (h[n] >= treshold) continue;
checked[n] = true;
queue.push(n);
@ -808,7 +808,6 @@ function addLakesInDeepDepressions() {
// if not, add a lake
if (deep) {
debug.append("circle").attr("cx", points[i][0]).attr("cy", points[i][1]).attr("r", 1).attr("fill", "red");
const lakeCells = [i].concat(c[i].filter(n => h[n] === h[i]));
addLake(lakeCells);
}