| 1 |
- import o from'./../../../../src/core/Thing';import{mergeDeep as t}from'@vci/helper/src/object';import{isEmpty as e}from'@vci/helper/src/other';import r from'../Polygon';import n from'./Polygon3D';import{cloneO3Materials as i}from'./../../../../src/helper/Helper';export default class Polygon3DGroup extends o{constructor(o){super(t({enableEdit:!1,enableEvent:!1,enableCreateFlatPolygon:!1,urlGeoJSON:null,mapPolygon:new Map},o))}init(){super.init(),this.isPolygon3DGroup=!0,this.thingsPolygon=new Map}afterInstantiation(){super.afterInstantiation();const{qt:o}=this,{enableCreateFlatPolygon:t,urlGeoJSON:s,mapPolygon:l}=this.option;t&&(e(s)?o.log.warn('缺少urlGeoJSON,无法创建2D区块'):this.thingArea=new r({qt:o,urlGeoJSON:s})),l.forEach((t,e)=>{const r=this.o3.getObjectByName(e);r?(i(r),this.thingsPolygon.set(e,new n({qt:o,name:t,o3:r,isInGroup:!0}))):o.log.warn(`解析多边形时为找到[${e}]对应的模型`)})}destroy(o=!1,t=!0){return this.thingArea&&!this.thingArea.isDestroyed&&this.thingArea.destroy(o,t),this.thingsPolygon.forEach(e=>!e.isDestroyed&&e.destroy(o,t)),super.destroy(o,t)}}
|