diff --git a/src/building.js b/src/building.js index 00a790d..c359e39 100644 --- a/src/building.js +++ b/src/building.js @@ -61,7 +61,7 @@ class Building { this.type = 'relation'; } if (this.isValidData(outerElementXml)) { - this.buildNodeList(); + this.nodelist = this.buildNodeList(this.fullXmlData); this.setHome(); this.repositionNodes(); if (this.type === 'way') { @@ -98,8 +98,8 @@ class Building { /** * build an array of all the lat/long values of the nodes */ - buildNodeList() { - const nodeElements = this.fullXmlData.getElementsByTagName('node'); + static buildNodeList(fullXmlData) { + const nodeElements = fullXmlData.getElementsByTagName('node'); let id = 0; var node; var coordinates = []; @@ -111,7 +111,7 @@ class Building { coordinates = [node.getAttribute('lon'), node.getAttribute('lat')]; nodeList[id] = coordinates; } - this.nodeList = nodeList; + return nodeList; } /**