@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.75 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{AttributeStoreView as t}from"./webgl/AttributeStoreView.js";import e from"./webgl/TileContainer.js";const i=60;class s extends e{constructor(e){super(e),this._statisticsByLevel=new Map,this._entityIndex=new Map,this.attributeView=new t}destroy(){super.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,7,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,s]of this._entityIndex)t-s.lastIndexed>i&&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{s as AFeatureContainer};