12345 |
- /*
- All material copyright ESRI, All Rights Reserved, unless otherwise specified.
- See https://js.arcgis.com/4.25/esri/copyright.txt for details.
- */
- import e from"../core/Error.js";import{isNone as t,isSome as o}from"../core/maybe.js";import{c as r,b as n,e as i,a as s,g as a}from"./vec3.js";import{c as l}from"./vec3f64.js";import{canProjectToWGS84ComparableLonLat as c}from"../geometry/projection.js";import{containsPoint as f,containsPointWithMargin as u,fromExtent as m,create as p}from"../geometry/support/aaBoundingRect.js";import{MAX_ROOT_TILES as h}from"../views/3d/terrain/TerrainConst.js";import{getMissingTileInfoError as g,TilingScheme as d}from"../views/3d/terrain/TilingScheme.js";const M=l(),x=l(),S=l(),j=l();function v(e,o,r=0){const n=e.extent;if(t(n))return!1;if(0===r)return f(n,o);const i=Math.min(n[2]-n[0],n[3]-n[1]);return u(n,o,r*i)}function y(e,t,o,l){r(M,o),M[l]=t[l];const c=n(M,M,t),f=n(x,e,t),u=i(f,c),m=i(c,c);let p;p=u<=0?t:m<=u?o:s(M,t,a(c,c,u/m));const h=n(M,e,p);return Math.PI/2-Math.atan(h[2]/Math.sqrt(h[0]*h[0]+h[1]*h[1]))}function T(e,o,r){const n=e.extent;if(t(n))return 0;S[0]=n[0],S[1]=n[1],S[2]=r,j[0]=n[2],j[1]=n[3],j[2]=r;let i=1/0,s=1/0;return o[0]<S[0]?i=y(o,S,j,0):o[0]>j[0]&&(i=y(o,j,S,0)),o[1]<S[1]?s=y(o,S,j,1):o[1]>j[1]&&(s=y(o,j,S,1)),Math.min(i,s)}function w(r,n,i){if(t(r))return g();if(r.spatialReference.isGeographic&&!c(r.spatialReference))return new e("tilingscheme:local-unsupported-spatial-reference","The tiling scheme spatial reference is not supported in local scenes");const s=d.checkUnsupported(r);if(o(s))return s;if(t(i))return new e("tilingscheme:extent-not-exist","The layer does not provide a layer extent.");const a=R(r,i);if(a)return a;const l=r.spatialReference;return o(n)&&!(l.equals(n)||n.isWGS84&&l.isWebMercator)?new e("tilingscheme:spatial-reference-mismatch","The tiling scheme does not match the spatial reference of the local scene"):null}function R(t,o){const r=t.lods,n=r[0].resolution*2**r[0].level,i=[n*t.size[0],n*t.size[1]],s=[t.origin.x,t.origin.y],a=m(o),l=p();d.computeRowColExtent(a,i,s,l);const c=(l[2]-l[0])*(l[3]-l[1]);if(c>h){const o=r[0].scale*2**r[0].level;let i=Math.max((a[3]-a[1])/t.size[1],(a[2]-a[0])/t.size[0])*o/n;const s=Math.floor(Math.log(i)/Math.log(10));return i=Math.ceil(i/10**s)*10**s,new e("tilingscheme:too-many-root-tiles","Scale of level 0 of the tiling scheme (1:"+Math.floor(o).toLocaleString()+") is too large for the layer's extent. Suggested scale: 1:"+i.toLocaleString()+".",{level0Scale:o,suggestedLevel0Scale:i,requiredNumRootTiles:c,allowedNumRootTiles:h})}return null}const b=Object.freeze(Object.defineProperty({__proto__:null,isInsideExtent:v,tiltToExtentEdge:T,checkIfTileInfoSupportedForViewSR:w},Symbol.toStringTag,{value:"Module"}));export{T as a,w as c,v as i,b as t};
|