@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 4.94 kB
JavaScript
import{_ as e}from"../../../chunks/tslib.es6.js";import s from"../../../Graphic.js";import t from"../../../core/Logger.js";import{isSome as i}from"../../../core/maybe.js";import{isAbortError as r}from"../../../core/promiseUtils.js";import{watch as o,syncAndInitial as a,sync as n,initial as u}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{hasExcludedVariableOrDimension as c}from"../../../layers/support/rasterDatasets/multidimensionalUtils.js";import d from"../engine/flow/FlowView2D.js";import{LayerView2DMixin as p}from"./LayerView2D.js";import m from"./imagery/ImageryTileView2D.js";import b from"./imagery/VectorFieldTileView2D.js";import{canUseMajorityInterpolationOnDataSource as v}from"./support/util.js";import w from"../../layers/ImageryTileLayerView.js";import y from"../../layers/LayerView.js";import g from"../../layers/RefreshableLayerView.js";let f=class extends(w(g(p(y)))){constructor(){super(...arguments),this._useWebGLForProcessing=!0,this._useProgressiveUpdate=!0,this.subview=null}get useWebGLForProcessing(){return this._useWebGLForProcessing}set useWebGLForProcessing(e){this._useWebGLForProcessing=e,this.subview&&"useWebGLForProcessing"in this.subview&&(this.subview.useWebGLForProcessing=e)}get useProgressiveUpdate(){return this._useWebGLForProcessing}set useProgressiveUpdate(e){this._useProgressiveUpdate=e,this.subview&&"useProgressiveUpdate"in this.subview&&(this.subview.useProgressiveUpdate=e)}update(e){this.subview?.update(e),this.notifyChange("updating")}isUpdating(){return!this.subview||this.subview.updating}attach(){this.layer.increaseRasterJobHandlerUsage(),this._updateSubview(),this.addAttachHandles([o((()=>{const{layer:e}=this;return{bandIds:e.bandIds,renderer:e.renderer,interpolation:e.interpolation,multidimensionalDefinition:e.multidimensionalDefinition,rasterFunction:"imagery-tile"===e.type?e.rasterFunction:null}}),((e,s)=>{const i=e.interpolation!==s?.interpolation&&("majority"===e.interpolation||"majority"===s?.interpolation)&&v(this.layer),o=e.renderer!==s?.renderer&&s?.renderer?.type!==e.renderer?.type;o&&this._updateSubview();const a=e.multidimensionalDefinition!==s?.multidimensionalDefinition,n=e.rasterFunction!==s?.rasterFunction,u=n&&!this._useWebGLForProcessing,h=a||i||o||u;this.subview.redrawOrRefetch({refetch:h,reprocess:n}).catch((e=>{r(e)||t.getLogger(this.declaredClass).error(e)})),this.notifyChange("updating")})),o((()=>this.layer.blendMode??"normal"),(e=>{this.subview.container.blendMode=e}),a),o((()=>this.layer.effect??null),(e=>{this.subview.container.effect=e}),a),o((()=>this.layer.multidimensionalSubset??null),((e,s)=>{const{multidimensionalDefinition:o}=this.layer;i(o)&&c(o,e)!==c(o,s)&&(this.subview.redrawOrRefetch({refetch:!0}).catch((e=>{r(e)||t.getLogger(this.declaredClass).error(e)})),this.notifyChange("updating"))}),n),o((()=>this.timeExtent),(()=>{this.subview.timeExtent=this.timeExtent,this.subview.redrawOrRefetch({refetch:!0}).catch((e=>{r(e)||t.getLogger(this.declaredClass).error(e)}))}),u)])}detach(){this.layer.decreaseRasterJobHandlerUsage(),this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}moveStart(){this.requestUpdate()}viewChange(){this.requestUpdate()}moveEnd(){this.subview.moveEnd()}async hitTest(e,t){return[{type:"graphic",layer:this.layer,mapPoint:e,graphic:new s({attributes:{},geometry:e.clone()})}]}doRefresh(){return this.subview?this.subview.doRefresh():Promise.resolve()}_updateSubview(){const e="vector-field"===this.layer.renderer.type?"rasterVF":"flow"===this.layer.renderer.type?"flow":"raster";if(this.subview){if(this.subview.type===e)return void this._attachSubview(this.subview);this._detachSubview(this.subview),this.subview?.destroy(),this.subview=null}const{layer:s}=this;let t;if(t="rasterVF"===e?new b({layer:s,layerView:this}):"flow"===e?new d({layer:s,layerView:this}):new m({layer:s,layerView:this}),"useWebGLForProcessing"in t&&(t.useWebGLForProcessing=this._useWebGLForProcessing),"useProgressiveUpdate"in t&&(t.useProgressiveUpdate=this._useProgressiveUpdate),"previousLOD"in t){const{subview:e}=this;t.previousLOD=e&&"previousLOD"in e?e.previousLOD:null}this._attachSubview(t),this.subview=t,this.requestUpdate()}_attachSubview(e){e&&!e.attached&&(e.attach(),e.attached=!0,this.container.addChildAt(e.container,0),e.container.blendMode=this.layer.blendMode,e.container.effect=this.layer.effect)}_detachSubview(e){e?.attached&&(this.container.removeChild(e.container),e.detach(),e.attached=!1)}};e([h()],f.prototype,"subview",void 0),e([h()],f.prototype,"useWebGLForProcessing",null),e([h()],f.prototype,"useProgressiveUpdate",null),f=e([l("esri.views.2d.layers.ImageryTileLayerView2D")],f);const L=f;export{L as default};