@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.24 kB
JavaScript
import t from"../../../../../core/ArrayPool.js";import e from"../../../../../geometry/Extent.js";import{create as i}from"../../../../../geometry/support/aaBoundingRect.js";import s from"../../../../../rest/support/QuantizationParameters.js";import o from"../../../tiling/TileKey.js";class n{constructor(t,e){this.key=new o(0,0,0,0),this.bounds=i(),this.objectIds=new Set,this.key.set(e);const s=t.getLODInfoAt(this.key);this.tileInfoView=t,this.tileInfoView.getTileBounds(this.bounds,this.key,!0),this.resolution=s.resolution,this.scale=s.scale,this.level=s.level}get id(){return this.key.id}get extent(){return e.fromBounds(this.bounds,this.tileInfoView.tileInfo.spatialReference)}get transform(){return{originPosition:"upperLeft",scale:[this.resolution,this.resolution],translate:[this.bounds[0],this.bounds[3]]}}createChildTiles(){const e=this.key.getChildKeys(),i=t.acquire();for(let t=0;t<e.length;t++)i[t]=new n(this.tileInfoView,e[t]);return i}getQuantizationParameters(){return s.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.tileInfo.spatialReference}})}}export{n as Tile};