UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

6 lines (5 loc) 638 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ class t{constructor(t,e,s){this._scale=t,this._shift=e,this._levelShift=s}getLevelRowColumn(t){const e=this.getLevelShift(t[0]),s=this._shift+e;return s?[t[0]-e,t[1]>>s,t[2]>>s]:t}getLevelShift(t){return Math.min(t,this._levelShift)}getOffset(t,e){let s=0,i=0;const h=this._shift+this.getLevelShift(t[0]);if(h){const l=(1<<h)-1,f=e/(this._scale*(1<<h-1));s=(t[2]&l)*f,i=(t[1]&l)*f}return[s,i]}getScale(t){return this._scale*(1<<this._shift+this.getLevelShift(t))}}export{t as SchemaHelper};