UNPKG

@arcgis/core

Version:

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

6 lines (5 loc) 4.74 kB
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.33/esri/copyright.txt for details. */ import n from"../../../core/Collection.js";import{isCGCS2000 as t,isEarth as e}from"../../../geometry/support/spatialReferenceUtils.js";import{getTileMaxtrixSetFromActiveLayer as r}from"../../../layers/support/layerUtils.js";import{ViewingMode as o}from"../../ViewingMode.js";import{NeighborIndex as i}from"./NeighborIndex.js";import{isRasterTile as u,isImageWithType as l,isTileTexture as f,isVectorTile as c}from"./TerrainData.js";import{t as T}from"../../../chunks/terrainUtilsPlanar.js";import{t as a}from"../../../chunks/terrainUtilsSpherical.js";const s={[o.Global]:a,[o.Local]:T};function S(n,t){n||console.warn("Terrain: "+t)}let E=!1,p=!1;function H(n){p=n,E=E||n}function O(n){E=n}function m(n,t){if(E&&!n){const n=(new Error).stack?.slice(5);throw console.warn("Terrain internal: "+(t??"")+" at "+n),new Error("Assertion failed"+(t?": "+t:""))}}function _(n){return"imagery-tile"===n?.type||"wcs"===n?.type}function I(n){return"imagery-tile-3d"===n?.type}function y(n){return"tile-3d"===n?.type}function R(n){return"vector-tile-3d"===n?.type}function d(n){return"wmts-3d"===n?.type}function N(n){return"elevation-3d"===n?.type}function U(n){return"elevation"===n?.type}function W(n){return"group"===n?.type}function A(n){return n&&(y(n)||d(n)||I(n)||R(n))}function x(n){return n&&(y(n)||I(n)||R(n)||d(n))}function L(n){return x(n)||N(n)}function g(n){return u(n?.sourceLayerInfo?.data)}function h(n){return v(n?.sourceLayerInfo)||!!n?.isVTLBackground}function w(n){return f(n?.sourceLayerInfo?.data)}function j(n){const t=n?.sourceLayerInfo?.data;return l(t)||t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageData}function v(n){return c(n?.data)}function C(n){return null!=n&&"release"in n&&n.release(),null}function b(n){return n.fetchTile&&!1!==n.hasOverriddenFetchTile}function M(n,t,e,r,o){return s[r].checkIfTileInfoSupportedForViewSR(n,e,t,o)}function V(n,t,e){let r=null,i=null;if("wmts"===n?.type){const o=k(n,t,e);r=o.tileInfo,i=o.fullExtent}else{i=_(n)?n.getCompatibleFullExtent(t):n.fullExtent;const u=e===o.Local;if(_(n))r=n.getCompatibleTileInfo(t,i,u);else if("vector-tile"===n?.type){r=u&&!F(t)||D.force512VTL?n.tileInfo:n.tileInfo.getCompatibleForVTL(256)}else r=n.tileInfo}const u="tilemapCache"in n?n.tilemapCache?.effectiveMaxLOD:void 0;return null!=r&&null!=i&&null==M(r,i,t,e,u)?{tileInfo:r,fullExtent:i}:null}function k(t,e,o){const i=r(t);if(null!=i){if(!n.isCollection(i))return{tileInfo:i.tileInfo,fullExtent:i.fullExtent};{const n=i.find((n=>null==M(n.tileInfo,n.fullExtent,e,o)));if(n)return{tileInfo:n.tileInfo,fullExtent:n.fullExtent}}}return{tileInfo:null,fullExtent:null}}function F(n){return n.isWGS84||n.isWebMercator||t(n)||!e(n)}const D={force512VTL:!1};function G(n){return"["+n[0]+","+n[1]+","+n[2]+"]"}function B(n){return"("+n[0]+","+n[1]+","+n[2]+")"}function P(n,t,e=tn){return Math.abs(n-t)<e}function q(n){return n===i.NORTH_EAST?i.SOUTH_WEST:n===i.NORTH_WEST?i.SOUTH_EAST:n===i.SOUTH_WEST?i.NORTH_EAST:i.NORTH_WEST}function z(n){return n===i.NORTH?i.SOUTH:n===i.EAST?i.WEST:n===i.SOUTH?i.NORTH:i.EAST}function J(n){return n===i.NORTH_WEST||n===i.SOUTH_WEST}function K(n){return n===i.NORTH_WEST||n===i.NORTH_EAST}function Q(n){return n===i.NORTH_WEST||n===i.WEST||n===i.SOUTH_WEST}function X(n){return n===i.NORTH_EAST||n===i.EAST||n===i.SOUTH_EAST}function Y(n){return n===i.SOUTH_EAST||n===i.SOUTH||n===i.SOUTH_WEST}function Z(n){return n===i.NORTH_EAST||n===i.NORTH||n===i.NORTH_WEST}const $=[i.NORTH,i.EAST,i.SOUTH,i.WEST],nn=[i.NORTH_EAST,i.SOUTH_EAST,i.SOUTH_WEST,i.NORTH_WEST],tn=1e-5;export{P as almostEquals,M as checkIfTileInfoSupportedForView,O as enableInternalTerrainChecks,E as enableTerrainInternalChecks,H as enableTerrainWaterproofChecks,p as enableWaterproofTests,tn as eps,k as getTileInfoAndExtentFromWMTSLayer,V as getTiledLayerInfo,m as internalAssert,A as isBlendableLayerView,X as isEast,U as isElevationLayer,N as isElevationLayerView,W as isGroupLayerView,j as isImageSourceRenderInfo,I as isImageryTileLayerView,g as isImageryTileRenderInfo,x as isMapTileLayerView,Z as isNorth,K as isNorthCorner,_ as isProjectableRasterLayer,Y as isSouth,L as isSurfaceLayerView,w as isTextureTileRenderInfo,y as isTileLayerView,R as isVectorTileLayerView,v as isVectorTilePerLayerInfo,h as isVectorTileRenderInfo,d as isWMTSLayerView,Q as isWest,J as isWestCorner,G as lij2s,nn as neighborCornerIndices,$ as neighborEdgeIndices,q as oppositeCorner,z as oppositeEdge,C as releaseTerrainData,D as test,b as useFetchTileForLayer,B as v32s,F as vtlAssumes256PixelSizeAsDefault,S as weakAssert};