@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 3.43 kB
JavaScript
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import r from"../../../core/Handles.js";import{destroyMaybe as s,isSome as n,isNone as i}from"../../../core/maybe.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{projectWithoutEngine as a}from"../../../geometry/projection.js";import{fromExtent as c,empty as p,expand as u,allFinite as y,equals as d}from"../../../geometry/support/aaBoundingRect.js";import{isTiledLayer as f}from"../../../layers/support/layerUtils.js";import{ViewingMode as m}from"../../ViewingMode.js";import{WEBMERCATOR_WORLD_EXTENT as h,GEOGRAPHIC_WORLD_EXTENT as E}from"./TerrainConst.js";import{getTiledLayerInfo as x,isProjectableRasterLayer as w}from"./terrainUtils.js";let g=class extends t{constructor(e){super(e),this._handles=new r}initialize(){this._handles.add([this.layerViews.on("change",(()=>this.notifyChange("stencilEnabledExtents")))])}destroy(){this._handles=s(this._handles)}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("IntegratedMeshLayer"===r.operationalLayerType&&null!=this.viewSpatialReference){const t=j(r.fullExtent,this.viewSpatialReference);n(t)&&e.push(c(t))}})),e}};function _(e,t){return e===m.Global?new L(t):new b(t)}e([o({readOnly:!0})],g.prototype,"layerViewsExtent",null),e([o({readOnly:!0})],g.prototype,"tiledLayersExtent",null),e([o({readOnly:!0})],g.prototype,"stencilEnabledExtents",null),e([o()],g.prototype,"viewSpatialReference",void 0),e([o()],g.prototype,"tilingScheme",void 0),e([o()],g.prototype,"defaultTiledLayersExtent",void 0),e([o({constructOnly:!0})],g.prototype,"layers",void 0),e([o({constructOnly:!0})],g.prototype,"layerViews",void 0),g=e([l("esri.views.3d.terrain.ExtentHelper")],g);let L=class extends g{_computeLayerViewsExtent(){return this._globalExtent}_computeTiledLayersExtent(){return this._globalExtent}get _globalExtent(){return this.viewSpatialReference.isWebMercator?h:E}};L=e([l("esri.views.3d.terrain.ExtentHelperGlobal")],L);let b=class extends g{_computeLayerViewsExtent(){const e=p(),t=this.viewSpatialReference;this.layerViews.forEach((r=>{const s=r.layer;if(r.isResolved()&&("graphics"!==s.type||!s.internal)){const s=j("fullExtentInLocalViewSpatialReference"in r&&r.fullExtentInLocalViewSpatialReference||r.layer.fullExtent,t);u(e,s,e)}}));const r=y(e)?e:null,s=this._get("layerViewsExtent");return d(r,s)?s:r}_computeTiledLayersExtent(){const e=this.tilingScheme;if(!e)return null;const t=this.viewSpatialReference,r=p();this.layers.forEach((s=>{if(s.loaded&&f(s)){const o=x(s,t,m.Local);if(i(o))return;const{tileInfo:l,fullExtent:a}=o;n(l)&&n(a)&&(w(s)||e.compatibleWith(l)&&a.spatialReference.equals(e.spatialReference))&&u(r,a,r)}})),u(r,this.defaultTiledLayersExtent,r);const s=y(r)?r:null,o=this._get("tiledLayersExtent");return d(s,o)?o:s}};function j(e,t){return n(e)&&!e.spatialReference.equals(t)?a(e,e.spatialReference,t):e}b=e([l("esri.views.3d.terrain.ExtentHelperLocal")],b);export{g as ExtentHelper,_ as create};