import t from'./../../../src/core/Thing';import{mergeDeep as e}from'@vci/helper/src/object';import{FileLoader as o,Group as i}from'three/webgpu';export default class Polygon extends t{constructor(t){super(e({position:[0,2,0],enableEvent:!1,enableEdit:!1,enableUpdateRenderOrderDeep:!1,styles:null,geoJSON:null,urlGeoJSON:null},t))}init(){super.init(),this.isPolygon=!0,this.isReady=!1,this.o3=new i}async afterInstantiation(){super.afterInstantiation();const{geoJSON:t}=this.option;t?this.createO3(t):await this.loadResource(),this.isReady=!0}async loadResource(){const{qt:t,option:e}=this,i=(await new o(t.thingWorld.loadingManager).loadAsync(e.urlGeoJSON)).toString();this.createO3(JSON.parse(i))}createO3(t){const{qt:e}=this,{styles:o}=this.option,i=e.thingWorld.createO3FromGeoJSONMercator(e.thingWorld.transformGeoJSON(t),o);this.o3.add(i.o3Area),this.o3.add(i.o3Line)}async next(){await new Promise(t=>this.inter.next=setInterval(()=>{this.isReady&&(clearInterval(this.inter.next),t())},50))}}