@arcgis/core 4.31.0-next.20240921 → 4.31.0-next.20240923
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/1810cb638ca1d52de7b2.js +1 -0
- package/assets/esri/core/workers/chunks/{69f6f35b04c722aba8cf.js → 238897e72fedd6754af7.js} +1 -1
- package/assets/esri/core/workers/chunks/2807eb7bfe4868fe840f.js +1 -0
- package/assets/esri/core/workers/chunks/{6c07116c8f7361780803.js → 2b04d2f8466d16a24a80.js} +1 -1
- package/assets/esri/core/workers/chunks/{83649583139b818d4dfa.js → 356f6cc122287412b888.js} +1 -1
- package/assets/esri/core/workers/chunks/36a1de3752ff13d77b4d.js +1 -0
- package/assets/esri/core/workers/chunks/{bf406a46515d5dfebe06.js → 3d207d1c6effda13b448.js} +1 -1
- package/assets/esri/core/workers/chunks/460ae228640fd5e545ad.js +1 -0
- package/assets/esri/core/workers/chunks/{f14cefc311a21116d21b.js → 4c0d37b799edae391ab2.js} +1 -1
- package/assets/esri/core/workers/chunks/{16eda85f728423c4ed02.js → 4ea08495271f6d291b05.js} +1 -1
- package/assets/esri/core/workers/chunks/{cf147f34032a8d07f322.js → 53becb5fe10f7f38311f.js} +1 -1
- package/assets/esri/core/workers/chunks/{24d45530fe47b3114daf.js → 5652ff08dcc5afd3d739.js} +1 -1
- package/assets/esri/core/workers/chunks/5fe1f8881959df0e61ce.js +1 -0
- package/assets/esri/core/workers/chunks/62f4eda8a9f4de481dcb.js +1 -0
- package/assets/esri/core/workers/chunks/{3fa3e1e6595668ca0e18.js → 686613864dd54d1cae3c.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d0d36230a5b8309c9e4.js → 75bf6dff29056a5a1242.js} +1 -1
- package/assets/esri/core/workers/chunks/{a7bd5bb21a7f3030ee13.js → 783d66397f16899dd0e9.js} +1 -1
- package/assets/esri/core/workers/chunks/7bc57e2a3836ddc8f121.js +1 -0
- package/assets/esri/core/workers/chunks/{2658205b1ab2502c0bc7.js → 856c82a20027435fd306.js} +1 -1
- package/assets/esri/core/workers/chunks/{99944b05d3142903511c.js → 93fb720bbfb3628f9c71.js} +1 -1
- package/assets/esri/core/workers/chunks/{14f77efbfba0ca9efb6c.js → 9dce33a9bcfb852a74d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{de7e197223471c7b66a7.js → afb35deb035c9c9225c9.js} +1 -1
- package/assets/esri/core/workers/chunks/{5f9beed2a9599b9ce649.js → bc37c0dc14ea54f1b9e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{35f92652df2561845d47.js → c9aa8df2f62e6d40b771.js} +1 -1
- package/assets/esri/core/workers/chunks/d8435cc010bd2260feec.js +1 -0
- package/assets/esri/core/workers/chunks/e5a8ab8d02a616469f1d.js +1 -0
- package/assets/esri/core/workers/chunks/f1446e56c35e59b904e1.js +1 -0
- package/assets/esri/core/workers/chunks/{6508ff21b0a5725629eb.js → fa3f9691a9bd1bbb25d3.js} +1 -1
- package/assets/esri/core/workers/chunks/{008f290833724454160d.js → fab59ee41f96b2378768.js} +1 -1
- package/assets/esri/core/workers/chunks/{67ea066a903f5ad31155.js → fe709db8238127f91e59.js} +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/core/utils.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/updateElevationUtils.js +1 -1
- package/layers/orientedImagery/transformations/utils.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/interactive/sketch/constraintUtils.js +1 -1
- package/views/interactive/sketch/constraints.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/0eb789af3c26fecdf3be.js +0 -1
- package/assets/esri/core/workers/chunks/41a3c7d286a050002d20.js +0 -1
- package/assets/esri/core/workers/chunks/59e4731d246203e94a96.js +0 -1
- package/assets/esri/core/workers/chunks/69c09478c899cd5e5013.js +0 -1
- package/assets/esri/core/workers/chunks/7088f771163fda53d196.js +0 -1
- package/assets/esri/core/workers/chunks/79ed119c70ce6ea02f71.js +0 -1
- package/assets/esri/core/workers/chunks/b5c02dbf540ededb863c.js +0 -1
- package/assets/esri/core/workers/chunks/eeacd5fa9fb9b1dee5f7.js +0 -1
- package/assets/esri/core/workers/chunks/f7c96d34c70ed36da7c2.js +0 -1
- package/assets/esri/core/workers/chunks/f9e90a2fda559ca68848.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as r}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{z as a,g as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import s from"../../../geometry/Mesh.js";import{projectWithZConversion as c}from"../../../geometry/projection.js";import{earth as f}from"../../../geometry/support/Ellipsoid.js";import{wrap as l}from"../../../geometry/support/lineSegment.js";import m from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as u}from"../../../geometry/support/MeshVertexAttributes.js";import{intersectLineSegmentClamp as p,create as y,fromArray as h}from"../../../geometry/support/plane.js";import{isWebMercator as g}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as x,
|
|
5
|
+
import"../../../geometry.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{create as t}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{zeros as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transpose as r}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{z as a,g as o}from"../../../chunks/vec32.js";import i from"../../../geometry/Circle.js";import s from"../../../geometry/Mesh.js";import{projectWithZConversion as c}from"../../../geometry/projection.js";import{earth as f}from"../../../geometry/support/Ellipsoid.js";import{wrap as l}from"../../../geometry/support/lineSegment.js";import m from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as u}from"../../../geometry/support/MeshVertexAttributes.js";import{intersectLineSegmentClamp as p,create as y,fromArray as h}from"../../../geometry/support/plane.js";import{isWebMercator as g}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as x,createRotationMatrixFromHPR as M,transformMat3 as w,scaleAndAddWithFactor as d,scaleWithFactor as R,computeHFOVAndVFOV as j,projectiveTransform as P}from"../transformations/utils.js";import v from"../../../geometry/Polygon.js";import A from"../../../geometry/SpatialReference.js";import b from"../../../geometry/Multipoint.js";const D=Math.PI/180;function z(e){return e.isSpherical?F(e):H(e)}function H(e){const{horizontalFieldOfView:t,verticalFieldOfView:n,geometry:r,cameraHeading:a}=e,o=x(r.y,r.spatialReference);let i=e.cameraPitch,s=e.cameraRoll,c=150;t>150&&(i=90,s=0,c=5);const f=Math.ceil(t/c),l=I(f,a,t);let m=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*D);e.cameraPitch+n/2>=90&&(m=(e.farDistance||20)*o);const u=new v({spatialReference:r?.spatialReference});u.imageID=e.objectId;let p=null;for(const y of l)p=S(y,i,s,e,r,m,o,n,t,f,u);return p.imageID=e.objectId,{polygon:u,frustum:p}}function I(e,t,n){const r=[];if(e%2==0)for(let a=0;a<e/2;a++)r.push(t-n/e*(a+.5),t+n/e*(a+.5));else{r.push(t);for(let a=1;a<e/2;a++)r.push(t-n/e*a,t+n/e*a)}return r.sort(),r}function S(e,i,s,c,f,l,m,u,p,y,h){const g=r(t(),M([e,i,s??0])),x=O(c,g),j=w([0,0,-1],g),{x:P,y:v}=f,A=d([P,v,c.cameraHeight],j,l,m),b=2*Math.tan(u*D/2)*l,z=2*Math.tan(p/y*D/2)*l,H=w([0,1,0],g),I=w([1,0,0],g),S=R(H,b/2,m),F=R(I,z/2,m),U=a(n(),S,F),q=o(n(),S,F),C=V([o(n(),A,U),o(n(),A,q),a(n(),A,U),a(n(),A,q)],c.cameraHeight,f,m);return C.push(C[0]),h.addRing(C),x}function V(e,t,n,r){return e.map((e=>C(e,t,n,r)))}function F(e){const{geometry:t,farDistance:n,objectId:r,nearDistance:a,cameraHeight:o}=e,c=x(t.y,t.spatialReference),f=new i({center:t.clone(),radius:n*c});if(f.imageID=r,a){const e=new i({center:t.clone(),radius:a*c});f.addRing(e.rings[0])}const l=t.clone();l.z=o-n*c;const m=s.createSphere(l,{size:2*n*c});return m.imageID=r,{polygon:f,frustum:m}}function U(e,t){return e.contains(t)}function q(e,t){return Math.sign(e)!==Math.sign(t)}function O(e,t,r){const{cameraHeight:i,cameraPitch:c,farDistance:f,geometry:l,horizontalFieldOfView:m,nearDistance:p,verticalFieldOfView:y}=e,h=E(l),g=p<0?0:p*h;let x=i*h/Math.cos(c*D),M=!0;c+y/2>=90&&(x=(f??20)*h,M=!1);const j=2*Math.tan(y*D/2)*g,P=2*Math.tan(m*D/2)*g,v=2*Math.tan(y*D/2)*x,A=2*Math.tan(m*D/2)*x;let b,z;z=[0,0,-1],z=w(z,t),b=d([l.x,l.y,i],z,x,h),M&&(b[2]=0);const H=d([l.x,l.y,i],z,g,h);let I=[0,1,0];I=w(I,t);let S=[1,0,0];S=w(S,t);let V=[],F=[];g?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(o(n(),H,a(n(),R(I,j/2,h),R(S,P/2,h)))),V=V.concat(o(n(),H,o(n(),R(I,j/2,h),R(S,P/2,h)))),V=V.concat(a(n(),H,a(n(),R(I,j/2,h),R(S,P/2,h)))),V=V.concat(a(n(),H,o(n(),R(I,j/2,h),R(S,P/2,h))))):(V=[l.x,l.y,i],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(o(n(),b,a(n(),R(I,v/2,h),R(S,A/2,h)))),V=V.concat(o(n(),b,o(n(),R(I,v/2,h),R(S,A/2,h)))),V=V.concat(a(n(),b,a(n(),R(I,v/2,h),R(S,A/2,h)))),V=V.concat(a(n(),b,o(n(),R(I,v/2,h),R(S,A/2,h))));const U=new u({position:Float64Array.from(V)});return new s({vertexAttributes:U,components:F,spatialReference:l.spatialReference})}function C(e,t,r,o){{const i=Math.sqrt((e[2]-t)**2+(Math.sqrt((e[0]-r.x)**2+(e[1]-r.y)**2)/o)**2)*o,s=R(a(n(),[e[0],e[1],e[2]],[r.x,r.y,t]),1/i,1/o),c=t/(t-e[2]),f={x:(1-c)*r.x+c*e[0],y:(1-c)*r.y+c*e[1],z:(1-c)*t+c*e[2]},l=Math.sqrt((f.z-t)**2+(Math.sqrt((f.x-r.x)**2+(f.y-r.y)**2)/o)**2)*o,m=R(a(n(),[f.x,f.y,f.z],[r.x,r.y,t]),1/l,1/o);return q(s[0],m[0])&&q(s[1],m[1])&&q(s[2],m[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function k(e){const{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:s}=e,c=E(e.geometry),f=new v({spatialReference:t}),l=Math.abs(1.44*i*c);let m=Math.abs(1.44*s*c);(o<20||null==a)&&(m=l);const u=[];return u[0]={x:n+l*Math.sin((a-45)*D),y:r+l*Math.cos((a-45)*D)},u[1]={x:n+l*Math.sin((a+45)*D),y:r+l*Math.cos((a+45)*D)},u[2]={x:n+m*Math.sin((a+135)*D),y:r+m*Math.cos((a+135)*D)},u[3]={x:n+m*Math.sin((a+225)*D),y:r+m*Math.cos((a+225)*D)},f.addRing([[u[0].x,u[0].y,0],[u[1].x,u[1].y,0],[u[2].x,u[2].y,0],[u[3].x,u[3].y,0],[u[0].x,u[0].y,0]]),f}function E(e){return e&&g(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/f.radius))):1}function L(e,t){const r=1+t/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:n}=e,a=new i({radius:t*r,center:n});return e.rings.length>1&&a.addRing(e.rings[1]),a}if("esri.geometry.Polygon"===e.declaredClass){const t=new v({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let t=0;t<e.rings[0].length;t++){const s=Math.sqrt((o.x-e.rings[0][t][0])**2+(o.y-e.rings[0][t][1])**2),c=R(a(n(),[e.rings[0][t][0],e.rings[0][t][1],0],[o.x,o.y,0]),1/s,1),f=d([o.x,o.y,0],c,s*r,1);i.push({x:f[0],y:f[1]})}t.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return t}return e}async function W(e,t,n){const{cameraHeight:r,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:s,imageHeight:c,imageWidth:f,inSRS:l,outSRS:m,verticalFieldOfView:u,cameraRoll:p,imageRotation:y,options:h}=n,g=new A(l),x=new A(m),M=j(s,u,p??0),w=i.length>15;return o+M.vfov/2>=90?await N(i,e,f,c,g,x,w,y,h):await B(i,e,t,a,r,w,g,x,h)}async function B(e,t,n,r,a,o,i,c,f){const l=G(e,t,n,r,a);if(!l)return;const{farPlane:m,nearPlane:p}=l,y=await Q([...p?.vertexPositions??e.slice(0,3),...m.vertexPositions],i,c,f);return new s({vertexAttributes:new u({position:y}),components:Z(Y(o)),spatialReference:c})}function G(e,t,n,r,a){const o=X(e),i=X(e,"near");if(!o)return;const{coefficients:s}=o,c=t.length;for(let f=0;f<c;f++){const e=T([n[f][0],n[f][1]],s),t=n[f];t[2]=(t[2]>=0?e:t[2])??0;const c=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??a)];K(r,c,f,i),J(r,c,f,o,n,e)}return{farPlane:o,nearPlane:i}}function J(e,t,r,a,o,i){const{coefficients:s,vertexPositions:c}=a;if(null!=i&&i>=0)c.splice(3*r,3,...o[r]);else{const a=n();p(s,l(e,t),a)&&c.splice(3*r,3,...a)}}function K(e,t,r,a){if(!a)return;const o=n();p(a.coefficients,l(e,t),o)&&a.vertexPositions.splice(3*r,3,...o)}async function N(e,t,n,r,a,o,i,c=0,f){const l=Math.cos((c??0)*D),m=Math.sin((c??0)*D),p=Math.abs(n*l+r*m),y=Math.abs(n*-m+r*l);let h,g,x=i?new Array:[e[0],e[1],e[2]],M=new Array;const w=t.length;for(let s=0;s<w;s++){const a=[p/2,y/2],o=t[s];g=[(o[0]-a[0])*l-(o[1]-a[1])*m+a[0],(o[0]-a[0])*m+(o[1]-a[1])*l+a[1]],i?(h=P([g[0],g[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[0],e[1],e[2]],[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]]]),x=x.concat(...h),h=P([g[0],g[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[12],e[13],e[14]],[e[15],e[16],e[17]],[e[18],e[19],e[20]],[e[21],e[22],e[23]]]),M=M.concat(...h)):(h=P([g[0],g[1],1],[[0,0,1],[n,0,1],[n,r,1],[0,r,1]],[[e[3],e[4],e[5]],[e[6],e[7],e[8]],[e[9],e[10],e[11]],[e[12],e[13],e[14]]]),x=x.concat(...h))}x=x.concat(M);const d=await Q(x,a,o,f);return new s({vertexAttributes:new u({position:d}),components:Z(Y(i)),spatialReference:o})}async function Q(t,n,r,a){if(n.equals(r))return t;const o=t.reduce(((e,t,n)=>{const r=Math.floor(n/3);return e[r]||(e[r]=new Array),e[r].push(t),e}),new Array),{points:i}=await c(new b(o,n),r,a);return e(a),i.flat()}function T(e,t){if(t)return(-t[3]-t[0]*e[0]-t[1]*e[1])/t[2]}function X(e,t="far"){const n=y();let r;switch(t){case"far":if(r=Array.from(15===e.length?e.slice(3):e.slice(12)),h(n,r,!1))return{coefficients:n,vertexPositions:r};break;case"near":if(r=Array.from(e.slice(0,12)),15===e.length||!h(n,r,!1))return;return{coefficients:n,vertexPositions:r}}}const Y=e=>e?[{faces:new Uint32Array([4,0,3,4,7,3])},{faces:new Uint32Array([5,1,2,5,6,2])},{faces:new Uint32Array([4,0,1,4,5,1])},{faces:new Uint32Array([6,2,3,6,7,3])}]:[{faces:new Uint32Array([0,1,2,0,2,3,0,3,4,0,4,1])}],Z=e=>e.map((e=>new m(e)));export{U as checkIfPolygonContainsSelectedPoint,k as computePolygonForInspection,z as createCoveragePolygon,V as limitZToGround,Q as projectVertices,L as resizePolygon,W as updateFrustum};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{JSONMap as
|
|
5
|
+
import{JSONMap as n}from"../../../core/jsonMap.js";import t from"./CameraOrientationHPR.js";import e from"./CameraOrientationOPK.js";import i from"./CameraOrientationYPR.js";import{ElevationSource as r,isConstantElevation as o,ConstantElevation as s}from"./ElevationSourceDefinitions.js";import{CameraOrientationType as a}from"../enums/CameraOrientationType.js";function l(n,t,e){return t&&(n=`${t}${n}`),e&&(n+=`${e}`),n}function c(n,t,e){let{url:i}=n;return i?(i=l(i,t,e),new r({...n,url:i})):null}function u(n,t,e){return n?o(n)?new s(n):c(n,t,e):n}const f=new n({Minutes:"minutes",Hours:"hours",Days:"days",Weeks:"weeks",Months:"months",Years:"years"}),p=new n({360:"360",Horizontal:"horizontal",Inspection:"inspection",Nadir:"nadir",Oblique:"oblique","":null}),h=new Map;h.set(`${a.OPK}`,{desc:"Using Omega Phi Kappa",constructor:e}),h.set(`${a.HPR}`,{desc:"Using Heading, Pitch and Roll",constructor:t}),h.set(`${a.YPR}`,{desc:"Using Yaw, Pitch and Roll",constructor:i});const m=new Map;function g(n){const[t,e,i,r,o,s,a,l,c,u,f,p,h,m,g,d,y,$,w,D,K,O]=n.slice(1);return{horizontalWKID:t,verticalWKID:e,x:i,y:r,z:o,omega:s,phi:a,kappa:l,...P([c,u,f,p,h,m],[d,y],[$,w,D],[K,O],g)}}m.set(`${a.HPR}`,y),m.set(`${a.YPR}`,$),m.set(`${a.OPK}`,g),m.set(`${a.LTP}`,w);const d=n=>{const t=n.map((n=>parseFloat(n))).filter((n=>!isNaN(n)));if(t.length===n.length)return t};function P(n,t,e,i,r){const o=d(n),s=d(t),a=d(e),l=d(i);return{affineTransformations:6===o?.length?o:void 0,focalLength:6===o?.length?parseFloat(r):void 0,principalOffsetPoint:2!==s?.length?void 0:s,radialDistortionCoefficients:3!==a?.length?void 0:a,tangentialDistortionCoefficients:2!==l?.length?void 0:l}}function y(n){const[t,e,i,r,o,s,a,l,c,u,f,p,h,m,g,d,y,$,w,D,K,O]=n.slice(1);return{horizontalWKID:t,verticalWKID:e,x:i,y:r,z:o,heading:s,pitch:a,roll:l,...P([c,u,f,p,h,m],[d,y],[$,w,D],[K,O],g)}}function $(n){const[t,e,i,r,o,s,a,l,c,u,f,p,h,m,g,d,y,$,w,D,K,O]=n.slice(1);return{horizontalWKID:t,verticalWKID:e,x:i,y:r,z:o,yaw:s,pitch:a,roll:l,...P([c,u,f,p,h,m],[d,y],[$,w,D],[K,O],g)}}function w(n){const[t,e,i,r,o,...s]=n.slice(1),a=m.get(o);if(!a)return null;return{latitude:t,longitude:e,ellipsoidRadius:i,squaredEccentricity:r,properties:a([o,"",...s])}}function D(n){if(!n)return null;const t=`${n}`.split("|");if(0===t.length)return null;const e=h.get(t[0]);if(!e)return null;const i=m.get(t[0]);if(!i)return null;return new(0,e.constructor)(i(t))}function K(n){return Array.isArray(n)&&9===n?.length&&!n.some(isNaN)}export{l as appendPrefixAndSuffix,h as cameraOrientationRegistry,D as createCameraOrientation,u as getEffectiveElevationSource,K as isOrientationAccuracy,p as orientedImageryTypeMap,c as processElevationSource,f as timeIntervalUnitTypeMap,m as transformersRegistry};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{isArrayLike as
|
|
5
|
+
import"../../../geometry.js";import{isArrayLike as e}from"../../../core/arrayUtils.js";import{clone as r,zeros as a}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{z as t}from"../../../chunks/vec32.js";import{fromPoints as i,fromValues as o}from"../../../geometry/support/ray.js";import{l as n,i as s}from"../../../chunks/sphere.js";import{isElevationSource as c}from"../core/ElevationSourceDefinitions.js";import{rectifyMapPoint as f,rectifyMapPointPanoramic as m}from"./rectifyMapPoint.js";import{isElevationSampler as l,scaleWithFactor as p,scaleAndAddWithFactor as y,or as u,computeNewReferenceCoordinates as h,projectiveTransform as g,validatePixelsToTransform as d,validateRotationMatrix as w,getWebMercatorScalingFactor as v,computeFarplaneVertices as x,computeHFOVAndVFOV as j,vecToPoint as A,hasAngles as P,convertPixelToHeadingPitch as R,convertHeadingPitchToSphereVertex as V,reducerFn as F}from"./utils.js";import{worldToImage as M}from"./worldToImage.js";import{defaultImageSphereCenter as T}from"../../../widgets/PanoramicViewer/constants.js";import b from"../../../geometry/Point.js";async function L(e,r,a){const{verticalFieldOfView:t,imageBoundaries:i,scalingFactor:o,farPlaneVertices:n,cameraLocation:s,pixelsToTransform:c,vecToPoint:f}=D(e,r),m=new Array;return await O(c,n,i,f,r,m,s,o,t,a),Array.isArray(e)?m:m[0]}async function O(e,r,a,t,i,o,n,s,m,p){for(const y of e){let e=S(r,a,y,t,i);p&&(c(p)||l(p.elevationSample))&&(e=await f(t(e),{x:y[0],y:y[1]},{...i,...p,farPlaneVertices:r.map(t)})),o.push(t(E(e,n,s,i.averageElevation,i.cameraPitch,m)))}}function E(e,i,o,n,s,c){let f=r(e);const m=Math.sqrt((e[2]-i[2])**2+(Math.sqrt((e[0]-i[0])**2+(e[1]-i[1])**2)/o)**2)*o,l=p(t(a(),e,i),1/m,1/o);if(k(e[2],n,s,c)){const e=Math.abs((i[2]-n)/-l[2])*o;f=y(i,l,e,o)}else f[2]=n;return f}function k(e,r,a,t){return e<r||a+t/2<90}function S(e,r,a,t,i){let o=null;const n=9;let s,c=0,f=e,m=r;for(;c<=n;){const e=z(a,m,f,i);if(s=e.error,o=e.transformedPoint,u(s<=1,c===n))break;f=h(f,s,a,r),m=q(f,t,i),c++}return o}function q(e,r,a){return M(e.map(r),a).map((({x:e,y:r})=>[e,r,1]))}function z(e,r,a,t){const{cameraLocation:i}=t,o=g(e,r,a),{x:n,y:s}=M(new b(o,i.spatialReference),t);return{transformedPoint:o,error:B(e,[n,s,1])}}function B(e,r){return Math.abs(e[0]-r[0])+Math.abs(e[1]-r[1])}function D(r,a){const t=e(r)||"items"in r?r:[r],{cameraLocation:i,rotationMatrix:o}=a;if(d(t,i),w(o),9!==o?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix");const n=v(i.y,i.spatialReference),s=x({...a,scalingFactor:n}),c=M(s.map((e=>new b(e,i.spatialReference))),a),{vfov:f}=j(a.horizontalFieldOfView,a.verticalFieldOfView,a.cameraRoll);return{cameraLocation:i.toArray(),imageBoundaries:c.map((({x:e,y:r})=>[e,r,1])),verticalFieldOfView:f,farPlaneVertices:s,scalingFactor:n,pixelsToTransform:t.map((e=>[e.x,e.y,1])),vecToPoint:A(i.spatialReference)}}async function H(e,r,t){const{averageElevation:f,cameraHeading:p,cameraLocation:y,farDistance:u,imageHeight:h,imageWidth:g,verticalFieldOfView:d}=r,w=v(y.y,y.spatialReference),x=new Array,[j,A,M]=y.toArray(),L=n([j,A,M??0],u/w),O=T.toArray(),k=Array.isArray(e)?e:[e];for(const n of k){let e,v;if(P(n))e=n.heading,v=n.pitch;else{const r=R({x:n.x,y:n.y},g,h);e=r.heading,v=r.pitch}e=(e+p)%360;const T=i([O[0],O[1],O[2]],V(e,v)),k=o([j,A,M??0],T.direction);let S=a();s(L,k,S),t&&(c(t)||l(t.elevationSample))&&v+d/2<90&&(S=await m(new b(S,y.spatialReference),{heading:e,pitch:v},{...r,...t,farPlaneVertices:F(u,u).map((([e,r])=>new b([y.x+e,y.y+r],y.spatialReference)))})),S=E(S,y.toArray(),w,f,v,d),x.push(new b(S,y.spatialReference))}return Array.isArray(e)?x:x[0]}export{L as imageToWorld,H as imageToWorldPanoramic};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{
|
|
5
|
+
import e from"../../../core/Error.js";import t from"../../../core/Logger.js";import{waitTick as r,isAbortError as a}from"../../../core/promiseUtils.js";import{projectWithZConversion as o}from"../../../geometry/projection.js";import{fromExtent as n}from"../../../geometry/support/aaBoundingRect.js";import i from"../../ElevationLayer.js";import s from"../../ImageryLayer.js";import c from"../../ImageryTileLayer.js";import{TileElevationSampler as l}from"../../support/ElevationSampler.js";import{ElevationTile as u}from"../../support/ElevationTile.js";import{ElevationTileData as m}from"../../support/ElevationTileData.js";import p from"../../support/RasterFunction.js";import f from"../../support/TileInfo.js";import{TileKey as w}from"../../support/TileKey.js";import{identify as y}from"../../../rest/imageService.js";import g from"../../../rest/support/ImageIdentifyParameters.js";import{fetchArcGISServiceJSON as d}from"../../../support/requestPresets.js";import{logAndThrow as v}from"../../../widgets/OrientedImageryViewer/utils.js";async function I(t,r,a){if(!r.extent||!r.url)throw v("esri.layer.orientedImagery.transformations",new e("update-elevation:missing-property","both extent and url are required to create a sampler",r));const o=await j(r);if(!o)throw v("esri.layers.orientedImagery.transformations",new e("update-elevation:elevation-source","could not create a sampler using provided elevation source",r));return E(t,o,a)}async function E(e,t,a){await r(a);const o=N(t,a),n=Array.isArray(e)?e:[e];return await Promise.all(n.map(o))}var h;!function(e){e[e.DYNAMIC=0]="DYNAMIC",e[e.ELEVATION=1]="ELEVATION",e[e.IMAGE=2]="IMAGE"}(h||(h={}));const j=async(e,r)=>{let o;const{extent:n,rasterFunction:i,url:s,lod:c}=e;try{o=await R(s)}catch(l){if(a(l))return;t.getLogger("esri.layers.orientedImagery.transformations").error("updateElevationUsingElevationSource",l)}switch(o){case h.DYNAMIC:return await L(s,n,i,r);case h.ELEVATION:return await A(s,n,c,r);default:return}};async function A(e,r,o,n){const s=new i(e);let c;try{const{tileInfo:e}=await s.load(),t=(o&&e.lodAt(Math.min(e.lods.length-1,o))?.resolution)??"finest-contiguous";c=await s.createElevationSampler(r,{...n,demResolution:t})}catch(l){if(a(l))return;t.getLogger(s).error(l)}finally{s.destroy()}return c}async function L(e,t,r,a){const o=r?new p({functionName:r}):void 0,i=new s({url:e,rasterFunction:o,format:"lerc"});await i.load(a);let c,y=512,g=512;const d=t.width/t.height;d>1?(g/=d,c=t.height/g):(y*=d,c=t.width/y);const v=await i.fetchImage(t,y,g,a),I=f.create({scales:[c],size:512,spatialReference:t.spatialReference}),E=new w(null,0,0,0,n(t)),h=new m(v.pixelData.pixelBlock.pixels[0],y,g,0),j=new u(E,h);return new l(j,I,void 0)}async function R(t,a){await r(a);const o=await d(t),{tileInfo:n,cacheType:i}=o;if(!o.hasOwnProperty("bandCount")||!o.hasOwnProperty("pixelSizeX"))throw new e("elevation-source:invalid-service-url",`ElevationSource URL expects an elevation 3D image service but given ${t}`);return n?"LERC"!==n?.format?.toUpperCase()||i&&"elevation"!==i.toLowerCase()?h.IMAGE:h.ELEVATION:h.DYNAMIC}function N(e,t){return async r=>{let a=r.clone();const n=r.spatialReference.equals(e.spatialReference)?a:await o(r,e.spatialReference,t),i=e.queryElevation(n);if(i){a=r.spatialReference.equals(e.spatialReference)?i.clone():await o(i,r.spatialReference,t)}return a.z=a.z??1,a}}async function T(e,t,a){return await r(a),e.map((e=>(e.z=t,e)))}async function M(e,r,o){const{url:n,rasterFunction:i}=r;let s;try{s=await R(n,o)}catch(l){a(l)||t.getLogger("esri.layers.orientedImagery.transformations").error(l)}switch(s){case h.ELEVATION:case h.DYNAMIC:{const t=await y(n,new g({geometry:e,rasterFunction:i?new p({functionName:i}):void 0}));if(t.value?.[0]){const r=e.clone();return r.z=+t.value[0],r}break}case h.IMAGE:{const t=new c(n,o);await t.load();const r=await t.identify(e,o);if(r.value?.[0]){const t=e.clone();return t.z=+r.value[0],t}break}}return e}export{j as getElevationSampler,L as getElevationSamplerFromDynamicImageService,A as getElevationSamplerFromElevationLayer,T as updateUsingConstant,E as updateUsingElevationSampler,I as updateUsingElevationSource,M as updateZfromService,R as validateElevationSourceURL};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{b as t}from"../../../chunks/languageUtils.js";import{deg2rad as a,rad2deg as n}from"../../../core/mathUtils.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import{create as e}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o,fromValues as r}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as c}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as s}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{invertOrIdentity as h,mul as l}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{projectWithZConversion as m}from"../../../geometry/projection.js";import{earth as f}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as u}from"../../../geometry/support/spatialReferenceUtils.js";import{geographicToWebMercator as M}from"../../../geometry/support/webMercatorUtils.js";import{b as p}from"../../../chunks/vec3.js";import g from"../core/cameraOrientationFactory.js";import{isElevationSource as d,isConstantElevation as x,ConstantElevation as y}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as v}from"./updateElevationUtils.js";import{defaultImageSphereSize as b}from"../../../widgets/PanoramicViewer/constants.js";import w from"../../../geometry/Point.js";import O from"../../../geometry/SpatialReference.js";function j(t,a,n){const[i,e,r,c]=a,[s,m,f,u]=n;z(i,e,r,c);const M=z(s,m,f,u),p=H(i,e,r,c),g=H(s,m,f,u),d=h(o(),p),x=l(o(),d,g),[y,v,b,w]=R(t,x);return[y/w,v/w,M?0:b/w]}function z(t,a,n,i){return 0===t[2]&&0===a[2]&&0===n[2]&&0===i[2]&&(t[2]=a[2]=n[2]=i[2]=1,!0)}function P(t){return 0===t?1:t}function R(t,a){const[n,i,e]=t,o=[0,0,0,0];return o[0]=n*a[0]+i*a[1]+e*a[2]+a[3],o[1]=n*a[4]+i*a[5]+e*a[6]+a[7],o[2]=n*a[8]+i*a[9]+e*a[10]+a[11],o[3]=P(n*a[12]+i*a[13]+e*a[14]+a[15]),o}function H(t,a,n,i){const e=V(c([...i,1]),h(new Array(16),r(t[0],a[0],n[0],0,t[1],a[1],n[1],0,t[2],a[2],n[2],0,1,1,1,1))),s=e[0],l=e[1],m=e[2],f=o();return f[0]=s*t[0],f[1]=l*a[0],f[2]=m*n[0],f[3]=0,f[4]=s*t[1],f[5]=l*a[1],f[6]=m*n[1],f[7]=0,f[8]=s*t[2],f[9]=l*a[2],f[10]=m*n[2],f[11]=0,f[12]=s,f[13]=l,f[14]=m,f[15]=1,f}function F(t,a,n,i,e=s()){return e[0]=t[0]+a[0]*n,e[1]=t[1]+a[1]*n,e[2]=t[2]+a[2]*(n/i),e}function E(t,a,n){const i=s();return i[0]=t[0]*a,i[1]=t[1]*a,i[2]=t[2]*(a/n),i}function N(t,a){const[n,i,e]=t,o=s();return o[0]=n*a[0]+i*a[3]+e*a[6],o[1]=n*a[1]+i*a[4]+e*a[7],o[2]=n*a[2]+i*a[5]+e*a[8],o}function V(t,a){const[n,i,e,o]=t,r=new Array(4);return r[0]=n*a[0]+i*a[1]+e*a[2]+o*a[3],r[1]=n*a[4]+i*a[5]+e*a[6]+o*a[7],r[2]=n*a[8]+i*a[9]+e*a[10]+o*a[11],r[3]=n*a[12]+i*a[13]+e*a[14]+o*a[15],r}function S(t,n){const i=e();if("OPK"===t){const t=a(Number(n[0])),e=a(Number(n[1])),o=a(Number(n[2]));i[0]=Math.cos(e)*Math.cos(o),i[1]=-Math.cos(e)*Math.sin(o),i[2]=Math.sin(e),i[3]=Math.cos(t)*Math.sin(o)+Math.sin(t)*Math.sin(e)*Math.cos(o),i[4]=Math.cos(t)*Math.cos(o)-Math.sin(t)*Math.sin(e)*Math.sin(o),i[5]=-Math.sin(t)*Math.cos(e),i[6]=Math.sin(t)*Math.sin(o)-Math.cos(t)*Math.sin(e)*Math.cos(o),i[7]=Math.sin(t)*Math.cos(o)+Math.cos(t)*Math.sin(e)*Math.sin(o),i[8]=Math.cos(t)*Math.cos(e)}else{const t=a(Number(n[0])),e=a(Number(n[1])),o=a(Number(n[2]));i[0]=Math.cos(t)*Math.cos(o)-Math.sin(t)*Math.cos(e)*Math.sin(o),i[1]=Math.cos(t)*Math.sin(o)+Math.sin(t)*Math.cos(e)*Math.cos(o),i[2]=Math.sin(t)*Math.sin(e)*-1,i[3]=Math.sin(t)*Math.cos(o)*-1-Math.cos(t)*Math.cos(e)*Math.sin(o),i[4]=Math.sin(t)*Math.sin(o)*-1+Math.cos(t)*Math.cos(e)*Math.cos(o),i[5]=Math.cos(t)*Math.sin(e)*-1,i[6]=Math.sin(o)*Math.sin(e)*-1,i[7]=Math.cos(o)*Math.sin(e),i[8]=Math.cos(e)}return i}function D(t,n,i){const e=Math.sin(a(i)),o=Math.cos(a(i)),r=[[t,0],[t,n],[0,n]];r.forEach(((t,a)=>{r[a]=[o*t[0]-e*t[1],e*t[0]+o*t[1]]}));const c={xmin:Math.min(0,r[0][0],r[1][0],r[2][0]),xmax:Math.max(0,r[0][0],r[1][0],r[2][0]),ymin:Math.min(0,r[0][1],r[1][1],r[2][1]),ymax:Math.max(0,r[0][1],r[1][1],r[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function L(t,a,n,i,e,o){const r=n*(a.x-t.x)+i*(a.y-t.y)+e*(a.z-t.z);if(0===r)return null;const c=-(n*t.x+i*t.y+e*t.z+o)/r;return{x:t.x+c*(a.x-t.x),y:t.y+c*(a.y-t.y),z:t.z+c*(a.z-t.z)}}function q(t,n){const i=a(t[1]),e=a(t[0]),o=t[2],[r,c,s,h]=n,l=a(r),m=a(c),f=s/Math.sqrt(1-h*Math.sin(l)**2),u=e-m,M=s/Math.sqrt(1-h*Math.sin(l)**2),p=h*(f*Math.sin(l)-M*Math.sin(i));return[(M+o)*Math.cos(i)*Math.sin(u),(M+o)*(Math.sin(i)*Math.cos(l)-Math.sin(l)*Math.cos(l)*Math.cos(u))+p*Math.cos(l),(M+o)*(Math.sin(i)*Math.sin(l)+Math.cos(l)*Math.cos(i)*Math.cos(u))-f+p*Math.sin(l)]}function A(t,i){const e=Number(t[0]),o=Number(t[1]),r=Number(t[2]),[c,s,h,l]=i,m=a(c),f=a(s),u=h/Math.sqrt(1-l*Math.sin(m)**2),M=e/u,p=o/u,g=r/u,d=Math.cos(m)-Math.sin(m)*p+Math.cos(m)*g,x=Math.sin(m)+Math.cos(m)*p+Math.sin(m)*g,y=Math.sqrt(d**2+M**2),v=l*u*Math.sin(m),b=(t,a=5)=>{if(0===a)return t;const n=b(t,a-1);return Math.atan(x/y-(v-l*(h/Math.sqrt(1-l*Math.sin(n)**2))*Math.sin(n))/(u*y))},w=b(m),O=Math.atan(e/(u*d))+f,j=n(w);return[n(O),j,e/(Math.cos(w)*Math.sin(O-f))-h/Math.sqrt(1-l*Math.sin(w)**2)]}function U(t,a,n){const i=360/a,e=180/n;return{heading:(t.x-a/2)*i,pitch:90-(t.y-n/2)*e}}function C(t,a,n,i=b/2){const{heading:e,pitch:o}=K(t,i);return W(e,o,a,n)}function W(t,a,n,i){return{x:n/2+t/(360/n),y:i-a/(180/i),heading:t,pitch:a}}function K(t,a){const i=n(Math.acos(-t.z/a));return{heading:n(Math.atan2(t.x,t.y)),pitch:i}}function T(t,n,i=b/2){return[i*(Math.sin(a(t))*Math.sin(a(n))),i*(Math.cos(a(t))*Math.sin(a(n))),i*Math.cos(a(180-n))]}async function k(t,a,i){const e=await m(a,t.spatialReference,i);let o=n(Math.atan2(e.y-t.y,e.x-t.x));return o=o>=0&&o<=90?90-o:o>90&&o<=180?360-o+90:90+Math.abs(o),o}function I(t,a,n){const i=Math.cos(n),e=Math.sin(n),o=[1,0,0,1,0,0],r=o[0]*i+o[2]*e,c=o[1]*i+o[3]*e,s=-o[0]*e+o[2]*i,h=-o[1]*e+o[3]*i;o[0]=r,o[1]=c,o[2]=s,o[3]=h;return[t*o[0]+a*o[2]+o[4],t*o[1]+a*o[3]+o[5]]}function G(t){return 4===t?.type}function X(t,a){let n=t;if(G(a)){const{latitude:i,longitude:e,ellipsoidRadius:o,squaredEccentricity:r}=a;n=new w(A(t.toArray(),[i,e,o,r]))}return n.spatialReference.isWGS84&&(n=M(n)),n}async function Y(t,a,n){const e=await m(t,O.WGS84,n);return i(n),q(e.toArray(),a)}function Z(t){const{cameraHeading:a,cameraPitch:n,cameraRoll:i}=t,e="string"==typeof t.cameraOrientation?g.getCameraOrientation(t.cameraOrientation):t.cameraOrientation;if("OPK"===(e?.isAdvanced&&2===e.type?"OPK":"HPR")){const{omega:t,phi:a,kappa:n}=e;return S("OPK",[t,a,n])}return S("HPR",[a,n,i])}const $=t=>t.toArray(),B=(...t)=>t.some((t=>t));function J(t,a){if(B(0===t.length,t.some((({x:t,y:a})=>B(null==t,null==a))),!a.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function Q(t,a){if(t.some((t=>null==t.z))||null==a.z)throw new Error("Input points and camera location must have z value")}function _(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function tt(t,a){return u(a)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/f.radius))):1}const at=t=>a=>new w(a,t),nt=t=>null!=t&&"queryExtent"in t;function it(t,a,n,i){return[[-a,-a],[+a,-a],[+a,+a],[-a,+a]].map((([a,e])=>j(p(s(),n,[a,e,0]),i,t)))}function et({a0:t,a1:a,a2:n,b0:i,b1:e,b2:o},[r,c]){const s=[t,a,n,i,e,o].map(ot);return rt(s)?s:[r/2-.5,1,0,c/2-.5,0,-1]}function ot(t,a){if(!t)return null;const n=parseFloat(`${t}`);return isNaN(n)?null:n}function rt(t){if(!Array.isArray(t)||6!==t.length)return!1;for(let a=0;a<6;a++)if("number"!=typeof t[a]||isNaN(t[a]))return!1;return!0}function ct(t,[a,n]){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:h,cameraHeight:l,cameraOrientation:m,cameraPitch:f,cameraRoll:u,elevation:M,farDistance:p,focalLength:g,horizontalFieldOfView:d,location:x,matrix:y,principalX:v,principalY:b,radial:w,tangential:O,verticalFieldOfView:j}=t,z=et({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},[a,n]);return{affineTransformations:m?.affineTransformations??z,averageElevation:M??(x.z??0)-l,cameraLocation:x.clone(),cameraPitch:f,cameraRoll:u??0,farDistance:p,focalLength:m?.focalLength??g,principalOffsetPoint:null!=v&&null!=b?[v,b]:void 0,radialDistortionCoefficients:w,rotationMatrix:y??Z({cameraHeading:h,cameraPitch:f,cameraRoll:u??0,cameraOrientation:m}),tangentialDistortionCoefficients:O,verticalFieldOfView:j,horizontalFieldOfView:d,imageWidth:a,imageHeight:n}}function st(t,a,n){const{location:i,cameraHeading:e,cameraHeight:o,cameraOrientation:r,cameraPitch:c,cameraRoll:s,farDistance:h,horizontalFieldOfView:l,matrix:m,verticalFieldOfView:f,elevation:u}=t;return{averageElevation:u??(i.z??0)-o,cameraLocation:i,cameraHeading:e,farDistance:h,horizontalFieldOfView:l,imageHeight:n,imageWidth:a,rotationMatrix:m??Z({cameraHeading:e,cameraPitch:c,cameraRoll:s??0,cameraOrientation:r}),verticalFieldOfView:f}}function ht(t,[a,n]){const{a0:i,a1:e,a2:o,b0:r,b1:c,b2:s,cameraHeading:h,cameraOrientation:l,cameraPitch:m,cameraRoll:f,focalLength:u,horizontalFieldOfView:M,location:p,matrix:g,principalX:d,principalY:x,radial:y,tangential:v,verticalFieldOfView:b}=t,w=et({a0:i,a1:e,a2:o,b0:r,b1:c,b2:s},[a,n]);return{affineTransformations:l?.affineTransformations??w,cameraLocation:p.clone(),focalLength:l?.focalLength??u,principalOffsetPoint:null!=d&&null!=x?[d,x]:void 0,radialDistortionCoefficients:y,rotationMatrix:g??Z({cameraHeading:h,cameraPitch:m,cameraRoll:f??0,cameraOrientation:l}),tangentialDistortionCoefficients:v,horizontalFieldOfView:M,verticalFieldOfView:b,imageHeight:n,imageWidth:a}}const lt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,mt=t=>d(t?.elevationSource)&&null!=t?.extent,ft=t=>x(t?.elevationSource),ut=async(t,a)=>null!=a&&(lt(a)||ft(a))?a:mt(a)?{elevationSample:await v({...a.elevationSource,extent:a.extent}),elevationSource:new y({constantElevation:t})}:{elevationSource:new y({constantElevation:t})},Mt=a=>t(a?.heading)&&t(a?.pitch),pt=(t,a)=>[[-t,-a],[t,-a],[t,a],[-t,a]];export{S as calculateRotationMatrix,D as computeHFOVAndVFOV,it as computeNewReferenceCoordinates,T as convertHeadingPitchToSphereVertex,W as convertOrientationToPixelLocation,U as convertPixelToHeadingPitch,K as convertSphereVertexToOrientation,C as convertSphereVertexToPixelLocation,Y as convertToLTP,q as geographicToLTP,et as getAffines,X as getCameraLocationWhenCameraOrientation,st as getImageToWorldPanoramicProperties,ct as getImageToWorldProperties,k as getInitialAngle,L as getPlaneLineIntersectionPoint,Z as getRotationMatrix,ut as getUpdateElevationProps,tt as getWebMercatorScalingFactor,ht as getWorldToImageProperties,Mt as hasAngles,G as hasCameraOrientationLTP,nt as isElevationSampler,lt as isUpdateElevationWithElevationSampler,mt as isUpdateElevationWithElevationSource,ft as isUpdateUsingConstantElevation,rt as isValidAffines,H as linearEquationSolve,A as ltpToGeographic,B as or,$ as pointToArray,j as projectiveTransform,pt as reducerFn,I as rotatePixel,F as scaleAndAddWithFactor,E as scaleWithFactor,N as transformMat3,V as transformMat4,J as validatePixelsToTransform,Q as validatePointsToTransform,_ as validateRotationMatrix,at as vecToPoint};
|
|
5
|
+
import"../../../geometry.js";import{b as t}from"../../../chunks/languageUtils.js";import n from"../../../core/Error.js";import{isSerializable as a}from"../../../core/JSONSupport.js";import{deg2rad as i,rad2deg as e}from"../../../core/mathUtils.js";import{throwIfAborted as r}from"../../../core/promiseUtils.js";import{create as o}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as c,fromValues as s}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromArray as l}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{zeros as f}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{multiply as u,transpose as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{invertOrIdentity as h,mul as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{z as M,g}from"../../../chunks/vec32.js";import{projectWithZConversion as v}from"../../../geometry/projection.js";import{earth as x}from"../../../geometry/support/Ellipsoid.js";import{isWebMercator as d}from"../../../geometry/support/spatialReferenceUtils.js";import{geographicToWebMercator as y}from"../../../geometry/support/webMercatorUtils.js";import{b as w}from"../../../chunks/vec3.js";import{isElevationSource as b,isConstantElevation as O,ConstantElevation as j}from"../core/ElevationSourceDefinitions.js";import{getElevationSampler as z}from"./updateElevationUtils.js";import{defaultImageSphereSize as S}from"../../../widgets/PanoramicViewer/constants.js";import E from"../../../geometry/Point.js";import F from"../../../geometry/SpatialReference.js";function R(t,n,a){const[i,e,r,o]=n,[s,l,f,u]=a;P(i,e,r,o);const m=P(s,l,f,u),M=N(i,e,r,o),g=N(s,l,f,u),v=h(c(),M),x=p(c(),v,g),[d,y,w,b]=C(t,x);return[d/b,y/b,m?0:w/b]}function P(t,n,a,i){return 0===t[2]&&0===n[2]&&0===a[2]&&0===i[2]&&(t[2]=n[2]=a[2]=i[2]=1,!0)}function V(t){return 0===t?1:t}function C(t,n){const[a,i,e]=t,r=[0,0,0,0];return r[0]=a*n[0]+i*n[1]+e*n[2]+n[3],r[1]=a*n[4]+i*n[5]+e*n[6]+n[7],r[2]=a*n[8]+i*n[9]+e*n[10]+n[11],r[3]=V(a*n[12]+i*n[13]+e*n[14]+n[15]),r}function N(t,n,a,i){const e=D(l([...i,1]),h(new Array(16),s(t[0],n[0],a[0],0,t[1],n[1],a[1],0,t[2],n[2],a[2],0,1,1,1,1))),r=e[0],o=e[1],f=e[2],u=c();return u[0]=r*t[0],u[1]=o*n[0],u[2]=f*a[0],u[3]=0,u[4]=r*t[1],u[5]=o*n[1],u[6]=f*a[1],u[7]=0,u[8]=r*t[2],u[9]=o*n[2],u[10]=f*a[2],u[11]=0,u[12]=r,u[13]=o,u[14]=f,u[15]=1,u}function A(t,n,a,i,e=f()){return e[0]=t[0]+n[0]*a,e[1]=t[1]+n[1]*a,e[2]=t[2]+n[2]*(a/i),e}function I(t,n,a){const i=f();return i[0]=t[0]*n,i[1]=t[1]*n,i[2]=t[2]*(n/a),i}function L(t,n){const[a,i,e]=t,r=f();return r[0]=a*n[0]+i*n[3]+e*n[6],r[1]=a*n[1]+i*n[4]+e*n[7],r[2]=a*n[2]+i*n[5]+e*n[8],r}function D(t,n){const[a,i,e,r]=t,o=new Array(4);return o[0]=a*n[0]+i*n[1]+e*n[2]+r*n[3],o[1]=a*n[4]+i*n[5]+e*n[6]+r*n[7],o[2]=a*n[8]+i*n[9]+e*n[10]+r*n[11],o[3]=a*n[12]+i*n[13]+e*n[14]+r*n[15],o}function H(t,a,e,r=!0){if(!Number.isFinite(t))throw new n("InvalidRotationAngle","Please specify a valid angle for rotation");const c=e*(r?i(t):t),s=Math.cos(c),l=Math.sin(c),f=o();switch(a){case 0:f[4]=s,f[5]=-l,f[7]=l,f[8]=s;break;case 1:f[0]=s,f[2]=l,f[6]=-l,f[8]=s;break;case 2:f[0]=s,f[1]=-l,f[3]=l,f[4]=s;break;default:throw new n("InvalidRotationAxis","Please specify either 0, 1 or 2 for X, Y or Z axis respectively")}return f}const q={HPR:[[2,-1],[0,1],[2,-1]],OPK:[[0,1],[1,1],[2,1]]};function U(t,a,i=!0){if(3!==t?.length||3!==a?.length)throw new n("InvalidRotationAngles","Please specify three angles with config for rotation");const e=o();for(let n=0;n<3;n++){const[r,o]=a[n],c=H(t[n],r,o,i);u(e,c,e)}return e}function W(t,n=!0){return U(t,q.OPK,n)}function k(t,n=!0){return U(t,q.HPR,n)}function K(t,n,a){const e=Math.sin(i(a)),r=Math.cos(i(a)),o=[[t,0],[t,n],[0,n]];o.forEach(((t,n)=>{o[n]=[r*t[0]-e*t[1],e*t[0]+r*t[1]]}));const c={xmin:Math.min(0,o[0][0],o[1][0],o[2][0]),xmax:Math.max(0,o[0][0],o[1][0],o[2][0]),ymin:Math.min(0,o[0][1],o[1][1],o[2][1]),ymax:Math.max(0,o[0][1],o[1][1],o[2][1])};return{hfov:Math.abs(c.xmax-c.xmin),vfov:Math.abs(c.ymax-c.ymin)}}function T(t,n,a,i,e,r){const o=a*(n.x-t.x)+i*(n.y-t.y)+e*(n.z-t.z);if(0===o)return null;const c=-(a*t.x+i*t.y+e*t.z+r)/o;return{x:t.x+c*(n.x-t.x),y:t.y+c*(n.y-t.y),z:t.z+c*(n.z-t.z)}}function G(t,n){const a=i(t[1]),e=i(t[0]),r=t[2],[o,c,s,l]=n,f=i(o),u=i(c),m=s/Math.sqrt(1-l*Math.sin(f)**2),h=e-u,p=s/Math.sqrt(1-l*Math.sin(f)**2),M=l*(m*Math.sin(f)-p*Math.sin(a));return[(p+r)*Math.cos(a)*Math.sin(h),(p+r)*(Math.sin(a)*Math.cos(f)-Math.sin(f)*Math.cos(f)*Math.cos(h))+M*Math.cos(f),(p+r)*(Math.sin(a)*Math.sin(f)+Math.cos(f)*Math.cos(a)*Math.cos(h))-m+M*Math.sin(f)]}function J(t,n){const a=Number(t[0]),r=Number(t[1]),o=Number(t[2]),[c,s,l,f]=n,u=i(c),m=i(s),h=l/Math.sqrt(1-f*Math.sin(u)**2),p=a/h,M=r/h,g=o/h,v=Math.cos(u)-Math.sin(u)*M+Math.cos(u)*g,x=Math.sin(u)+Math.cos(u)*M+Math.sin(u)*g,d=Math.sqrt(v**2+p**2),y=f*h*Math.sin(u),w=(t,n=5)=>{if(0===n)return t;const a=w(t,n-1);return Math.atan(x/d-(y-f*(l/Math.sqrt(1-f*Math.sin(a)**2))*Math.sin(a))/(h*d))},b=w(u),O=Math.atan(a/(h*v))+m,j=e(b);return[e(O),j,a/(Math.cos(b)*Math.sin(O-m))-l/Math.sqrt(1-f*Math.sin(b)**2)]}function X(t,n,a){const i=360/n,e=180/a;return{heading:(t.x-n/2)*i,pitch:90-(t.y-a/2)*e}}function Y(t,n,a,i=S/2){const{heading:e,pitch:r}=$(t,i);return Z(e,r,n,a)}function Z(t,n,a,i){return{x:a/2+t/(360/a),y:i-n/(180/i),heading:t,pitch:n}}function $(t,n){const a=e(Math.acos(-t.z/n));return{heading:e(Math.atan2(t.x,t.y)),pitch:a}}function B(t,n,a=S/2){return[a*(Math.sin(i(t))*Math.sin(i(n))),a*(Math.cos(i(t))*Math.sin(i(n))),a*Math.cos(i(180-n))]}async function Q(t,n,a){const i=await v(n,t.spatialReference,a);let r=e(Math.atan2(i.y-t.y,i.x-t.x));return r=r>=0&&r<=90?90-r:r>90&&r<=180?360-r+90:90+Math.abs(r),r}function _(t,n,a){const i=Math.cos(a),e=Math.sin(a),r=[1,0,0,1,0,0],o=r[0]*i+r[2]*e,c=r[1]*i+r[3]*e,s=-r[0]*e+r[2]*i,l=-r[1]*e+r[3]*i;r[0]=o,r[1]=c,r[2]=s,r[3]=l;return[t*r[0]+n*r[2]+r[4],t*r[1]+n*r[3]+r[5]]}function tt(t){return 4===t?.type}function nt(t,n){let a=t;if(tt(n)){const{latitude:i,longitude:e,ellipsoidRadius:r,squaredEccentricity:o}=n;a=new E(J(t.toArray(),[i,e,r,o]))}return a.spatialReference.isWGS84&&(a=y(a)),a}async function at(t,n,a){const i=await v(t,F.WGS84,a);return r(a),G(i.toArray(),n)}const it=t=>t.toArray(),et=(...t)=>t.some((t=>t));function rt(t,n){if(et(0===t.length,t.some((({x:t,y:n})=>et(null==t,null==n))),!n.hasZ))throw new Error("Input pixels must have x, y and camera location must have z value")}function ot(t,n){if(t.some((t=>null==t.z))||null==n.z)throw new Error("Input points and camera location must have z value")}function ct(t){if(9!==t?.length)throw new Error("Rotation matrix is not provided or is not a valid 3x3 matrix")}function st(t,n){return d(n)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*t/x.radius))):1}const lt=t=>n=>new E(n,t),ft=t=>null!=t&&"queryExtent"in t;function ut(t,n,a,i){return[[-n,-n],[+n,-n],[+n,+n],[-n,+n]].map((([n,e])=>R(w(f(),a,[n,e,0]),i,t)))}function mt({a0:t,a1:n,a2:a,b0:i,b1:e,b2:r},o,c){const s=[t,n,a,i,e,r].map(ht);return pt(s)?s:[o/2-.5,1,0,c/2-.5,0,-1]}function ht(t,n){if(!t)return null;const a=parseFloat(`${t}`);return isNaN(a)?null:a}function pt(t){if(!Array.isArray(t)||6!==t.length)return!1;for(let n=0;n<6;n++)if("number"!=typeof t[n]||isNaN(t[n]))return!1;return!0}function Mt(t,n,a){const{cameraHeight:i,cameraPitch:e,cameraRoll:r,elevation:o,farDistance:c,horizontalFieldOfView:s,location:l,verticalFieldOfView:f}=t,u=o??(l.z??0)-i;return{...xt(t,n,a),averageElevation:u,cameraPitch:e,cameraRoll:r??0,farDistance:c,horizontalFieldOfView:s,verticalFieldOfView:f}}function gt(t,n,a,i){return St(i)?W([i.omega,i.phi,i.kappa]):k([t,n,a??0])}function vt(t,n,a){const{cameraHeading:i,cameraHeight:e,cameraOrientation:r,cameraPitch:o,cameraRoll:c,elevation:s,farDistance:l,horizontalFieldOfView:f,location:u,matrix:m,verticalFieldOfView:h}=t,p=m??gt(i,o,c,r);return{averageElevation:s??(u.z??0)-e,cameraLocation:u,cameraHeading:i,farDistance:l,horizontalFieldOfView:f,imageHeight:a,imageWidth:n,rotationMatrix:p,verticalFieldOfView:h}}function xt(t,n,a){const{a0:i,a1:e,a2:r,b0:o,b1:c,b2:s,cameraHeading:l,cameraOrientation:f,cameraPitch:u,cameraRoll:m,focalLength:h,horizontalFieldOfView:p,location:M,matrix:g,principalX:v,principalY:x,radial:d,tangential:y,verticalFieldOfView:w}=t,b=mt({a0:i,a1:e,a2:r,b0:o,b1:c,b2:s},n,a),O=g??gt(l,u,m,f);return{affineTransformations:f?.affineTransformations??b,cameraLocation:M.clone(),focalLength:f?.focalLength??h,horizontalFieldOfView:p,imageHeight:a,imageWidth:n,principalOffsetPoint:null!=v&&null!=x?[v,x]:void 0,radialDistortionCoefficients:d,rotationMatrix:O,tangentialDistortionCoefficients:y,verticalFieldOfView:w}}const dt=t=>null!=t&&"elevationSample"in t&&null!=t.elevationSample,yt=t=>b(t?.elevationSource)&&null!=t?.extent,wt=t=>O(t?.elevationSource),bt=async(t,n)=>null!=n&&(dt(n)||wt(n))?n:yt(n)?{elevationSample:await z({...a(n.elevationSource)?n.elevationSource.toJSON():n.elevationSource,extent:n.extent}),elevationSource:new j({constantElevation:t})}:{elevationSource:new j({constantElevation:t})},Ot=n=>t(n?.heading)&&t(n?.pitch),jt=(t,n)=>[[-t,-n],[t,-n],[t,n],[-t,n]];function zt(t){const{cameraLocation:n,farDistance:a,horizontalFieldOfView:e,rotationMatrix:r,scalingFactor:c,verticalFieldOfView:s}=t,l=o();m(l,r);const u=2*Math.tan(i(s)/2)*a*c,h=2*Math.tan(i(e)/2)*a*c,p=L([0,0,-1],l),v=A([n.x,n.y,n.z],p,t.farDistance*c,c),x=L([0,1,0],l),d=L([1,0,0],l),y=I(x,u/2,c),w=I(d,h/2,c),b=M(f(),y,w),O=g(f(),y,w);return[g(f(),v,b),g(f(),v,O),M(f(),v,b),M(f(),v,O)]}const St=t=>2===t?.type;var Et;!function(t){t[t.CLOCKWISE=-1]="CLOCKWISE",t[t.COUNTERCLOCKWISE=1]="COUNTERCLOCKWISE"}(Et||(Et={}));export{zt as computeFarplaneVertices,K as computeHFOVAndVFOV,ut as computeNewReferenceCoordinates,B as convertHeadingPitchToSphereVertex,Z as convertOrientationToPixelLocation,X as convertPixelToHeadingPitch,$ as convertSphereVertexToOrientation,Y as convertSphereVertexToPixelLocation,at as convertToLTP,U as createRotationMatrix,k as createRotationMatrixFromHPR,W as createRotationMatrixFromOPK,G as geographicToLTP,mt as getAffines,nt as getCameraLocationWhenCameraOrientation,vt as getImageToWorldPanoramicProperties,Mt as getImageToWorldProperties,Q as getInitialAngle,T as getPlaneLineIntersectionPoint,bt as getUpdateElevationProps,st as getWebMercatorScalingFactor,xt as getWorldToImageProperties,Ot as hasAngles,tt as hasCameraOrientationLTP,St as hasOmegaPhiKappa,ft as isElevationSampler,dt as isUpdateElevationWithElevationSampler,yt as isUpdateElevationWithElevationSource,wt as isUpdateUsingConstantElevation,pt as isValidAffines,N as linearEquationSolve,J as ltpToGeographic,et as or,it as pointToArray,R as projectiveTransform,jt as reducerFn,_ as rotatePixel,A as scaleAndAddWithFactor,I as scaleWithFactor,L as transformMat3,D as transformMat4,rt as validatePixelsToTransform,ot as validatePointsToTransform,ct as validateRotationMatrix,lt as vecToPoint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import o from"../../renderers/SimpleRenderer.js";import n from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import s from"../../core/Logger.js";import{ClonableMixin as a}from"../../core/Clonable.js";import"../../core/has.js";import l from"../../core/Error.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as d}from"../../core/lang.js";import u from"../../core/Loadable.js";import{MultiOriginJSONMixin as y}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../../core/object.js";import{sqlAnd as m}from"../../core/sql.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{reader as h}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{createTypeReader as j}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import v from"../../form/FormTemplate.js";import w from"../../geometry/SpatialReference.js";import{labelsVisible as F,legendEnabled as O,minScale as I,maxScale as S,popupEnabled as T}from"./commonProperties.js";import{createQuery as C}from"./featureLayerUtils.js";import R from"./FeatureTemplate.js";import{defineFieldProperties as q}from"./fieldProperties.js";import{fixRendererFields as E}from"./fieldUtils.js";import A from"./LabelClass.js";import{reader as x}from"./labelingInfo.js";import P from"../../rest/support/Query.js";import{createPopupTemplate as D}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as L,defaultPolylineSymbol2D as G,defaultPointSymbol2D as V}from"../../symbols/support/defaults.js";const N={key:"type",base:i,errorContext:"renderer",typeMap:{simple:o,"unique-value":n,"class-breaks":r}},U=q(),$=j({types:N});let k=0;function M(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function _(e){return new o({symbol:B(e)})}function B(e){switch(e){case"point":case"multipoint":return V.clone();case"polyline":return G.clone();case"polygon":case"multipatch":return L.clone();default:return null}}function H(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function Q(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function z(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},o=Q(e,t);if(null!=o){const{defaultValues:e}=o;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new R({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let J=class extends(y(a(p(u)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${k++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return E(this.renderer,this.fieldsIndex),Promise.resolve(this)}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:o}=this;let n;if(i){n=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const a=o?.fields?.find((e=>e.name===t));if(!a)return;const l={name:t};let p=!1;r!==a.alias&&(l.alias=r,p=!0),i!==a.editable&&(l.editable=i,p=!0),n.push(l),p&&e++})),0===e&&n.length===i.length&&(n=null)}else n=d(e);n?.length&&c(r,n,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:o,subtypeField:n}=e,s=o?.find((e=>e.code===r)),a=s?.defaultValues,l=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,o=t?.find((e=>e.name===i));if(e.visible=!t||!!o,o){const{alias:t,editable:r}=o;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=a?.[i]??null;e.defaultValue=i===n?r:s;const u=l?.[i]??null;e.domain=i===n?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(X("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){E(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?_(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,n=$(i,t,r);let s;const{subtypeCode:a}=this;if(null!=a&&H(n,t.subtypeField)){const e=n.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(a)));e&&(s=new o({symbol:e.symbol}))}else"simple"!==n?.type||n.visualVariables?.length||(s=n);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const o=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return o?void 0:$(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??w.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[z(this.subtypeCode,t)]}readTitleFromService(e,t){const r=Q(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw X("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw X("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw X("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw X("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:o}=this;if(r){const{displayField:e,editFieldsInfo:n,objectIdField:s}=r;t={displayField:e,editFieldsInfo:n,fields:i,objectIdField:s,title:o}}return D(t,e)}createQuery(){if(!this.parent)throw X("createQuery");const e=C(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=m(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw X("queryAttachments");const i=e.clone();return i.where=K(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatureCount");return r.parent.queryFeatureCount(W(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryFeatures");return r.parent.queryFeatures(W(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw X("queryObjectIds");return r.parent.queryObjectIds(W(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw X("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw X("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([f({readOnly:!0,json:{read:!1}})],J.prototype,"capabilities",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"effectiveCapabilities",null),e([f({json:{write:{ignoreOrigin:!0}}})],J.prototype,"charts",void 0),e([f({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],J.prototype,"editingEnabled",void 0),e([f({type:Boolean,readOnly:!0})],J.prototype,"effectiveEditingEnabled",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"elevationInfo",null),e([f({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],J.prototype,"fieldOverrides",void 0),e([g("fieldOverrides")],J.prototype,"writeFieldOverrides",null),e([f({...U.fields,readOnly:!0,json:{read:!1}})],J.prototype,"fields",null),e([f(U.fieldsIndex)],J.prototype,"fieldsIndex",void 0),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"floorInfo",null),e([f({type:v,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],J.prototype,"formTemplate",void 0),e([f({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],J.prototype,"id",void 0),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"geometryType",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"type",void 0),e([f(M(d(F)))],J.prototype,"labelsVisible",void 0),e([f({type:[A],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:x},write:{ignoreOrigin:!0}}})],J.prototype,"labelingInfo",void 0),e([f({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],J.prototype,"layerType",void 0),e([f(M(d(O)))],J.prototype,"legendEnabled",void 0),e([f({type:["show","hide"]})],J.prototype,"listMode",void 0),e([f((()=>{const e=d(I);return e.json.origins.service.read=!1,M(e)})())],J.prototype,"minScale",void 0),e([f((()=>{const e=d(S);return e.json.origins.service.read=!1,M(e)})())],J.prototype,"maxScale",void 0),e([f({readOnly:!0})],J.prototype,"effectiveScaleRange",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"objectIdField",null),e([f({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],J.prototype,"opacity",void 0),e([f({clonable:!1})],J.prototype,"parent",void 0),e([f(M(d(T)))],J.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],J.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],J.prototype,"defaultPopupTemplate",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"relationships",null),e([f({types:N,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],J.prototype,"renderer",null),e([h("service","renderer",["drawingInfo.renderer","subtypeField","type"])],J.prototype,"readRendererFromService",null),e([h("renderer",["layerDefinition.drawingInfo.renderer"])],J.prototype,"readRenderer",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"spatialReference",null),e([f({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],J.prototype,"subtypeCode",void 0),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"subtypeField",null),e([f({type:[R],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],J.prototype,"templates",void 0),e([h("service","templates",["geometryType","subtypeField","subtypes","type"])],J.prototype,"readTemplatesFromService",null),e([f({type:String,json:{write:{ignoreOrigin:!0}}})],J.prototype,"title",void 0),e([h("service","title",["subtypes"])],J.prototype,"readTitleFromService",null),e([f({readOnly:!0,json:{read:!1}})],J.prototype,"url",null),e([f({readOnly:!0})],J.prototype,"userHasUpdateItemPrivileges",null),e([f({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],J.prototype,"visible",void 0),J=e([b("esri.layers.support.SubtypeSublayer")],J);const W=(e,t,r)=>{if(!r)return t.createQuery();const i=P.from(r);return i.where=K(i.where,e.subtypeField,t.subtypeCode),i},K=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),o=`${t}=${r}`,n=e??"";return i.test(n)?n.replace(i,o):m(o,n)},X=e=>new l(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Y=J;export{Y as default};
|
|
5
|
+
import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../PopupTemplate.js";import r from"../../renderers/ClassBreaksRenderer.js";import"../../renderers/DictionaryRenderer.js";import"../../renderers/DotDensityRenderer.js";import"../../renderers/HeatmapRenderer.js";import"../../renderers/PieChartRenderer.js";import i from"../../renderers/Renderer.js";import n from"../../renderers/SimpleRenderer.js";import o from"../../renderers/UniqueValueRenderer.js";import"../../renderers/support/jsonUtils.js";import s from"../../core/Logger.js";import{ClonableMixin as a}from"../../core/Clonable.js";import"../../core/has.js";import l from"../../core/Error.js";import{IdentifiableMixin as p}from"../../core/Identifiable.js";import{clone as d}from"../../core/lang.js";import u from"../../core/Loadable.js";import{MultiOriginJSONMixin as y}from"../../core/MultiOriginJSONSupport.js";import{setDeepValue as c}from"../../core/object.js";import{sqlAnd as m}from"../../core/sql.js";import{property as f}from"../../core/accessorSupport/decorators/property.js";import{reader as h}from"../../core/accessorSupport/decorators/reader.js";import{subclass as b}from"../../core/accessorSupport/decorators/subclass.js";import{writer as g}from"../../core/accessorSupport/decorators/writer.js";import{createTypeReader as j}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import v from"../../form/FormTemplate.js";import w from"../../geometry/SpatialReference.js";import{labelsVisible as F,legendEnabled as O,minScale as I,maxScale as S,popupEnabled as T}from"./commonProperties.js";import{createQuery as C,getImpliedDomainForTypeOrSubtypeField as R}from"./featureLayerUtils.js";import q from"./FeatureTemplate.js";import{defineFieldProperties as E}from"./fieldProperties.js";import{fixRendererFields as A}from"./fieldUtils.js";import x from"./LabelClass.js";import{reader as P}from"./labelingInfo.js";import D from"../../rest/support/Query.js";import{createPopupTemplate as L}from"../../support/popupUtils.js";import{defaultPolygonSymbol2D as G,defaultPolylineSymbol2D as V,defaultPointSymbol2D as N}from"../../symbols/support/defaults.js";const U={key:"type",base:i,errorContext:"renderer",typeMap:{simple:n,"unique-value":o,"class-breaks":r}},$=E(),k=j({types:U});let M=0;function _(e){const t=e.json.write;return"object"==typeof t?t.ignoreOrigin=!0:e.json.write={ignoreOrigin:!0},e}function B(e){return new n({symbol:H(e)})}function H(e){switch(e){case"point":case"multipoint":return N.clone();case"polyline":return V.clone();case"polygon":case"multipatch":return G.clone();default:return null}}function Q(e,t){return!!t&&("unique-value"===e?.type&&null!=e.field&&e.field.toLowerCase()===t.toLowerCase()&&!e.field2&&!e.field3&&!e.valueExpression)}function z(e,t){return null==e?null:t.subtypes?.find((t=>t.code===e))}function J(e,t){let r=null;switch(t.geometryType){case"esriGeometryPoint":case"esriGeometryMultipoint":r="point";break;case"esriGeometryPolyline":r="line";break;case"esriGeometryPolygon":case"esriGeometryMultiPatch":r="polygon";break;default:t.type,r=null}const i={},n=z(e,t);if(null!=n){const{defaultValues:e}=n;for(const t in e)i[t]=e[t]}return i[t.subtypeField]=e,new q({name:"New Feature",drawingTool:r,prototype:{attributes:i}})}let W=class extends(y(a(p(u)))){constructor(e){super(e),this.charts=null,this.editingEnabled=!0,this.fieldOverrides=null,this.fieldsIndex=null,this.formTemplate=null,this.id=`${Date.now().toString(16)}-subtype-sublayer-${M++}`,this.type="subtype-sublayer",this.labelsVisible=!0,this.labelingInfo=null,this.layerType="ArcGISFeatureLayer",this.legendEnabled=!0,this.listMode="show",this.minScale=0,this.maxScale=0,this.opacity=1,this.parent=null,this.popupEnabled=!0,this.popupTemplate=null,this.subtypeCode=null,this.templates=null,this.title=null,this.visible=!0}load(e){return A(this.renderer,this.fieldsIndex),Promise.resolve(this)}get capabilities(){return this.parent?.capabilities}get effectiveCapabilities(){return this.parent?.effectiveCapabilities}get effectiveEditingEnabled(){const{parent:e}=this;return e?e.effectiveEditingEnabled&&this.editingEnabled:this.editingEnabled}get elevationInfo(){return this.parent?.elevationInfo}writeFieldOverrides(e,t,r){const{fields:i,parent:n}=this;let o;if(i){o=[];let e=0;i.forEach((({name:t,alias:r,editable:i,visible:s})=>{if(!s)return;const a=n?.fields?.find((e=>e.name===t));if(!a)return;const l={name:t};let p=!1;r!==a.alias&&(l.alias=r,p=!0),i!==a.editable&&(l.editable=i,p=!0),o.push(l),p&&e++})),0===e&&o.length===i.length&&(o=null)}else o=d(e);o?.length&&c(r,o,t)}get fields(){const{parent:e,fieldOverrides:t,subtypeCode:r}=this,i=e?.fields;if(!e||!i?.length)return null;const{subtypes:n,subtypeField:o}=e,s=n?.find((e=>e.code===r)),a=s?.defaultValues,l=s?.domains,p=[];for(const d of i){const e=d.clone(),{name:i}=e,n=t?.find((e=>e.name===i));if(e.visible=!t||!!n,n){const{alias:t,editable:r}=n;t&&(e.alias=t),!1===r&&(e.editable=!1)}const s=a?.[i]??null;e.defaultValue=i===o?r:s;const u=l?.[i]??null;e.domain=i===o?null:u?"inherited"===u.type?e.domain:u.clone():null,p.push(e)}return p}get floorInfo(){return this.parent?.floorInfo}get geometryType(){return this.parent?.geometryType}get effectiveScaleRange(){const{minScale:e,maxScale:t}=this;return{minScale:e,maxScale:t}}get objectIdField(){return this.parent||s.getLogger(this).error(Y("objectIdField")),this.parent?.objectIdField}get defaultPopupTemplate(){return this.createPopupTemplate()}get relationships(){return this.parent?.relationships}set renderer(e){A(e,this.fieldsIndex),this._override("renderer",e)}get renderer(){if(this._isOverridden("renderer"))return this._get("renderer");const{parent:e}=this;return e&&!e.isTable&&"mesh"!==e.geometryType?B(e.geometryType):null}readRendererFromService(e,t,r){if("Table"===t.type)return null;const i=t.drawingInfo?.renderer,o=k(i,t,r);let s;const{subtypeCode:a}=this;if(null!=a&&Q(o,t.subtypeField)){const e=o.uniqueValueInfos?.find((({value:e})=>(e="number"==typeof e?String(e):e)===String(a)));e&&(s=new n({symbol:e.symbol}))}else"simple"!==o?.type||o.visualVariables?.length||(s=o);return s}readRenderer(e,t,r){const i=t?.layerDefinition?.drawingInfo?.renderer;if(!i)return;const n=i.visualVariables?.some((e=>"rotationInfo"!==e.type));return n?void 0:k(i,t,r)||void 0}get spatialReference(){return this.parent?.spatialReference??w.WGS84}get subtypeField(){return this.parent?.subtypeField}readTemplatesFromService(e,t){return[J(this.subtypeCode,t)]}readTitleFromService(e,t){const r=z(this.subtypeCode,t);return null!=r?r.name:null}get url(){return this.parent?.url}get userHasUpdateItemPrivileges(){return!!this.parent?.userHasUpdateItemPrivileges}async addAttachment(e,t){const{parent:r}=this;if(!r)throw Y("addAttachment");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:addAttachment","The feature provided does not belong to this SubtypeSublayer");return r.addAttachment(e,t)}async updateAttachment(e,t,r){const{parent:i}=this;if(!i)throw Y("updateAttachment");if(e.getAttribute(i.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:updateAttachment","The feature provided does not belong to this SubtypeSublayer");return i.updateAttachment(e,t,r)}async deleteAttachments(e,t){const{parent:r}=this;if(!r)throw Y("deleteAttachments");if(e.getAttribute(r.subtypeField)!==this.subtypeCode)throw new l("subtype-sublayer:deleteAttachments","The feature provided does not belong to this SubtypeSublayer");return r.deleteAttachments(e,t)}async applyEdits(e,t){if(!this.parent)throw Y("applyEdits");return this.parent.applyEdits(e,t)}createPopupTemplate(e){let t=this;const{parent:r,fields:i,title:n}=this;if(r){const{displayField:e,editFieldsInfo:o,objectIdField:s}=r;t={displayField:e,editFieldsInfo:o,fields:i,objectIdField:s,title:n}}return L(t,e)}createQuery(){if(!this.parent)throw Y("createQuery");const e=C(this.parent),t=`${this.parent.subtypeField}=${this.subtypeCode}`;return e.where=m(t,this.parent.definitionExpression),e}getField(e){return this.fieldsIndex.get(e)}getFieldDomain(e,t){if(t?.includeImpliedDomains&&this.parent){const t=R(this.parent,e);if(t)return t}return this._getLayerDomain(e)}async queryAttachments(e,t){const r=await this.load();if(!r.parent)throw Y("queryAttachments");const i=e.clone();return i.where=X(i.where,r.parent.subtypeField,r.subtypeCode),r.parent.queryAttachments(e,t)}async queryFeatureCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatureCount");return r.parent.queryFeatureCount(K(r.parent,r,e),t)}async queryFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryFeatures");return r.parent.queryFeatures(K(r.parent,r,e),t)}async queryObjectIds(e,t){const r=await this.load();if(!r.parent)throw Y("queryObjectIds");return r.parent.queryObjectIds(K(r.parent,r,e),t)}async queryRelatedFeatures(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeatures");return r.parent.queryRelatedFeatures(e,t)}async queryRelatedFeaturesCount(e,t){const r=await this.load();if(!r.parent)throw Y("queryRelatedFeaturesCount");return r.parent.queryRelatedFeaturesCount(e,t)}_getLayerDomain(e){const t=this.fieldsIndex.get(e);return t?t.domain:null}};e([f({readOnly:!0,json:{read:!1}})],W.prototype,"capabilities",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"effectiveCapabilities",null),e([f({json:{write:{ignoreOrigin:!0}}})],W.prototype,"charts",void 0),e([f({type:Boolean,nonNullable:!0,json:{name:"enableEditing",write:{ignoreOrigin:!0}}})],W.prototype,"editingEnabled",void 0),e([f({type:Boolean,readOnly:!0})],W.prototype,"effectiveEditingEnabled",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"elevationInfo",null),e([f({json:{name:"layerDefinition.fieldOverrides",origins:{service:{read:!1}},write:{ignoreOrigin:!0,allowNull:!0}}})],W.prototype,"fieldOverrides",void 0),e([g("fieldOverrides")],W.prototype,"writeFieldOverrides",null),e([f({...$.fields,readOnly:!0,json:{read:!1}})],W.prototype,"fields",null),e([f($.fieldsIndex)],W.prototype,"fieldsIndex",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"floorInfo",null),e([f({type:v,json:{name:"formInfo",write:{ignoreOrigin:!0}}})],W.prototype,"formTemplate",void 0),e([f({type:String,clonable:!1,json:{origins:{service:{read:!1},"portal-item":{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"id",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"geometryType",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"type",void 0),e([f(_(d(F)))],W.prototype,"labelsVisible",void 0),e([f({type:[x],json:{name:"layerDefinition.drawingInfo.labelingInfo",origins:{service:{read:!1}},read:{reader:P},write:{ignoreOrigin:!0}}})],W.prototype,"labelingInfo",void 0),e([f({type:["ArcGISFeatureLayer"],readOnly:!0,json:{read:!1,write:{ignoreOrigin:!0}}})],W.prototype,"layerType",void 0),e([f(_(d(O)))],W.prototype,"legendEnabled",void 0),e([f({type:["show","hide"]})],W.prototype,"listMode",void 0),e([f((()=>{const e=d(I);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"minScale",void 0),e([f((()=>{const e=d(S);return e.json.origins.service.read=!1,_(e)})())],W.prototype,"maxScale",void 0),e([f({readOnly:!0})],W.prototype,"effectiveScaleRange",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"objectIdField",null),e([f({type:Number,range:{min:0,max:1},nonNullable:!0,json:{write:{ignoreOrigin:!0}}})],W.prototype,"opacity",void 0),e([f({clonable:!1})],W.prototype,"parent",void 0),e([f(_(d(T)))],W.prototype,"popupEnabled",void 0),e([f({type:t,json:{name:"popupInfo",write:{ignoreOrigin:!0}}})],W.prototype,"popupTemplate",void 0),e([f({readOnly:!0})],W.prototype,"defaultPopupTemplate",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"relationships",null),e([f({types:U,json:{write:{target:"layerDefinition.drawingInfo.renderer",ignoreOrigin:!0}}})],W.prototype,"renderer",null),e([h("service","renderer",["drawingInfo.renderer","subtypeField","type"])],W.prototype,"readRendererFromService",null),e([h("renderer",["layerDefinition.drawingInfo.renderer"])],W.prototype,"readRenderer",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"spatialReference",null),e([f({type:Number,json:{origins:{service:{read:!1}},write:{ignoreOrigin:!0}}})],W.prototype,"subtypeCode",void 0),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"subtypeField",null),e([f({type:[q],json:{name:"layerDefinition.templates",write:{ignoreOrigin:!0}}})],W.prototype,"templates",void 0),e([h("service","templates",["geometryType","subtypeField","subtypes","type"])],W.prototype,"readTemplatesFromService",null),e([f({type:String,json:{write:{ignoreOrigin:!0}}})],W.prototype,"title",void 0),e([h("service","title",["subtypes"])],W.prototype,"readTitleFromService",null),e([f({readOnly:!0,json:{read:!1}})],W.prototype,"url",null),e([f({readOnly:!0})],W.prototype,"userHasUpdateItemPrivileges",null),e([f({type:Boolean,nonNullable:!0,json:{name:"visibility",write:{ignoreOrigin:!0}}})],W.prototype,"visible",void 0),W=e([b("esri.layers.support.SubtypeSublayer")],W);const K=(e,t,r)=>{if(!r)return t.createQuery();const i=D.from(r);return i.where=X(i.where,e.subtypeField,t.subtypeCode),i},X=(e,t,r)=>{const i=new RegExp(`${t}\\s*=\\s*\\d+`),n=`${t}=${r}`,o=e??"";return i.test(o)?o.replace(i,n):m(n,o)},Y=e=>new l(`This sublayer must have a parent SubtypeGroupLayer in order to use ${e}`),Z=W;export{Z as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{id as t}from"../../kernel.js";import{symbolTypesRenderer as e}from"../../symbols.js";import{resultOrAbort as r}from"../../core/asyncUtils.js";import n from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import{parseWhereClause as s}from"../../core/sql.js";import{createTypeReader as i}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{queryAllJSON as a}from"./featureQueryAll.js";import{getOwningPortalUrl as u}from"./layerUtils.js";import c from"../../renderers/SimpleRenderer.js";import l from"../../renderers/UniqueValueRenderer.js";import p from"../../rest/support/AttachmentQuery.js";import d from"../../rest/support/Query.js";import f from"../../rest/support/RelationshipQuery.js";const y=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function m(t,e,r,o){const s=await C(t);if(await h(t,e,o),!s.addAttachment)throw new n(o,"Layer source does not support addAttachment capability");return s.addAttachment(e,r)}function h(t,e,r){const{attributes:o}=e,{objectIdField:s}=t;return t.capabilities?.data?.supportsAttachment?e?o?s&&o[s]?Promise.resolve():Promise.reject(new n(r,`feature is missing the identifying attribute ${s}`)):Promise.reject(new n(r,"'attributes' are required on a feature to query attachments")):Promise.reject(new n(r,"A feature is required to add/delete/update attachments")):Promise.reject(new n(r,"this layer doesn't support attachments"))}async function w(t,e,r,o,s){const i=await C(t);if(await h(t,e,s),!i.updateAttachment)throw new n(s,"Layer source does not support updateAttachment capability");return i.updateAttachment(e,r,o)}async function b(t,e,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await t.load();let s=r;return"feature"===o.type&&o.infoFor3D&&null!=e.deleteFeatures&&null!=o.globalIdField&&(s={...s,globalIdToObjectId:await k(o,e.deleteFeatures,o.globalIdField)}),n(o,o.source,e,r)}async function g(t,e,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await t.load();return n(o,o.source,e,r)}async function I(t,e,r,o){const s=await C(t);if(await h(t,e,o),!s.deleteAttachments)throw new n(o,"Layer source does not support deleteAttachments capability");return s.deleteAttachments(e,r)}async function j(t,e,r){const o=(await t.load({signal:e?.signal})).source;if(!o.fetchRecomputedExtents)throw new n(r,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(e)}async function F(t,e,r,o){e=p.from(e),await t.load();const s=t.source,i=t.capabilities;if(!i?.data?.supportsAttachment)throw new n(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:d,start:f,where:y}=e;if(!i?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||d?.length>0||l||f||y)throw new n(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",e)}if(!(u?.length||c?.length||y))throw new n(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",e);if(!s.queryAttachments)throw new n(o,"Layer source does not support queryAttachments capability",e);return s.queryAttachments(e)}async function q(t,e,r,o){const s=await C(t);if(!s.queryObjectIds)throw new n(o,"Layer source does not support queryObjectIds capability");return s.queryObjectIds(d.from(e)??t.createQuery(),r)}async function x(t,e,r,o){const s=await C(t);if(!s.queryFeatureCount)throw new n(o,"Layer source does not support queryFeatureCount capability");return s.queryFeatureCount(d.from(e)??t.createQuery(),r)}async function A(t,e,r,o){const s=await C(t);if(!s.queryExtent)throw new n(o,"Layer source does not support queryExtent capability");return s.queryExtent(d.from(e)??t.createQuery(),r)}async function v(t,e,r,o){const s=await C(t);if(!s.queryRelatedFeatures)throw new n(o,"Layer source does not support queryRelatedFeatures capability");return s.queryRelatedFeatures(f.from(e),r)}async function S(t,e,r,o){const s=await C(t);if(!s.queryRelatedFeaturesCount)throw new n(o,"Layer source does not support queryRelatedFeaturesCount capability");return s.queryRelatedFeaturesCount(f.from(e),r)}async function O(t){const e=t.source;if(e?.refresh)try{const{dataChanged:r,updates:n}=await e.refresh();if(null!=n&&(t.sourceJSON={...t.sourceJSON,...n},t.read(n,{origin:"service",url:t.parsedUrl})),r)return!0}catch{}if(t.definitionExpression)try{return(await s(t.definitionExpression,t.fieldsIndex)).hasDateFunctions}catch{}return!1}function P(t){const e=new d,r=t.capabilities?.data,n=t.capabilities?.query;e.historicMoment=t.historicMoment,e.gdbVersion=t.gdbVersion,e.returnGeometry=!0,n&&(e.compactGeometryEnabled=n.supportsCompactGeometry,e.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=t.returnZ&&(e.returnZ=t.returnZ),r.supportsM&&null!=t.returnM&&(e.returnM=t.returnM)),e.outFields=["*"];const{timeOffset:o,timeExtent:s}=t;return e.timeExtent=null!=o&&null!=s?s.offset(-o.value,o.unit):s||null,e.multipatchOption="multipatch"===t.geometryType?"xyFootprint":null,e}function E(t){const{globalIdField:e,fields:r}=t;if(e)return e;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function L(t){const{objectIdField:e,fields:r}=t;if(e)return e;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function R(t){return t.currentVersion?t.currentVersion:t.hasOwnProperty("capabilities")||t.hasOwnProperty("drawingInfo")||t.hasOwnProperty("hasAttachments")||t.hasOwnProperty("htmlPopupType")||t.hasOwnProperty("relationships")||t.hasOwnProperty("timeInfo")||t.hasOwnProperty("typeIdField")||t.hasOwnProperty("types")?10:9.3}function M(t,e){const{subtypes:r,subtypeField:n}=t;if(!e||!r?.length||!n)return null;const o=e.attributes[n];return null==o?null:r.find((t=>t.code===o))}async function C(t){return(await t.load()).source}async function G(e,r){if(!t)return;if(t.findCredential(e))return;let n;try{const o=await u(e,r);o&&(n=await t.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await t.getCredential(e,{signal:n})}catch(o){}}async function Q(t,e,r){const n=t.parsedUrl?.path;n&&t.authenticationTriggerEvent===e&&await G(n,r)}function D(t){return!N(t)&&(t.userHasUpdateItemPrivileges||t.editingEnabled)}const T=i({types:e});function U(t,e){if(t.defaultSymbol)return t.types?.length?new l({defaultSymbol:T(t.defaultSymbol,t,e),field:t.typeIdField,uniqueValueInfos:t.types.map((t=>({id:t.id,symbol:T(t.symbol,t,e)})))}):new c({symbol:T(t.defaultSymbol,t,e)})}function V(t){let e=t.sourceJSON?.cacheMaxAge;if(!e)return!1;const r=t.editingInfo?.lastEditDate?.getTime();return null==r||(e*=1e3,Date.now()-r<e)}async function k(t,e,n){if(null==e)return null;const o=[],{objectIdField:s}=t;if(e.forEach((t=>{let e=null;if("attributes"in t){const{attributes:r}=t;e={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else e={globalId:t.globalId,objectId:null!=t.objectId&&-1!==t.objectId?t.objectId:null};null!=e.globalId&&(null!=e.objectId&&-1!==e.objectId||o.push(e.globalId))})),0===o.length)return null;const i=t.createQuery();i.where=o.map((t=>`${n}='${t}'`)).join(" OR "),i.returnGeometry=!1,i.outFields=[s,n],i.cacheHint=!1;const u=await r(a(t,i));if(!u.ok)return null;const c=new Map,l=u.value.features;for(const r of l){const t=r.attributes[n],e=r.attributes[s];null!=t&&null!=e&&-1!==e&&c.set(t,e)}return c}function J(t,e,r){if(!e||!r||!t)return null;const n=r.getAttribute(e);return null==n?null:t.find((t=>{const{id:e}=t;return null!=e&&e.toString()===n.toString()}))??null}function N(t){return t.sourceJSON?.isMultiServicesView||$(t)}function $(t){return!!t.sourceJSON?.capabilities?.toLowerCase().split(",").map((t=>t.trim())).includes("map")}function Z(t,e,r){const o=e?.queryBins;if(!o)throw new n(r,"Layer source does not support binning");switch(t.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new n(r,"Layer source does not support auto-interval binning");break;case"date":if(!o.supportsDate)throw new n(r,"Layer source does not support date binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new n(r,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new n(r,"Layer source does not support fixed-interval binning")}const s=o?.supportedStatistics;if(t.outStatistics&&s){const e=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of t.outStatistics){const t=e.get(o);if(t&&!s[t])throw new n(r,`Layer source does not support ${o} statistic type`)}}}export{m as addAttachment,b as applyEdits,D as computeEffectiveEditingEnabled,U as createDefaultRenderer,P as createQuery,I as deleteAttachments,G as ensureCredentialIfSignedIn,Q as ensureLayerCredential,j as fetchRecomputedExtents,y as geometryTypeKebabDict,M as getFeatureSubtype,J as getFeatureType,k as getGlobalIdToObjectIdMap,O as hasDataChanged,V as isLayerCacheStale,F as queryAttachments,A as queryExtent,x as queryFeatureCount,q as queryObjectIds,v as queryRelatedFeatures,S as queryRelatedFeaturesCount,E as readGlobalIdField,L as readObjectIdField,R as readVersion,N as supportsQueryOnly,w as updateAttachment,g as uploadAssets,Z as validateBinsQuery};
|
|
5
|
+
import{id as e}from"../../kernel.js";import{symbolTypesRenderer as t}from"../../symbols.js";import{resultOrAbort as r}from"../../core/asyncUtils.js";import n from"../../core/Error.js";import{JSONMap as o}from"../../core/jsonMap.js";import{parseWhereClause as s}from"../../core/sql.js";import{createTypeReader as i}from"../../core/accessorSupport/extensions/serializableProperty/reader.js";import{CodedValue as a}from"./CodedValue.js";import u from"./CodedValueDomain.js";import{queryAllJSON as c}from"./featureQueryAll.js";import{getOwningPortalUrl as l}from"./layerUtils.js";import p from"../../renderers/SimpleRenderer.js";import d from"../../renderers/UniqueValueRenderer.js";import f from"../../rest/support/AttachmentQuery.js";import y from"../../rest/support/Query.js";import m from"../../rest/support/RelationshipQuery.js";const h=new o({esriGeometryPoint:"point",esriGeometryMultipoint:"multipoint",esriGeometryPolyline:"polyline",esriGeometryPolygon:"polygon",esriGeometryMultiPatch:"multipatch"});async function w(e,t,r,o){const s=await G(e);if(await b(e,t,o),!s.addAttachment)throw new n(o,"Layer source does not support addAttachment capability");return s.addAttachment(t,r)}function b(e,t,r){const{attributes:o}=t,{objectIdField:s}=e;return e.capabilities?.data?.supportsAttachment?t?o?s&&o[s]?Promise.resolve():Promise.reject(new n(r,`feature is missing the identifying attribute ${s}`)):Promise.reject(new n(r,"'attributes' are required on a feature to query attachments")):Promise.reject(new n(r,"A feature is required to add/delete/update attachments")):Promise.reject(new n(r,"this layer doesn't support attachments"))}async function g(e,t,r,o,s){const i=await G(e);if(await b(e,t,s),!i.updateAttachment)throw new n(s,"Layer source does not support updateAttachment capability");return i.updateAttachment(t,r,o)}async function I(e,t,r){const{applyEdits:n}=await import("../graphics/editingSupport.js"),o=await e.load();let s=r;return"feature"===o.type&&o.infoFor3D&&null!=t.deleteFeatures&&null!=o.globalIdField&&(s={...s,globalIdToObjectId:await $(o,t.deleteFeatures,o.globalIdField)}),n(o,o.source,t,r)}async function j(e,t,r){const{uploadAssets:n}=await import("../graphics/editingSupport.js"),o=await e.load();return n(o,o.source,t,r)}async function F(e,t,r,o){const s=await G(e);if(await b(e,t,o),!s.deleteAttachments)throw new n(o,"Layer source does not support deleteAttachments capability");return s.deleteAttachments(t,r)}async function q(e,t,r){const o=(await e.load({signal:t?.signal})).source;if(!o.fetchRecomputedExtents)throw new n(r,"Layer source does not support fetchUpdates capability");return o.fetchRecomputedExtents(t)}async function x(e,t,r,o){t=f.from(t),await e.load();const s=e.source,i=e.capabilities;if(!i?.data?.supportsAttachment)throw new n(o,"this layer doesn't support attachments");const{attachmentTypes:a,objectIds:u,globalIds:c,num:l,size:p,start:d,where:y}=t;if(!i?.operations?.supportsQueryAttachments){if(a?.length>0||c?.length>0||p?.length>0||l||d||y)throw new n(o,"when 'capabilities.operations.supportsQueryAttachments' is false, only objectIds is supported",t)}if(!(u?.length||c?.length||y))throw new n(o,"'objectIds', 'globalIds', or 'where' are required to perform attachment query",t);if(!s.queryAttachments)throw new n(o,"Layer source does not support queryAttachments capability",t);return s.queryAttachments(t)}async function A(e,t,r,o){const s=await G(e);if(!s.queryObjectIds)throw new n(o,"Layer source does not support queryObjectIds capability");return s.queryObjectIds(y.from(t)??e.createQuery(),r)}async function v(e,t,r,o){const s=await G(e);if(!s.queryFeatureCount)throw new n(o,"Layer source does not support queryFeatureCount capability");return s.queryFeatureCount(y.from(t)??e.createQuery(),r)}async function S(e,t,r,o){const s=await G(e);if(!s.queryExtent)throw new n(o,"Layer source does not support queryExtent capability");return s.queryExtent(y.from(t)??e.createQuery(),r)}async function O(e,t,r,o){const s=await G(e);if(!s.queryRelatedFeatures)throw new n(o,"Layer source does not support queryRelatedFeatures capability");return s.queryRelatedFeatures(m.from(t),r)}async function P(e,t,r,o){const s=await G(e);if(!s.queryRelatedFeaturesCount)throw new n(o,"Layer source does not support queryRelatedFeaturesCount capability");return s.queryRelatedFeaturesCount(m.from(t),r)}async function E(e){const t=e.source;if(t?.refresh)try{const{dataChanged:r,updates:n}=await t.refresh();if(null!=n&&(e.sourceJSON={...e.sourceJSON,...n},e.read(n,{origin:"service",url:e.parsedUrl})),r)return!0}catch{}if(e.definitionExpression)try{return(await s(e.definitionExpression,e.fieldsIndex)).hasDateFunctions}catch{}return!1}function L(e){const t=new y,r=e.capabilities?.data,n=e.capabilities?.query;t.historicMoment=e.historicMoment,t.gdbVersion=e.gdbVersion,t.returnGeometry=!0,n&&(t.compactGeometryEnabled=n.supportsCompactGeometry,t.defaultSpatialReferenceEnabled=n.supportsDefaultSpatialReference),r&&(r.supportsZ&&null!=e.returnZ&&(t.returnZ=e.returnZ),r.supportsM&&null!=e.returnM&&(t.returnM=e.returnM)),t.outFields=["*"];const{timeOffset:o,timeExtent:s}=e;return t.timeExtent=null!=o&&null!=s?s.offset(-o.value,o.unit):s||null,t.multipatchOption="multipatch"===e.geometryType?"xyFootprint":null,t}function C(e){const{globalIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeGlobalID"===n.type)return n.name}function R(e){const{objectIdField:t,fields:r}=e;if(t)return t;if(r)for(const n of r)if("esriFieldTypeOID"===n.type)return n.name}function M(e){return e.currentVersion?e.currentVersion:e.hasOwnProperty("capabilities")||e.hasOwnProperty("drawingInfo")||e.hasOwnProperty("hasAttachments")||e.hasOwnProperty("htmlPopupType")||e.hasOwnProperty("relationships")||e.hasOwnProperty("timeInfo")||e.hasOwnProperty("typeIdField")||e.hasOwnProperty("types")?10:9.3}function V(e,t){const{subtypes:r,subtypeField:n}=e;if(!t?.attributes||!r?.length||!n)return null;const o=t.attributes[n];return null==o?null:r.find((e=>e.code===o))}function D(e,t){const{fieldsIndex:r,subtypeField:n}=e,o=r.get(t)?.name;if(!o)return null;if((n&&r.get(n)?.name)===o&&e.subtypes?.length){const t=e.subtypes.map((e=>new a({code:e.code,name:e.name})));if(t?.length)return new u({codedValues:t})}if(("typeIdField"in e?r.get(e.typeIdField)?.name:null)===o&&"types"in e&&e.types?.length){const t=e.types.map((e=>new a({code:e.id,name:e.name})));return new u({codedValues:t})}return null}async function G(e){return(await e.load()).source}async function Q(t,r){if(!e)return;if(e.findCredential(t))return;let n;try{const o=await l(t,r);o&&(n=await e.checkSignInStatus(`${o}/sharing`))}catch(o){}if(n)try{const n=null!=r?r.signal:null;await e.getCredential(t,{signal:n})}catch(o){}}async function T(e,t,r){const n=e.parsedUrl?.path;n&&e.authenticationTriggerEvent===t&&await Q(n,r)}function U(e){return!H(e)&&(e.userHasUpdateItemPrivileges||e.editingEnabled)}const k=i({types:t});function J(e,t){if(e.defaultSymbol)return e.types?.length?new d({defaultSymbol:k(e.defaultSymbol,e,t),field:e.typeIdField,uniqueValueInfos:e.types.map((e=>({id:e.id,symbol:k(e.symbol,e,t)})))}):new p({symbol:k(e.defaultSymbol,e,t)})}function N(e){let t=e.sourceJSON?.cacheMaxAge;if(!t)return!1;const r=e.editingInfo?.lastEditDate?.getTime();return null==r||(t*=1e3,Date.now()-r<t)}async function $(e,t,n){if(null==t)return null;const o=[],{objectIdField:s}=e;if(t.forEach((e=>{let t=null;if("attributes"in e){const{attributes:r}=e;t={globalId:r[n],objectId:null!=r[s]&&-1!==r[s]?r[s]:null}}else t={globalId:e.globalId,objectId:null!=e.objectId&&-1!==e.objectId?e.objectId:null};null!=t.globalId&&(null!=t.objectId&&-1!==t.objectId||o.push(t.globalId))})),0===o.length)return null;const i=e.createQuery();i.where=o.map((e=>`${n}='${e}'`)).join(" OR "),i.returnGeometry=!1,i.outFields=[s,n],i.cacheHint=!1;const a=await r(c(e,i));if(!a.ok)return null;const u=new Map,l=a.value.features;for(const r of l){const e=r.attributes[n],t=r.attributes[s];null!=e&&null!=t&&-1!==t&&u.set(e,t)}return u}function Z(e,t,r){if(!t||!r||!e)return null;const n=r.getAttribute(t);return null==n?null:e.find((e=>{const{id:t}=e;return null!=t&&t.toString()===n.toString()}))??null}function H(e){return e.sourceJSON?.isMultiServicesView||z(e)}function z(e){return!!e.sourceJSON?.capabilities?.toLowerCase().split(",").map((e=>e.trim())).includes("map")}function B(e,t,r){const o=t?.queryBins;if(!o)throw new n(r,"Layer source does not support binning");switch(e.binParameters.type){case"auto-interval":if(!o.supportsAutoInterval)throw new n(r,"Layer source does not support auto-interval binning");break;case"date":if(!o.supportsDate)throw new n(r,"Layer source does not support date binning");break;case"fixed-boundaries":if(!o.supportsFixedBoundaries)throw new n(r,"Layer source does not support fixed-boundaries binning");break;case"fixed-interval":if(!o.supportsFixedInterval)throw new n(r,"Layer source does not support fixed-interval binning")}const s=o?.supportedStatistics;if(e.outStatistics&&s){const t=new Map([["count","count"],["sum","sum"],["min","min"],["max","max"],["avg","avg"],["stddev","stddev"],["var","var"],["percentile-continuous","percentileContinuous"],["percentile-discrete","percentileDiscrete"],["centroid-aggregate","centroid"],["convex-hull-aggregate","convexHull"],["envelope-aggregate","envelope"]]);for(const{statisticType:o}of e.outStatistics){const e=t.get(o);if(e&&!s[e])throw new n(r,`Layer source does not support ${o} statistic type`)}}}export{w as addAttachment,I as applyEdits,U as computeEffectiveEditingEnabled,J as createDefaultRenderer,L as createQuery,F as deleteAttachments,Q as ensureCredentialIfSignedIn,T as ensureLayerCredential,q as fetchRecomputedExtents,h as geometryTypeKebabDict,V as getFeatureSubtype,Z as getFeatureType,$ as getGlobalIdToObjectIdMap,D as getImpliedDomainForTypeOrSubtypeField,E as hasDataChanged,N as isLayerCacheStale,x as queryAttachments,S as queryExtent,v as queryFeatureCount,A as queryObjectIds,O as queryRelatedFeatures,P as queryRelatedFeaturesCount,C as readGlobalIdField,R as readObjectIdField,M as readVersion,H as supportsQueryOnly,g as updateAttachment,j as uploadAssets,B as validateBinsQuery};
|
package/package.json
CHANGED
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const c="20240923",b="c23c5280b8d318c14559e7e254c44443fdb9bc95";export{c as buildDate,b as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{valueInUnit as e,createLength as n,createAngle as t}from"../../../core/quantityUtils.js";import{verticalLengthUnitFromSpatialReference as r,lengthUnitFromSpatialReference as o}from"../../../core/unitUtils.js";import{f as i,c as l,g as u}from"../../../chunks/vec32.js";import{projectVectorToVector as s}from"../../../geometry/projection/projectVectorToVector.js";import{geodesicCompatibleSpatialReference as c}from"../../../geometry/support/geodesicUtils.js";import{makeDehydratedPoint as a}from"../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevationFromXYZ as f}from"../../../support/elevationInfoUtils.js";import{CoordinateConstraint as m,constraintOrSet as d,VerticalCylinderConstraint as p,HorizontalPlaneConstraint as v,GeodesicConstraint as g,PointConstraint as R,VerticalHalfPlaneConstraint as j}from"./constraints.js";import{fromPoint as w,createWritable as y,toElevationAlignedDehydratedPoint as h}from"./normalizedPoint.js";import{getDegreesGeographic as x,DirectionMode as S,directionBetweenPoints as I,pointFromDistanceAlongAzimuth as U}from"../../support/angularMeasurementUtils.js";import M from"../../../geometry/SpatialReference.js";function Z(e,n,t,r,o,i){let l="geodesic",u=c(t);const a=y();return w(e,n,r,a),a[2]=0,u&&s(a,t,a,u)||(l="euclidean",u=t),{mode:l,view:n,elevationInfo:r,hasZ:o,directionMode:i,spatialReference:e.spatialReference,measurementSR:u,origin:a}}function b(n,t,r){if(null==t||null==n)return;const i=o(r.measurementSR);if(null==i)return;const l=G(n,r);if(null==l)return;const u=e(t,i);return new p(l,u)}function A(e,n,r,o){if(null==r||null==e)return;const i=G(e,o);if(null==i)return;const l=x(r),u=10,s=e=>{if(null==e)return;const n=y(),r=t(e,"degrees","geographic");return U(n,i,o.measurementSR,u,r,o.mode)?new j(i,n):void 0},c=()=>{if(null!=n&&null!=e)return x(I(n,e))};switch(o.directionMode){case S.Absolute:return s(l);case S.Relative:{const e=c();if(null==e)return;return s(e+l)}case S.RelativeBilateral:{const e=c();if(null==e)return;return d([s(e+l),s(e-l)])}}}function B(e,n){const t=C(e,n);return null!=t?new v(t):void 0}function P(e,n,t){const{context:r,longitude:o,latitude:i,direction:l,distance:u,elevation:s}=t;if(null!=o||null!=i||null!=u||null!=s||null!=l){if(null!=o||null!=i){const e=x(o),n=x(i),t=
|
|
5
|
+
import"../../../geometry.js";import{valueInUnit as e,createLength as n,createAngle as t}from"../../../core/quantityUtils.js";import{verticalLengthUnitFromSpatialReference as r,lengthUnitFromSpatialReference as o}from"../../../core/unitUtils.js";import{f as i,c as l,g as u}from"../../../chunks/vec32.js";import{projectVectorToVector as s}from"../../../geometry/projection/projectVectorToVector.js";import{geodesicCompatibleSpatialReference as c}from"../../../geometry/support/geodesicUtils.js";import{makeDehydratedPoint as a}from"../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevationFromXYZ as f}from"../../../support/elevationInfoUtils.js";import{CoordinateConstraint as m,constraintOrSet as d,VerticalCylinderConstraint as p,HorizontalPlaneConstraint as v,GeodesicConstraint as g,PointConstraint as R,VerticalHalfPlaneConstraint as j}from"./constraints.js";import{fromPoint as w,createWritable as y,toElevationAlignedDehydratedPoint as h}from"./normalizedPoint.js";import{getDegreesGeographic as x,DirectionMode as S,directionBetweenPoints as I,pointFromDistanceAlongAzimuth as U}from"../../support/angularMeasurementUtils.js";import M from"../../../geometry/SpatialReference.js";function Z(e,n,t,r,o,i){let l="geodesic",u=c(t);const a=y();return w(e,n,r,a),a[2]=0,u&&s(a,t,a,u)||(l="euclidean",u=t),{mode:l,view:n,elevationInfo:r,hasZ:o,directionMode:i,spatialReference:e.spatialReference,measurementSR:u,origin:a}}function b(n,t,r){if(null==t||null==n)return;const i=o(r.measurementSR);if(null==i)return;const l=G(n,r);if(null==l)return;const u=e(t,i);return new p(l,u)}function A(e,n,r,o){if(null==r||null==e)return;const i=G(e,o);if(null==i)return;const l=x(r),u=10,s=e=>{if(null==e)return;const n=y(),r=t(e,"degrees","geographic");return U(n,i,o.measurementSR,u,r,o.mode)?new j(i,n):void 0},c=()=>{if(null!=n&&null!=e)return x(I(n,e))};switch(o.directionMode){case S.Absolute:return s(l);case S.Relative:{const e=c();if(null==e)return;return s(e+l)}case S.RelativeBilateral:{const e=c();if(null==e)return;return d([s(e+l),s(e-l)])}}}function B(e,n){const t=C(e,n);return null!=t?new v(t):void 0}function P(e,n,t){const{context:r,longitude:o,latitude:i,direction:l,distance:u,elevation:s}=t;if(null!=o||null!=i||null!=u||null!=s||null!=l){if(null!=o||null!=i){const e=x(o),n=x(i),t=C(s,r);return new m(e,n,t)}return T(e,n,t)}}function T(n,t,{context:r,direction:o,distance:i,elevation:l}){if(null==t)return B(l,r);const{view:u,elevationInfo:c,measurementSR:a}=r,f=w(t,u,c);if(!a||!s(f,t.spatialReference,E,a))return;const[m,p]=E,v=null!=i?e(i,"meters"):void 0,j=x(o),y=C(l,r),h=e=>{const n=new g([m,p],a,v,y,e);return null==v||null==e||null==y&&r.hasZ?n:new R(n.closestTo(f))};if(null==j)return h(void 0);const U=()=>{if(null!=n&&null!=t)return x(I(n,t))};switch(r.directionMode){case S.Absolute:return h(j);case S.Relative:{const e=U();if(null==e)return;return h(e+j)}case S.RelativeBilateral:{const e=U();if(null==e)return;return d([h(e+j),h(e-j)])}}}function V(e){return"geodesic"===e.context.mode?P(null,null,e):q(e)}function k(e,n,t){const{context:r,x:o,y:i,distance:l,direction:u,elevation:s}=t;return"geodesic"===r.mode?P(n,e,t):null!=o||null!=i?q(t):z([b(e,l,r),A(e,n,u,r),B(s,r)])}function q({x:e,y:n,elevation:t,context:r}){J.x=e?.value??0,J.y=n?.value??0,J.spatialReference=r.spatialReference;const o=G(J,r,F);return new m(null!=e&&null!=o?o[0]:void 0,null!=n&&null!=o?o[1]:void 0,C(t,r))}function z(e){let n;for(const t of e)t&&(n=n?.intersect(t)??t);return n}function G(e,n,t=y()){const{view:r,elevationInfo:o,measurementSR:l,origin:u,mode:c}=n;if(w(e,r,o,t),s(t,e.spatialReference,t,l))return"geodesic"!==c&&i(t,t,u),t}function W(e,n,t,r){const{view:o,measurementSR:i,spatialReference:c,origin:a,mode:f}=t;if("geodesic"===f?l(H,e):u(H,e,a),s(H,i,H,c))return h(H,o,n,t,r)}function C(e,n){return D(e,n)?.value??void 0}function D(t,{view:o,origin:i,elevationInfo:l,hasZ:u,measurementSR:s}){if(null==t||!u)return;const c=r(s);if(null==c)return;const[a,m]=i,d=e(t,c),p="3d"===o?.type?f(o,a,m,d,s,l):d;return null!=p?n(p,c):void 0}const E=y(),F=y(),H=y(),J=a(0,0,0,M.WGS84);export{W as constraintSpaceToPoint,Z as getConstraintContext,P as getGeodesicConstraint,V as getPointConstraint,k as getPolylineOrPolygonConstraint,z as intersectAll,G as pointToConstraintSpace};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{asinClamped as s}from"../../../core/mathUtils.js";import{dot as r,subtract as n,exactEquals as i,set as o,squaredDistance as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{r as a,e as h,s as l,z as f,q as d,a as p,c as m,f as g,H as _,l as L,b as k,n as M}from"../../../chunks/vec32.js";import{clone as x,create as y,UNIT_Z as P,fromValues as z}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as v,h as T}from"../../../chunks/vec42.js";import{create as q}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{toRadians as w}from"../../../geometry/support/geodesicConstants.js";import{directGeodeticSolver as j,inverseGeodeticSolver as A,InverseGeodeticSolverResult as D}from"../../../geometry/support/geodesicUtils.js";import{create as b,intersectLine as E,signedDistance as R,projectPoint as N,fromPositionAndNormal as U,fromPoints as Z,distance as I,getNormal as S}from"../../../geometry/support/plane.js";import{l as C,m as G,p as O,g as H,n as F}from"../../../chunks/sphere.js";import{tangentFrame as V}from"../../3d/support/mathUtils.js";import{fromVec3 as Y,clone as B,fromValues as J,asVec2 as K,create as Q,createWritable as W}from"./normalizedPoint.js";import{vectorsHaveCloseZ as X,isClose as $,intersectVerticalPlaneAndVerticalCylinder as tt,isPointInsidePlane as et,projectPointToLineLike as st,projectPointToVerticalCylinder as rt,projectPointToVerticalPlane as nt,VerticalPlaneType as it,intersectLineLikes as ot,intersectVerticalPlaneAndLineLike as ct,intersectLineLikeAndVerticalCylinder as ut,intersectLineLikeAndCircle as at,intersectVerticalPlanes as ht,intersectVerticalCylinders as lt,pointsInsidePlane as ft,intersectVerticalPlaneAndPoint as dt}from"../../support/geometry3dUtils.js";import{LineType as pt}from"../../support/geometry2dUtils.js";class mt{intersect(t){return Ft(this,t)}closestPoints(t){return[this.closestTo(t)]}}class gt extends mt{constructor(t){super(),this.point=t}equals(t){return this===t||Le(t)&&h(this.point,t.point)}closestTo(){return B(this.point)}}class _t extends mt{constructor(t,e,s){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:s}}equals(t){return this===t||ke(t)&&this.lineLike.type===t.lineLike.type&&h(this.start,t.start)&&h(this.end,t.end)}closestTo(t){const e=W();return st(t,this.lineLike,e),e}}class Lt extends _t{constructor(t,e){super(t,e,pt.LINE)}}class kt extends _t{constructor(t,e){super(t,e,pt.RAY)}}class Mt extends mt{constructor(t){super(),this.constraints=t}equals(t){return this===t||_e(t)&&e(this.constraints,t.constraints,((t,e)=>t.equals(e)))}closestTo(t){let e,s=1/0;for(const r of this.constraints){const n=r.closestTo(t),i=l(t,n);i<s&&(s=i,e=n)}return B(e??t)}closestPoints(t){return this.constraints.flatMap((e=>e===this?[]:e.closestPoints(t)))}}class xt extends mt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ye(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=W();return rt(t,this.center,this.radius,e),e}}class yt extends mt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||Pe(t)&&h(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=W();return rt(t,this.center,this.radius,e),e[2]=this.center[2],e}asCircle(){return new Pt(B(this.center),this.radius,J(0,0,1))}}class Pt extends mt{constructor(t,e,s,r=void 0){super(),this.center=t,this.radius=e,this.normal=s,this.slicePlane=r}equals(t){return this===t||ze(t)&&h(this.center,t.center)&&h(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:s}=this;N(this.getPlane(vt),t,zt);const r=f(zt,zt,e),n=d(r);if($(n,0))return B(t);const i=s/Math.sqrt(n),o=W();a(o,e,r,i);const{slicePlane:c}=this;if(c&&!et(c,o)){const e=Jt(c,this);return e?.closestTo(t)??B(t)}return o}getPlane(t=b()){return U(this.center,this.normal,t)}}const zt=y(),vt=b();class Tt extends mt{constructor(t){super(),this.z=t}equals(t){return this===t||Me(t)&&this.z===t.z}closestTo(t){return J(t[0],t[1],this.z)}getPlane(t=b()){return p(qt,0,0,this.z),U(qt,P,t)}}const qt=y();class wt extends mt{constructor(t,e,s){super(),this.start=t,this.end=e,this.planeLike={start:K(t),end:K(e),type:s}}equals(t){return this===t||xe(t)&&this.planeLike.type===t.planeLike.type&&h(this.start,t.start)&&h(this.end,t.end)}closestTo(t){const e=W();return nt(t,this.planeLike,e),e}closestEndTo(t){const{start:e,end:s}=this.planeLike;return Math.sign(r(n(jt,s,e),n(At,K(t),e)))>0?this.end:this.start}getPlane(t=b()){const e=m(Dt,this.end);return e[2]+=1,Z(this.start,this.end,e,t)}getSlicePlane(t=b()){const{start:e,end:s,type:r}=this.planeLike;if(r===it.PLANE)return;const n=p(Dt,e[0],e[1],0),i=p(bt,s[0],s[1],0),o=g(bt,i,n);return U(n,o,t),t}}const jt=u(),At=u(),Dt=y(),bt=y();class Et extends wt{constructor(t,e){super(t,e,it.HALF_PLANE)}}class Rt extends wt{constructor(t,e){super(t,e,it.PLANE)}}class Nt extends mt{constructor(t,e){super(),this.sphere=C(t,e)}equals(t){return this===t||ve(t)&&G(this.sphere,t.sphere)}closestTo(t){const e=W();return O(this.sphere,t,e),e}get center(){return H(this.sphere)}get radius(){return this.sphere[3]}}class Ut extends mt{constructor(t,e,s){super(),this.start=t,this.end=e,this.getZ=s,this.planeLike={start:K(t),end:K(e),type:it.PLANE}}equals(t){return this===t||Te(t)&&h(this.start,t.start)&&h(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return Ht(this,t)}addIfOnTheGround(t,e){for(const s of e){const e=this.getZ(s[0],s[1])??0;$(s[2],e)&&(s[2]=e,t.push(s))}}}class Zt extends mt{constructor(t,e,s){super(),this._x=t,this._y=e,this._z=s}equals(t){return this===t||we(t)&&this._x===t._x&&this._y===t._y&&this._z===t._z}closestTo([t,e,s]){return Q(this._x??t,this._y??e,this._z??s)}}class It extends mt{constructor(t,e,s,r,n){super(),this._origin=t,this._spatialReference=e,this._distanceMeters=s,this._elevationMeters=r,this._directionDegrees=n}equals(t){return this===t||qe(t)&&i(this._origin,t._origin)&&this._spatialReference===t._spatialReference&&this._distanceMeters===t._distanceMeters&&this._elevationMeters===t._elevationMeters&&this._directionDegrees===t._directionDegrees}closestTo([t,e,s]){return o(St,t,e),i(St,this._origin)||this._applyDirectionAndDistance(St),Q(St[0],St[1],this._elevationMeters??s)}_applyDirectionAndDistance(t){if(null!=this._directionDegrees&&null!=this._distanceMeters)j(t,this._origin,this._directionDegrees,this._distanceMeters,this._spatialReference);else if(null!=this._directionDegrees)Gt(t,this._origin,this._directionDegrees,t,this._spatialReference);else if(null!=this._distanceMeters){const{azimuth:e}=A(Ct,this._origin,t,this._spatialReference);j(t,this._origin,e??0,this._distanceMeters,this._spatialReference)}}}const St=[0,0],Ct=new D;function Gt(t,e,s,r,n){let{azimuth:i,distance:o}=A(Ot,e,r,n);i??=0;let c=o*Math.cos((i-s)*w);c=Math.max(0,c),j(t,e,s,c,n)}const Ot=new D;function Ht(t,e){const s=W();return nt(e,t.planeLike,s),s[2]=t.getZ(s[0],s[1])??je,s}function Ft(t,e){if(_e(t)){const s=[];for(const r of t.constraints){const t=r.intersect(e);t&&s.push(t)}return ge(s)}if(_e(e))return Ft(e,t);if(Te(t))return fe(t,e);if(Te(e))return fe(e,t);if(Le(t)){const{point:s}=t;if(Le(e))return h(s,e.point)?t:void 0;const r=e.closestTo(s);return _(r,s)?t:void 0}if(ke(t)){if(Le(e))return Ft(e,t);if(ke(e))return pe(ot(t.lineLike,e.lineLike));if(Me(e))return Vt(t,e);if(xe(e))return pe(ct(e.planeLike,t.lineLike));if(ye(e))return pe(ut(t.lineLike,e.center,e.radius));if(ze(e))return pe(at(t.lineLike,e));if(Pe(e))return Yt(t,e);if(ve(e))return Bt(t,e)}else if(Me(t)){if(Le(e)||ke(e))return Ft(e,t);if(Me(e))return Kt(t,e);if(xe(e))return Qt(t,e);if(ye(e))return Wt(t,e);if(ze(e))return $t(t,e);if(Pe(e))return Xt(t,e);if(ve(e))return te(t,e)}else if(xe(t)){if(Le(e)||ke(e)||Me(e))return Ft(e,t);if(xe(e))return de(ht(t.planeLike,e.planeLike));if(ye(e))return de(tt(t.planeLike,e.center,e.radius));if(ze(e))return se(t,e);if(Pe(e))return ee(t,e);if(ve(e))return re(t,e)}else if(ye(t)){if(Le(e)||ke(e)||Me(e)||xe(e))return Ft(e,t);if(ye(e))return de(lt(K(t.center),t.radius,K(e.center),e.radius));if(ze(e))return ne();if(Pe(e))return ie(t,e);if(ve(e))return oe()}else if(ze(t)){if(Le(e)||ke(e)||Me(e)||xe(e)||ye(e))return Ft(e,t);if(ze(e))return ce();if(Pe(e))return ce(e.asCircle());if(ve(e))return ue()}else if(Pe(t)){if(Le(e)||ke(e)||Me(e)||xe(e)||ye(e)||ze(e))return Ft(e,t);if(Pe(e))return ae(e,t);if(ve(e))return he()}else if(ve(t)){if(Le(e)||ke(e)||Me(e)||xe(e)||ye(e)||Pe(e))return Ft(e,t);if(ve(e))return le()}}const Vt=(()=>{const t=b();return(e,s)=>{const{start:r,end:n}=e;if(X(r,n)&&$(r[2],s.z))return e;const i=W();return E(s.getPlane(t),r,n,i)?new gt(i):void 0}})();function Yt({lineLike:t},{center:e,radius:s}){const r=e[2];return pe(ut(t,e,s).filter((t=>$(t[2],r))))}function Bt({lineLike:t},{sphere:e}){return pe(F(e,t.start,t.end))}const Jt=(()=>{const t=q(),e=y(),r=y();return(n,i,o)=>{const{normal:c,center:u,radius:h}=i;V(c,e,r);const l=S(n),f=h*L(l,e),d=h*L(l,r);v(t,u[0],u[1],u[2],1);const p=T(n,t),m=Math.hypot(f,d),g=$(m,0);if($(I(n,u),0)){if(g)return i;if($(h,0))return!o||et(o,u)?new gt(B(u)):void 0;k(e,l,c),M(e,e);const t=new Array,s=x(u);a(s,s,e,h),o&&!et(o,s)||t.push(s);const r=x(u);return a(r,r,e,-h),o&&!et(o,r)||t.push(r),pe(t)}if(g)return;const _=-p/m;if(Math.abs(_)>1||$(_,1))return;const P=Math.atan(f/d),z=s(_)-P,q=Math.PI-z,w=new Array,j=y();a(j,u,e,h*Math.cos(z)),a(j,j,r,h*Math.sin(z)),w.push(j);const A=y();return a(A,u,e,h*Math.cos(q)),a(A,A,r,h*Math.sin(q)),w.push(A),pe(o?ft(o,w):w)}})();function Kt(t,e){return $(t.z,e.z)?t:void 0}function Qt({z:t},{planeLike:e}){const[s,r]=e.start,[n,i]=e.end,o=J(s,r,t),c=J(n,i,t);return e.type===it.PLANE?new Lt(o,c):new kt(o,c)}function Wt(t,e){const[s,r]=e.center;return new yt(J(s,r,t.z),e.radius)}function Xt(t,e){return $(e.center[2],t.z)?e:void 0}const $t=(()=>{const t=b();return(e,s)=>Jt(e.getPlane(t),s,s.slicePlane)})();function te(t,{center:e,radius:s}){const r=Math.abs(e[2]-t.z);if(r>s&&!$(r,s))return;const n=J(e[0],e[1],t.z),i=Math.sqrt(s**2-r**2);return $(i,0)?void 0:new yt(n,i)}const ee=(()=>{const t=b();return(e,{center:s,radius:r})=>{const n=tt(e.planeLike,s,r),i=s[2];e.getSlicePlane(t);const o=new Array;for(const[c,u]of n){const e=[c,u,i];et(t,e)&&o.push(e)}return pe(o)}})(),se=(()=>{const t=b(),e=b();return(s,r)=>Jt(s.getPlane(t),r,s.getSlicePlane(e))})(),re=(()=>{const t=b();return(e,{center:s,radius:r})=>{const n=e.getPlane(t),i=R(n,s),o=Math.abs(i);if(o>r&&!$(o,r))return;const c=Math.sqrt(r**2-i**2);if($(c,0)){const t=W();return N(n,s,t),new gt(t)}const u=W(),h=x(S(n));return a(u,s,h,i),new Pt(u,c,h,e.getSlicePlane())}})();function ne(t,e){}function ie(t,e){const s=c(K(t.center),K(e.center));if($(s,0)&&$(t.radius,e.radius))return e;return me(lt(K(t.center),t.radius,K(e.center),e.radius),e.center[2])}function oe(t,e){}function ce(t,e){}function ue(t,e){}function ae(t,e){if(!X(t.center,e.center))return;const s=c(K(t.center),K(e.center));if($(s,0)&&$(t.radius,e.radius))return t;return me(lt(K(t.center),t.radius,K(e.center),e.radius),t.center[2])}function he(t,e){}function le(t,e){}function fe(t,e){const{planeLike:s,getZ:r}=t,n=new Array;if(Le(e))t.addIfOnTheGround(n,dt(s,e.point));else if(ke(e))t.addIfOnTheGround(n,ct(s,e.lineLike));else if(ye(e))for(const[i,o]of tt(s,e.center,e.radius)){const t=r(i,o);null!=t&&n.push(z(i,o,t))}else if(xe(e)||Te(e))for(const[i,o]of ht(s,e.planeLike)){const t=r(i,o)??je;n.push(z(i,o,t))}return pe(n)}function de(t){return ge(t.map((([t,e])=>{const s=J(t,e,0),r=J(t,e,1);return new Lt(s,r)})))}function pe(t){return ge(t.map((t=>t?new gt(Y(t)):void 0)))}function me(t,e){return pe(t.map((([t,s])=>[t,s,e])))}function ge(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new Mt(e.filter(t))}function _e(t){return t instanceof Mt}function Le(t){return t instanceof gt}function ke(t){return t instanceof _t}function Me(t){return t instanceof Tt}function xe(t){return t instanceof wt}function ye(t){return t instanceof xt}function Pe(t){return t instanceof yt}function ze(t){return t instanceof Pt}function ve(t){return t instanceof Nt}function Te(t){return t instanceof Ut}function qe(t){return t instanceof It}function we(t){return t instanceof Zt}const je=0;export{Pt as CircleConstraint,mt as Constraint,Zt as CoordinateConstraint,Ut as DrapedLineConstraint,It as GeodesicConstraint,yt as HorizontalCircleConstraint,Tt as HorizontalPlaneConstraint,Lt as LineConstraint,_t as LineLikeConstraint,gt as PointConstraint,kt as RayConstraint,Mt as SetConstraint,Nt as SphereConstraint,xt as VerticalCylinderConstraint,Et as VerticalHalfPlaneConstraint,Rt as VerticalPlaneConstraint,wt as VerticalPlaneLikeConstraint,ge as constraintOrSet,Le as isPoint};
|
|
5
|
+
import{isSome as t,equals as e}from"../../../core/arrayUtils.js";import{asinClamped as s}from"../../../core/mathUtils.js";import{dot as r,subtract as n,exactEquals as i,set as o,squaredDistance as c}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{r as a,e as h,s as f,z as l,q as d,a as p,c as m,f as g,H as _,l as L,b as k,n as x}from"../../../chunks/vec32.js";import{clone as y,create as z,UNIT_Z as P,fromValues as M}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as T,h as q}from"../../../chunks/vec42.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{toRadians as j}from"../../../geometry/support/geodesicConstants.js";import{directGeodeticSolver as v,inverseGeodeticSolver as A,InverseGeodeticSolverResult as D}from"../../../geometry/support/geodesicUtils.js";import{create as b,intersectLine as E,signedDistance as R,projectPoint as N,fromPositionAndNormal as U,fromPoints as Z,distance as I,getNormal as S}from"../../../geometry/support/plane.js";import{l as C,m as G,p as O,g as H,n as F}from"../../../chunks/sphere.js";import{tangentFrame as V}from"../../3d/support/mathUtils.js";import{fromVec3 as Y,clone as B,fromValues as J,asVec2 as K,create as Q,createWritable as W}from"./normalizedPoint.js";import{vectorsHaveCloseZ as X,isClose as $,intersectVerticalPlaneAndVerticalCylinder as tt,isPointInsidePlane as et,projectPointToLineLike as st,projectPointToVerticalCylinder as rt,projectPointToVerticalPlane as nt,VerticalPlaneType as it,intersectLineLikes as ot,intersectVerticalPlaneAndLineLike as ct,intersectLineLikeAndVerticalCylinder as ut,intersectLineLikeAndCircle as at,intersectVerticalPlanes as ht,intersectVerticalCylinders as ft,pointsInsidePlane as lt,intersectVerticalPlaneAndPoint as dt}from"../../support/geometry3dUtils.js";import{LineType as pt}from"../../support/geometry2dUtils.js";class mt{intersect(t){return Ft(this,t)}closestPoints(t){return[this.closestTo(t)]}}class gt extends mt{constructor(t){super(),this.point=t}equals(t){return this===t||Le(t)&&h(this.point,t.point)}closestTo(){return B(this.point)}}class _t extends mt{constructor(t,e,s){super(),this.start=t,this.end=e,this.lineLike={start:t,end:e,type:s}}equals(t){return this===t||ke(t)&&this.lineLike.type===t.lineLike.type&&h(this.start,t.start)&&h(this.end,t.end)}closestTo(t){const e=W();return st(t,this.lineLike,e),e}}class Lt extends _t{constructor(t,e){super(t,e,pt.LINE)}}class kt extends _t{constructor(t,e){super(t,e,pt.RAY)}}class xt extends mt{constructor(t){super(),this.constraints=t}equals(t){return this===t||_e(t)&&e(this.constraints,t.constraints,((t,e)=>t.equals(e)))}closestTo(t){let e,s=1/0;for(const r of this.constraints){const n=r.closestTo(t),i=f(t,n);i<s&&(s=i,e=n)}return B(e??t)}closestPoints(t){return this.constraints.flatMap((e=>e===this?[]:e.closestPoints(t)))}}class yt extends mt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||ze(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const e=W();return rt(t,this.center,this.radius,e),e}}class zt extends mt{constructor(t,e){super(),this.center=t,this.radius=e}equals(t){return this===t||Pe(t)&&h(this.center,t.center)&&this.radius===t.radius}closestTo(t){const e=W();return rt(t,this.center,this.radius,e),e[2]=this.center[2],e}asCircle(){return new Pt(B(this.center),this.radius,J(0,0,1))}}class Pt extends mt{constructor(t,e,s,r=void 0){super(),this.center=t,this.radius=e,this.normal=s,this.slicePlane=r}equals(t){return this===t||Me(t)&&h(this.center,t.center)&&h(this.normal,t.normal)&&this.radius===t.radius}closestTo(t){const{center:e,radius:s}=this;N(this.getPlane(Tt),t,Mt);const r=l(Mt,Mt,e),n=d(r);if($(n,0))return B(t);const i=s/Math.sqrt(n),o=W();a(o,e,r,i);const{slicePlane:c}=this;if(c&&!et(c,o)){const e=Jt(c,this);return e?.closestTo(t)??B(t)}return o}getPlane(t=b()){return U(this.center,this.normal,t)}}const Mt=z(),Tt=b();class qt extends mt{constructor(t){super(),this.z=t}equals(t){return this===t||xe(t)&&this.z===t.z}closestTo(t){return J(t[0],t[1],this.z)}getPlane(t=b()){return p(wt,0,0,this.z),U(wt,P,t)}}const wt=z();class jt extends mt{constructor(t,e,s){super(),this.start=t,this.end=e,this.planeLike={start:K(t),end:K(e),type:s}}equals(t){return this===t||ye(t)&&this.planeLike.type===t.planeLike.type&&h(this.start,t.start)&&h(this.end,t.end)}closestTo(t){const e=W();return nt(t,this.planeLike,e),e}closestEndTo(t){const{start:e,end:s}=this.planeLike;return Math.sign(r(n(vt,s,e),n(At,K(t),e)))>0?this.end:this.start}getPlane(t=b()){const e=m(Dt,this.end);return e[2]+=1,Z(this.start,this.end,e,t)}getSlicePlane(t=b()){const{start:e,end:s,type:r}=this.planeLike;if(r===it.PLANE)return;const n=p(Dt,e[0],e[1],0),i=p(bt,s[0],s[1],0),o=g(bt,i,n);return U(n,o,t),t}}const vt=u(),At=u(),Dt=z(),bt=z();class Et extends jt{constructor(t,e){super(t,e,it.HALF_PLANE)}}class Rt extends jt{constructor(t,e){super(t,e,it.PLANE)}}class Nt extends mt{constructor(t,e){super(),this.sphere=C(t,e)}equals(t){return this===t||Te(t)&&G(this.sphere,t.sphere)}closestTo(t){const e=W();return O(this.sphere,t,e),e}get center(){return H(this.sphere)}get radius(){return this.sphere[3]}}class Ut extends mt{constructor(t,e,s){super(),this.start=t,this.end=e,this.getZ=s,this.planeLike={start:K(t),end:K(e),type:it.PLANE}}equals(t){return this===t||qe(t)&&h(this.start,t.start)&&h(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return Ht(this,t)}addIfOnTheGround(t,e){for(const s of e){const e=this.getZ(s[0],s[1])??0;$(s[2],e)&&(s[2]=e,t.push(s))}}}class Zt extends mt{constructor(t,e,s){super(),this._x=t,this._y=e,this._z=s}equals(t){return this===t||je(t)&&this._x===t._x&&this._y===t._y&&this._z===t._z}closestTo([t,e,s]){return Q(this._x??t,this._y??e,this._z??s)}}class It extends mt{constructor(t,e,s,r,n){super(),this._origin=t,this._spatialReference=e,this._distanceMeters=s,this._z=r,this._directionDegrees=n}equals(t){return this===t||we(t)&&i(this._origin,t._origin)&&this._spatialReference===t._spatialReference&&this._distanceMeters===t._distanceMeters&&this._z===t._z&&this._directionDegrees===t._directionDegrees}closestTo([t,e,s]){return o(St,t,e),i(St,this._origin)||this._applyDirectionAndDistance(St),Q(St[0],St[1],this._z??s)}_applyDirectionAndDistance(t){if(null!=this._directionDegrees&&null!=this._distanceMeters)v(t,this._origin,this._directionDegrees,this._distanceMeters,this._spatialReference);else if(null!=this._directionDegrees)Gt(t,this._origin,this._directionDegrees,t,this._spatialReference);else if(null!=this._distanceMeters){const{azimuth:e}=A(Ct,this._origin,t,this._spatialReference);v(t,this._origin,e??0,this._distanceMeters,this._spatialReference)}}}const St=[0,0],Ct=new D;function Gt(t,e,s,r,n){let{azimuth:i,distance:o}=A(Ot,e,r,n);i??=0;let c=o*Math.cos((i-s)*j);c=Math.max(0,c),v(t,e,s,c,n)}const Ot=new D;function Ht(t,e){const s=W();return nt(e,t.planeLike,s),s[2]=t.getZ(s[0],s[1])??ve,s}function Ft(t,e){if(_e(t)){const s=[];for(const r of t.constraints){const t=r.intersect(e);t&&s.push(t)}return ge(s)}if(_e(e))return Ft(e,t);if(qe(t))return le(t,e);if(qe(e))return le(e,t);if(Le(t)){const{point:s}=t;if(Le(e))return h(s,e.point)?t:void 0;const r=e.closestTo(s);return _(r,s)?t:void 0}if(ke(t)){if(Le(e))return Ft(e,t);if(ke(e))return pe(ot(t.lineLike,e.lineLike));if(xe(e))return Vt(t,e);if(ye(e))return pe(ct(e.planeLike,t.lineLike));if(ze(e))return pe(ut(t.lineLike,e.center,e.radius));if(Me(e))return pe(at(t.lineLike,e));if(Pe(e))return Yt(t,e);if(Te(e))return Bt(t,e)}else if(xe(t)){if(Le(e)||ke(e))return Ft(e,t);if(xe(e))return Kt(t,e);if(ye(e))return Qt(t,e);if(ze(e))return Wt(t,e);if(Me(e))return $t(t,e);if(Pe(e))return Xt(t,e);if(Te(e))return te(t,e)}else if(ye(t)){if(Le(e)||ke(e)||xe(e))return Ft(e,t);if(ye(e))return de(ht(t.planeLike,e.planeLike));if(ze(e))return de(tt(t.planeLike,e.center,e.radius));if(Me(e))return se(t,e);if(Pe(e))return ee(t,e);if(Te(e))return re(t,e)}else if(ze(t)){if(Le(e)||ke(e)||xe(e)||ye(e))return Ft(e,t);if(ze(e))return de(ft(K(t.center),t.radius,K(e.center),e.radius));if(Me(e))return ne();if(Pe(e))return ie(t,e);if(Te(e))return oe()}else if(Me(t)){if(Le(e)||ke(e)||xe(e)||ye(e)||ze(e))return Ft(e,t);if(Me(e))return ce();if(Pe(e))return ce(e.asCircle());if(Te(e))return ue()}else if(Pe(t)){if(Le(e)||ke(e)||xe(e)||ye(e)||ze(e)||Me(e))return Ft(e,t);if(Pe(e))return ae(e,t);if(Te(e))return he()}else if(Te(t)){if(Le(e)||ke(e)||xe(e)||ye(e)||ze(e)||Pe(e))return Ft(e,t);if(Te(e))return fe()}}const Vt=(()=>{const t=b();return(e,s)=>{const{start:r,end:n}=e;if(X(r,n)&&$(r[2],s.z))return e;const i=W();return E(s.getPlane(t),r,n,i)?new gt(i):void 0}})();function Yt({lineLike:t},{center:e,radius:s}){const r=e[2];return pe(ut(t,e,s).filter((t=>$(t[2],r))))}function Bt({lineLike:t},{sphere:e}){return pe(F(e,t.start,t.end))}const Jt=(()=>{const t=w(),e=z(),r=z();return(n,i,o)=>{const{normal:c,center:u,radius:h}=i;V(c,e,r);const f=S(n),l=h*L(f,e),d=h*L(f,r);T(t,u[0],u[1],u[2],1);const p=q(n,t),m=Math.hypot(l,d),g=$(m,0);if($(I(n,u),0)){if(g)return i;if($(h,0))return!o||et(o,u)?new gt(B(u)):void 0;k(e,f,c),x(e,e);const t=new Array,s=y(u);a(s,s,e,h),o&&!et(o,s)||t.push(s);const r=y(u);return a(r,r,e,-h),o&&!et(o,r)||t.push(r),pe(t)}if(g)return;const _=-p/m;if(Math.abs(_)>1||$(_,1))return;const P=Math.atan(l/d),M=s(_)-P,w=Math.PI-M,j=new Array,v=z();a(v,u,e,h*Math.cos(M)),a(v,v,r,h*Math.sin(M)),j.push(v);const A=z();return a(A,u,e,h*Math.cos(w)),a(A,A,r,h*Math.sin(w)),j.push(A),pe(o?lt(o,j):j)}})();function Kt(t,e){return $(t.z,e.z)?t:void 0}function Qt({z:t},{planeLike:e}){const[s,r]=e.start,[n,i]=e.end,o=J(s,r,t),c=J(n,i,t);return e.type===it.PLANE?new Lt(o,c):new kt(o,c)}function Wt(t,e){const[s,r]=e.center;return new zt(J(s,r,t.z),e.radius)}function Xt(t,e){return $(e.center[2],t.z)?e:void 0}const $t=(()=>{const t=b();return(e,s)=>Jt(e.getPlane(t),s,s.slicePlane)})();function te(t,{center:e,radius:s}){const r=Math.abs(e[2]-t.z);if(r>s&&!$(r,s))return;const n=J(e[0],e[1],t.z),i=Math.sqrt(s**2-r**2);return $(i,0)?void 0:new zt(n,i)}const ee=(()=>{const t=b();return(e,{center:s,radius:r})=>{const n=tt(e.planeLike,s,r),i=s[2];e.getSlicePlane(t);const o=new Array;for(const[c,u]of n){const e=[c,u,i];et(t,e)&&o.push(e)}return pe(o)}})(),se=(()=>{const t=b(),e=b();return(s,r)=>Jt(s.getPlane(t),r,s.getSlicePlane(e))})(),re=(()=>{const t=b();return(e,{center:s,radius:r})=>{const n=e.getPlane(t),i=R(n,s),o=Math.abs(i);if(o>r&&!$(o,r))return;const c=Math.sqrt(r**2-i**2);if($(c,0)){const t=W();return N(n,s,t),new gt(t)}const u=W(),h=y(S(n));return a(u,s,h,i),new Pt(u,c,h,e.getSlicePlane())}})();function ne(t,e){}function ie(t,e){const s=c(K(t.center),K(e.center));if($(s,0)&&$(t.radius,e.radius))return e;return me(ft(K(t.center),t.radius,K(e.center),e.radius),e.center[2])}function oe(t,e){}function ce(t,e){}function ue(t,e){}function ae(t,e){if(!X(t.center,e.center))return;const s=c(K(t.center),K(e.center));if($(s,0)&&$(t.radius,e.radius))return t;return me(ft(K(t.center),t.radius,K(e.center),e.radius),t.center[2])}function he(t,e){}function fe(t,e){}function le(t,e){const{planeLike:s,getZ:r}=t,n=new Array;if(Le(e))t.addIfOnTheGround(n,dt(s,e.point));else if(ke(e))t.addIfOnTheGround(n,ct(s,e.lineLike));else if(ze(e))for(const[i,o]of tt(s,e.center,e.radius)){const t=r(i,o);null!=t&&n.push(M(i,o,t))}else if(ye(e)||qe(e))for(const[i,o]of ht(s,e.planeLike)){const t=r(i,o)??ve;n.push(M(i,o,t))}return pe(n)}function de(t){return ge(t.map((([t,e])=>{const s=J(t,e,0),r=J(t,e,1);return new Lt(s,r)})))}function pe(t){return ge(t.map((t=>t?new gt(Y(t)):void 0)))}function me(t,e){return pe(t.map((([t,s])=>[t,s,e])))}function ge(e){if(0!==e.length)return 1===e.length?e[0]??void 0:new xt(e.filter(t))}function _e(t){return t instanceof xt}function Le(t){return t instanceof gt}function ke(t){return t instanceof _t}function xe(t){return t instanceof qt}function ye(t){return t instanceof jt}function ze(t){return t instanceof yt}function Pe(t){return t instanceof zt}function Me(t){return t instanceof Pt}function Te(t){return t instanceof Nt}function qe(t){return t instanceof Ut}function we(t){return t instanceof It}function je(t){return t instanceof Zt}const ve=0;export{Pt as CircleConstraint,mt as Constraint,Zt as CoordinateConstraint,Ut as DrapedLineConstraint,It as GeodesicConstraint,zt as HorizontalCircleConstraint,qt as HorizontalPlaneConstraint,Lt as LineConstraint,_t as LineLikeConstraint,gt as PointConstraint,kt as RayConstraint,xt as SetConstraint,Nt as SphereConstraint,yt as VerticalCylinderConstraint,Et as VerticalHalfPlaneConstraint,Rt as VerticalPlaneConstraint,jt as VerticalPlaneLikeConstraint,ge as constraintOrSet,Le as isPoint};
|