@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 3.16 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.19/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{property as r,subclass as n}from"../../../core/accessorSupport/decorators.js";import{projectWithoutEngine as l}from"../../../geometry/projectionUtils.js";import{fromExtent as i,empty as s,expand as a,allFinite as o,equals as c}from"../../../geometry/support/aaBoundingRect.js";import{isIntegratedMeshLayer as p,isTiledLayer as u}from"../../../layers/support/layerUtils.js";import{webMercatorWorldExtent as y,geographicWorldExtent as f}from"./TerrainConst.js";import{getTiledLayerInfo as E,isProjectableRasterLayer as d}from"./terrainUtils.js";let x=class extends t{constructor(e){super(e)}initialize(){this.addHandles([this.layerViews.on("change",()=>this.notifyChange("stencilEnabledExtents"))])}destroy(){}get layerViewsExtent(){return this._computeLayerViewsExtent()}get tiledLayersExtent(){return this._computeTiledLayersExtent()}get stencilEnabledExtents(){return this._computeStencilEnabledExtents()}_computeStencilEnabledExtents(){const e=[];return this.layerViews.forEach(t=>{const r=t.layer;if(p(r)&&null!=this.viewSpatialReference){const t=g(r.fullExtent,this.viewSpatialReference);null!=t&&e.push(i(t))}}),e}};function h(e,t){return 1===e?new m(t):new w(t)}e([r({readOnly:!0})],x.prototype,"layerViewsExtent",null),e([r({readOnly:!0})],x.prototype,"tiledLayersExtent",null),e([r({readOnly:!0})],x.prototype,"stencilEnabledExtents",null),e([r()],x.prototype,"viewSpatialReference",void 0),e([r()],x.prototype,"tilingScheme",void 0),e([r()],x.prototype,"defaultTiledLayersExtent",void 0),e([r({constructOnly:!0})],x.prototype,"layers",void 0),e([r({constructOnly:!0})],x.prototype,"layerViews",void 0),x=e([n("esri.views.3d.terrain.ExtentHelper")],x);let m=class extends x{_computeLayerViewsExtent(){return this._globalExtent}_computeTiledLayersExtent(){return this._globalExtent}get _globalExtent(){return this.viewSpatialReference.isWebMercator?y:f}};m=e([n("esri.views.3d.terrain.ExtentHelper.ExtentHelperGlobal")],m);let w=class extends x{_computeLayerViewsExtent(){const e=s(),t=this.viewSpatialReference;this.layerViews.forEach(r=>{const n=r.layer;if(r.isResolved()&&("graphics"!==n.type||!n.internal)){const n=g("fullExtentInLocalViewSpatialReference"in r&&r.fullExtentInLocalViewSpatialReference||r.layer.fullExtent,t);a(e,n,e)}});const r=o(e)?e:null,n=this._get("layerViewsExtent");return c(r,n)?n:r}_computeTiledLayersExtent(){const e=this.tilingScheme;if(!e)return null;const t=this.viewSpatialReference,r=s();this.layers.forEach(n=>{if(n.loaded&&u(n)){const l=E(n,t,2);if(null==l)return;const{tileInfo:i,fullExtent:s}=l,o="tilemapCache"in n?n.tilemapCache?.effectiveMaxLOD:void 0;null!=i&&null!=s&&(d(n)||e.compatibleWith(i,o)&&s.spatialReference.equals(e.spatialReference))&&a(r,s,r)}}),a(r,this.defaultTiledLayersExtent,r);const n=o(r)?r:null,l=this._get("tiledLayersExtent");return c(n,l)?l:n}};function g(e,t){return null==e||e.spatialReference.equals(t)?e:l(e,e.spatialReference,t)}w=e([n("esri.views.3d.terrain.ExtentHelper.ExtentHelperLocal")],w);export{x as ExtentHelper,h as create};