File tree Expand file tree Collapse file tree 2 files changed +8
-9
lines changed
Expand file tree Collapse file tree 2 files changed +8
-9
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,9 @@ class Building {
3030 options ;
3131
3232 /**
33- * Create new building
33+ * Download data for new building
3434 */
35- static async create ( type , id ) {
35+ static async downloadDataAroundBuilding ( type , id ) {
3636 var data ;
3737 if ( type === 'way' ) {
3838 data = await Building . getWayData ( id ) ;
@@ -42,8 +42,7 @@ class Building {
4242 let xmlData = new window . DOMParser ( ) . parseFromString ( data , 'text/xml' ) ;
4343 const nodelist = Building . buildNodeList ( xmlData ) ;
4444 const extents = Building . getExtents ( id , xmlData , nodelist ) ;
45- const innerData = await Building . getInnerData ( ...extents ) ;
46- return new Building ( id , innerData ) ;
45+ return await Building . getInnerData ( ...extents ) ;
4746 }
4847
4948 /**
Original file line number Diff line number Diff line change @@ -53,13 +53,13 @@ function init() {
5353 if ( params . has ( 'errorBox' ) ) {
5454 errorBox = true ;
5555 }
56- Building . create ( type , id ) . then ( function ( myObj ) {
57- mainBuilding = myObj ;
58- const helperSize = myObj . outerElement . getWidth ( ) ;
56+ Building . downloadDataAroundBuilding ( type , id ) . then ( function ( innerData ) {
57+ mainBuilding = new Building ( id , innerData ) ;
58+ const helperSize = mainBuilding . outerElement . getWidth ( ) ;
5959 const helper = new GridHelper ( helperSize / 0.9 , helperSize / 9 ) ;
6060 scene . add ( helper ) ;
6161
62- const mesh = myObj . render ( ) ;
62+ const mesh = mainBuilding . render ( ) ;
6363 for ( let i = 0 ; i < mesh . length ; i ++ ) {
6464 if ( mesh [ i ] && mesh [ i ] . isObject3D ) {
6565 scene . add ( mesh [ i ] ) ;
@@ -69,7 +69,7 @@ function init() {
6969 }
7070 if ( displayInfo ) {
7171 gui = new GUI ( ) ;
72- const info = myObj . getInfo ( ) ;
72+ const info = mainBuilding . getInfo ( ) ;
7373 const folder = gui . addFolder ( info . type + ' - ' + info . id ) ;
7474 createFolders ( folder , info . options ) ;
7575 for ( let i = 0 ; i < info . parts . length ; i ++ ) {
You can’t perform that action at this time.
0 commit comments