diff --git a/dist/aframe-street-component.js b/dist/aframe-street-component.js index 53de41860..599c1f136 100644 --- a/dist/aframe-street-component.js +++ b/dist/aframe-street-component.js @@ -13,4 +13,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ -var n,a=function(){return a=Object.assign||function(t){for(var e,i=1,n=arguments.length;i{t.exports.isSidewalk=function(t){return t.startsWith("sidewalk")||["utilities","scooter-drop-zone","bikeshare","flex-zone-curb","transit-shelter","brt-station"].includes(t)},t.exports.createBuildingsArray=function(){var t,e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:150,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"narrow";if("narrow"===n||"wide"===n)t=[{id:"SM3D_Bld_Mixed_4fl",width:5.251},{id:"SM3D_Bld_Mixed_Double_5fl",width:10.9041},{id:"SM3D_Bld_Mixed_4fl_2",width:5.309},{id:"SM3D_Bld_Mixed_5fl",width:5.903},{id:"SM3D_Bld_Mixed_Corner_4fl",width:5.644}],e="41431323432402434130303230234102402341";else if("residential"===n)t=[{id:"SM_Bld_House_Preset_03_1800",width:20},{id:"SM_Bld_House_Preset_08_1809",width:20},{id:"SM_Bld_House_Preset_09_1845",width:20}],e="12021201210101212021201012012021201210";else{if("arcade"!==n)return[];t=[{id:"arched-building-01",width:9.191},{id:"arched-building-02",width:11.19},{id:"arched-building-03",width:13.191},{id:"arched-building-04",width:15.191}],e="03120223130210321203123023103201232013"}for(var a=0,r=0,s=[];r{function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var i=[],n=!0,a=!1,r=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){a=!0,r=t}finally{try{n||null==o.return||o.return()}finally{if(a)throw r}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0&&void 0!==arguments[0]?arguments[0]:{},i=document.createElement(t.tag);delete t.tag;for(var n=0,a=Object.entries(t);n1?arguments[1]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((function(e,i){t.appendChild(n(e))})),t}},394:t=>{t.exports.streetmixUserToAPI=function(t){var e=new URL(t).pathname.split("/"),i=e[1],n=e[2];return"-"===i?"https://streetmix.net/api/v1/streets?namespacedId="+n:"https://streetmix.net/api/v1/streets?namespacedId="+n+"&creatorId="+i},t.exports.pathStartsWithAPI=function(t){var e=document.createElement("a");return e.href=t,"api"===e.pathname.split("/")[1]},t.exports.streetmixAPIToUser=function(t){function e(t,e){for(var i=t.split("&"),n=0;n(t.paths=[],t.children||(t.children=[]),t);return(()=>{function t(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var i=[],n=!0,a=!1,r=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){a=!0,r=t}finally{try{n||null==o.return||o.return()}finally{if(a)throw r}}return i}(t,i)||function(t,i){if(!t)return;if("string"==typeof t)return e(t,i);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,i)}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=200&&this.status<400){var t=JSON.parse(this.response),n=t.data.street.segments,a=t.name;i.setAttribute("streetmix-loader","name",a),e.showBuildings&&(i.setAttribute("street","right",t.data.street.rightBuildingVariant),i.setAttribute("street","left",t.data.street.leftBuildingVariant)),i.setAttribute("street","type","streetmixSegmentsFeet"),i.setAttribute("street","JSON",JSON.stringify({streetmixSegmentsFeet:n})),i.emit("streetmix-loader-street-loaded")}else console.log("[streetmix-loader]","Loading Error: We reached the target server, but it returned an error")},n.onerror=function(){console.log("[streetmix-loader]","Loading Error: There was a connection error of some sort")},n.send()}else{if(e.streetmixStreetURL.length>0){var r=a.streetmixUserToAPI(e.streetmixStreetURL);return console.log("[streetmix-loader]","setting `streetmixAPIURL` to",r),void i.setAttribute("streetmix-loader","streetmixAPIURL",r)}console.log("[streetmix-loader]","Neither `streetmixAPIURL` nor `streetmixStreetURL` properties provided, please provide at least one.")}}}),AFRAME.registerComponent("intersection",{schema:{dimensions:{type:"string",default:"20 20"},sidewalk:{type:"string",default:"0 0 0 0"},northeastcurb:{type:"string",default:"0 0"},southwestcurb:{type:"string",default:"0 0"},southeastcurb:{type:"string",default:"0 0"},northwestcurb:{type:"string",default:"0 0"},stopsign:{type:"string",default:"0 0 0 0"},trafficsignal:{type:"string",default:"0 0 0 0"},crosswalk:{type:"string",default:"0 0 0 0"}},init:function(){var e=this.data,i=this.el,n=e.dimensions.split(" ").map((function(t){return Number(t)})),a=[this.el.getAttribute("position").x,this.el.getAttribute("position").y,this.el.getAttribute("position").z],r=e.sidewalk.split(" ").map((function(t){return Number(t)})),s=e.northeastcurb.split(" ").map((function(t){return Number(t)})),o=e.southwestcurb.split(" ").map((function(t){return Number(t)})),l=e.southeastcurb.split(" ").map((function(t){return Number(t)})),c=e.northwestcurb.split(" ").map((function(t){return Number(t)})),d=e.stopsign.split(" ").map((function(t){return Number(t)})),u=e.trafficsignal.split(" ").map((function(t){return Number(t)})),m=e.crosswalk.split(" ").map((function(t){return Number(t)})),p=n[0],h=n[1];function f(t){var e=t.length,n=t.width,a=t.positionVec,r=t.scaleVec,s=void 0===r?{x:1,y:1,z:1}:r,o=t.rotationVec,l=document.createElement("a-entity"),c=[];c[0]=n/2,c[1]=parseInt(e/2),l.setAttribute("geometry","primitive","box"),l.setAttribute("geometry","height: 0.4"),l.setAttribute("position",a),l.setAttribute("scale",s),l.setAttribute("geometry","depth",e),l.setAttribute("geometry","width",n),l.setAttribute("rotation",o),l.setAttribute("mixin","sidewalk"),l.setAttribute("material","repeat: ".concat(c[0]," ").concat(c[1])),i.appendChild(l)}this.el.setAttribute("geometry","primitive","plane"),this.geometry=new THREE.PlaneGeometry(p,h,1,1),this.material=new THREE.MeshStandardMaterial({color:"#FF0000"}),this.mesh=new THREE.Mesh(this.geometry,this.material),i.setObject3D("mesh",this.mesh),this.el.setAttribute("position",{x:a[0],y:a[1],z:a[2]}),this.el.setAttribute("rotation","-90 0 0"),this.el.setAttribute("material","src: #asphalt-texture; repeat:5 5; roughness:1");var g={west:{positionVec:{x:p/2-r[0]/2},rotationVec:{x:90,y:0,z:0},length:h,width:r[0]},east:{positionVec:{x:-p/2+r[1]/2},rotationVec:{x:90,y:0,z:0},length:h,width:r[1]},north:{positionVec:{y:-h/2+r[2]/2,x:r[1]/2-r[0]/2},rotationVec:{x:0,y:90,z:-90},length:p-r[1]-r[0],width:r[2]},south:{positionVec:{y:h/2-r[3]/2,x:r[1]/2-r[0]/2},rotationVec:{x:0,y:90,z:-90},length:p-r[1]-r[0],width:r[3]}};Object.keys(g).filter((function(t,e){return r[e]})).forEach((function(t,e){f(g[t])}));for(var y={northeast:{positionVec:{x:p/2-s[0]/2,y:h/2-s[1]/2},rotationVec:{x:0,y:90,z:-90},length:s[0],width:s[1]},southwest:{positionVec:{x:-p/2+o[0]/2,y:-h/2+o[1]/2},rotationVec:{x:0,y:90,z:-90},length:o[0],width:o[1]},southeast:{positionVec:{x:p/2-l[0]/2,y:-h/2+l[1]/2},rotationVec:{x:0,y:90,z:-90},length:l[0],width:l[1]},northwest:{positionVec:{x:-p/2+c[0]/2,y:h/2-c[1]/2},rotationVec:{x:0,y:90,z:-90},length:c[0],width:c[1]}},b=0,x=Object.entries(y);b{t.exports.isSidewalk=function(t){return t.startsWith("sidewalk")||["utilities","scooter-drop-zone","bikeshare","flex-zone-curb","transit-shelter","brt-station"].includes(t)},t.exports.createBuildingsArray=function(){var t,e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:150,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"narrow";if("narrow"===n||"wide"===n)t=[{id:"SM3D_Bld_Mixed_4fl",width:5.251},{id:"SM3D_Bld_Mixed_Double_5fl",width:10.9041},{id:"SM3D_Bld_Mixed_4fl_2",width:5.309},{id:"SM3D_Bld_Mixed_5fl",width:5.903},{id:"SM3D_Bld_Mixed_Corner_4fl",width:5.644}],e="41431323432402434130303230234102402341";else if("residential"===n)t=[{id:"SM_Bld_House_Preset_03_1800",width:20},{id:"SM_Bld_House_Preset_08_1809",width:20},{id:"SM_Bld_House_Preset_09_1845",width:20}],e="12021201210101212021201012012021201210";else{if("arcade"!==n)return[];t=[{id:"arched-building-01",width:9.191},{id:"arched-building-02",width:11.19},{id:"arched-building-03",width:13.191},{id:"arched-building-04",width:15.191}],e="03120223130210321203123023103201232013"}for(var a=0,r=0,s=[];r{function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var i=[],n=!0,a=!1,r=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){a=!0,r=t}finally{try{n||null==o.return||o.return()}finally{if(a)throw r}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return i(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i0&&void 0!==arguments[0]?arguments[0]:{},i=document.createElement(t.tag);delete t.tag;for(var n=0,a=Object.entries(t);n1?arguments[1]:void 0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((function(e,i){t.appendChild(n(e))})),t}},394:t=>{t.exports.streetmixUserToAPI=function(t){var e=new URL(t).pathname.split("/"),i=e[1],n=e[2];return"-"===i?"https://streetmix.net/api/v1/streets?namespacedId="+n:"https://streetmix.net/api/v1/streets?namespacedId="+n+"&creatorId="+i},t.exports.pathStartsWithAPI=function(t){var e=document.createElement("a");return e.href=t,"api"===e.pathname.split("/")[1]},t.exports.streetmixAPIToUser=function(t){function e(t,e){for(var i=t.split("&"),n=0;n(t.paths=[],t.children||(t.children=[]),t);return(()=>{function t(t,i){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(t)))return;var i=[],n=!0,a=!1,r=void 0;try{for(var s,o=t[Symbol.iterator]();!(n=(s=o.next()).done)&&(i.push(s.value),!e||i.length!==e);n=!0);}catch(t){a=!0,r=t}finally{try{n||null==o.return||o.return()}finally{if(a)throw r}}return i}(t,i)||function(t,i){if(!t)return;if("string"==typeof t)return e(t,i);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return e(t,i)}(t,i)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i=200&&this.status<400){var t=JSON.parse(this.response),n=t.data.street.segments,a=t.name;i.setAttribute("streetmix-loader","name",a),e.showBuildings&&(i.setAttribute("street","right",t.data.street.rightBuildingVariant),i.setAttribute("street","left",t.data.street.leftBuildingVariant)),i.setAttribute("street","type","streetmixSegmentsFeet"),i.setAttribute("street","JSON",JSON.stringify({streetmixSegmentsFeet:n})),i.emit("streetmix-loader-street-loaded")}else console.log("[streetmix-loader]","Loading Error: We reached the target server, but it returned an error")},n.onerror=function(){console.log("[streetmix-loader]","Loading Error: There was a connection error of some sort")},n.send()}else{if(e.streetmixStreetURL.length>0){var r=a.streetmixUserToAPI(e.streetmixStreetURL);return console.log("[streetmix-loader]","setting `streetmixAPIURL` to",r),void i.setAttribute("streetmix-loader","streetmixAPIURL",r)}console.log("[streetmix-loader]","Neither `streetmixAPIURL` nor `streetmixStreetURL` properties provided, please provide at least one.")}}}),AFRAME.registerComponent("intersection",{schema:{dimensions:{type:"string",default:"20 20"},sidewalk:{type:"string",default:"0 0 0 0"},northeastcurb:{type:"string",default:"0 0"},southwestcurb:{type:"string",default:"0 0"},southeastcurb:{type:"string",default:"0 0"},northwestcurb:{type:"string",default:"0 0"},stopsign:{type:"string",default:"0 0 0 0"},trafficsignal:{type:"string",default:"0 0 0 0"},crosswalk:{type:"string",default:"0 0 0 0"}},init:function(){var e=this.data,i=this.el,n=e.dimensions.split(" ").map((function(t){return Number(t)})),a=[this.el.getAttribute("position").x,this.el.getAttribute("position").y,this.el.getAttribute("position").z],r=e.sidewalk.split(" ").map((function(t){return Number(t)})),s=e.northeastcurb.split(" ").map((function(t){return Number(t)})),o=e.southwestcurb.split(" ").map((function(t){return Number(t)})),l=e.southeastcurb.split(" ").map((function(t){return Number(t)})),c=e.northwestcurb.split(" ").map((function(t){return Number(t)})),d=e.stopsign.split(" ").map((function(t){return Number(t)})),u=e.trafficsignal.split(" ").map((function(t){return Number(t)})),m=e.crosswalk.split(" ").map((function(t){return Number(t)})),p=n[0],h=n[1];function f(t){var e=t.length,n=t.width,a=t.positionVec,r=t.scaleVec,s=void 0===r?{x:1,y:1,z:1}:r,o=t.rotationVec,l=document.createElement("a-entity"),c=[];c[0]=n/2,c[1]=parseInt(e/2),l.setAttribute("geometry","primitive","box"),l.setAttribute("geometry","height: 0.4"),l.setAttribute("position",a),l.setAttribute("scale",s),l.setAttribute("geometry","depth",e),l.setAttribute("geometry","width",n),l.setAttribute("rotation",o),l.setAttribute("mixin","sidewalk"),l.setAttribute("material","repeat: ".concat(c[0]," ").concat(c[1])),i.appendChild(l)}this.el.setAttribute("geometry","primitive","plane"),this.geometry=new THREE.PlaneGeometry(p,h,1,1),this.material=new THREE.MeshStandardMaterial({color:"#FF0000"}),this.mesh=new THREE.Mesh(this.geometry,this.material),i.setObject3D("mesh",this.mesh),this.el.setAttribute("position",{x:a[0],y:a[1],z:a[2]}),this.el.setAttribute("rotation","-90 0 0"),this.el.setAttribute("material","src: #asphalt-texture; repeat:5 5; roughness:1");var g={west:{positionVec:{x:p/2-r[0]/2},rotationVec:{x:90,y:0,z:0},length:h,width:r[0]},east:{positionVec:{x:-p/2+r[1]/2},rotationVec:{x:90,y:0,z:0},length:h,width:r[1]},north:{positionVec:{y:-h/2+r[2]/2,x:r[1]/2-r[0]/2},rotationVec:{x:0,y:90,z:-90},length:p-r[1]-r[0],width:r[2]},south:{positionVec:{y:h/2-r[3]/2,x:r[1]/2-r[0]/2},rotationVec:{x:0,y:90,z:-90},length:p-r[1]-r[0],width:r[3]}};Object.keys(g).filter((function(t,e){return r[e]})).forEach((function(t,e){f(g[t])}));for(var y={northeast:{positionVec:{x:p/2-s[0]/2,y:h/2-s[1]/2},rotationVec:{x:0,y:90,z:-90},length:s[0],width:s[1]},southwest:{positionVec:{x:-p/2+o[0]/2,y:-h/2+o[1]/2},rotationVec:{x:0,y:90,z:-90},length:o[0],width:o[1]},southeast:{positionVec:{x:p/2-l[0]/2,y:-h/2+l[1]/2},rotationVec:{x:0,y:90,z:-90},length:l[0],width:l[1]},northwest:{positionVec:{x:-p/2+c[0]/2,y:h/2-c[1]/2},rotationVec:{x:0,y:90,z:-90},length:c[0],width:c[1]}},b=0,x=Object.entries(y);b