@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 4.74 kB
JavaScript
import t from"../../../core/Collection.js";import{isSome as n}from"../../../core/maybe.js";import{isCGCS2000 as e,isEarth as r}from"../../../geometry/support/spatialReferenceUtils.js";import{getTileMaxtrixSetFromActiveLayer as o}from"../../../layers/support/layerUtils.js";import{ViewingMode as i}from"../../ViewingMode.js";import{ImageWithType as l}from"../support/StreamDataLoader.js";import{NeighborIndex as u}from"./interfaces.js";import{t as f}from"../../../chunks/terrainUtilsPlanar.js";import{t as c}from"../../../chunks/terrainUtilsSpherical.js";const a={[i.Global]:c,[i.Local]:f};function T(t,n){t||console.warn("Terrain: "+n)}let s=!1,S=!1;function E(t){S=t,s=s||t}function p(t){s=t}function m(t,n){if(s&&!t){const t=(new Error).stack?.slice(5);throw console.warn("Terrain internal: "+(n||"")+" at "+t),new Error("Assertion failed"+(n?": "+n:""))}}function H(t){return y(t)?{fullExtent:t.fullExtent,minScale:t.layer.minScale,maxScale:t.layer.maxScale,tilemapCache:null}:t.layer}function O(t){return"imagery-tile"===t?.type||"wcs"===t?.type}function y(t){return"imagery-tile-3d"===t?.type}function _(t){return"tile-3d"===t?.type}function I(t){return"vector-tile-3d"===t?.type}function R(t){return"wmts-3d"===t?.type}function U(t){return"elevation-3d"===t?.type}function W(t){return"group"===t?.type}function N(t){return t&&(_(t)||R(t)||y(t)||I(t))}function d(t){return t&&(_(t)||y(t)||I(t)||R(t))}function x(t){return d(t)||U(t)}function A(t){const e=t?.sourceLayerInfo?.data;return n(e)&&"type"in e&&"raster-tile"===e.type}function g(t){const e=t?.sourceLayerInfo?.data;return n(e)&&"type"in e&&"vector-tile"===e.type}function h(t){const e=t?.sourceLayerInfo?.data;return n(e)&&"type"in e&&"tile-texture"===e.type}function L(t){const n=t?.sourceLayerInfo?.data;return n instanceof HTMLImageElement||n instanceof l||n instanceof HTMLCanvasElement||n instanceof ImageData}function w(t){return n(t)&&"release"in t&&t.release(),null}function j(t){return t.fetchTile&&!1!==t.hasOverriddenFetchTile}function C(t,n,e,r){return a[r].checkIfTileInfoSupportedForViewSR(t,e,n)}function b(t,e,r){let o=null,l=null;if("wmts"===t?.type){const n=v(t,e,r);o=n.tileInfo,l=n.fullExtent}else{l=O(t)?t.getCompatibleFullExtent(e):t.fullExtent;const n=r===i.Local;if(O(t))o=t.getCompatibleTileInfo(e,l,n);else if("vector-tile"===t?.type){const r=n&&!M(e)||k.force512VTL,i=t.tileInfo.spatialReference.isGeographic;o=r?t.tileInfo:t.tileInfo.getOrCreateCompatible(256,i?1:2)}else o=t.tileInfo}return n(o)&&n(l)&&null==C(o,l,e,r)?{tileInfo:o,fullExtent:l}:null}function v(e,r,i){const l=o(e);if(n(l)){if(!t.isCollection(l))return{tileInfo:l.tileInfo,fullExtent:l.fullExtent};{const t=l.find((t=>null==C(t.tileInfo,t.fullExtent,r,i)));if(t)return{tileInfo:t.tileInfo,fullExtent:t.fullExtent}}}return{tileInfo:null,fullExtent:null}}function M(t){return t.isWGS84||t.isWebMercator||e(t)||!r(t)}const k={force512VTL:!1};function V(t){return"["+t[0]+","+t[1]+","+t[2]+"]"}function F(t){return"("+t[0]+","+t[1]+","+t[2]+")"}function G(t,n,e=Z){return Math.abs(t-n)<e}function D(t){return t===u.NORTH_EAST?u.SOUTH_WEST:t===u.NORTH_WEST?u.SOUTH_EAST:t===u.SOUTH_WEST?u.NORTH_EAST:u.NORTH_WEST}function P(t){return t===u.NORTH?u.SOUTH:t===u.EAST?u.WEST:t===u.SOUTH?u.NORTH:u.EAST}function q(t){return t===u.NORTH_WEST||t===u.SOUTH_WEST}function z(t){return t===u.NORTH_WEST||t===u.NORTH_EAST}function B(t){return t===u.NORTH_WEST||t===u.WEST||t===u.SOUTH_WEST}function J(t){return t===u.NORTH_EAST||t===u.EAST||t===u.SOUTH_EAST}function K(t){return t===u.SOUTH_EAST||t===u.SOUTH||t===u.SOUTH_WEST}function Q(t){return t===u.NORTH_EAST||t===u.NORTH||t===u.NORTH_WEST}const X=[u.NORTH,u.EAST,u.SOUTH,u.WEST],Y=[u.NORTH_EAST,u.SOUTH_EAST,u.SOUTH_WEST,u.NORTH_WEST],Z=1e-5;export{s as ENABLE_TERRAIN_INTERNAL_CHECKS,S as ENABLE_WATERPROOFNESS_TESTS,G as almostEquals,C as checkIfTileInfoSupportedForView,p as enableTerrainInternalChecks,E as enableTerrainWaterproofnessChecks,Z as eps,H as getLayerWithExtentRange,v as getTileInfoAndExtentFromWMTSLayer,b as getTiledLayerInfo,m as internalAssert,N as isBlendableLayerView,J as isEast,U as isElevationLayerView,W as isGroupLayerView,y as isImageryTileLayerView,A as isImageryTileRenderInfo,d as isMapTileLayerView,Q as isNorth,z as isNorthCorner,O as isProjectableRasterLayer,L as isRasterTileRenderInfo,K as isSouth,x as isSurfaceLayerView,h as isTextureTileRenderInfo,_ as isTileLayerView,I as isVectorTileLayerView,g as isVectorTileRenderInfo,R as isWMTSLayerView,B as isWest,q as isWestCorner,V as lij2s,Y as neighborCornerIndices,X as neighborEdgeIndices,D as oppositeCorner,P as oppositeEdge,w as releaseTileData,k as test,j as useFetchTileForLayer,F as v32s,M as vtlAssumes256PixelSizeAsDefault,T as weakAssert};