Skip to content

Commit 966fa33

Browse files
authored
Update BuildingShapeUtils.js
1 parent 707017b commit 966fa33

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/extras/BuildingShapeUtils.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class BuildingShapeUtils extends ShapeUtils {
3737
}
3838

3939
/**
40-
* Check if a way is a cloased shape.
40+
* Check if a way is a closed shape.
4141
*
4242
* @param {DOM.Element} way - OSM XML way element.
4343
*
@@ -62,12 +62,13 @@ class BuildingShapeUtils extends ShapeUtils {
6262
nodes.pop();
6363
}
6464
const refs = [];
65-
66-
// foreach (node in way)
67-
// if (the ref value exists in the array)
68-
// return true;
69-
// push ref value to array
70-
// return false;
65+
for (let i = 0; i < nodes.length - 1; i++) {
66+
if (refs.inclides(nodes[i].getAttribute('ref')){
67+
return true;
68+
}
69+
nodes.push(nodes[i].getAttribute('ref'));
70+
}
71+
return false;
7172
}
7273

7374
/**

0 commit comments

Comments
 (0)