@arcgis/core 5.2.0-next.88 → 5.2.0-next.89

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.
Files changed (129) hide show
  1. package/Graphic.js +1 -1
  2. package/arcade/Dictionary.js +1 -1
  3. package/arcade/Pixel.js +1 -1
  4. package/arcade/Voxel.js +1 -1
  5. package/arcade/debug.js +1 -1
  6. package/arcade/functions/featuresetstats.js +1 -1
  7. package/arcade/functions/stats.js +1 -1
  8. package/assets/esri/core/workers/RemoteClient.js +1 -1
  9. package/assets/esri/core/workers/chunks/07613ecf13c38ad58b79.js +1 -0
  10. package/assets/esri/core/workers/chunks/090ea7a131f8f60203ed.js +1 -0
  11. package/assets/esri/core/workers/chunks/159b16f47665f94a0305.js +1 -0
  12. package/assets/esri/core/workers/chunks/15f4f7e34e14e3cf52e6.js +1 -0
  13. package/assets/esri/core/workers/chunks/1bf967c68d0c795d3fb4.js +1 -0
  14. package/assets/esri/core/workers/chunks/{304a36e862947fdb05c0.js → 20f6e681ccd8bf884b77.js} +1 -1
  15. package/assets/esri/core/workers/chunks/23addf8b11938e0c96e9.js +1 -0
  16. package/assets/esri/core/workers/chunks/30d816bdeea00f6fa1ca.js +1 -0
  17. package/assets/esri/core/workers/chunks/{b6f67302d0d5d57add66.js → 31a0620a6028e94c7532.js} +2 -2
  18. package/assets/esri/core/workers/chunks/39b6a5222f45cb8dbc94.js +1 -0
  19. package/assets/esri/core/workers/chunks/3aceedec9abfb2fdfa18.js +1 -0
  20. package/assets/esri/core/workers/chunks/3f82410d9f701e7ad8eb.js +1 -0
  21. package/assets/esri/core/workers/chunks/45858d1c6487f4a98e40.js +1 -0
  22. package/assets/esri/core/workers/chunks/45c1c90ac6c14657f3ff.js +1 -0
  23. package/assets/esri/core/workers/chunks/46f8c7ae7fb356c3410d.js +1 -0
  24. package/assets/esri/core/workers/chunks/486f1a3b7269ce6c3911.js +1 -0
  25. package/assets/esri/core/workers/chunks/4c7264e3f4156f92d613.js +1 -0
  26. package/assets/esri/core/workers/chunks/{a7727a2377470d586ff9.js → 51c9bd7c03d780fadebc.js} +1 -1
  27. package/assets/esri/core/workers/chunks/5bf65dbfd9c7a5ea187d.js +1 -0
  28. package/assets/esri/core/workers/chunks/607acd9f615f87e14075.js +1 -0
  29. package/assets/esri/core/workers/chunks/62ee6c247f783acabb74.js +1 -0
  30. package/assets/esri/core/workers/chunks/680557b8832fbdab7f46.js +1 -0
  31. package/assets/esri/core/workers/chunks/6b84982dfaf084a61b93.js +1 -0
  32. package/assets/esri/core/workers/chunks/777f2fdf1f4b9f243893.js +1 -0
  33. package/assets/esri/core/workers/chunks/{4d4ebb4e4d83c1123b63.js → 7e41cee4a0ae75e1490d.js} +1 -1
  34. package/assets/esri/core/workers/chunks/86c3d3c7015f1cd55fac.js +1 -0
  35. package/assets/esri/core/workers/chunks/87e0ceb1a64ab08e679a.js +1 -0
  36. package/assets/esri/core/workers/chunks/{dceaa6b68eee090073b1.js → 94453d075ce02eff4844.js} +1 -1
  37. package/assets/esri/core/workers/chunks/a176727a1148ca4fb432.js +1 -0
  38. package/assets/esri/core/workers/chunks/a6d4132a16c51323a38a.js +1 -0
  39. package/assets/esri/core/workers/chunks/a7e6382ecc91c876117f.js +1 -0
  40. package/assets/esri/core/workers/chunks/a88bf8ae93077e1b48cf.js +1 -0
  41. package/assets/esri/core/workers/chunks/bd1a7e95a797e1ed4a7b.js +1 -0
  42. package/assets/esri/core/workers/chunks/{70dc25f721c0ac5f3660.js → bdfffa5f88b559a4b42d.js} +1 -1
  43. package/assets/esri/core/workers/chunks/bf11319138facf44752c.js +1 -0
  44. package/assets/esri/core/workers/chunks/{0b7860a3f18d252b774a.js → c23943e51734254d31e8.js} +1 -1
  45. package/assets/esri/core/workers/chunks/c88bfa51d2a8a024fc24.js +1 -0
  46. package/assets/esri/core/workers/chunks/{fc4a5996fc03f6c32030.js → d58d6b55b2749a535eb3.js} +1 -1
  47. package/assets/esri/core/workers/chunks/{60f490afdbe299f89669.js → d871572997600930e017.js} +1 -1
  48. package/assets/esri/core/workers/chunks/e50adcfb392adfb3f79c.js +1 -0
  49. package/assets/esri/core/workers/chunks/eda04911553cf99fb99b.js +1 -0
  50. package/assets/esri/core/workers/chunks/f3716ce04d09af31cfb1.js +1 -0
  51. package/assets/esri/core/workers/chunks/f3e53be08ab9dbdf17ae.js +1 -0
  52. package/assets/esri/core/workers/chunks/{9eb3e6800f5034f1593f.js → f83c3597e9332bd991eb.js} +1 -1
  53. package/assets/esri/core/workers/chunks/f8a6d8cdcabcd1d511b6.js +1 -0
  54. package/chunks/array.js +1 -1
  55. package/chunks/boundedPlane.js +1 -1
  56. package/chunks/cameraUtilsSpherical.js +1 -1
  57. package/config.js +1 -1
  58. package/core/accessorSupport/Property.js +1 -1
  59. package/geometry/operators/support/projectionTransformation.js +1 -1
  60. package/geometry/support/convexPolyhedron.js +1 -1
  61. package/geometry/support/frustum.js +1 -1
  62. package/geometry/support/plane.js +1 -1
  63. package/kernel.js +1 -1
  64. package/layers/graphics/data/FlatFeatureStore.js +1 -1
  65. package/layers/graphics/data/QueryEngine.js +1 -1
  66. package/package.json +3 -3
  67. package/support/revision.js +1 -1
  68. package/views/2d/engine/vectorTiles/TileManager.js +1 -1
  69. package/views/2d/engine/webgl/util/Fader.js +1 -1
  70. package/views/3d/layers/I3SMeshView3D.js +1 -1
  71. package/views/3d/layers/IntegratedMeshNormals.js +1 -1
  72. package/views/3d/layers/i3s/SweptSphereVolume.js +1 -1
  73. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  74. package/views/3d/layers/support/IntegratedMesh3DTilesVertexProcessing.js +1 -1
  75. package/views/3d/state/Frustum.js +1 -1
  76. package/views/3d/support/sphericalTileUtils.js +1 -1
  77. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  78. package/views/3d/webgl-engine/lib/LineMaterial.js +2 -0
  79. package/views/3d/webgl-engine/lib/Material.js +1 -1
  80. package/views/3d/webgl-engine/lib/PointMaterial.js +2 -0
  81. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  82. package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
  83. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  84. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  85. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  86. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  87. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  88. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  89. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  90. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  91. package/views/interactive/sketch/constraints.js +1 -1
  92. package/views/popupAdapter.js +1 -1
  93. package/views/support/geometry3dUtils.js +1 -1
  94. package/widgets/FeatureTable/support/types.d.ts +3 -1
  95. package/assets/esri/core/workers/chunks/0439d4f4dfd6e78be97e.js +0 -1
  96. package/assets/esri/core/workers/chunks/12a3b55195ce3244259d.js +0 -1
  97. package/assets/esri/core/workers/chunks/19aa4072764937743bd8.js +0 -1
  98. package/assets/esri/core/workers/chunks/2724900f7992a79fc442.js +0 -1
  99. package/assets/esri/core/workers/chunks/35d3e60d15294f268992.js +0 -1
  100. package/assets/esri/core/workers/chunks/37a2be4380796f14fe4e.js +0 -1
  101. package/assets/esri/core/workers/chunks/414093fa4957d17bf551.js +0 -1
  102. package/assets/esri/core/workers/chunks/466bb1b69aabaeabad6a.js +0 -1
  103. package/assets/esri/core/workers/chunks/47e60b2acec18ef37b6c.js +0 -1
  104. package/assets/esri/core/workers/chunks/4849849fc8330d05a8e6.js +0 -1
  105. package/assets/esri/core/workers/chunks/4f0804429d8989aa4c51.js +0 -1
  106. package/assets/esri/core/workers/chunks/55572cefc752b755cf0a.js +0 -1
  107. package/assets/esri/core/workers/chunks/59cf23cc8f91b5bea31a.js +0 -1
  108. package/assets/esri/core/workers/chunks/6a4f007f87d9f2a6fbc4.js +0 -1
  109. package/assets/esri/core/workers/chunks/7c1f989ee3d13dfe7ebd.js +0 -1
  110. package/assets/esri/core/workers/chunks/7ce9c84f90e9dd1deb38.js +0 -1
  111. package/assets/esri/core/workers/chunks/7fc3231768ce79e375ae.js +0 -1
  112. package/assets/esri/core/workers/chunks/7febb434f2de2436435f.js +0 -1
  113. package/assets/esri/core/workers/chunks/909a85cb6e0e9a3c8567.js +0 -1
  114. package/assets/esri/core/workers/chunks/922c24b9bb68f4201b03.js +0 -1
  115. package/assets/esri/core/workers/chunks/9407db0584c730591161.js +0 -1
  116. package/assets/esri/core/workers/chunks/a0300fac6a06e7d89a52.js +0 -1
  117. package/assets/esri/core/workers/chunks/ab9927a32350063cb5f0.js +0 -1
  118. package/assets/esri/core/workers/chunks/adc2620cbe735532004d.js +0 -1
  119. package/assets/esri/core/workers/chunks/c4f582dec07895d3bb93.js +0 -1
  120. package/assets/esri/core/workers/chunks/cd8b3c2fc27c239f9954.js +0 -1
  121. package/assets/esri/core/workers/chunks/d04a01dc1b4947478264.js +0 -1
  122. package/assets/esri/core/workers/chunks/d6b87134e0d120c68d2f.js +0 -1
  123. package/assets/esri/core/workers/chunks/db4c9a9103e979292948.js +0 -1
  124. package/assets/esri/core/workers/chunks/e32a14770e036fce79d9.js +0 -1
  125. package/assets/esri/core/workers/chunks/eacf216dcd6397c7bd7f.js +0 -1
  126. package/assets/esri/core/workers/chunks/eff359210893239ecec3.js +0 -1
  127. package/assets/esri/core/workers/chunks/f210cd8afb86b6eaf7a2.js +0 -1
  128. package/assets/esri/core/workers/chunks/f250a7aa571889c5ad4b.js +0 -1
  129. package/assets/esri/core/workers/chunks/f31330d628d7e741bf5b.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{cyclical2PI as e}from"../core/Cyclical.js";import{lerp as t,deg2rad as r,rad2deg as o,asinClamped as s,clamp as n}from"../core/mathUtils.js";import{fromRotation as i,rotate as a}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{normalize as l,cross as m,dot as u,length as p,scale as f,distance as h,transformMat4 as g,negate as d,lerp as y,sqrDist as M,scaleAndAdd as j}from"../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as b,clone as v,create as x,fromValues as T}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as C,squaredLength as w}from"../core/libs/gl-matrix-2/math/vec4.js";import{create as R}from"../core/libs/gl-matrix-2/factories/vec4f64.js";import{getEpsilon as S}from"../core/libs/gl-matrix-2/math/common.js";import{getReferenceEllipsoid as U}from"../geometry/ellipsoidUtils.js";import H from"../geometry/Extent.js";import P from"../geometry/Polygon.js";import A from"../geometry/SpatialReference.js";import{isClockwise as I}from"../geometry/support/coordsUtils.js";import{fromPoints as q,create as E}from"../geometry/support/lineSegment.js";import{gcsCyclical as k}from"../geometry/support/normalizeUtils.js";import{fromPositionAndNormal as F,create as _,isPointInside as z,intersectLineOrRay as G,getNormal as W}from"../geometry/support/plane.js";import{wrap as O}from"../geometry/support/ray.js";import{Sphere as D}from"../geometry/support/sphere.js";import{geographicToWebMercator as L}from"../geometry/support/webMercatorUtils.js";import{Frustum as N}from"../views/3d/state/Frustum.js";import{minNearDistanceInMeters as B}from"../views/3d/state/NearFarHeuristic.js";import{directionToHeadingTilt as J,createDirectionUp as K,clampLineSegmentToPlane as Q}from"../views/3d/support/cameraUtilsInternal.js";import{getLonDeltaForDistance as V}from"../views/3d/support/earthUtils.js";import{slerp as X}from"../views/3d/support/mathUtils.js";const Y=T(0,0,1),Z=l(x(),T(1,1,1)),$=c(),ee=x(),te=x();function re(e,t,o,s=K()){m(ee,e,Y),0===u(ee,ee)&&m(ee,e,Z),i($,-r(t),e),a($,$,-r(o),ee);const{up:n,direction:c}=s;return m(n,ee,e),l(n,n),g(n,n,$),l(c,e),d(c,c),g(c,c,$),s}function oe(e,t,r,o){const s=ee,n=te;return l(s,e),m(te,s,Y),0===u(te,te)&&m(te,s,Z),m(n,te,s),J(t,r,o,s,n)}function se(e,t,o,n){const i={eye:x(),up:null,tilt:n,heading:o},a=ee;a[0]=e[0],a[1]=e[2],a[2]=-e[1];const c=t,l=r(o),m=r(n),u=Math.sin(l),h=Math.cos(l),g=Math.sin(m),d=Math.cos(m),y=p(a);let M;if(Math.abs(m)<1e-8)M=c+y;else{const e=y/g,t=s(c/e),r=Math.PI-m-t;M=e*Math.sin(r)}const j=d*c,b=c*c*(g*g),v=h*h*b,T=M-j,C=T*T,w=v*(v+C-a[1]*a[1]);if(w<0)return f(i.eye,a,M/y),i.tilt=0,ie(i,e);const R=Math.sqrt(w),S=a[1]*T,U=v+C;let H;if(H=h>0?-R+S:R+S,Math.abs(U)<1e-8)return y<1e-8?(i.eye[0]=0,i.eye[1]=0,i.eye[2]=c):f(i.eye,a,M/y),i.tilt=0,ne(i.eye),ie(i,e);i.eye[1]=H/U;const P=u*u*b,A=g*c,I=h*A*i.eye[1],q=i.eye[1]*i.eye[1],E=1-q,k=Math.sqrt(E),F=v*q+P-2*I*k*T+E*C;return Math.abs(F)<1e-8?(f(i.eye,a,M/y),i.tilt=0,ne(i.eye),ie(i,e)):(i.eye[0]=(E*(M*a[0]-j*a[0])-A*k*(a[0]*i.eye[1]*h+a[2]*u))/F,i.eye[2]=(E*(M*a[2]-j*a[2])-A*k*(a[2]*i.eye[1]*h-a[0]*u))/F,f(i.eye,i.eye,M),ne(i.eye),ie(i,e))}function ne(e){const t=e[1];e[1]=-e[2],e[2]=t}function ie(e,t){const r=re(t,e.heading,e.tilt);return e.up=r.up,e}function ae(e,t,r){const n=p(t),i=Math.sqrt(r*r+n*n-2*r*n*Math.cos(Math.PI-e)),a=s(r/(i/Math.sin(e)));return o(e-a)}function ce(e,t,o){const n=r(e),i=p(t);return s(o/(i/Math.sin(n)))+n}function le(t,s,n,i,a){let c,l,m,u;const p=s.latitude,f=U(t.spatialReference).radius,h=s.longitude,g=V(p,n,f)/2;c=h-g,l=h+g;const d=r(p),y=(1+Math.sin(d))/(1-Math.sin(d)),M=(y+1)*Math.tan(i/f/2),j=M*M;function b(t){const r=Math.PI/2;return(t=e.normalize(t,-r))>r&&(t=Math.PI-t),t}if(m=1.5*Math.PI-2*Math.atan(.5*(M+Math.sqrt(4*y+j))),u=m+i/f,m=b(m),u=b(u),u<m){const e=u;u=m,m=e}if(m=Math.max(o(m),-90),u=Math.min(o(u),90),l=k.monotonic(c,l),l-c>180){const e=(l-c-180)/2;c+=e,l-=e}const v=t.spatialReference&&t.spatialReference.isGeographic?t.spatialReference:A.WGS84;return a?(a.xmin=c,a.ymin=m,a.xmax=l,a.ymax=u,a.spatialReference=v):a=new H(c,m,l,u,v),t.spatialReference&&t.spatialReference.isWebMercator&&L(a,!1,a),a}function me(e,r){const{renderCoordsHelper:o}=e,s=e.state.camera.clone(),n=new N(o);s.near=B,n.update(s);const i=o.getAltitude(r),a=e.spatialReference,c=s.eye,l=ge(e),m=ue(e,r),u=s.aboveGround,p=n.planes[5],f=[],h=F(b,ye,_()),g=F(b,Me,_());C(Ce,0,0,0,0);const d=e=>{};for(let b=0;b<4;b++){const e=1===b&&!u||3===b&&u?1-l:0,r=1===b&&u||3===b&&!u?l:1,s=n.lines[b],a=n.lines[3===b?0:b+1];for(let n=0;n<m;n++){const l=n/m,u=0===n?0:t(e,r,1===b?1-(1-l)**2:3===b?l**2:l),j=y(be,s.origin,a.origin,u),x=X(s.direction,a.direction,u,je);o.intersectManifoldClosestSilhouette(O(j,x),i,ve),Q(ve,c,ve,p),f.push(v(ve)),0!==f.length&&d(M(f.at(-1),ve));const T=(z(h,ve)?1:0)|(z(g,ve)?2:0);Ce[T]=1}}f.length>2&&d(M(f[0],f.at(-1)));const j=pe(w(Ce)>1?fe(he(f,h),g):[f],o,a);return new P({rings:j,spatialReference:a})}function ue(e,r){const{renderCoordsHelper:o,state:s}=e;if(1!==s.viewingMode)return 1;const i=o.getAltitude(r),a=o.referenceEllipsoid.radius,c=1+h(s.camera.eye,r)/(a+i),l=Math.sqrt(c*c-1),{minCurvature:m,maxCurvature:u,minSamples:p,maxSamples:f}=de,g=n((l-m)/(u-m),0,1);return Math.round(t(p,f,g))}function pe(e,t,r){const o=2*S();return e.map(e=>{const s=[];let n=!1;for(const i of e)t.fromRenderCoords(i,ve,r),Math.abs(i[0])<o&&Math.abs(i[1])<o?(s.push([null,ve[1]]),s.push([null,ve[1]]),n=!0):s.push([ve[0],ve[1]]);if(n)for(let t=0;t<s.length;t++){const e=s[t];if(null!=e[0])continue;const r=s[t+1],o=s.at(0===t?-1:t-1);e[0]=o[0],t++;const n=s.at(t===s.length-1?0:t+1);r[0]=n[0]}return s.push(s[0]),I(s)||s.reverse(),s})}function fe(e,t){const r=[];for(const o of e)r.push(...he(o,t));return r}function he(e,t){const r=[],o=[],s=S();for(let i=0;i<e.length;i++){const n=e[i],a=i===e.length-1?e[0]:e[i+1],c=q(n,a,Te),l=G(t,c.origin,c.vector,0,ve);switch(l){case 2:r.push(n);break;case 3:o.push(n);break;case 0:case 1:{const[e,i,a]=0===l?[1,r,o]:[-1,o,r],c=W(t),m=j(x(),ve,c,e*s),u=j(x(),ve,c,e*-s);i.push(n),i.push(m),a.push(u)}}}const n=[];return r.length&&n.push(r),o.length&&n.push(o),n}function ge(e){const{renderCoordsHelper:t,state:r}=e,o=Math.abs(t.getAltitude(r.camera.center));return xe.radius=t.referenceEllipsoid.radius+o,r.camera.sphereFrustumCoverage(xe,t)}const de={minCurvature:r(5),maxCurvature:r(50),minSamples:1,maxSamples:6},ye=T(1,0,0),Me=T(0,1,0),je=x(),be=x(),ve=x(),xe=new D,Te=E(),Ce=R(),we=Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:oe,eyeForCenterWithHeadingTilt:se,eyeTiltToLookAtTilt:ce,getCurvatureSamples:ue,headingTiltToDirectionUp:re,lookAtTiltToEyeTilt:ae,toArea:me,toExtent:le},Symbol.toStringTag,{value:"Module"}));export{ce as a,le as b,we as c,oe as d,se as e,ue as g,re as h,ae as l,me as t};
2
+ import{cyclical2PI as e}from"../core/Cyclical.js";import{lerp as t,deg2rad as r,rad2deg as o,asinClamped as s,clamp as n}from"../core/mathUtils.js";import{fromRotation as i,rotate as a}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{normalize as l,cross as m,dot as u,length as p,scale as f,distance as h,transformMat4 as g,negate as d,lerp as y,sqrDist as M,scaleAndAdd as j}from"../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as b,clone as v,create as x,fromValues as T}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as C,squaredLength as w}from"../core/libs/gl-matrix-2/math/vec4.js";import{create as R}from"../core/libs/gl-matrix-2/factories/vec4f64.js";import{getEpsilon as S}from"../core/libs/gl-matrix-2/math/common.js";import{getReferenceEllipsoid as U}from"../geometry/ellipsoidUtils.js";import H from"../geometry/Extent.js";import P from"../geometry/Polygon.js";import A from"../geometry/SpatialReference.js";import{isClockwise as I}from"../geometry/support/coordsUtils.js";import{fromPoints as q,create as E}from"../geometry/support/lineSegment.js";import{gcsCyclical as k}from"../geometry/support/normalizeUtils.js";import{fromPositionAndNormal as F,create as _,isPointInClosedPositiveHalfspace as z,intersectLineOrRay as G,getNormal as W}from"../geometry/support/plane.js";import{wrap as O}from"../geometry/support/ray.js";import{Sphere as D}from"../geometry/support/sphere.js";import{geographicToWebMercator as L}from"../geometry/support/webMercatorUtils.js";import{Frustum as N}from"../views/3d/state/Frustum.js";import{minNearDistanceInMeters as B}from"../views/3d/state/NearFarHeuristic.js";import{directionToHeadingTilt as J,createDirectionUp as K,clampLineSegmentToPlane as Q}from"../views/3d/support/cameraUtilsInternal.js";import{getLonDeltaForDistance as V}from"../views/3d/support/earthUtils.js";import{slerp as X}from"../views/3d/support/mathUtils.js";const Y=T(0,0,1),Z=l(x(),T(1,1,1)),$=c(),ee=x(),te=x();function re(e,t,o,s=K()){m(ee,e,Y),0===u(ee,ee)&&m(ee,e,Z),i($,-r(t),e),a($,$,-r(o),ee);const{up:n,direction:c}=s;return m(n,ee,e),l(n,n),g(n,n,$),l(c,e),d(c,c),g(c,c,$),s}function oe(e,t,r,o){const s=ee,n=te;return l(s,e),m(te,s,Y),0===u(te,te)&&m(te,s,Z),m(n,te,s),J(t,r,o,s,n)}function se(e,t,o,n){const i={eye:x(),up:null,tilt:n,heading:o},a=ee;a[0]=e[0],a[1]=e[2],a[2]=-e[1];const c=t,l=r(o),m=r(n),u=Math.sin(l),h=Math.cos(l),g=Math.sin(m),d=Math.cos(m),y=p(a);let M;if(Math.abs(m)<1e-8)M=c+y;else{const e=y/g,t=s(c/e),r=Math.PI-m-t;M=e*Math.sin(r)}const j=d*c,b=c*c*(g*g),v=h*h*b,T=M-j,C=T*T,w=v*(v+C-a[1]*a[1]);if(w<0)return f(i.eye,a,M/y),i.tilt=0,ie(i,e);const R=Math.sqrt(w),S=a[1]*T,U=v+C;let H;if(H=h>0?-R+S:R+S,Math.abs(U)<1e-8)return y<1e-8?(i.eye[0]=0,i.eye[1]=0,i.eye[2]=c):f(i.eye,a,M/y),i.tilt=0,ne(i.eye),ie(i,e);i.eye[1]=H/U;const P=u*u*b,A=g*c,I=h*A*i.eye[1],q=i.eye[1]*i.eye[1],E=1-q,k=Math.sqrt(E),F=v*q+P-2*I*k*T+E*C;return Math.abs(F)<1e-8?(f(i.eye,a,M/y),i.tilt=0,ne(i.eye),ie(i,e)):(i.eye[0]=(E*(M*a[0]-j*a[0])-A*k*(a[0]*i.eye[1]*h+a[2]*u))/F,i.eye[2]=(E*(M*a[2]-j*a[2])-A*k*(a[2]*i.eye[1]*h-a[0]*u))/F,f(i.eye,i.eye,M),ne(i.eye),ie(i,e))}function ne(e){const t=e[1];e[1]=-e[2],e[2]=t}function ie(e,t){const r=re(t,e.heading,e.tilt);return e.up=r.up,e}function ae(e,t,r){const n=p(t),i=Math.sqrt(r*r+n*n-2*r*n*Math.cos(Math.PI-e)),a=s(r/(i/Math.sin(e)));return o(e-a)}function ce(e,t,o){const n=r(e),i=p(t);return s(o/(i/Math.sin(n)))+n}function le(t,s,n,i,a){let c,l,m,u;const p=s.latitude,f=U(t.spatialReference).radius,h=s.longitude,g=V(p,n,f)/2;c=h-g,l=h+g;const d=r(p),y=(1+Math.sin(d))/(1-Math.sin(d)),M=(y+1)*Math.tan(i/f/2),j=M*M;function b(t){const r=Math.PI/2;return(t=e.normalize(t,-r))>r&&(t=Math.PI-t),t}if(m=1.5*Math.PI-2*Math.atan(.5*(M+Math.sqrt(4*y+j))),u=m+i/f,m=b(m),u=b(u),u<m){const e=u;u=m,m=e}if(m=Math.max(o(m),-90),u=Math.min(o(u),90),l=k.monotonic(c,l),l-c>180){const e=(l-c-180)/2;c+=e,l-=e}const v=t.spatialReference&&t.spatialReference.isGeographic?t.spatialReference:A.WGS84;return a?(a.xmin=c,a.ymin=m,a.xmax=l,a.ymax=u,a.spatialReference=v):a=new H(c,m,l,u,v),t.spatialReference&&t.spatialReference.isWebMercator&&L(a,!1,a),a}function me(e,r){const{renderCoordsHelper:o}=e,s=e.state.camera.clone(),n=new N(o);s.near=B,n.update(s);const i=o.getAltitude(r),a=e.spatialReference,c=s.eye,l=ge(e),m=ue(e,r),u=s.aboveGround,p=n.planes[5],f=[],h=F(b,ye,_()),g=F(b,Me,_());C(Ce,0,0,0,0);const d=e=>{};for(let b=0;b<4;b++){const e=1===b&&!u||3===b&&u?1-l:0,r=1===b&&u||3===b&&!u?l:1,s=n.lines[b],a=n.lines[3===b?0:b+1];for(let n=0;n<m;n++){const l=n/m,u=0===n?0:t(e,r,1===b?1-(1-l)**2:3===b?l**2:l),j=y(be,s.origin,a.origin,u),x=X(s.direction,a.direction,u,je);o.intersectManifoldClosestSilhouette(O(j,x),i,ve),Q(ve,c,ve,p),f.push(v(ve)),0!==f.length&&d(M(f.at(-1),ve));const T=(z(h,ve)?1:0)|(z(g,ve)?2:0);Ce[T]=1}}f.length>2&&d(M(f[0],f.at(-1)));const j=pe(w(Ce)>1?fe(he(f,h),g):[f],o,a);return new P({rings:j,spatialReference:a})}function ue(e,r){const{renderCoordsHelper:o,state:s}=e;if(1!==s.viewingMode)return 1;const i=o.getAltitude(r),a=o.referenceEllipsoid.radius,c=1+h(s.camera.eye,r)/(a+i),l=Math.sqrt(c*c-1),{minCurvature:m,maxCurvature:u,minSamples:p,maxSamples:f}=de,g=n((l-m)/(u-m),0,1);return Math.round(t(p,f,g))}function pe(e,t,r){const o=2*S();return e.map(e=>{const s=[];let n=!1;for(const i of e)t.fromRenderCoords(i,ve,r),Math.abs(i[0])<o&&Math.abs(i[1])<o?(s.push([null,ve[1]]),s.push([null,ve[1]]),n=!0):s.push([ve[0],ve[1]]);if(n)for(let t=0;t<s.length;t++){const e=s[t];if(null!=e[0])continue;const r=s[t+1],o=s.at(0===t?-1:t-1);e[0]=o[0],t++;const n=s.at(t===s.length-1?0:t+1);r[0]=n[0]}return s.push(s[0]),I(s)||s.reverse(),s})}function fe(e,t){const r=[];for(const o of e)r.push(...he(o,t));return r}function he(e,t){const r=[],o=[],s=S();for(let i=0;i<e.length;i++){const n=e[i],a=i===e.length-1?e[0]:e[i+1],c=q(n,a,Te),l=G(t,c.origin,c.vector,0,ve);switch(l){case 2:r.push(n);break;case 3:o.push(n);break;case 0:case 1:{const[e,i,a]=0===l?[1,r,o]:[-1,o,r],c=W(t),m=j(x(),ve,c,e*s),u=j(x(),ve,c,e*-s);i.push(n),i.push(m),a.push(u)}}}const n=[];return r.length&&n.push(r),o.length&&n.push(o),n}function ge(e){const{renderCoordsHelper:t,state:r}=e,o=Math.abs(t.getAltitude(r.camera.center));return xe.radius=t.referenceEllipsoid.radius+o,r.camera.sphereFrustumCoverage(xe,t)}const de={minCurvature:r(5),maxCurvature:r(50),minSamples:1,maxSamples:6},ye=T(1,0,0),Me=T(0,1,0),je=x(),be=x(),ve=x(),xe=new D,Te=E(),Ce=R(),we=Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:oe,eyeForCenterWithHeadingTilt:se,eyeTiltToLookAtTilt:ce,getCurvatureSamples:ue,headingTiltToDirectionUp:re,lookAtTiltToEyeTilt:ae,toArea:me,toExtent:le},Symbol.toStringTag,{value:"Module"}));export{ce as a,le as b,we as c,oe as d,se as e,ue as g,re as h,ae as l,me as t};
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.88";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const s={apiKey:void 0,apiKeys:{scopes:[]},applicationName:"",applicationUrl:globalThis.location?.href,assetsPath:"",fontsUrl:"https://static.arcgis.com/fonts",geometryServiceUrl:"https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer",geoRSSServiceUrl:"https://utility.arcgis.com/sharing/rss",kmlServiceUrl:"https://utility.arcgis.com/sharing/kml",userPrivilegesApplied:!0,portalUrl:"https://www.arcgis.com",respectPrefersReducedMotion:!0,routeServiceUrl:"https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World",workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:["arcgis.com","arcgisonline.com","esrikr.com","premiumservices.blackbridge.com","esripremium.accuweather.com","gbm.digitalglobe.com","firstlook.digitalglobe.com","msi.digitalglobe.com"],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:"high",proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};if(globalThis.esriConfig&&(e(s,globalThis.esriConfig,!0),delete s.has),!s.assetsPath){{const e="5.2.0-next.89";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ObservableBase as t}from"./ObservableBase.js";import{trackAccess as i,runTracked as s,trackExplicitDependencies as e,runUntracked as o}from"./tracking.js";import{Flags as r}from"./tracking/Flags.js";import{TrackingTarget as a}from"./tracking/TrackingTarget.js";class n extends t{constructor(t,i){super(),this.propertyName=t,this.metadata=i,this.trackingTarget=new a(this),this.flags=0,this.flags=r.Dirty|(i.nonNullable?r.NonNullable:0)|(i.hasOwnProperty("value")?r.HasDefaultValue:0)|(void 0===i.get?r.DepTrackingInitialized:0)|(void 0===i.dependsOn?r.AutoTracked:0)}destroy(){this.flags&r.Dirty&&this.onCommitted(),super.destroy(),this.trackingTarget.destroy()}getComputed(t,a){t.mutable&&i(this);const n=t.store,l=this.propertyName,g=this.flags,h=n.get(l);if(g&r.Computing)return h;if(!(g&r.Dirty)&&n.has(l))return h;let d;this.flags|=r.Computing;const{host:m}=t;g&r.AutoTracked?d=s(this.trackingTarget,a,m):(e(m,this),d=a.call(m)),this.flags|=r.DepTrackingInitialized,n.set(l,d,1);const c=n.get(l);return c===h?this.flags&=~r.Dirty:o(this.commit,this),this.flags&=~r.Computing,c}notifyChange(){this.onInvalidated(),this.onCommitted()}invalidate(){this.onInvalidated()}commit(){this.flags&=~r.Dirty,this.onCommitted()}onInvalidated(){~this.flags&r.Overridden&&(this.flags|=r.Dirty);const t=this._observers;if(t&&t.length>0)for(const i of t)i.onInvalidated()}onCommitted(){const t=this._observers;if(t&&t.length>0){const i=t.slice();for(const t of i)t.onCommitted()}}}export{n as Property};
2
+ import{ObservableBase as t}from"./ObservableBase.js";import{trackAccess as i,runTracked as s,trackExplicitDependencies as e,runUntracked as r}from"./tracking.js";import{Flags as n}from"./tracking/Flags.js";import{TrackingTarget as o}from"./tracking/TrackingTarget.js";const a=new WeakMap;function g(t){const i=a.get(t);if(null!=i)return i;const s=n.Dirty|(t.nonNullable?n.NonNullable:0)|(t.hasOwnProperty("value")?n.HasDefaultValue:0)|(void 0===t.get?n.DepTrackingInitialized:0)|(void 0===t.dependsOn?n.AutoTracked:0);return a.set(t,s),s}class l extends t{get trackingTarget(){return this._trackingTarget??=new o(this)}constructor(t,i){super(),this.propertyName=t,this.metadata=i,this.flags=g(i)}destroy(){this.flags&n.Dirty&&this.onCommitted(),super.destroy(),this._trackingTarget?.destroy()}getComputed(t,o){t.mutable&&i(this);const a=t.store,g=this.propertyName,l=this.flags,h=a.get(g);if(l&n.Computing)return h;if(!(l&n.Dirty)&&a.has(g))return h;let c;this.flags|=n.Computing;const{host:d}=t;l&n.AutoTracked?c=s(this.trackingTarget,o,d):(e(d,this),c=o.call(d)),this.flags|=n.DepTrackingInitialized,a.set(g,c,1);const m=a.get(g);return m===h?this.flags&=~n.Dirty:r(this.commit,this),this.flags&=~n.Computing,m}notifyChange(){this.onInvalidated(),this.onCommitted()}invalidate(){this.onInvalidated()}commit(){this.flags&=~n.Dirty,this.onCommitted()}onInvalidated(){~this.flags&n.Overridden&&(this.flags|=n.Dirty);const t=this._observers;if(t&&t.length>0)for(const i of t)i.onInvalidated()}onCommitted(){const t=this._observers;if(t&&t.length>0){const i=t.slice();for(const t of i)t.onCommitted()}}}export{l as Property};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ac as e,y as t,z as n,E as s,D as a,C as r,ad as i,H as o}from"../../../chunks/UnitFactory.js";import"../../../chunks/Point2D.js";import"../../../chunks/Envelope.js";import"../../../chunks/Geometry.js";import{Envelope2D as c}from"../../../chunks/Envelope2D.js";function f(c,f,m){let u,d;if(m?.geographicTransformation){if(m.geographicTransformation.steps?.length){const s=new e;s.setInputSpatialReference(c),s.setOutputSpatialReference(f);for(const e of m.geographicTransformation.steps){let a;a=e.wkid?t(e.wkid,e.isInverse):n(e.wkt,e.isInverse),s.add(a)}u=s.create()}else u=i();if(m.extendedParams){d=o();const{densificationStep:e}=m.extendedParams;null!=e&&(d.densificationStep=e)}}else if(m?.areaOfInterestExtent)return s(c,f,p(m.areaOfInterestExtent));return u?a(c,f,u,d):r(c,f)}function p(e){return c.construct(e.xmin,e.ymin,e.xmax,e.ymax)}export{f as createProjectionTransformation};
2
+ import{ac as e,y as t,z as s,E as n,D as a,C as r,ad as o,H as i}from"../../../chunks/UnitFactory.js";import"../../../chunks/Point2D.js";import{E as c}from"../../../chunks/Envelope.js";import"../../../chunks/Geometry.js";import{clipToSpatialReference as p}from"../gx/operatorProject.js";function f(f,m,d){let l,u;if(d?.geographicTransformation){if(d.geographicTransformation.steps?.length){const n=new e;n.setInputSpatialReference(f),n.setOutputSpatialReference(m);for(const e of d.geographicTransformation.steps){let a;a=e.wkid?t(e.wkid,e.isInverse):s(e.wkt,e.isInverse),n.add(a)}l=n.create()}else l=o();if(d.extendedParams){u=i();const{densificationStep:e}=d.extendedParams;null!=e&&(u.densificationStep=e)}}else if(d?.areaOfInterestExtent){const e=p(new c(d.areaOfInterestExtent),f);return n(f,m,e.asEnvelope2D())}return l?a(f,m,l,u):r(f,m)}export{f as createProjectionTransformation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{signedDistance as t}from"./plane.js";function n(n,r,o=r.length){for(let f=0;f<o;++f){const o=r[f];let e=!0;for(const r of n){if(t(r,o)>0){e=!1;break}}if(e)return!0}return!1}function r(t,n,r){const o={t0:0,t1:1};for(const e of t){if(!f(e,n,r,o))return!1}return o.t0<o.t1}function o(t,n,r,o){const e={t0:0,t1:1};for(const i of n){if(!f(t[i],r,o,e))return!1}return e.t0<e.t1}function f(n,r,o,f){let{t0:e,t1:i}=f;const u=t(n,r),c=t(n,o);if(u>=0&&c>=0)return!1;if(u<0&&c>=0){const t=-u/(c-u);if(t<e)return!1;t<i&&(i=t)}else if(u>=0&&c<0){const t=u/(u-c);if(t>i)return!1;t>e&&(e=t)}return f.t0=e,f.t1=i,!0}export{r as edgeIntersectsPolyhedron,o as edgeIntersectsPolyhedronAtIndices,n as isAnyVertexInPolyhedron};
2
+ import{signedDistance as t,isPointInside as n}from"./plane.js";function r(t,r,o=r.length){for(let f=0;f<o;++f){const o=r[f];let e=!0;for(const r of t)if(!n(r,o)){e=!1;break}if(e)return!0}return!1}function o(t,n,r){const o={t0:0,t1:1};for(const f of t){if(!e(f,n,r,o))return!1}return o.t0<o.t1}function f(t,n,r,o){const f={t0:0,t1:1};for(const i of n){if(!e(t[i],r,o,f))return!1}return f.t0<f.t1}function e(n,r,o,f){let{t0:e,t1:i}=f;const u=t(n,r),c=t(n,o);if(u>=0&&c>=0)return!1;if(u<0&&c>=0){const t=-u/(c-u);if(t<e)return!1;t<i&&(i=t)}else if(u>=0&&c<0){const t=u/(u-c);if(t>i)return!1;t>e&&(e=t)}return f.t0=e,f.t1=i,!0}export{o as edgeIntersectsPolyhedron,f as edgeIntersectsPolyhedronAtIndices,r as isAnyVertexInPolyhedron};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{ObjectStack as t}from"../../core/ObjectStack.js";import{multiply as r,invert as o}from"../../core/libs/gl-matrix-2/math/mat4.js";import{transformMat4 as n,set as e}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as i}from"../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as u,width as a,depth as s,height as m}from"./aaBoundingBox.js";import{fromRay as l,fromLineSegmentAndDirection as p,create as b}from"./clipRay.js";import{edgeIntersectsPolyhedronAtIndices as j}from"./convexPolyhedron.js";import{create as g,fromPoints as h,signedDistance as x,clip as M,clipInfinite as v,copy as d}from"./plane.js";import{sm4d as y,sv4d as k}from"./vectorStacks.js";function B(t){return t?[g(t[0]),g(t[1]),g(t[2]),g(t[3]),g(t[4]),g(t[5])]:[g(),g(),g(),g(),g(),g()]}function S(){return[f(),f(),f(),f(),f(),f(),f(),f()]}function w(t,r){for(let o=0;o<N;o++)d(t[o],r[o]);return t}function O(t,n,f,c=W){const u=r(y.get(),n,t);o(u,u);for(let r=0;r<Q;++r){const t=i(k.get(),T[r],u);e(c[r],t[0]/t[3],t[1]/t[3],t[2]/t[3])}P(f,c)}function P(t,r){h(r[4],r[0],r[3],t[0]),h(r[1],r[5],r[6],t[1]),h(r[4],r[5],r[1],t[2]),h(r[3],r[2],r[6],t[3]),h(r[0],r[1],r[2],t[4]),h(r[5],r[4],r[7],t[5])}function R(t,r){return q(t,r.center,r.radius)}function q(t,r,o){for(let n=0;n<N;n++){const e=t[n];if(e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]>=o)return!1}return!0}function z(t,r,o){for(const n of V)if(A(t[n],r,o))return!0;return!1}function A(t,r,o){for(let n=0;n<o;++n)if(x(t,r[n])<=0)return!1;return!0}function C(t,r,o){const n=u(r,X),e=a(r)/2,f=s(r)/2,i=m(r)/2;return o?E(t,n,e,f,i,o):D(t,n,e,f,i)}function D(t,r,o,n,e){for(let f=0;f<N;f++){const i=t[f];if(i[0]*r[0]+i[1]*r[1]+i[2]*r[2]+i[3]-(Math.abs(i[0])*o+Math.abs(i[1])*n+Math.abs(i[2])*e)>0)return!1}return!0}function E(t,r,o,e,f,i){const c=n(Y,r,i);for(let n=0;n<N;n++){const r=t[n];if(r[0]*c[0]+r[1]*c[1]+r[2]*c[2]+r[3]-(Math.abs(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])*o+Math.abs(r[0]*i[4]+r[1]*i[5]+r[2]*i[6])*e+Math.abs(r[0]*i[8]+r[1]*i[9]+r[2]*i[10])*f)>0)return!1}return!0}function F(t,r){return K(t,l(r,U.get()))}function G(t,r){for(let o=0;o<N;o++){const n=t[o];if(!v(n,r))return!1}return!0}function H(t,r,o){return K(t,p(r,o,U.get()))}function I(t,r,o){return j(t,V,r,o)}function J(t,r){for(let o=0;o<N;o++){if(x(t[o],r)>0)return!1}return!0}function K(t,r){for(let o=0;o<N;o++)if(!M(t[o],r))return!1;return!0}const L={bottom:[5,1,0,4],near:[0,1,2,3],far:[5,4,7,6],right:[1,5,6,2],left:[4,0,3,7],top:[7,3,2,6]},N=6,Q=8,T=[c(-1,-1,-1,1),c(1,-1,-1,1),c(1,1,-1,1),c(-1,1,-1,1),c(-1,-1,1,1),c(1,-1,1,1),c(1,1,1,1),c(-1,1,1,1)],U=new t(b),V=[0,1,2,3,5],W=S(),X=f(),Y=f();export{P as computePlanes,w as copy,B as create,S as createPoints,I as edgeIntersectsFrustum,O as fromMatrix,G as intersectClipRay,H as intersectsLineSegment,J as intersectsPoint,F as intersectsRay,R as intersectsSphere,q as intersectsSphereCenterRadius,C as intersectsTransformedAabb,z as isConvexHullOutsideOfFrustum,N as numPlanes,Q as numPoints,L as planePointIndices};
2
+ import{ObjectStack as t}from"../../core/ObjectStack.js";import{multiply as r,invert as o}from"../../core/libs/gl-matrix-2/math/mat4.js";import{transformMat4 as n,set as e}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{transformMat4 as i}from"../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as a,width as s,depth as u,height as m}from"./aaBoundingBox.js";import{fromRay as l,fromLineSegmentAndDirection as p,create as b}from"./clipRay.js";import{edgeIntersectsPolyhedronAtIndices as j}from"./convexPolyhedron.js";import{create as g,signedDistance as h,fromPoints as x,clip as M,clipInfinite as v,copy as d,areAllPointsOutside as y}from"./plane.js";import{sm4d as k,sv4d as B}from"./vectorStacks.js";function S(t){return t?[g(t[0]),g(t[1]),g(t[2]),g(t[3]),g(t[4]),g(t[5])]:[g(),g(),g(),g(),g(),g()]}function w(){return[f(),f(),f(),f(),f(),f(),f(),f()]}function O(t,r){for(let o=0;o<N;o++)d(t[o],r[o]);return t}function P(t,n,f,c=W){const a=r(k.get(),n,t);o(a,a);for(let r=0;r<Q;++r){const t=i(B.get(),T[r],a);e(c[r],t[0]/t[3],t[1]/t[3],t[2]/t[3])}R(f,c)}function R(t,r){x(r[4],r[0],r[3],t[0]),x(r[1],r[5],r[6],t[1]),x(r[4],r[5],r[1],t[2]),x(r[3],r[2],r[6],t[3]),x(r[0],r[1],r[2],t[4]),x(r[5],r[4],r[7],t[5])}function q(t,r){return z(t,r.center,r.radius)}function z(t,r,o){for(let n=0;n<N;n++){const e=t[n];if(e[0]*r[0]+e[1]*r[1]+e[2]*r[2]+e[3]>=o)return!1}return!0}function A(t,r,o){for(const n of V)if(y(t[n],r,o))return!0;return!1}function C(t,r,o){const n=a(r,X),e=s(r)/2,f=u(r)/2,i=m(r)/2;return o?E(t,n,e,f,i,o):D(t,n,e,f,i)}function D(t,r,o,n,e){for(let f=0;f<N;f++){const i=t[f];if(i[0]*r[0]+i[1]*r[1]+i[2]*r[2]+i[3]-(Math.abs(i[0])*o+Math.abs(i[1])*n+Math.abs(i[2])*e)>0)return!1}return!0}function E(t,r,o,e,f,i){const c=n(Y,r,i);for(let n=0;n<N;n++){const r=t[n];if(r[0]*c[0]+r[1]*c[1]+r[2]*c[2]+r[3]-(Math.abs(r[0]*i[0]+r[1]*i[1]+r[2]*i[2])*o+Math.abs(r[0]*i[4]+r[1]*i[5]+r[2]*i[6])*e+Math.abs(r[0]*i[8]+r[1]*i[9]+r[2]*i[10])*f)>0)return!1}return!0}function F(t,r){return K(t,l(r,U.get()))}function G(t,r){for(let o=0;o<N;o++){const n=t[o];if(!v(n,r))return!1}return!0}function H(t,r,o){return K(t,p(r,o,U.get()))}function I(t,r,o){return j(t,V,r,o)}function J(t,r){for(let o=0;o<N;o++){if(h(t[o],r)>0)return!1}return!0}function K(t,r){for(let o=0;o<N;o++)if(!M(t[o],r))return!1;return!0}const L={bottom:[5,1,0,4],near:[0,1,2,3],far:[5,4,7,6],right:[1,5,6,2],left:[4,0,3,7],top:[7,3,2,6]},N=6,Q=8,T=[c(-1,-1,-1,1),c(1,-1,-1,1),c(1,1,-1,1),c(-1,1,-1,1),c(-1,-1,1,1),c(1,-1,1,1),c(1,1,1,1),c(-1,1,1,1)],U=new t(b),V=[0,1,2,3,5],W=w(),X=f(),Y=f();export{R as computePlanes,O as copy,S as create,w as createPoints,I as edgeIntersectsFrustum,P as fromMatrix,G as intersectClipRay,H as intersectsLineSegment,J as intersectsPoint,F as intersectsRay,q as intersectsSphere,z as intersectsSphereCenterRadius,C as intersectsTransformedAabb,A as isConvexHullOutsideOfFrustum,N as numPlanes,Q as numPoints,L as planePointIndices};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{clamp as t}from"../../core/mathUtils.js";import{exactEquals as n,subtract as r,normalize as o,dot as c,lerp as e,copy as u,add as i,scale as f,cross as s,set as a,scaleAndAdd as m}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as g,exactEquals as h}from"../../core/libs/gl-matrix-2/math/vec4.js";import{projectPointSignedLength as p}from"./vector.js";import{sv3d as M,sv4d as v}from"./vectorStacks.js";import{tangentFrame as b}from"../../views/3d/support/mathUtils.js";function j(t=ct){return[t[0],t[1],t[2],t[3]]}const x=h,q=g;function y(t=ct[0],n=ct[1],r=ct[2],o=ct[3]){return U(t,n,r,o,v.get())}function d(t,n){return U(n[0],n[1],n[2],n[3],t)}function E(t){return t}function U(t,n,r,o,c=j()){return c[0]=t,c[1]=n,c[2]=r,c[3]=o,c}function k(t,n,r){return u(r,t),r[3]=n,r}function w(t,n,r){const o=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],c=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return r[0]=n[0]*c,r[1]=n[1]*c,r[2]=n[2]*c,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function S(t,n,r,o=j()){const c=r[0]-n[0],e=r[1]-n[1],u=r[2]-n[2],i=t[0]-n[0],f=t[1]-n[1],s=t[2]-n[2],a=e*s-u*f,m=u*i-c*s,l=c*f-e*i,g=a*a+m*m+l*l,h=Math.abs(g-1)>1e-5&&g>1e-12?1/Math.sqrt(g):1;return o[0]=a*h,o[1]=m*h,o[2]=l*h,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function z(t,e,u,i=0,f=Math.floor(u*(1/3)),s=Math.floor(u*(2/3))){if(u<3)return!1;e(C,i);let a=f,m=!1;for(;a<u-1&&!m;)e(D,a),a++,m=!n(C,D);if(!m)return!1;for(a=Math.max(a,s),m=!1;a<u&&!m;)e(F,a),a++,r(G,C,D),o(G,G),r(H,D,F),o(H,H),m=!n(C,F)&&!n(D,F)&&Math.abs(c(G,H))<B;return m?(S(C,D,F,t),!0):(0!==i||1!==f||2!==s)&&z(t,e,u,0,1,2)}function A(t,n,r=!0){const o=n.length/3;return z(t,(t,r)=>a(t,n[3*r+0],n[3*r+1],n[3*r+2]),r?o-1:o)}const B=.99619469809,C=l(),D=l(),F=l(),G=l(),H=l();function I(t,n,r){return n!==t&&d(t,n),t[3]=-c(E(t),r),t}function J(t,n){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n}function K(t,n,r,o){return s(F,n,t),w(r,F,o)}function L(t,n,o,c){return rt(ot(t,n,r(M.get(),o,n),et,c))}function N(t,n,r){return null!=n&&rt(ot(t,n.origin,n.direction,ut,r))}function O(t,n,r){return rt(ot(t,n.origin,n.vector,0,r))}function P(t,n,r){return rt(ot(t,n.origin,n.vector,1,r))}function Q(t,n){return nt(t,n)>=0}function R(t,n){return V(t,n.ray.origin,n.ray.direction,n,!1,!1,!0)}function T(t,n){return V(t,n.ray.origin,n.ray.direction,n,!1,!1,!1)}function V(t,n,r,o,e,u,i){const f=c(E(t),r),s=nt(t,n);if(f>-1e-6&&f<1e-6)return W(s,e,u);const a=-s/f,m=W(f,e,!1);return!(i&&!m&&!W(s,e,u))&&(m?a>o.c0&&(o.c0=a):a<o.c1&&(o.c1=a),o.c0<=o.c1)}function W(t,n,r){return r?n?t>=0:t<=0:n?t>0:t<0}function X(t,n,r,o=!1){let c=n.at(-1),i=nt(t,c),f=o?i>0:i<=0;for(let s=0;s<n.length;s++){const a=n.at(s),m=nt(t,a),l=o?m>0:m<=0;f!==l&&e(r(),c,a,i/(i-m)),l&&u(r(),a),c=a,i=m,f=l}}function Y(t,n,o,c,e,u=!1){return r(it,o,n),ft.c0=0,ft.c1=1,!!V(t,n,it,ft,u,!u,!1)&&(m(c,n,it,ft.c0),m(e,n,it,ft.c1),!0)}function Z(t,n,o){const c=f(M.get(),E(t),-t[3]),e=_(t,r(M.get(),n,c),M.get());return i(o,e,c),o}function $(t,n,o,c){const e=E(t),u=M.get(),i=M.get();b(e,u,i);const f=r(M.get(),o,n),s=p(u,f),m=p(i,f),l=p(e,f);return a(c,s,m,l)}function _(t,n,o){const e=f(M.get(),E(t),c(E(t),n));return r(o,n,e),o}function tt(t,n){return Math.abs(nt(t,n))}function nt(t,n){return c(E(t),n)+t[3]}function rt(t){return 0===t||1===t}function ot(n,r,o,e,u){const s=c(E(n),o),a=nt(n,r);if(0===s)return a>=0?2:3;let m=-a/s;return 1&e&&(m=t(m,0,1)),!(4&e)&&m<0||!(8&e)&&m>1?a>=0?2:3:(i(u,r,f(u,o,m)),a>=0?0:1)}const ct=[0,0,1,0],et=12,ut=8,it=l(),ft={c0:0,c1:1};export{R as clip,T as clipInfinite,Y as clipLineSegment,X as clipPolygon,d as copy,j as create,tt as distance,q as equals,x as exactEquals,A as fromArray,z as fromManyPoints,k as fromNormalAndOffset,S as fromPoints,w as fromPositionAndNormal,U as fromValues,K as fromVectorsAndPoint,E as getNormal,L as intersectLine,ot as intersectLineOrRay,O as intersectLineSegment,P as intersectLineSegmentClamp,N as intersectRay,Q as isPointInside,J as negate,Z as projectPoint,$ as projectPointLocal,_ as projectVector,I as setOffsetFromPoint,nt as signedDistance,ct as up,y as wrap};
2
+ import{clamp as t}from"../../core/mathUtils.js";import{exactEquals as n,subtract as r,normalize as o,dot as e,lerp as c,copy as u,add as i,scale as f,cross as s,set as a,scaleAndAdd as l}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{equals as g,exactEquals as h}from"../../core/libs/gl-matrix-2/math/vec4.js";import{projectPointSignedLength as p}from"./vector.js";import{sv3d as M,sv4d as v}from"./vectorStacks.js";import{tangentFrame as b}from"../../views/3d/support/mathUtils.js";function j(t=ut){return[t[0],t[1],t[2],t[3]]}const x=h,q=g;function y(t=ut[0],n=ut[1],r=ut[2],o=ut[3]){return U(t,n,r,o,v.get())}function d(t,n){return U(n[0],n[1],n[2],n[3],t)}function E(t){return t}function U(t,n,r,o,e=j()){return e[0]=t,e[1]=n,e[2]=r,e[3]=o,e}function k(t,n,r){return u(r,t),r[3]=n,r}function w(t,n,r){const o=n[0]*n[0]+n[1]*n[1]+n[2]*n[2],e=Math.abs(o-1)>1e-5&&o>1e-12?1/Math.sqrt(o):1;return r[0]=n[0]*e,r[1]=n[1]*e,r[2]=n[2]*e,r[3]=-(r[0]*t[0]+r[1]*t[1]+r[2]*t[2]),r}function S(t,n,r,o=j()){const e=r[0]-n[0],c=r[1]-n[1],u=r[2]-n[2],i=t[0]-n[0],f=t[1]-n[1],s=t[2]-n[2],a=c*s-u*f,l=u*i-e*s,m=e*f-c*i,g=a*a+l*l+m*m,h=Math.abs(g-1)>1e-5&&g>1e-12?1/Math.sqrt(g):1;return o[0]=a*h,o[1]=l*h,o[2]=m*h,o[3]=-(o[0]*t[0]+o[1]*t[1]+o[2]*t[2]),o}function z(t,c,u,i=0,f=Math.floor(u*(1/3)),s=Math.floor(u*(2/3))){if(u<3)return!1;c(C,i);let a=f,l=!1;for(;a<u-1&&!l;)c(D,a),a++,l=!n(C,D);if(!l)return!1;for(a=Math.max(a,s),l=!1;a<u&&!l;)c(F,a),a++,r(G,C,D),o(G,G),r(H,D,F),o(H,H),l=!n(C,F)&&!n(D,F)&&Math.abs(e(G,H))<B;return l?(S(C,D,F,t),!0):(0!==i||1!==f||2!==s)&&z(t,c,u,0,1,2)}function A(t,n,r=!0){const o=n.length/3;return z(t,(t,r)=>a(t,n[3*r+0],n[3*r+1],n[3*r+2]),r?o-1:o)}const B=.99619469809,C=m(),D=m(),F=m(),G=m(),H=m();function I(t,n,r){return n!==t&&d(t,n),t[3]=-e(E(t),r),t}function J(t,n){return n[0]=-t[0],n[1]=-t[1],n[2]=-t[2],n[3]=-t[3],n}function K(t,n,r,o){return s(F,n,t),w(r,F,o)}function L(t,n,o,e){return et(ct(t,n,r(M.get(),o,n),it,e))}function N(t,n,r){return null!=n&&et(ct(t,n.origin,n.direction,ft,r))}function O(t,n,r){return et(ct(t,n.origin,n.vector,0,r))}function P(t,n,r){return et(ct(t,n.origin,n.vector,1,r))}function Q(t,n){return rt(t,n)<=0}function R(t,n){return rt(t,n)>=0}function T(t,n){return W(t,n.ray.origin,n.ray.direction,n,!1,!1,!0)}function V(t,n){return W(t,n.ray.origin,n.ray.direction,n,!1,!1,!1)}function W(t,n,r,o,c,u,i){const f=e(E(t),r),s=rt(t,n);if(f>-1e-6&&f<1e-6)return X(s,c,u);const a=-s/f,l=X(f,c,!1);return!(i&&!l&&!X(s,c,u))&&(l?a>o.c0&&(o.c0=a):a<o.c1&&(o.c1=a),o.c0<=o.c1)}function X(t,n,r){return r?n?t>=0:t<=0:n?t>0:t<0}function Y(t,n,r,o=!1){let e=n.at(-1),i=rt(t,e),f=o?i>0:i<=0;for(let s=0;s<n.length;s++){const a=n.at(s),l=rt(t,a),m=o?l>0:l<=0;f!==m&&c(r(),e,a,i/(i-l)),m&&u(r(),a),e=a,i=l,f=m}}function Z(t,n,o,e,c,u=!1){return r(st,o,n),at.c0=0,at.c1=1,!!W(t,n,st,at,u,!u,!1)&&(l(e,n,st,at.c0),l(c,n,st,at.c1),!0)}function $(t,n,o){const e=f(M.get(),E(t),-t[3]),c=tt(t,r(M.get(),n,e),M.get());return i(o,c,e),o}function _(t,n,o,e){const c=E(t),u=M.get(),i=M.get();b(c,u,i);const f=r(M.get(),o,n),s=p(u,f),l=p(i,f),m=p(c,f);return a(e,s,l,m)}function tt(t,n,o){const c=f(M.get(),E(t),e(E(t),n));return r(o,n,c),o}function nt(t,n){return Math.abs(rt(t,n))}function rt(t,n){return e(E(t),n)+t[3]}function ot(t,n,r){for(let o=0;o<r;++o)if(Q(t,n[o]))return!1;return!0}function et(t){return 0===t||1===t}function ct(n,r,o,c,u){const s=e(E(n),o),a=rt(n,r);if(0===s)return a>=0?2:3;let l=-a/s;return 1&c&&(l=t(l,0,1)),!(4&c)&&l<0||!(8&c)&&l>1?a>=0?2:3:(i(u,r,f(u,o,l)),a>=0?0:1)}const ut=[0,0,1,0],it=12,ft=8,st=m(),at={c0:0,c1:1};export{ot as areAllPointsOutside,T as clip,V as clipInfinite,Z as clipLineSegment,Y as clipPolygon,d as copy,j as create,nt as distance,q as equals,x as exactEquals,A as fromArray,z as fromManyPoints,k as fromNormalAndOffset,S as fromPoints,w as fromPositionAndNormal,U as fromValues,K as fromVectorsAndPoint,E as getNormal,L as intersectLine,ct as intersectLineOrRay,O as intersectLineSegment,P as intersectLineSegmentClamp,N as intersectRay,R as isPointInClosedPositiveHalfspace,Q as isPointInside,J as negate,$ as projectPoint,_ as projectPointLocal,tt as projectVector,I as setOffsetFromPoint,rt as signedDistance,ut as up,y as wrap};
package/kernel.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let r,s=e;function i(o){r=o}function t(e){const s=r?.findCredential(e);return s?.token?o(e,"token",s.token):e}s="5.2.0-next.88",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,s as fullVersion,r as id,i as setId,e as version};
2
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let r,s=e;function i(o){r=o}function t(e){const s=r?.findCredential(e);return s?.token?o(e,"token",s.token):e}s="5.2.0-next.89",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,s as fullVersion,r as id,i as setId,e as version};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{EventEmitter as r}from"../../../core/Evented.js";import s from"../../../core/Logger.js";import{getBoundingRect as o}from"../../../geometry/FlatGeometry.js";import{fromRect as i,create as u}from"../../../geometry/support/aaBoundingBox.js";import{BoundsStore as a}from"./BoundsStore.js";import{flatFeatureQueryEngineAdapter as n}from"./flatFeatureQueryEngineAdapter.js";import{cleanFromGeometryEngine as d}from"./geometryUtils.js";const h=u();class m{constructor(e,t,s){this.geometryType=e,this.hasZ=t,this.hasM=s,this._boundsStore=new a,this._featuresById=new Map,this._usedMemory=0,this.events=new r,this.featureAdapter=n}get usedMemory(){return this._usedMemory}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){const e=this._featuresById.size;let t=0;return this._featuresById.forEach(({geometry:e})=>{t+=e?e.vertexCount:0}),{featureCount:e,vertexCount:t}}getFullExtent(e){if(null==this.fullBounds)return null;const[t,r,s,o]=this.fullBounds;return{xmin:t,ymin:r,xmax:s,ymax:o,spatialReference:d(e)}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(t){const r=t.map(e=>this._upsert(e));return this._emitChanged(),r.filter(e)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged(),this._usedMemory=0}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(const r of e){const e=this._boundsStore.get(r.objectId);e&&t(i(h,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,e=>{t(this._featuresById.get(e))})}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const r=e.objectId;if(null==r)return void s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e}));const i=this._featuresById.get(r);let u;if(i?(e.displayId=i.displayId,u=this._boundsStore.get(r)??void 0,this._boundsStore.delete(r),this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0):this.onFeatureAdd?.(e),!e.geometry)return this._boundsStore.set(r,null),void this._featuresById.set(r,e);this._boundsStore.set(r,o(e.geometry,u)),this._featuresById.set(r,e),this._usedMemory+=this.estimateFeatureUsedMemory?.(e)??0}_upsert(e){const r=e?.objectId;if(null==r)return s.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const i=this._featuresById.get(r);if(!i)return this._add(e),e;this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0;const{geometry:u,attributes:a}=e;for(const t in a)i.attributes[t]=a[t];return u&&(i.geometry=u,this._boundsStore.set(r,o(u)??null)),this._usedMemory+=this.estimateFeatureUsedMemory?.(i)??0,i}_remove(e){null!=this.onFeatureRemove&&this.onFeatureRemove(e);const t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(e)??0,e}}export{m as default};
2
+ import{isSome as e}from"../../../core/arrayUtils.js";import t from"../../../core/Error.js";import{EventEmitter as s}from"../../../core/Evented.js";import r from"../../../core/Logger.js";import{getBoundingRect as o}from"../../../geometry/FlatGeometry.js";import{fromRect as i,create as u}from"../../../geometry/support/aaBoundingBox.js";import{BoundsStore as a}from"./BoundsStore.js";import{flatFeatureQueryEngineAdapter as n}from"./flatFeatureQueryEngineAdapter.js";const d=u();class h{constructor(e,t,r){this.geometryType=e,this.hasZ=t,this.hasM=r,this._boundsStore=new a,this._featuresById=new Map,this._usedMemory=0,this.events=new s,this.featureAdapter=n}get usedMemory(){return this._usedMemory}get numFeatures(){return this._featuresById.size}get fullBounds(){return this._boundsStore.fullBounds}get storeStatistics(){const e=this._featuresById.size;let t=0;return this._featuresById.forEach(({geometry:e})=>{t+=e?e.vertexCount:0}),{featureCount:e,vertexCount:t}}getFullExtent(e){if(null==this.fullBounds)return null;const[t,s,r,o]=this.fullBounds;return{xmin:t,ymin:s,xmax:r,ymax:o,spatialReference:e}}add(e){this._add(e),this._emitChanged()}addMany(e){for(const t of e)this._add(t);this._emitChanged()}upsertMany(t){const s=t.map(e=>this._upsert(e));return this._emitChanged(),s.filter(e)}clear(){this._featuresById.clear(),this._boundsStore.clear(),this._emitChanged(),this._usedMemory=0}removeById(e){const t=this._featuresById.get(e);return t?(this._remove(t),this._emitChanged(),t):null}removeManyById(e){this._boundsStore.invalidateIndex();for(const t of e){const e=this._featuresById.get(t);e&&this._remove(e)}this._emitChanged()}forEachBounds(e,t){for(const s of e){const e=this._boundsStore.get(s.objectId);e&&t(i(d,e))}}getFeature(e){return this._featuresById.get(e)}has(e){return this._featuresById.has(e)}forEach(e){this._featuresById.forEach(t=>e(t))}forEachInBounds(e,t){this._boundsStore.forEachInBounds(e,e=>{t(this._featuresById.get(e))})}_emitChanged(){this.events.emit("changed",void 0)}_add(e){if(!e)return;const s=e.objectId;if(null==s)return void r.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e}));const i=this._featuresById.get(s);let u;if(i?(e.displayId=i.displayId,u=this._boundsStore.get(s)??void 0,this._boundsStore.delete(s),this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0):this.onFeatureAdd?.(e),!e.geometry)return this._boundsStore.set(s,null),void this._featuresById.set(s,e);this._boundsStore.set(s,o(e.geometry,u)),this._featuresById.set(s,e),this._usedMemory+=this.estimateFeatureUsedMemory?.(e)??0}_upsert(e){const s=e?.objectId;if(null==s)return r.getLogger("esri.layers.graphics.data.FeatureStore").error(new t("featurestore:invalid-feature","feature id is missing",{feature:e})),null;const i=this._featuresById.get(s);if(!i)return this._add(e),e;this._usedMemory-=this.estimateFeatureUsedMemory?.(i)??0;const{geometry:u,attributes:a}=e;for(const t in a)i.attributes[t]=a[t];return u&&(i.geometry=u,this._boundsStore.set(s,o(u)??null)),this._usedMemory+=this.estimateFeatureUsedMemory?.(i)??0,i}_remove(e){null!=this.onFeatureRemove&&this.onFeatureRemove(e);const t=e.objectId;return this._boundsStore.delete(t),this._featuresById.delete(t),this._usedMemory-=this.estimateFeatureUsedMemory?.(e)??0,e}}export{h as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{isExtent as _,isPolygon as F}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as E,cleanFromGeometryEngine as b}from"./geometryUtils.js";import{checkProjectionSupport as T,project as A,projectMany as v}from"./projectionSupport.js";import{QueryEngineCache as G}from"./QueryEngineCache.js";import{queryCapabilities as k}from"./QueryEngineCapabilities.js";import{QueryEngineResult as C}from"./QueryEngineResult.js";import{queryEngineEmptyResult as O,normalizeAttributeBinsQuery as P,normalizeQueryLike as q,normalizeQuery as z}from"./queryUtils.js";import{validateAttributeBinsQuery as U,validateQuery as B,validateStatisticsQuery as M}from"./queryValidationUtils.js";import{getSpatialQueryOperator as H,canQueryWithRBush as Z}from"./spatialQuerySupport.js";import{getTimeExtent as J,getTimeOperator as L}from"./timeSupport.js";import N from"../../support/FieldsIndex.js";import{ImmediateTask as V}from"../../../views/support/Scheduler.js";const D="unsupported-query";class K{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class W{constructor(e){this._changeHandle=null,this.capabilities={query:k},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new G,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:N.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=V}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(D,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=J(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==O)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===O)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===O)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==O)throw t;return await new C([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await P(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==O)throw i;t=new C([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await q(l,this.definitionExpression,this.spatialReference),yield,l=await B(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const o=!S(i.spatialReference,this.spatialReference);o&&(await T(i.spatialReference,this.spatialReference),yield);const u="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=o?A(y,this.spatialReference):y;if(!h)return{candidates:[]};const[d]=await Q(w(i),{signal:t});yield;const[m]=await Q(w(h),{signal:t});if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(X(m.toJSON()));yield;const p=new C(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=o?A(x,this.spatialReference):x,_=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:_},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),Y(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new C(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:A(a,s);if(!n)return null;const l=i||r,o=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(X(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await H("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(u.getObjectId(e))||r(u.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new C(a,e,this);return await o(l)}if(!c.length)return new C([],e,this);if(this._canExecuteSinglePass(n,e))return await o(new C(c,e,this));const y=await H("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(u.getGeometry(e)));return yield,await o(new C(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,o=r?null:this._getCacheKey(i),u=o?this._cache.get(o):null;if(u)return new C(u,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:A(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(X(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await H(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new C(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new C([],i,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new C(p,i,this));const g=await H(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new C(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=L(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await H(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const o=r||s;return R(a)&&!S(this.spatialReference,a)&&o?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return Z(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await v(e.items.map(e=>E(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await z(e,this.definitionExpression,this.spatialReference),yield,e=await M(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==O)throw i;return new C([],e,this)}}get test(){}}function X(e){if(Z(e)){if(_(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function Y(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:b(r)};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=A(a,t,i);if(n.spatialReference=b(i),n.xmax-n.xmin===0){const e=u(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=u(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=u(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{K as Feature,W as QueryEngine,X as getQueryBoundingRects,Y as getQueryResultExtent};
2
+ import{indexOf as e,PositionHint as t}from"../../../core/arrayUtils.js";import{toConst as i}from"../../../core/compilerUtils.js";import r from"../../../core/Error.js";import"../../../core/has.js";import{clone as s}from"../../../core/lang.js";import{removeMaybe as a,destroyMaybe as n}from"../../../core/maybe.js";import{signalFromSignalOrOptions as l,throwIfAborted as o}from"../../../core/promiseUtils.js";import{getMetersPerUnitForSR as u}from"../../../core/units.js";import{isSerializable as c}from"../../../core/support/jsonUtils.js";import{isLoaded as y}from"../../../geometry/projectionUtils.js";import{set as h,create as d,expandWithAABB as m,negativeInfinity as f}from"../../../geometry/support/aaBoundingBox.js";import{fromValues as p,create as x}from"../../../geometry/support/aaBoundingRect.js";import{getBoundsXY as g}from"../../../geometry/support/boundsUtils.js";import{isExtent as _,isPolygon as F}from"../../../geometry/support/jsonTypeUtils.js";import{fromJSON as w}from"../../../geometry/support/jsonUtils.js";import{normalizeCentralMeridian as Q}from"../../../geometry/support/normalizeUtils.js";import{equals as S,isValid as R}from"../../../geometry/support/spatialReferenceUtils.js";import{convertFromGeometry as I}from"../featureConversionUtils.js";import{getWhereClause as j}from"./attributeSupport.js";import{getGeometry as E}from"./geometryUtils.js";import{checkProjectionSupport as b,project as T,projectMany as A}from"./projectionSupport.js";import{QueryEngineCache as v}from"./QueryEngineCache.js";import{queryCapabilities as G}from"./QueryEngineCapabilities.js";import{QueryEngineResult as k}from"./QueryEngineResult.js";import{queryEngineEmptyResult as C,normalizeAttributeBinsQuery as O,normalizeQueryLike as P,normalizeQuery as q}from"./queryUtils.js";import{validateAttributeBinsQuery as z,validateQuery as U,validateStatisticsQuery as B}from"./queryValidationUtils.js";import{getSpatialQueryOperator as M,canQueryWithRBush as H}from"./spatialQuerySupport.js";import{getTimeExtent as Z,getTimeOperator as J}from"./timeSupport.js";import L from"../../support/FieldsIndex.js";import{ImmediateTask as N}from"../../../views/support/Scheduler.js";const V="unsupported-query";class D{constructor(e,t=null,i,r,s){this.attributes=e,this.geometry=i,this.centroid=r,this.filterFlags=s,this.groupId=-1,this.displayId=t}}class K{constructor(e){this._changeHandle=null,this.capabilities={query:G},this.geometryType=e.geometryType,this.hasM=!!e.hasM,this.hasZ=!!e.hasZ,this.spatialReference=e.spatialReference,this.definitionExpression=e.definitionExpression,this.featureStore=e.featureStore,this.aggregateAdapter=e.aggregateAdapter,this._cache=e.cache??new v,this.timeInfo=e.timeInfo,this.featureIdInfo=e.featureIdInfo,this._changeHandle=this.featureStore.events.on("changed",()=>this._clearCache()),this.fieldsIndex=c(e.fieldsIndex)?e.fieldsIndex:L.fromJSON(e.fieldsIndex),!e.availableFields||1===e.availableFields.length&&"*"===e.availableFields[0]?this.availableFields=new Set(this.fieldsIndex.fields.map(e=>e.name)):this.availableFields=new Set(e.availableFields.map(e=>this.fieldsIndex.get(e)?.name).filter(e=>null!=e)),e.scheduler&&e.priority?this._frameTask=e.scheduler.registerTask(e.priority):this._frameTask=N}destroy(){this._changeHandle=a(this._changeHandle),this._frameTask=a(this._frameTask),this._clearCache(),n(this._cache)}get featureAdapter(){return this.featureStore.featureAdapter}async executeQuery(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryFeatureSet(e),i)}async executeQueryForCount(e={},t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForCount(e),i)}async executeQueryForExtent(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForExtent(e),i)}async executeQueryForIds(e,t){return Array.from(await this.executeQueryForIdSet(e,t))}async executeQueryForIdSet(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForIdSet(e),i)}async executeQueryForLatestObservations(e,t){const i=l(t);if(!this.timeInfo?.trackIdField)throw new r(V,"Missing timeInfo or timeInfo.trackIdField",{query:e,timeInfo:this.timeInfo});return await this._frameTask.scheduleGenerator(()=>this._executeQueryForLatestObservations(e),i)}async executeQueryForOpaqueFeatures(e,t){const i=l(t);return(await this._frameTask.scheduleGenerator(()=>this._executeQuery(e,{}),i)).items}async executeAttributeBinsQuery(e,t){const i=l(t);return e=s(e),await this._frameTask.scheduleGenerator(()=>this._executeAttributeBinsQuery(e),i)}async executeQueryForSummaryStatistics(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSummaryStatistics(e,t),r)}async executeQueryForUniqueValues(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForUniqueValues(e,t),r)}async executeQueryForClassBreaks(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForClassBreaks(e,t),r)}async executeQueryForHistogram(e={},t,i){const r=l(i);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForHistogram(e,t),r)}async executeQueryForSnapping(e,t){const i=l(t);return await this._frameTask.scheduleGenerator(()=>this._executeQueryForSnapping(e,i),i)}async fetchRecomputedExtents(e){const t=l(e);this._timeExtentPromise||=Z(this.timeInfo,this.featureStore);const[i,r]=await Promise.all([this._getFullExtent(),this._timeExtentPromise]);return o(t),{fullExtent:i,timeExtent:r}}_clearCache(){this._cache.clear(),this._allFeaturesPromise=null,this._timeExtentPromise=null,this._fullExtentPromise=null}async*_executeQueryFeatureSet(e){try{const t=yield*this._executeQuery(e,{});return yield,await t.createQueryResponse()}catch(t){if(t!==C)throw t;return await new k([],e,this).createQueryResponse()}}async*_executeQueryForCount(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!1,returnCentroid:!1,outSR:null});return yield,t.createQueryResponseForCount()}catch(t){if(t!==C)throw t;return 0}}async*_executeQueryForExtent(e){const t=e.outSR;try{const i=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const r=i.size;if(!r)return{count:0,extent:null};const s=await this._getBounds(i.items,i.spatialReference,t??this.spatialReference);return yield,{count:r,extent:s}}catch(i){if(i===C)return{count:0,extent:null};throw i}}async*_executeQueryForIdSet(e){try{const t=yield*this._executeQuery(e,{returnGeometry:!0,returnCentroid:!1,outSR:null});yield;const i=t.items,r=new Set;for(const e of i)r.add(t.featureAdapter.getObjectId(e));return r}catch(t){if(t===C)return new Set;throw t}}async*_executeQueryForLatestObservations(e){try{const t=yield*this._executeQuery(e,{});return yield,this._filterLatest(t),yield,await t.createQueryResponse()}catch(t){if(t!==C)throw t;return await new k([],e,this).createQueryResponse()}}async*_executeAttributeBinsQuery(e){let t;try{e=await O(e,this.definitionExpression,this.spatialReference),yield,e=await z(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield,t=yield*this._executeGeometryQuery(e,i),yield,this._executeAggregateIdsQuery(t),yield,this._executeObjectIdsQuery(t),yield,this._executeTimeQuery(t),yield,this._executeAttributesQuery(t),yield}catch(i){if(i!==C)throw i;t=new k([],e,this)}return await t.createQueryBinsResponse(e)}async*_executeQueryForSummaryStatistics(e={},t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createSummaryStatisticsResponse(t)}async*_executeQueryForUniqueValues(e={},t){const{field:i,field2:r,field3:s,valueExpression:a}=t,n=yield*this._executeQueryForStatistics(e,{field:i,field2:r,field3:s,valueExpression:a});return yield,await n.createUniqueValuesResponse(t)}async*_executeQueryForClassBreaks(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createClassBreaksResponse(t)}async*_executeQueryForHistogram(e,t){const{field:i,normalizationField:r,valueExpression:s}=t,a=yield*this._executeQueryForStatistics(e,{field:i,normalizationField:r,valueExpression:s});return yield,await a.createHistogramResponse(t)}async*_executeQueryForSnapping(e,t){const{point:i,distance:r,returnEdge:a,vertexMode:n}=e;if(!a&&"none"===n)return{candidates:[]};let l=s(e.query);l=await P(l,this.definitionExpression,this.spatialReference),yield,l=await U(l,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const o=!S(i.spatialReference,this.spatialReference);o&&(await b(i.spatialReference,this.spatialReference),yield);const u="number"==typeof r?r:r.x,c="number"==typeof r?r:r.y,y={xmin:i.x-u,xmax:i.x+u,ymin:i.y-c,ymax:i.y+c,spatialReference:i.spatialReference},h=o?T(y,this.spatialReference):y;if(!h)return{candidates:[]};const[d]=await Q(w(i),{signal:t});yield;const[m]=await Q(w(h),{signal:t});if(yield,null==d||null==m)return{candidates:[]};const f=await this._searchFeatures(W(m.toJSON()));yield;const p=new k(f,l,this);this._executeObjectIdsQuery(p),yield,this._executeTimeQuery(p),yield,this._executeAttributesQuery(p),yield,yield*this._executeGeometryQueryForSnapping(p),yield;const x=d.toJSON(),g=o?T(x,this.spatialReference):x,_=o?Math.max(h.xmax-h.xmin,h.ymax-h.ymin)/2:r;return p.createSnappingResponse({...e,point:g,distance:_},l.returnZ,i.spatialReference)}async _getBounds(e,t,i){const r=h(d(),f);return await this.featureStore.forEachBounds(e,e=>m(r,e)),X(r,t,i,this.spatialReference,this.hasZ)}_getFullExtent(){return this._fullExtentPromise||="getFullExtent"in this.featureStore&&this.featureStore.getFullExtent?Promise.resolve(this.featureStore.getFullExtent(this.spatialReference)):this._getAllFeatures().then(e=>this._getBounds(e,this.spatialReference,this.spatialReference)),this._fullExtentPromise}async _getAllFeaturesQueryEngineResult(e){return new k(await this._getAllFeatures(),e,this)}async _getAllFeatures(){if(null==this._allFeaturesPromise){const e=[];this._allFeaturesPromise=(async()=>await this.featureStore.forEach(t=>e.push(t)))().then(()=>i(e))}const e=this._allFeaturesPromise,t=await e;return e===this._allFeaturesPromise?t.slice():this._getAllFeatures()}async*_executeQuery(e,t){e=s(e),e=await q(e,this.definitionExpression,this.spatialReference),yield,e=await U(e,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield,e={...e,...t};const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),r}async*_executeSceneFilterQuery(e){if(null==e.sceneFilter)return null;const{outSR:t,returnGeometry:i,returnCentroid:r}=e,s=this.featureStore.featureSpatialReference,a=e.sceneFilter.geometry,n=null==s||S(s,a.spatialReference)?a:T(a,s);if(!n)return null;const l=i||r,o=R(t)&&!S(this.spatialReference,t)&&l?async e=>this._project(e,t):e=>e;yield;const u=this.featureAdapter,c=await this._searchFeatures(W(n));yield;if("disjoint"===e.sceneFilter.spatialRelationship){if(!c.length)return null;const t=new Set;for(const e of c)t.add(u.getObjectId(e));const i=await this._getAllFeatures();yield;const r=await M("esriSpatialRelDisjoint",n,this.geometryType);yield;const s=e=>!t.has(u.getObjectId(e))||r(u.getGeometry(e)),a=yield*this._runSpatialFilter(i,s);yield;const l=new k(a,e,this);return await o(l)}if(!c.length)return new k([],e,this);if(this._canExecuteSinglePass(n,e))return await o(new k(c,e,this));const y=await M("esriSpatialRelContains",n,this.geometryType);yield;const h=yield*this._runSpatialFilter(c,e=>y(u.getGeometry(e)));return yield,await o(new k(h,e,this))}async*_executeGeometryQuery(i,r){if(null!=r&&0===r.items.length)return r;const{geometry:s,outSR:a,returnGeometry:n,returnCentroid:l}=i,o=r?null:this._getCacheKey(i),u=o?this._cache.get(o):null;if(u)return new k(u,i,this);const c=R(a)&&!S(this.spatialReference,a),y=n||l,h=async e=>(c&&y&&await this._project(e,a),o&&this._cache.put(o,e.items),e),d=this.featureStore.featureSpatialReference,m=!s||null==d||S(d,s.spatialReference)?s:T(s,d);if(!m)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));yield;const f=this.featureAdapter;let p=await this._searchFeatures(W(s));yield;const x=i.spatialRel??"esriSpatialRelIntersects";if("esriSpatialRelDisjoint"===x){if(!p.length)return await h(null!=r?r:await this._getAllFeaturesQueryEngineResult(i));const e=new Set;for(const i of p)e.add(f.getObjectId(i));let t;null!=r?t=r.items:(yield,t=await this._getAllFeatures(),yield);const s=await M(x,m,this.geometryType);yield;const a=t=>!e.has(f.getObjectId(t))||s(f.getGeometry(t)),n=yield*this._runSpatialFilter(t,a);yield;const l=new k(n,i,this);return await h(l)}if(null!=r){const i=new t;p=p.filter(t=>e(r.items,t,r.items.length,i)>=0)}if(!p.length){const e=new k([],i,this);return o&&this._cache.put(o,e.items),e}if(this._canExecuteSinglePass(m,i))return await h(new k(p,i,this));const g=await M(x,m,this.geometryType);yield;const _=yield*this._runSpatialFilter(p,e=>g(f.getGeometry(e)));return yield,await h(new k(_,i,this))}_executeAggregateIdsQuery(e){if(0===e.items.length||!e.query.aggregateIds?.length||null==this.aggregateAdapter)return;const t=new Set;for(const r of e.query.aggregateIds){this.aggregateAdapter.getFeatureObjectIds(r).forEach(e=>t.add(e))}const i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeObjectIdsQuery(e){if(0===e.items.length||!e.query.objectIds?.length)return;const t=new Set(e.query.objectIds),i=this.featureAdapter.getObjectId;e.items=e.items.filter(e=>t.has(i(e)))}_executeTimeQuery(e){if(0===e.items.length)return;const t=J(this.timeInfo,e.query.timeExtent,this.featureAdapter);null!=t&&(e.items=e.items.filter(t))}_executeAttributesQuery(e){if(0===e.items.length)return;const t=j(e.query.where,this.fieldsIndex);if(t){if(!t.isStandardized)throw new TypeError("Where clause is not standardized");e.items=e.items.filter(e=>t.testFeature(e,this.featureAdapter))}}async*_executeGeometryQueryForSnapping(e){const{query:t}=e,{spatialRel:i}=t;if(!e?.items?.length||!t.geometry||!i)return;const r=await M(i,t.geometry,this.geometryType);yield;const s=this.featureAdapter,a=e=>r(s.getGeometry(e)),n=yield*this._runSpatialFilter(e.items,a);e.items=n}*_runSpatialFilter(e,t){if(!t)return e;if(null==this._frameTask)return e.filter(e=>t(e));let i=yield;const r=new Array;for(const s of e)t(s)&&r.push(s),i.madeProgress(),i.done&&(i=yield);return r}_filterLatest(e){const{trackIdField:t,startTimeField:i,endTimeField:r}=this.timeInfo,s=r||i,a=new Map,n=this.featureAdapter.getAttribute;for(const l of e.items){const e=n(l,t),i=n(l,s),r=a.get(e);(!r||i>n(r,s))&&a.set(e,l)}e.items=Array.from(a.values())}_getCacheKey(e){const{geometry:t,spatialRel:i,returnGeometry:r,returnCentroid:s,outSR:a,resultType:n,cacheHint:l}=e;if("tile"!==n&&!l)return null;const o=r||s;return R(a)&&!S(this.spatialReference,a)&&o?JSON.stringify([t,i,a]):JSON.stringify([t,i])}_canExecuteSinglePass(e,t){const{spatialRel:i}=t;return H(e)&&("esriSpatialRelEnvelopeIntersects"===i||"esriGeometryPoint"===this.geometryType&&("esriSpatialRelIntersects"===i||"esriSpatialRelContains"===i))}async _project(e,t){if(!t||S(this.spatialReference,t))return e;const r=this.featureAdapter,s=y()?await this._getFullExtent():void 0,a=await A(e.items.map(e=>E(this.geometryType,r.getGeometry(e))),this.spatialReference,t,{areaOfInterestExtent:s});return e.items=i(a.map((t,i)=>r.cloneWithGeometry(e.items[i],I(t,this.hasZ,this.hasM),this.geometryType))),e}async _searchFeatures(e){const t=new Set;await Promise.all(e.map(e=>this.featureStore.forEachInBounds(e,e=>t.add(e))));const i=Array.from(t.values());return t.clear(),i}async*_executeQueryForStatistics(e,t){e=s(e);try{e=await q(e,this.definitionExpression,this.spatialReference),yield,e=await B(e,t,{availableFields:this.availableFields,fieldsIndex:this.fieldsIndex,geometryType:this.geometryType,spatialReference:this.spatialReference}),yield;const i=yield*this._executeSceneFilterQuery(e);yield;const r=yield*this._executeGeometryQuery(e,i);return yield,this._executeAggregateIdsQuery(r),yield,this._executeObjectIdsQuery(r),yield,this._executeTimeQuery(r),yield,this._executeAttributesQuery(r),yield,r}catch(i){if(i!==C)throw i;return new k([],e,this)}}get test(){}}function W(e){if(H(e)){if(_(e))return[p(Math.min(e.xmin,e.xmax),Math.min(e.ymin,e.ymax),Math.max(e.xmin,e.xmax),Math.max(e.ymin,e.ymax))];if(F(e))return e.rings.map(e=>p(Math.min(e[0][0],e[2][0]),Math.min(e[0][1],e[2][1]),Math.max(e[0][0],e[2][0]),Math.max(e[0][1],e[2][1])))}return[g(x(),e)]}function X(e,t,i,r,s){const a={xmin:e[0],ymin:e[1],xmax:e[3],ymax:e[4],spatialReference:r};s&&isFinite(e[2])&&isFinite(e[5])&&(a.zmin=e[2],a.zmax=e[5],a.hasZ=!0);const n=T(a,t,i);if(n.spatialReference=i,n.xmax-n.xmin===0){const e=u(n.spatialReference);n.xmin-=e,n.xmax+=e}if(n.ymax-n.ymin===0){const e=u(n.spatialReference);n.ymin-=e,n.ymax+=e}if(s&&null!=n.zmin&&null!=n.zmax&&n.zmax-n.zmin===0){const e=u(n.spatialReference);n.zmin-=e,n.zmax+=e}return n}export{D as Feature,K as QueryEngine,W as getQueryBoundingRects,X as getQueryResultExtent};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.2.0-next.88",
3
+ "version": "5.2.0-next.89",
4
4
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
5
5
  "keywords": [
6
6
  "ArcGIS",
@@ -19,8 +19,8 @@
19
19
  "type": "module",
20
20
  "license": "SEE LICENSE IN LICENSE.md",
21
21
  "dependencies": {
22
- "@amcharts/amcharts5": "~5.20.2",
23
- "@arcgis/toolkit": "5.2.0-next.88",
22
+ "@amcharts/amcharts5": "~5.20.3",
23
+ "@arcgis/toolkit": "5.2.0-next.89",
24
24
  "@esri/arcgis-html-sanitizer": "~4.1.0",
25
25
  "@esri/calcite-components": "^5.2.0-next.52",
26
26
  "@vaadin/grid": "~25.2.8",
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- const b="20260825",d="dc8561b9b53b9a04393520e651d5a0d47483193e";export{b as buildDate,d as revision};
2
+ const e="20260826",d="685de96f9967bf618be6817ac7e973920e8ed6d5";export{e as buildDate,d as revision};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{LRUCache as e}from"../../../../core/LRUCache.js";import{fromValues as t,create as i,intersects as s}from"../../../../geometry/support/aaBoundingRect.js";import{tileSizeInPixels as l}from"./constants.js";import r from"../../tiling/TileCoverage.js";import n from"../../tiling/TileKey.js";const o=1e-6;class a{constructor(t,i){this._tiles=new Map,this._tileCache=new e(40,e=>e.dispose()),this._viewSize=[0,0],this._visibleTiles=new Map,this._previousLevel=-1,this._currentLevel=-1,this.acquireTile=t.acquireTile,this.releaseTile=t.releaseTile,this.tileInfoView=t.tileInfoView,this._container=i}destroy(){for(const e of this._tiles.values())e.dispose();this._tiles=null,this._tileCache.clear(),this._tileCache=null}update(e){this._updateCacheSize(e);const t=this.tileInfoView,i=t.getTileCoverage(e.state,0,!0,"smallest");if(!i)return!0;const{spans:s,lodInfo:l}=i,{level:o}=l,a=this._tiles;this._currentLevel=o;const c=new Set,h=new Set;for(const{row:r,colFrom:f,colTo:u}of s)for(let e=f;e<=u;e++){const t=n.getId(o,r,l.normalizeCol(e),l.getWorldForColumn(e)),i=this._getOrAcquireTile(t);c.add(t),i.processed()?this._addToContainer(i):h.add(new n(t))}for(const[r,n]of a)n.isCoverage=c.has(r);for(const r of h)this._findPlaceholdersForMissingTiles(r,c);let d=!1;for(const[r,n]of a)n.neededForCoverage=c.has(r),n.neededForCoverage||!n.isHoldingForFade&&n.fader.isFinished()||!t.intersects(i,n.key)||c.add(r),n.isFading&&(n.fader.value()<1&&null!=n.parentTile&&n.parentTile.hasData()&&c.add(n.parentTile.id),d=!0);for(const r of this._tiles.keys())c.has(r)||this._releaseTile(r);return r.pool.release(i),this._previousLevel=o,!d}clear(){this._tiles.clear(),this._tileCache.clear(),this._visibleTiles.clear()}clearCache(){this._tileCache.clear()}getIntersectingTiles(e,l,r,n,o){const a=[0,0],c=[0,0];n.toMap(a,e-r,l+r),n.toMap(c,e+r,l-r);const h=Math.min(a[0],c[0]),d=Math.min(a[1],c[1]),f=Math.max(a[0],c[0]),u=Math.max(a[1],c[1]),_=t(h,d,f,u),p=i(),T=[],v=new Set;for(const t of this._visibleTiles.values())this.tileInfoView.getTileBounds(p,t.key),s(_,p)&&(T.push(t),v.add(t.id));if(null!=o)for(const t of o){const e=t.tileKey.id;if(v.has(e))continue;const i=this._visibleTiles.get(e);null!=i&&(T.push(i),v.add(e))}return T}isFading(){for(const e of this._visibleTiles.values())if(e.isFading)return!0;return!1}_findPlaceholdersForMissingTiles(e,t){let i=0;for(const s of this._tiles.values())if(i+=this._addPlaceholderChild(s,e,t),Math.abs(1-i)<o)return null;return this._addPlaceholderParent(e.id,t)}_addPlaceholderChild(e,t,i){if(e.key.level<=t.level||!e.hasData())return 0;if(h(t,e.key)){this._addToContainer(e),i.add(e.id);return 1/(1<<2*(e.key.level-t.level))}return 0}_addPlaceholderParent(e,t){const i=this._tiles;let s=e;for(;;){if(s=c(s),!s||t.has(s))return null;const e=i.get(s);if(e?.hasData())return this._addToContainer(e),t.add(e.id),s}}_getOrAcquireTile(e){let t=this._tiles.get(e);return t||(t=this._tileCache.pop(e),t||(t=this._applyPlaceholderOpacity(this.acquireTile(new n(e)))),this._tiles.set(e,t),t)}_applyPlaceholderOpacity(e){const t=this._tiles;let i=e.id;for(;i&&(i=c(i),i);){const s=t.get(i);if(s?.hasData())return e.fader?.setStartOpacity(s.fader?.value()??1),e}const s=this._currentLevel<this._previousLevel?1:0;return e.fader?.setStartOpacity(s),e}_releaseTile(e){const t=this._tiles.get(e);this.releaseTile(t),this._removeFromContainer(t),this._tiles.delete(e),t.hasData()?this._tileCache.put(e,t,1):t.dispose()}_addToContainer(e){let t;const i=[],s=this._container;if(s.contains(e))return;const l=this._visibleTiles;for(const r of l.values())this._canConnectDirectly(e,r)&&i.push(r),null==t&&this._canConnectDirectly(r,e)&&(t=r);if(null!=t){for(const s of i)t.childrenTiles.delete(s),e.childrenTiles.add(s),s.parentTile=e;t.childrenTiles.add(e),e.parentTile=t,e.fader.setStartOpacity(t.fader?.value()??1)}else{e.fader.reset();for(const t of i)e.childrenTiles.add(t),t.parentTile=e}l.set(e.id,e),s.addChild(e)}_removeFromContainer(e){if(this._visibleTiles.delete(e.id),this._container.removeChild(e),null!=e.parentTile){e.parentTile.childrenTiles.delete(e);for(const t of e.childrenTiles)e.parentTile.childrenTiles.add(t)}for(const t of e.childrenTiles)t.parentTile=e.parentTile;e.parentTile=null,e.childrenTiles.clear()}_canConnectDirectly(e,t){const i=e.key;let{level:s,row:l,col:r,world:n}=t.key;const o=this._visibleTiles;for(;s>0;){if(s--,l>>=1,r>>=1,i.level===s&&i.row===l&&i.col===r&&i.world===n)return!0;if(o.has(`${s}/${l}/${r}/${n}`))return!1}return!1}_updateCacheSize(e){const t=e.state.size;if(t[0]===this._viewSize[0]&&t[1]===this._viewSize[1])return;const i=Math.ceil(t[0]/l)+1,s=Math.ceil(t[1]/l)+1;this._viewSize[0]=t[0],this._viewSize[1]=t[1],this._tileCache.maxSize=5*i*s}}function c(e){const[t,i,s,l]=e.split("/"),r=parseInt(t,10);return 0===r?null:`${r-1}/${parseInt(i,10)>>1}/${parseInt(s,10)>>1}/${parseInt(l,10)}`}function h(e,t){const i=t.level-e.level;return e.row===t.row>>i&&e.col===t.col>>i&&e.world===t.world}export{a as TileManager};
2
+ import{LRUCache as e}from"../../../../core/LRUCache.js";import{fromValues as t,create as i,intersects as s}from"../../../../geometry/support/aaBoundingRect.js";import{tileSizeInPixels as l}from"./constants.js";import r from"../../tiling/TileCoverage.js";import a from"../../tiling/TileKey.js";const o=1e-6;class n{constructor(t,i){this._tiles=new Map,this._tileCache=new e(40,e=>e.dispose()),this._viewSize=[0,0],this._visibleTiles=new Map,this._previousLevel=-1,this._currentLevel=-1,this._tilesFromCache=new Set,this.acquireTile=t.acquireTile,this.releaseTile=t.releaseTile,this.tileInfoView=t.tileInfoView,this._container=i}destroy(){for(const e of this._tiles.values())e.dispose();this._tiles=null,this._tileCache.clear(),this._tileCache=null,this._tilesFromCache.clear(),this._tilesFromCache=null}update(e){this._updateCacheSize(e);const t=this.tileInfoView,i=t.getTileCoverage(e.state,0,!0,"smallest");if(!i)return!0;const{spans:s,lodInfo:l}=i,{level:o}=l,n=this._tiles;this._currentLevel=o;const h=new Set,c=new Set;for(const{row:r,colFrom:f,colTo:_}of s)for(let e=f;e<=_;e++){const t=a.getId(o,r,l.normalizeCol(e),l.getWorldForColumn(e)),i=this._getOrAcquireTile(t);h.add(t),i.processed()?this._addToContainer(i):c.add(new a(t))}for(const[r,a]of n)a.isCoverage=h.has(r);for(const r of c)this._findPlaceholdersForMissingTiles(r,h);let d=!1;for(const[r,a]of n)a.neededForCoverage=h.has(r),a.neededForCoverage||!a.isHoldingForFade&&a.fader.isFinished()||!t.intersects(i,a.key)||h.add(r),a.isFading&&(a.fader.value()<1&&null!=a.parentTile&&a.parentTile.hasData()&&h.add(a.parentTile.id),d=!0);for(const r of this._tiles.keys())h.has(r)||this._releaseTile(r);return r.pool.release(i),this._previousLevel=o,!d}clear(){this._tiles.clear(),this._tileCache.clear(),this._visibleTiles.clear(),this._tilesFromCache.clear()}clearCache(){this._tileCache.clear(),this._tilesFromCache.clear()}getIntersectingTiles(e,l,r,a,o){const n=[0,0],h=[0,0];a.toMap(n,e-r,l+r),a.toMap(h,e+r,l-r);const c=Math.min(n[0],h[0]),d=Math.min(n[1],h[1]),f=Math.max(n[0],h[0]),_=Math.max(n[1],h[1]),u=t(c,d,f,_),p=i(),T=[],v=new Set;for(const t of this._visibleTiles.values())this.tileInfoView.getTileBounds(p,t.key),s(u,p)&&(T.push(t),v.add(t.id));if(null!=o)for(const t of o){const e=t.tileKey.id;if(v.has(e))continue;const i=this._visibleTiles.get(e);null!=i&&(T.push(i),v.add(e))}return T}isFading(){for(const e of this._visibleTiles.values())if(e.isFading)return!0;return!1}_findPlaceholdersForMissingTiles(e,t){let i=0;for(const s of this._tiles.values())if(i+=this._addPlaceholderChild(s,e,t),Math.abs(1-i)<o)return null;return this._addPlaceholderParent(e.id,t)}_addPlaceholderChild(e,t,i){if(e.key.level<=t.level||!e.hasData())return 0;if(c(t,e.key)){this._addToContainer(e),i.add(e.id);return 1/(1<<2*(e.key.level-t.level))}return 0}_addPlaceholderParent(e,t){const i=this._tiles;let s=e;for(;;){if(s=h(s),!s||t.has(s))return null;const e=i.get(s);if(e?.hasData())return this._addToContainer(e),t.add(e.id),s}}_getOrAcquireTile(e){let t=this._tiles.get(e);return t||(t=this._tileCache.pop(e),t?this._tilesFromCache.add(t):t=this._applyPlaceholderOpacity(this.acquireTile(new a(e))),this._tiles.set(e,t),t)}_applyPlaceholderOpacity(e){const t=this._tiles;let i=e.id;for(;i&&(i=h(i),i);){const s=t.get(i);if(s?.hasData())return e.fader?.setStartOpacity(s.fader?.value()??1),e}const s=this._currentLevel<this._previousLevel?1:0;return e.fader?.setStartOpacity(s),e}_releaseTile(e){const t=this._tiles.get(e);this.releaseTile(t),this._removeFromContainer(t),this._tiles.delete(e),t.hasData()?this._tileCache.put(e,t,1):t.dispose()}_addToContainer(e){let t;const i=[],s=this._container;if(s.contains(e))return;const l=this._tilesFromCache.delete(e),r=this._visibleTiles;for(const a of r.values())this._canConnectDirectly(e,a)&&i.push(a),null==t&&this._canConnectDirectly(a,e)&&(t=a);if(null!=t){for(const s of i)t.childrenTiles.delete(s),e.childrenTiles.add(s),s.parentTile=e;t.childrenTiles.add(e),e.parentTile=t,l||e.fader.setStartOpacity(t.fader.value())}else{l||e.fader.reset();for(const t of i)e.childrenTiles.add(t),t.parentTile=e}l&&e.fader.finish(),r.set(e.id,e),s.addChild(e)}_removeFromContainer(e){if(this._visibleTiles.delete(e.id),this._container.removeChild(e),null!=e.parentTile){e.parentTile.childrenTiles.delete(e);for(const t of e.childrenTiles)e.parentTile.childrenTiles.add(t)}for(const t of e.childrenTiles)t.parentTile=e.parentTile;e.parentTile=null,e.childrenTiles.clear()}_canConnectDirectly(e,t){const i=e.key;let{level:s,row:l,col:r,world:a}=t.key;const o=this._visibleTiles;for(;s>0;){if(s--,l>>=1,r>>=1,i.level===s&&i.row===l&&i.col===r&&i.world===a)return!0;if(o.has(`${s}/${l}/${r}/${a}`))return!1}return!1}_updateCacheSize(e){const t=e.state.size;if(t[0]===this._viewSize[0]&&t[1]===this._viewSize[1])return;const i=Math.ceil(t[0]/l)+1,s=Math.ceil(t[1]/l)+1;this._viewSize[0]=t[0],this._viewSize[1]=t[1],this._tileCache.maxSize=5*i*s}}function h(e){const[t,i,s,l]=e.split("/"),r=parseInt(t,10);return 0===r?null:`${r-1}/${parseInt(i,10)>>1}/${parseInt(s,10)>>1}/${parseInt(l,10)}`}function c(e,t){const i=t.level-e.level;return e.row===t.row>>i&&e.col===t.col>>i&&e.world===t.world}export{n as TileManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{now as t}from"../../../../../core/time.js";class i{static create(t,s,r=1){return new i(t,r,s)}constructor(i,s,r){this._finished=!1,this._duration=r,this._computedDuration=r,this._startOpacity=i,this._endOpacity=s,this._currentOpacity=i,this._startTime=t()}fade(){if(this._finished)return this._endOpacity;const i=t()-this._startTime,s=Math.min(i/this._computedDuration,1),r=this._startOpacity+s*(this._endOpacity-this._startOpacity);return 1===s&&(this._finished=!0),this._currentOpacity=r,r}value(){return this._currentOpacity}isFinished(){return this._finished}setStartOpacity(i){this._startOpacity=i,this._startTime=t()}reset(){this._startTime=t(),this._computedDuration=this._duration,this._finished=!1}}export{i as default};
2
+ import{now as t}from"../../../../../core/time.js";class i{static create(t,s,r=1){return new i(t,r,s)}constructor(i,s,r){this._finished=!1,this._duration=r,this._computedDuration=r,this._startOpacity=i,this._endOpacity=s,this._currentOpacity=i,this._startTime=t()}fade(){if(this._finished)return this._endOpacity;const i=t()-this._startTime,s=Math.min(i/this._computedDuration,1),r=this._startOpacity+s*(this._endOpacity-this._startOpacity);return 1===s&&(this._finished=!0),this._currentOpacity=r,r}value(){return this._currentOpacity}isFinished(){return this._finished}setStartOpacity(i){this._startOpacity=i,this._startTime=t()}reset(){this._startTime=t(),this._computedDuration=this._duration,this._finished=!1}finish(){this._startOpacity=this._endOpacity,this._currentOpacity=this._endOpacity,this._finished=!0}}export{i as default};