@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 1.72 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import t from"../../../../../core/ArrayPool.js";import{create as e,toExtent as i}from"../../../../../geometry/support/aaBoundingRect.js";import{normalizeTransform as s}from"../../../../../geometry/support/quantizationUtils.js";import o from"../../../../../rest/support/QuantizationParameters.js";import{createArcadeEvaluationOptions as r}from"./arcadeUtils.js";import n from"../../../tiling/TileKey.js";class a{constructor(t,i){this.key=new n(0,0,0,0),this.bounds=e(),this.objectIds=new Set,this.key.set(i);const s=t.getLODInfoAt(this.key);this.tileInfoView=t,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.level=s.level,this.scale=s.scale,this.minScale=t.zoomToScale(s.level-1),this.maxScale=t.zoomToScale(s.level+1)}get lod(){return this.tileInfoView.getLODInfoAt(this.key)}get id(){return this.key.id}get extent(){const[t,e,i,s]=this.bounds;return{xmin:t,ymin:e,xmax:i,ymax:s}}get hydratedExtent(){return i(this.bounds,this.tileInfoView.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}get normalizedTransform(){return s(this.transform)}createArcadeEvaluationOptions(t){return r(this.scale,t)}createChildTiles(){const e=this.key.getChildKeys(),i=t.acquire();for(let t=0;t<e.length;t++)i[t]=new a(this.tileInfoView,e[t]);return i}getQuantizationParameters(){return o.fromJSON({mode:"view",originPosition:"upperLeft",tolerance:this.resolution,extent:{xmin:this.bounds[0],ymin:this.bounds[1],xmax:this.bounds[2],ymax:this.bounds[3],spatialReference:this.tileInfoView.spatialReference}})}}export{a as Tile};