UNPKG

@doegis/core

Version:

DOE GIS API

3 lines (1 loc) 3.4 kB
import{_ as e}from"../../../../../chunks/tslib.es6.js";import has from"../../../../../core/has.js";import{destroyMaybe as t}from"../../../../../core/maybe.js";import{isAbortError as i}from"../../../../../core/promiseUtils.js";import"../../../../../core/Logger.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/Error.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as r}from"../../../../../geometry/support/aaBoundingRect.js";import{FeatureTile as a}from"../../../engine/webgl/FeatureTile.js";import{simplifyVVRenderer as o}from"../support/rendererUtils.js";import l from"./BaseTileRenderer.js";import{convertVisualVariables as n}from"./support/visualVariablesUtils.js";import{WGLFeatureView as u}from"./support/WGLFeatureView.js";let p=class extends l{constructor(){super(...arguments),this.type="symbol"}install(e){const t=()=>this.notifyChange("updating"),i=new u(this.tileInfoView,this.layerView,this.layer,t);this.featuresView=i,e.addChild(i)}uninstall(e){e.removeChild(this.featuresView),this.featuresView=t(this.featuresView)}fetchResource(e,t){const{url:s}=e,r=this.featuresView.stage;try{return r.resourceManager.fetchResource(s,{signal:t.signal})}catch(a){return i(a)?Promise.resolve({width:0,height:0}):Promise.reject(a)}}isUpdating(){const e=super.isUpdating(),t=!this.featuresView||this.featuresView.isUpdating(),i=this.featuresView?.hasEmptyAttributeView(),s=e||t||e&&i;return has("esri-2d-log-updating")&&console.log(`Updating SymbolTileRenderer ${s}\n -> updatingTiles ${e}\n -> hasFeaturesView ${!!this.featuresView}\n -> updatingFeaturesView ${t}`),s}hitTest(e){return this.featuresView.hitTest(e)}supportsRenderer(e){return null!=e&&["simple","class-breaks","unique-value","dot-density","dictionary","heatmap","pie-chart"].includes(e.type)}onConfigUpdate(e){let t=null;if(e&&"visualVariables"in e){const i=(o(e).visualVariables||[]).map((e=>{const t=e.clone();return"normalizationField"in e&&(t.normalizationField=null),e.valueExpression&&"$view.scale"!==e.valueExpression&&(t.valueExpression=null,t.field="nop"),t}));t=n(i)}this.featuresView.setRendererInfo(e,t,this.layerView.featureEffect)}onTileData(e){const t=this.tiles.get(e.tileKey);t&&e.data&&this.featuresView.onTileData(t,e.data),this.layerView.view.labelManager.requestUpdate()}onTileError(e){const t=this.tiles.get(e.tileKey);t&&this.featuresView.onTileError(t)}forceAttributeTextureUpload(){this.featuresView.attributeView.forceTextureUpload()}lockGPUUploads(){this.featuresView.attributeView.lockTextureUpload(),this.tiles.forEach((e=>e.lock()))}unlockGPUUploads(){this.featuresView.attributeView.unlockTextureUpload(),this.tiles.forEach((e=>e.unlock()))}async getMaterialItems(e){return this.featuresView.getMaterialItems(e)}invalidateLabels(){this.featuresView.hasLabels&&this.layerView.view.labelManager.requestUpdate()}createTile(e){const t=this.tileInfoView.getTileBounds(r(),e),i=()=>this.layerView.view.labelManager.requestUpdate(),s=this.tileInfoView.getTileResolution(e.level),o=this.featuresView.attributeView;return new a(e,s,t[0],t[3],o,i)}disposeTile(e){this.featuresView.removeChild(e),e.destroy(),this.layerView.view.labelManager.requestUpdate()}};p=e([s("esri.views.2d.layers.features.tileRenderers.SymbolTileRenderer")],p);const h=p;export{h as default};