fix: #1118 - get lake shoreline if missing

This commit is contained in:
Azgaar 2024-09-01 21:42:34 +02:00
parent d1fcdf20f7
commit 59462a4f15
2 changed files with 9 additions and 3 deletions

View file

@ -21,7 +21,10 @@ function getVertexPaths({getType, options}) {
if (onborderCell === undefined) continue;
const feature = pack.features[cells.f[onborderCell]];
if (feature.type === "lake" && feature.shoreline.every(ofSameType)) continue; // inner lake
if (feature.type === "lake") {
if (!feature.shoreline) Lakes.getShoreline(feature);
if (feature.shoreline.every(ofSameType)) continue; // inner lake
}
const startingVertex = cells.v[cellId].find(v => vertices.c[v].some(ofDifferentType));
if (startingVertex === undefined) throw new Error(`Starting vertex for cell ${cellId} is not found`);
@ -104,7 +107,10 @@ function getVertexPath(cellsArray) {
if (onborderCell === undefined) continue;
const feature = pack.features[cells.f[onborderCell]];
if (feature.type === "lake" && feature.shoreline.every(ofSameType)) continue; // inner lake
if (feature.type === "lake") {
if (!feature.shoreline) Lakes.getShoreline(feature);
if (feature.shoreline.every(ofSameType)) continue; // inner lake
}
const startingVertex = cells.v[cellId].find(v => vertices.c[v].some(ofDifferentType));
if (startingVertex === undefined) throw new Error(`Starting vertex for cell ${cellId} is not found`);