@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 1.9 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{AttributeStoreView as t}from"./webgl/AttributeStoreView.js";import{AttributeDataType as e}from"./webgl/definitions.js";import i from"./webgl/TileContainer.js";const s=60;class n extends i{constructor(e){super(e),this._statisticsByLevel=new Map,this._entityIndex=new Map,this.attributeView=new t}destroy(){this.children.forEach((t=>t.destroy())),this.removeAllChildren(),this.attributeView.destroy()}doRender(t){t.context.capabilities.enable("textureFloatLinear"),super.doRender(t)}get hasAnimations(){for(const t of this.children)if(t.hasAnimations)return!0;return!1}_reindexAndUpdateFeaturesIfNeeded(){if(this.hasAnimations&&(this._reindexFeatures(),0!==this.attributeView.size))for(const t of this._entityIndex.values())t.dirty&&(this.attributeView.setData(t.displayId,e.LocalTimeOrigin,0,t.firstIndexed),t.dirty=!1)}restartAnimation(t){const e=this._entityIndex.get(t);if(!e)return;const i=performance.now()/1e3;e.firstIndexed=i,e.dirty=!0}restartAllAnimations(){const t=performance.now()/1e3;for(const[e,i]of this._entityIndex)i.firstIndexed=t,i.dirty=!0}_reindexFeatures(){const t=performance.now()/1e3;for(const e of this.children)for(const i of e.entityIds){const{objectId:e}=i;let s=this._entityIndex.get(e);s||(s={objectId:e,displayId:0,firstIndexed:t,lastIndexed:0,dirty:!0},this._entityIndex.set(e,s)),s.lastIndexed=t,s.displayId=i.displayId}for(const[e,i]of this._entityIndex)t-i.lastIndexed>s&&this._entityIndex.delete(e)}_updateAttributeView(){this.attributeView.update(),this._reindexAndUpdateFeaturesIfNeeded()}createRenderParams(t){const e=super.createRenderParams(t);return e.attributeView=this.attributeView,e.instanceStore=this._instanceStore,e.statisticsByLevel=this._statisticsByLevel,e}}export{n as AFeatureContainer};