UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 1.57 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import{set as t,multiply as e}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{RasterVFDisplayObject as i}from"./RasterVFDisplayObject.js";import{TiledDisplayObject as a}from"../webgl/TiledDisplayObject.js";class r extends a{constructor(t,e,s,a,r,l,o=null){super(t,e,s,a,r,l),this.tileData=new i(o),this.tileData.coordScale=[r,l],this.tileData.once("isReady",(()=>this.ready()))}destroy(){super.destroy(),this.tileData.destroy(),this.tileData=null,this.stage=null}set stencilRef(t){this.tileData.stencilRef=t}get stencilRef(){return this.tileData.stencilRef}_createTransforms(){return{displayViewScreenMat3:s(),tileMat3:s()}}setTransform(s){super.setTransform(s);const i=this.resolution/(s.resolution*s.pixelRatio),a=this.transforms.tileMat3,[r,l]=this.tileData.offset,o=[this.x+r*this.resolution,this.y-l*this.resolution],[n,h]=s.toScreenNoRotation([0,0],o),{symbolTileSize:c}=this.tileData.symbolizerParameters,f=Math.round((this.width-this.tileData.offset[0])/c)*c,m=Math.round((this.height-this.tileData.offset[1])/c)*c,D=f/this.rangeX*i,d=m/this.rangeY*i;t(a,D,0,0,0,d,0,n,h,1),e(this.transforms.displayViewScreenMat3,s.displayViewMat3,a),this.tileData.transforms.displayViewScreenMat3=this.transforms.displayViewScreenMat3}onAttach(){this.tileData.stage=this.stage}onDetach(){this.tileData.stage=null}}export{r as RasterVFTile};