@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.67 kB
JavaScript
import{result as r}from"../../../../core/asyncUtils.js";import{destroyMaybe as a,isSome as o}from"../../../../core/maybe.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{make as l}from"./Graphics3DCalloutSymbolLayerFactory.js";import{LineCalloutSymbolLayerRenderingInfo as e}from"./Graphics3DLineCalloutSymbolLayer.js";import s from"./Graphics3DSymbol.js";class i extends s{constructor(r,a,o){super(r,a,o),this._calloutSymbolLayer=null,this.symbol.hasVisibleCallout()&&(this._calloutSymbolLayer=l(this.symbol,a))}async doLoad(a){const o=this._calloutSymbolLayer?r(this._calloutSymbolLayer.load()):null;try{await super.doLoad(a),t(a)}catch(l){throw this._calloutSymbolLayer?.abortLoad(),l}o&&await o}destroy(){super.destroy(),this._calloutSymbolLayer=a(this._calloutSymbolLayer)}createGraphics3DGraphic(r,a){const t=super.createGraphics3DGraphic(r,a);if(o(this._calloutSymbolLayer)&&o(t)){const a=this._createCalloutGraphic(r);o(a)&&t.addAuxiliaryGraphic(a)}return t}globalPropertyChanged(r,a){return!!super.globalPropertyChanged(r,a)&&(!this._calloutSymbolLayer||this._calloutSymbolLayer.globalPropertyChanged(r,a,(r=>this._getCalloutGraphicLayer(r))))}updateGeometry(r,a){const o=super.updateGeometry(r,a);if(o&&this._calloutSymbolLayer){const o=this._getCalloutGraphicLayer(r);if(o)return this._calloutSymbolLayer.updateGeometry(o,a)}return o}_createCalloutGraphic(r){const a=r.renderingInfo;return r.renderingInfo=new e(a.renderer,a.symbol),this._calloutSymbolLayer.createGraphics3DGraphic(r)}_getCalloutGraphicLayer(r){for(const a of r._auxiliaryLayers)if(a.graphics3DSymbolLayer===this._calloutSymbolLayer)return a}}export{i as default};