var KTMapPluginRoadnetLayer=function(e,t){"use strict";function n(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{c(r.next(e))}catch(t){o(t)}}function s(e){try{c(r.throw(e))}catch(t){o(t)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((r=r.apply(e,t||[])).next())}))}class r{constructor(){var e;Object.defineProperty(this,"emitter",{enumerable:!0,configurable:!0,writable:!0,value:{all:e=e||new Map,on:function(t,n){var r=e.get(t);r?r.push(n):e.set(t,[n])},off:function(t,n){var r=e.get(t);r&&(n?r.splice(r.indexOf(n)>>>0,1):e.set(t,[]))},emit:function(t,n){var r=e.get(t);r&&r.slice().map((function(e){e(n)})),(r=e.get("*"))&&r.slice().map((function(e){e(t,n)}))}}})}on(e,t){return this.emitter.on(e,t),this}off(e,t){return this.emitter.off(e,t),this}}class i extends r{constructor(){super(),Object.defineProperty(this,"map",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}__inject(e){return this.map=e,this}}class o extends i{constructor(e){super(),Object.defineProperty(this,"options",{enumerable:!0,configurable:!0,writable:!0,value:e})}__init(){console.log("RoadNetLayer init success"),this.initData(this.drawRoadNet.bind(this))}initData(e){return n(this,void 0,void 0,(function*(){const{data:t}=this.options;if("function"==typeof t)try{const n=yield t();console.log("resresresres :>> ",n),null==e||e(n)}catch(n){}else null==e||e(t)}))}drawRoadNet(e){const{map:n}=this;for(const r of e){r.begin[0]=+r.begin[0],r.begin[1]=+r.begin[1],r.end[0]=+r.end[0],r.end[1]=+r.end[1];const{begin:e,end:n}=r;this.drawNormalLine([new t.Vector3(...e,0),new t.Vector3(...n,0)],{name:"ar_roadNetPath",color:"red"})}n.reDraw()}drawNormalLine(e,n){const{map:r}=this,i=new t.Line((new t.BufferGeometry).setFromPoints(e),new t.LineBasicMaterial({color:(null==n?void 0:n.color)||"red",opacity:1,transparent:!0,depthTest:!1}));i.name=(null==n?void 0:n.name)||"",i.userData={},r.scene.add(i)}}return Object.defineProperty(o,"NAME",{enumerable:!0,configurable:!0,writable:!0,value:"RoadNetLayer"}),e.RoadNetLayer=o,Object.defineProperty(e,"__esModule",{value:!0}),e}({},THREE);
