@arcgis/core 5.0.0-next.60 → 5.0.0-next.61

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 (192) hide show
  1. package/analysis/VolumeMeasurement/volumeMeasurementConfiguration.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{1e8ceed33a3657ac02b3.js → 153ff2ceefccd946498b.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{7147fc7502b385b302b2.js → 23b623637126f8411a30.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{a7aa87e2c4197ba595ef.js → 2abc205f81f26fc4852b.js} +2 -2
  6. package/assets/esri/core/workers/chunks/{492d575894c7905bb70c.js → 3d49c6427120edc8eac9.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{23a9dd9454d5249bbd59.js → 3da53c017f9c5d2d778a.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{60362c5651ef41fa7e5f.js → 4cf2bec636dd8ceecf0c.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{3d1a5a3467f3a6585b3e.js → 4f03d19a70dca6c507be.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{5d31fbabaa875f8627c0.js → 631a11a2b2001c708527.js} +1 -1
  11. package/assets/esri/core/workers/chunks/{fa95c9248fbfab338f2e.js → 63b8cd7d5cafbaeed894.js} +1 -1
  12. package/assets/esri/core/workers/chunks/6b4a24248182245167ca.js +1 -0
  13. package/assets/esri/core/workers/chunks/{352c674730c7b7258ae3.js → 76086517591d0eb35156.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{436f206898306df019ac.js → 7c47fefbf4c93b63200f.js} +1 -1
  15. package/assets/esri/core/workers/chunks/7e8573749a02e1f54fb1.js +1 -0
  16. package/assets/esri/core/workers/chunks/{424daef7b5dec1b99aba.js → af3e93a4ac3ff2addc90.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{bf82bb1cdd8b31e7f2aa.js → bb08359610a41e304b55.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{495b11fdecc3ba90d454.js → bfc063d4431bfa162160.js} +1 -1
  19. package/assets/esri/core/workers/chunks/d13b2ce8a89938b0472b.js +1 -0
  20. package/assets/esri/core/workers/chunks/{0483a2cfdb8c7158e73a.js → e85da52d9cc7d9396872.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{1ced78750c61600b2d4e.js → f351007cdcd0938d3b6c.js} +1 -1
  22. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ar.json +1 -1
  23. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bg.json +1 -1
  24. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_bs.json +1 -1
  25. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ca.json +1 -1
  26. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_cs.json +1 -1
  27. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_da.json +1 -1
  28. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_de.json +1 -1
  29. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_el.json +1 -1
  30. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_es.json +1 -1
  31. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_et.json +1 -1
  32. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fi.json +1 -1
  33. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_fr.json +1 -1
  34. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_he.json +1 -1
  35. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hr.json +1 -1
  36. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_hu.json +1 -1
  37. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_id.json +1 -1
  38. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_it.json +1 -1
  39. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ja.json +1 -1
  40. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ko.json +1 -1
  41. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lt.json +1 -1
  42. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_lv.json +1 -1
  43. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_nl.json +1 -1
  44. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_no.json +1 -1
  45. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pl.json +1 -1
  46. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-BR.json +1 -1
  47. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_pt-PT.json +1 -1
  48. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ro.json +1 -1
  49. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_ru.json +1 -1
  50. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sk.json +1 -1
  51. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sl.json +1 -1
  52. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sr.json +1 -1
  53. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_sv.json +1 -1
  54. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_th.json +1 -1
  55. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_tr.json +1 -1
  56. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_uk.json +1 -1
  57. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_vi.json +1 -1
  58. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-CN.json +1 -1
  59. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-HK.json +1 -1
  60. package/assets/esri/widgets/UtilityNetworkValidateTopology/t9n/UtilityNetworkValidateTopology_zh-TW.json +1 -1
  61. package/chunks/CutFillDepth.glsl.js +13 -10
  62. package/chunks/CutFillReduction.glsl.js +14 -8
  63. package/chunks/GaussianSplat.glsl.js +1 -1
  64. package/chunks/Laserlines.glsl.js +2 -2
  65. package/chunks/boundedPlane.js +1 -1
  66. package/chunks/cameraUtilsSpherical.js +1 -1
  67. package/chunks/vec32.js +1 -1
  68. package/config.js +1 -1
  69. package/core/libs/gl-matrix-2/math/vec3.js +1 -1
  70. package/effects/FocusAreas.d.ts +1 -1
  71. package/geometry/support/lineSegment.js +1 -1
  72. package/geometry/support/meshUtils/merge.js +1 -1
  73. package/geometry/support/sphere.js +1 -1
  74. package/kernel.js +1 -1
  75. package/layers/VoxelWasmPerSceneView.js +1 -1
  76. package/layers/orientedImagery/transformations/worldToImage.js +1 -1
  77. package/layers/support/FieldsIndex.d.ts +2 -1
  78. package/layers/support/tiles3DUtils.js +1 -1
  79. package/layers/voxel/VoxelVolume.js +1 -1
  80. package/package.json +1 -1
  81. package/support/revision.js +1 -1
  82. package/views/2d/engine/flow/dataUtils.js +1 -1
  83. package/views/2d/engine/flow/utils.js +1 -1
  84. package/views/2d/engine/vectorTiles/shaders/sources/shaderRepository.js +1 -1
  85. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  86. package/views/2d/interactive/SegmentLabels2D.js +1 -1
  87. package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
  88. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  89. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  90. package/views/3d/analysis/Dimension/lengthDimensionUtils.js +1 -1
  91. package/views/3d/analysis/LineOfSight/LineOfSightController.js +1 -1
  92. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  93. package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
  94. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillComputation.js +1 -1
  95. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  96. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  97. package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
  98. package/views/3d/animation/pointToPoint/Camera.js +1 -1
  99. package/views/3d/camera/constraintUtils/distance.js +1 -1
  100. package/views/3d/camera/constraintUtils/tilt.js +1 -1
  101. package/views/3d/environment/ChapmanApproximation.glsl.js +1 -1
  102. package/views/3d/environment/CloudsParameters.js +1 -1
  103. package/views/3d/environment/EnvironmentManager.js +1 -1
  104. package/views/3d/environment/MarsAtmosphere.js +1 -1
  105. package/views/3d/interactive/SegmentLabels3D.js +1 -1
  106. package/views/3d/interactive/editingTools/manipulations/MoveZManipulation.js +1 -1
  107. package/views/3d/interactive/editingTools/media/MediaElementManipulator3D.js +1 -1
  108. package/views/3d/interactive/editingTools/reshape/edgeOffsetUtils.js +1 -1
  109. package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
  110. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  111. package/views/3d/layers/FlowSubView3D.js +1 -1
  112. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  113. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  114. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  115. package/views/3d/layers/i3s/I3SViewportQueries.js +1 -1
  116. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  117. package/views/3d/layers/support/FeatureTileMeasurements3D.js +1 -1
  118. package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
  119. package/views/3d/state/Frustum.js +1 -1
  120. package/views/3d/state/controllers/FovController.js +1 -1
  121. package/views/3d/state/controllers/GamepadKeyboardController.js +1 -1
  122. package/views/3d/state/controllers/momentum/ZoomPlanarMomentumController.js +1 -1
  123. package/views/3d/support/FrustumExtentIntersection.js +1 -1
  124. package/views/3d/support/cameraUtils.js +1 -1
  125. package/views/3d/support/engineContent/line.js +1 -1
  126. package/views/3d/support/flow/FlowWorker.js +1 -1
  127. package/views/3d/support/flow/StreamlineResources3D.js +1 -1
  128. package/views/3d/support/flow/constants.js +1 -1
  129. package/views/3d/support/flow/geometryUtils.js +1 -1
  130. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  131. package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
  132. package/views/3d/support/intersectionUtils.js +1 -1
  133. package/views/3d/support/orientedBoundingBox.js +1 -1
  134. package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
  135. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  136. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  137. package/views/3d/support/viewpointUtils.js +1 -1
  138. package/views/3d/terrain/OverlayManager.js +1 -1
  139. package/views/3d/terrain/OverlayRenderer.js +1 -1
  140. package/views/3d/terrain/PatchRenderData.js +1 -1
  141. package/views/3d/terrain/SphericalPatch.js +1 -1
  142. package/views/3d/terrain/Tile.js +1 -1
  143. package/views/3d/webgl/RenderCamera.js +1 -1
  144. package/views/3d/webgl-engine/core/FBOCache.js +1 -1
  145. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  146. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  147. package/views/3d/webgl-engine/effects/geometry/RenderOccludedRenderNode.js +1 -1
  148. package/views/3d/webgl-engine/lib/CutFillDepth.js +1 -1
  149. package/views/3d/webgl-engine/lib/GPUPointOcclusionQuery.js +1 -1
  150. package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
  151. package/views/3d/webgl-engine/lib/MainFramebuffer.js +1 -1
  152. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  153. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  154. package/views/3d/webgl-engine/lib/ShadowAccumulator.js +1 -1
  155. package/views/3d/webgl-engine/lib/ShadowMap.js +1 -1
  156. package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
  157. package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
  158. package/views/3d/webgl-engine/lib/edgeRendering/edgePreprocessing.js +1 -1
  159. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  160. package/views/3d/webgl-engine/lib/triangleIntersectionUtils.js +1 -1
  161. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  165. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  166. package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +13 -12
  167. package/views/3d/webgl-engine/shaders/CutFillDepthTechniqueConfiguration.js +5 -0
  168. package/views/3d/webgl-engine/shaders/CutFillReductionTechniqueConfiguration.js +5 -0
  169. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  170. package/views/3d/webgl-engine/shaders/SphereDepthInterpolate.glsl.js +1 -1
  171. package/views/interactive/GraphicManipulator.js +1 -1
  172. package/views/interactive/coordinateHelper.js +1 -1
  173. package/views/interactive/editGeometry/operations/OffsetEdgeVertex.js +1 -1
  174. package/views/interactive/sketch/constraints.js +1 -1
  175. package/views/interactive/snapping/featureSources/sceneLayerSource/SceneLayerSnappingSourceWorker.js +1 -1
  176. package/views/interactive/snapping/featureSources/sceneLayerSource/sceneLayerSnappingUtils.js +1 -1
  177. package/views/interactive/snapping/hints/LineSnappingHint.js +1 -1
  178. package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
  179. package/views/navigation/PanSphericalMomentumEstimator.js +1 -1
  180. package/views/support/Scheduler.js +1 -1
  181. package/views/support/euclideanAreaMeasurementUtils.js +1 -1
  182. package/views/support/euclideanLengthMeasurementUtils.js +1 -1
  183. package/views/support/geometry3dUtils.js +1 -1
  184. package/webdoc/widgets/FloorFilter.js +1 -1
  185. package/widgets/Expand/ExpandViewModel.d.ts +1 -0
  186. package/widgets/Expand/ExpandViewModel.js +1 -1
  187. package/widgets/Expand.js +1 -1
  188. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  189. package/assets/esri/core/workers/chunks/1e17ad6cdffa5016a3db.js +0 -1
  190. package/assets/esri/core/workers/chunks/21ebd234cf32ae52b3ea.js +0 -1
  191. package/assets/esri/core/workers/chunks/262c5794650853457acc.js +0 -1
  192. /package/effects/{FocusAreaStyle.d.ts → types.d.ts} +0 -0
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../core/has.js";import s from"../core/Logger.js";import{acosClamped as t}from"../core/mathUtils.js";import{ObjectStack as i}from"../core/ObjectStack.js";import{invert as n,transpose as r,fromRotation as e}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as a,j as c,i as u,h as g,D as b,b as f,E as p,g as l,e as m,m as d,p as j,F as h,n as I}from"./vec32.js";import{fromValues as y,clone as v,create as P}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as N}from"../geometry/support/aaBoundingRect.js";import{projectPointClamp as w,distance2 as x,create as M}from"../geometry/support/lineSegment.js";import{create as S,wrap as T,copy as V,fromVectorsAndPoint as A,fromValues as E,intersectRay as _,intersectLineSegment as O,intersectLineSegmentClamp as F,isPointInside as k,projectPoint as R,signedDistance as q,getNormal as B,setOffsetFromPoint as C}from"../geometry/support/plane.js";import{distance2 as Y}from"../geometry/support/ray.js";import{projectPointSignedLength as L}from"../geometry/support/vector.js";import{sv3d as U}from"../geometry/support/vectorStacks.js";const z=()=>s.getLogger("esri.views.3d.support.geometryUtils.boundedPlane");function D(s=ws){return{plane:S(s.plane),origin:v(s.origin),basis1:v(s.basis1),basis2:v(s.basis2)}}function G(s,t,i){const n=Ts.get();return n.origin=s,n.basis1=t,n.basis2=i,n.plane=T(0,0,0,0),K(n),n}function W(s,t=D()){return J(s.origin,s.basis1,s.basis2,t)}function H(s,t){a(t.origin,s.origin),a(t.basis1,s.basis1),a(t.basis2,s.basis2),V(t.plane,s.plane)}function J(s,t,i,n=D()){return a(n.origin,s),a(n.basis1,t),a(n.basis2,i),K(n),Ps(n,"fromValues()"),n}function K(s){A(s.basis2,s.basis1,s.origin,s.plane)}function Q(s,t,i){s!==i&&W(s,i);const n=c(U.get(),js(s),t);return u(i.origin,i.origin,n),i.plane[3]-=t,i}function X(s,t,i){return $(t,i),Q(i,fs(s,s.origin),i),i}function Z(s,t){const i=s.basis1[0],n=s.basis2[1],[r,e]=s.origin;return N(r-i,e-n,r+i,e+n,t)}function $(s,t=D()){const i=(s[2]-s[0])/2,n=(s[3]-s[1])/2;return g(t.origin,s[0]+i,s[1]+n,0),g(t.basis1,i,0,0),g(t.basis2,0,n,0),E(0,0,1,0,t.plane),t}function ss(s,t,i){return!!_(s.plane,t,i)&&Is(s,i)}function ts(s,t,i){if(ss(s,t,i))return i;const n=is(s,t,U.get());return u(i,t.origin,c(U.get(),t.direction,b(t.origin,n)/f(t.direction))),i}function is(s,i,n){const r=xs.get();Ns(s,i,r,xs.get());let e=Number.POSITIVE_INFINITY;for(const o of Vs){const c=vs(s,o,Ms.get()),u=U.get();if(O(r,c,u)){const s=p(U.get(),i.origin,u),r=Math.abs(t(l(i.direction,s)));r<e&&(e=r,a(n,u))}}return e===Number.POSITIVE_INFINITY?rs(s,i,n):n}function ns(s,t){return(t-s)/t}function rs(s,t,i){if(ss(s,t,i))return i;const n=xs.get(),r=xs.get();Ns(s,t,n,r);let e=Number.POSITIVE_INFINITY;for(const o of Vs){const c=vs(s,o,Ms.get()),u=U.get();if(F(n,c,u)){const s=Y(t,u);if(!k(r,u))continue;s<e&&(e=s,a(i,u))}}return as(s,t.origin)<e&&es(s,t.origin,i),i}function es(s,t,i){const n=R(s.plane,t,U.get()),r=w(ys(s,s.basis1),n,-1,1,U.get()),e=w(ys(s,s.basis2),n,-1,1,U.get());return m(i,u(U.get(),r,e),s.origin),i}function os(s,t,i){const{origin:n,basis1:r,basis2:e}=s,o=m(U.get(),t,n),a=L(r,o),c=L(e,o),u=L(js(s),o);return g(i,a,c,u)}function as(s,t){const i=os(s,t,U.get()),{basis1:n,basis2:r}=s,e=f(n),o=f(r),a=Math.max(Math.abs(i[0])-e,0),c=Math.max(Math.abs(i[1])-o,0),u=i[2];return a*a+c*c+u*u}function cs(s,t){return Math.sqrt(as(s,t))}function us(s,t){let i=Number.NEGATIVE_INFINITY;for(const n of Vs){const r=vs(s,n,Ms.get()),e=x(r,t);e>i&&(i=e)}return Math.sqrt(i)}function gs(s,t){return q(s.plane,t)>0&&Is(s,t)}function bs(s,t,i,n){return hs(s,i,n)}function fs(s,t){const i=-s.plane[3];return L(js(s),t)-i}function ps(s,t,i,n){const r=fs(s,t),e=c(Ss,js(s),i-r);return u(n,t,e),n}function ls(s,t){return d(s.basis1,t.basis1)&&d(s.basis2,t.basis2)&&d(s.origin,t.origin)}function ms(s,t,i){return s!==i&&W(s,i),n(As,t),r(As,As),j(i.basis1,s.basis1,As),j(i.basis2,s.basis2,As),j(B(i.plane),B(s.plane),As),j(i.origin,s.origin,t),C(i.plane,i.plane,i.origin),i}function ds(s,t,i,n){return s!==n&&W(s,n),e(Es,t,i),j(n.basis1,s.basis1,Es),j(n.basis2,s.basis2,Es),K(n),n}function js(s){return B(s.plane)}function hs(s,t,i){switch(t){case 0:a(i,s.basis1),I(i,i);break;case 1:a(i,s.basis2),I(i,i);break;case 2:a(i,js(s))}return i}function Is(s,t){const i=m(U.get(),t,s.origin),n=h(s.basis1),r=h(s.basis2),e=l(s.basis1,i),o=l(s.basis2,i);return-e-n<0&&e-n<0&&-o-r<0&&o-r<0}function ys(s,t){const i=Ms.get();return a(i.origin,s.origin),a(i.vector,t),i}function vs(s,t,i){const{basis1:n,basis2:r,origin:e}=s,o=c(U.get(),n,t.origin[0]),a=c(U.get(),r,t.origin[1]);u(i.origin,o,a),u(i.origin,i.origin,e);const g=c(U.get(),n,t.direction[0]),b=c(U.get(),r,t.direction[1]);return c(i.vector,u(g,g,b),2),i}function Ps(s,t){Math.abs(l(s.basis1,s.basis2)/(f(s.basis1)*f(s.basis2)))>1e-6&&z().warn(t,"Provided basis vectors are not perpendicular"),Math.abs(l(s.basis1,js(s)))>1e-6&&z().warn(t,"Basis vectors and plane normal are not perpendicular"),Math.abs(-l(js(s),s.origin)-s.plane[3])>1e-6&&z().warn(t,"Plane offset is not consistent with plane origin")}function Ns(s,t,i,n){const r=js(s);A(r,t.direction,t.origin,i),A(B(i),r,t.origin,n)}const ws={plane:S(),origin:y(0,0,0),basis1:y(1,0,0),basis2:y(0,1,0)},xs=new i(S),Ms=new i(M),Ss=P(),Ts=new i(()=>D()),Vs=[{origin:[-1,-1],direction:[1,0]},{origin:[1,-1],direction:[0,1]},{origin:[1,1],direction:[-1,0]},{origin:[-1,1],direction:[0,-1]}],As=o(),Es=o(),_s=Object.freeze(Object.defineProperty({__proto__:null,altitudeAt:fs,axisAt:bs,cameraFrustumCoverage:ns,closestPoint:rs,closestPointOnSilhouette:is,copy:W,copyWithoutVerify:H,create:D,distance:cs,distance2:as,distanceToSilhouette:us,elevate:Q,equals:ls,extrusionContainsPoint:gs,fromAABoundingRect:$,fromValues:J,getExtent:Z,intersectRay:ss,intersectRayClosestSilhouette:ts,normal:js,projectPoint:es,projectPointLocal:os,rotate:ds,setAltitudeAt:ps,setExtent:X,transform:ms,up:ws,updateUnboundedPlane:K,wrap:G},Symbol.toStringTag,{value:"Module"}));export{fs as A,ps as B,ms as C,ws as D,ns as a,_s as b,W as c,D as d,gs as e,J as f,ls as g,$ as h,ss as i,cs as j,H as k,Q as l,Z as m,js as n,ts as o,is as p,rs as q,ds as r,X as s,es as t,K as u,os as v,G as w,as as x,us as y,bs as z};
5
+ import"../core/has.js";import s from"../core/Logger.js";import{acosClamped as t}from"../core/mathUtils.js";import{ObjectStack as i}from"../core/ObjectStack.js";import{invert as n,transpose as r,fromRotation as e}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{d as a,j as c,i as u,h as g,B as b,b as f,C as p,g as l,e as m,m as d,p as j,D as h,n as I}from"./vec32.js";import{fromValues as y,clone as v,create as P}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as N}from"../geometry/support/aaBoundingRect.js";import{projectPointClamp as w,distance2 as x,create as M}from"../geometry/support/lineSegment.js";import{create as S,wrap as T,copy as V,fromVectorsAndPoint as A,fromValues as _,intersectRay as E,intersectLineSegment as O,intersectLineSegmentClamp as k,isPointInside as B,projectPoint as C,signedDistance as F,getNormal as R,setOffsetFromPoint as q}from"../geometry/support/plane.js";import{distance2 as Y}from"../geometry/support/ray.js";import{projectPointSignedLength as L}from"../geometry/support/vector.js";import{sv3d as U}from"../geometry/support/vectorStacks.js";const z=()=>s.getLogger("esri.views.3d.support.geometryUtils.boundedPlane");function D(s=ws){return{plane:S(s.plane),origin:v(s.origin),basis1:v(s.basis1),basis2:v(s.basis2)}}function G(s,t,i){const n=Ts.get();return n.origin=s,n.basis1=t,n.basis2=i,n.plane=T(0,0,0,0),K(n),n}function W(s,t=D()){return J(s.origin,s.basis1,s.basis2,t)}function H(s,t){a(t.origin,s.origin),a(t.basis1,s.basis1),a(t.basis2,s.basis2),V(t.plane,s.plane)}function J(s,t,i,n=D()){return a(n.origin,s),a(n.basis1,t),a(n.basis2,i),K(n),Ps(n,"fromValues()"),n}function K(s){A(s.basis2,s.basis1,s.origin,s.plane)}function Q(s,t,i){s!==i&&W(s,i);const n=c(U.get(),js(s),t);return u(i.origin,i.origin,n),i.plane[3]-=t,i}function X(s,t,i){return $(t,i),Q(i,fs(s,s.origin),i),i}function Z(s,t){const i=s.basis1[0],n=s.basis2[1],[r,e]=s.origin;return N(r-i,e-n,r+i,e+n,t)}function $(s,t=D()){const i=(s[2]-s[0])/2,n=(s[3]-s[1])/2;return g(t.origin,s[0]+i,s[1]+n,0),g(t.basis1,i,0,0),g(t.basis2,0,n,0),_(0,0,1,0,t.plane),t}function ss(s,t,i){return!!E(s.plane,t,i)&&Is(s,i)}function ts(s,t,i){if(ss(s,t,i))return i;const n=is(s,t,U.get());return u(i,t.origin,c(U.get(),t.direction,b(t.origin,n)/f(t.direction))),i}function is(s,i,n){const r=xs.get();Ns(s,i,r,xs.get());let e=Number.POSITIVE_INFINITY;for(const o of Vs){const c=vs(s,o,Ms.get()),u=U.get();if(O(r,c,u)){const s=p(U.get(),i.origin,u),r=Math.abs(t(l(i.direction,s)));r<e&&(e=r,a(n,u))}}return e===Number.POSITIVE_INFINITY?rs(s,i,n):n}function ns(s,t){return(t-s)/t}function rs(s,t,i){if(ss(s,t,i))return i;const n=xs.get(),r=xs.get();Ns(s,t,n,r);let e=Number.POSITIVE_INFINITY;for(const o of Vs){const c=vs(s,o,Ms.get()),u=U.get();if(k(n,c,u)){const s=Y(t,u);if(!B(r,u))continue;s<e&&(e=s,a(i,u))}}return as(s,t.origin)<e&&es(s,t.origin,i),i}function es(s,t,i){const n=C(s.plane,t,U.get()),r=w(ys(s,s.basis1),n,-1,1,U.get()),e=w(ys(s,s.basis2),n,-1,1,U.get());return m(i,u(U.get(),r,e),s.origin),i}function os(s,t,i){const{origin:n,basis1:r,basis2:e}=s,o=m(U.get(),t,n),a=L(r,o),c=L(e,o),u=L(js(s),o);return g(i,a,c,u)}function as(s,t){const i=os(s,t,U.get()),{basis1:n,basis2:r}=s,e=f(n),o=f(r),a=Math.max(Math.abs(i[0])-e,0),c=Math.max(Math.abs(i[1])-o,0),u=i[2];return a*a+c*c+u*u}function cs(s,t){return Math.sqrt(as(s,t))}function us(s,t){let i=Number.NEGATIVE_INFINITY;for(const n of Vs){const r=vs(s,n,Ms.get()),e=x(r,t);e>i&&(i=e)}return Math.sqrt(i)}function gs(s,t){return F(s.plane,t)>0&&Is(s,t)}function bs(s,t,i,n){return hs(s,i,n)}function fs(s,t){const i=-s.plane[3];return L(js(s),t)-i}function ps(s,t,i,n){const r=fs(s,t),e=c(Ss,js(s),i-r);return u(n,t,e),n}function ls(s,t){return d(s.basis1,t.basis1)&&d(s.basis2,t.basis2)&&d(s.origin,t.origin)}function ms(s,t,i){return s!==i&&W(s,i),n(As,t),r(As,As),j(i.basis1,s.basis1,As),j(i.basis2,s.basis2,As),j(R(i.plane),R(s.plane),As),j(i.origin,s.origin,t),q(i.plane,i.plane,i.origin),i}function ds(s,t,i,n){return s!==n&&W(s,n),e(_s,t,i),j(n.basis1,s.basis1,_s),j(n.basis2,s.basis2,_s),K(n),n}function js(s){return R(s.plane)}function hs(s,t,i){switch(t){case 0:a(i,s.basis1),I(i,i);break;case 1:a(i,s.basis2),I(i,i);break;case 2:a(i,js(s))}return i}function Is(s,t){const i=m(U.get(),t,s.origin),n=h(s.basis1),r=h(s.basis2),e=l(s.basis1,i),o=l(s.basis2,i);return-e-n<0&&e-n<0&&-o-r<0&&o-r<0}function ys(s,t){const i=Ms.get();return a(i.origin,s.origin),a(i.vector,t),i}function vs(s,t,i){const{basis1:n,basis2:r,origin:e}=s,o=c(U.get(),n,t.origin[0]),a=c(U.get(),r,t.origin[1]);u(i.origin,o,a),u(i.origin,i.origin,e);const g=c(U.get(),n,t.direction[0]),b=c(U.get(),r,t.direction[1]);return c(i.vector,u(g,g,b),2),i}function Ps(s,t){Math.abs(l(s.basis1,s.basis2)/(f(s.basis1)*f(s.basis2)))>1e-6&&z().warn(t,"Provided basis vectors are not perpendicular"),Math.abs(l(s.basis1,js(s)))>1e-6&&z().warn(t,"Basis vectors and plane normal are not perpendicular"),Math.abs(-l(js(s),s.origin)-s.plane[3])>1e-6&&z().warn(t,"Plane offset is not consistent with plane origin")}function Ns(s,t,i,n){const r=js(s);A(r,t.direction,t.origin,i),A(R(i),r,t.origin,n)}const ws={plane:S(),origin:y(0,0,0),basis1:y(1,0,0),basis2:y(0,1,0)},xs=new i(S),Ms=new i(M),Ss=P(),Ts=new i(()=>D()),Vs=[{origin:[-1,-1],direction:[1,0]},{origin:[1,-1],direction:[0,1]},{origin:[1,1],direction:[-1,0]},{origin:[-1,1],direction:[0,-1]}],As=o(),_s=o(),Es=Object.freeze(Object.defineProperty({__proto__:null,altitudeAt:fs,axisAt:bs,cameraFrustumCoverage:ns,closestPoint:rs,closestPointOnSilhouette:is,copy:W,copyWithoutVerify:H,create:D,distance:cs,distance2:as,distanceToSilhouette:us,elevate:Q,equals:ls,extrusionContainsPoint:gs,fromAABoundingRect:$,fromValues:J,getExtent:Z,intersectRay:ss,intersectRayClosestSilhouette:ts,normal:js,projectPoint:es,projectPointLocal:os,rotate:ds,setAltitudeAt:ps,setExtent:X,transform:ms,up:ws,updateUnboundedPlane:K,wrap:G},Symbol.toStringTag,{value:"Module"}));export{fs as A,ps as B,ms as C,ws as D,ns as a,Es as b,W as c,D as d,gs as e,J as f,ls as g,$ as h,ss as i,cs as j,H as k,Q as l,Z as m,js as n,ts as o,is as p,rs as q,ds as r,X as s,es as t,K as u,os as v,G as w,as as x,us as y,bs as z};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{cyclical2PI as e}from"../core/Cyclical.js";import{deg2rad as t,rad2deg as r,asinClamped as o,lerp as s,clamp as n}from"../core/mathUtils.js";import{fromRotation as a,rotate as i}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as l,g as m,n as p,p as u,q as f,b as h,j as g,D as d,l as y,w as M,c as j}from"./vec32.js";import{fromValues as b,create as v,ZEROS as x,clone as T}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as w,d as C}from"./vec42.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 P from"../geometry/Extent.js";import q from"../geometry/Polygon.js";import H from"../geometry/SpatialReference.js";import{isClockwise as I}from"../geometry/support/coordsUtils.js";import{fromPoints as A,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 D}from"../geometry/support/ray.js";import{Sphere as O}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{createDirectionUp as J,directionToHeadingTilt 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=b(0,0,1),Z=p(v(),b(1,1,1)),$=c(),ee=v(),te=v();function re(e,r,o,s=J()){l(ee,e,Y),0===m(ee,ee)&&l(ee,e,Z),a($,-t(r),e),i($,$,-t(o),ee);const{up:n,direction:c}=s;return l(n,ee,e),p(n,n),u(n,n,$),p(c,e),f(c,c),u(c,c,$),s}function oe(e,t,r,o){const s=ee,n=te;return p(s,e),l(te,s,Y),0===m(te,te)&&l(te,s,Z),l(n,te,s),K(t,r,o,s,n)}function se(e,r,s,n){const a={eye:v(),up:null,tilt:n,heading:s},i=ee;i[0]=e[0],i[1]=e[2],i[2]=-e[1];const c=r,l=t(s),m=t(n),p=Math.sin(l),u=Math.cos(l),f=Math.sin(m),d=Math.cos(m),y=h(i);let M;if(Math.abs(m)<1e-8)M=c+y;else{const e=y/f,t=o(c/e),r=Math.PI-m-t;M=e*Math.sin(r)}const j=d*c,b=c*c*(f*f),x=u*u*b,T=M-j,w=T*T,C=x*(x+w-i[1]*i[1]);if(C<0)return g(a.eye,i,M/y),a.tilt=0,ae(a,e);const R=Math.sqrt(C),S=i[1]*T,U=x+w;let P;if(P=u>0?-R+S:R+S,Math.abs(U)<1e-8)return y<1e-8?(a.eye[0]=0,a.eye[1]=0,a.eye[2]=c):g(a.eye,i,M/y),a.tilt=0,ne(a.eye),ae(a,e);a.eye[1]=P/U;const q=p*p*b,H=f*c,I=u*H*a.eye[1],A=a.eye[1]*a.eye[1],E=1-A,k=Math.sqrt(E),F=x*A+q-2*I*k*T+E*w;return Math.abs(F)<1e-8?(g(a.eye,i,M/y),a.tilt=0,ne(a.eye),ae(a,e)):(a.eye[0]=(E*(M*i[0]-j*i[0])-H*k*(i[0]*a.eye[1]*u+i[2]*p))/F,a.eye[2]=(E*(M*i[2]-j*i[2])-H*k*(i[2]*a.eye[1]*u-i[0]*p))/F,g(a.eye,a.eye,M),ne(a.eye),ae(a,e))}function ne(e){const t=e[1];e[1]=-e[2],e[2]=t}function ae(e,t){const r=re(t,e.heading,e.tilt);return e.up=r.up,e}function ie(e,t,s){const n=h(t),a=Math.sqrt(s*s+n*n-2*s*n*Math.cos(Math.PI-e)),i=o(s/(a/Math.sin(e)));return r(e-i)}function ce(e,r,s){const n=t(e),a=h(r);return o(s/(a/Math.sin(n)))+n}function le(o,s,n,a,i){let c,l,m,p;const u=s.latitude,f=U(o.spatialReference).radius,h=s.longitude,g=V(u,n,f)/2;c=h-g,l=h+g;const d=t(u),y=(1+Math.sin(d))/(1-Math.sin(d)),M=(y+1)*Math.tan(a/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))),p=m+a/f,m=b(m),p=b(p),p<m){const e=p;p=m,m=e}if(m=Math.max(r(m),-90),p=Math.min(r(p),90),l=k.monotonic(c,l),l-c>180){const e=(l-c-180)/2;c+=e,l-=e}const v=o.spatialReference&&o.spatialReference.isGeographic?o.spatialReference:H.WGS84;return i?(i.xmin=c,i.ymin=m,i.xmax=l,i.ymax=p,i.spatialReference=v):i=new P(c,m,l,p,v),o.spatialReference&&o.spatialReference.isWebMercator&&L(i,!1,i),i}function me(e,t){const{renderCoordsHelper:r}=e,o=e.state.camera.clone(),a=new N(r);o.near=B,a.update(o);const i=r.getAltitude(t),c=e.spatialReference,l=r.referenceEllipsoid.radius,m=o.eye,p=1+d(m,t)/(l+i),u=Math.sqrt(p*p-1),{minCurvature:f,maxCurvature:h,minSamples:g,maxSamples:j}=ge,b=he(e),v=n((u-f)/(h-f),0,1),R=Math.round(s(g,j,v)),S=o.aboveGround,U=a.planes[5],P=[],H=F(x,de,_()),I=F(x,ye,_());w(Te,0,0,0,0);const A=e=>{};for(let n=0;n<4;n++){const e=1===n&&!S||3===n&&S?1-b:0,t=1===n&&S||3===n&&!S?b:1,o=a.lines[n],c=a.lines[3===n?0:n+1];for(let a=0;a<R;a++){const l=a/R,p=0===a?0:s(e,t,1===n?1-(1-l)**2:3===n?l**2:l),u=y(je,o.origin,c.origin,p),f=X(o.direction,c.direction,p,Me);r.intersectManifoldClosestSilhouette(D(u,f),i,be),Q(be,m,be,U),P.push(T(be)),0!==P.length&&A(M(P.at(-1),be));const h=(z(H,be)?1:0)|(z(I,be)?2:0);Te[h]=1}}P.length>2&&A(M(P[0],P.at(-1)));const E=pe(C(Te)>1?ue(fe(P,H),I):[P],r,c);return new q({rings:E,spatialReference:c})}function pe(e,t,r){const o=2*S();return e.map(e=>{const s=[];let n=!1;for(const a of e)t.fromRenderCoords(a,be,r),Math.abs(a[0])<o&&Math.abs(a[1])<o?(s.push([null,be[1]]),s.push([null,be[1]]),n=!0):s.push([be[0],be[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 ue(e,t){const r=[];for(const o of e)r.push(...fe(o,t));return r}function fe(e,t){const r=[],o=[],s=S();for(let a=0;a<e.length;a++){const n=e[a],i=a===e.length-1?e[0]:e[a+1],c=A(n,i,xe),l=G(t,c.origin,c.vector,0,be);switch(l){case 2:r.push(n);break;case 3:o.push(n);break;case 0:case 1:{const[e,a,i]=0===l?[1,r,o]:[-1,o,r],c=W(t),m=j(v(),be,c,e*s),p=j(v(),be,c,e*-s);a.push(n),a.push(m),i.push(p)}}}const n=[];return r.length&&n.push(r),o.length&&n.push(o),n}function he(e){const{renderCoordsHelper:t,state:r}=e,o=Math.abs(t.getAltitude(r.camera.center));return ve.radius=t.referenceEllipsoid.radius+o,r.camera.sphereFrustumCoverage(ve,t)}const ge={minCurvature:t(5),maxCurvature:t(50),minSamples:1,maxSamples:6},de=b(1,0,0),ye=b(0,1,0),Me=v(),je=v(),be=v(),ve=new O,xe=E(),Te=R(),we=Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:oe,eyeForCenterWithHeadingTilt:se,eyeTiltToLookAtTilt:ce,headingTiltToDirectionUp:re,lookAtTiltToEyeTilt:ie,toArea:me,toExtent:le},Symbol.toStringTag,{value:"Module"}));export{ce as a,me as b,we as c,oe as d,se as e,re as h,ie as l,le as t};
5
+ import{cyclical2PI as e}from"../core/Cyclical.js";import{deg2rad as t,rad2deg as r,asinClamped as o,lerp as s,clamp as n}from"../core/mathUtils.js";import{fromRotation as a,rotate as i}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as l,g as m,n as p,p as u,q as f,b as h,j as g,B as d,l as y,G as M,c as j}from"./vec32.js";import{fromValues as b,create as v,ZEROS as x,clone as T}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{c as w,d as C}from"./vec42.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 P from"../geometry/Extent.js";import q from"../geometry/Polygon.js";import H from"../geometry/SpatialReference.js";import{isClockwise as I}from"../geometry/support/coordsUtils.js";import{fromPoints as A,create as E}from"../geometry/support/lineSegment.js";import{gcsCyclical as k}from"../geometry/support/normalizeUtils.js";import{fromPositionAndNormal as F,create as G,isPointInside as _,intersectLineOrRay as z,getNormal as W}from"../geometry/support/plane.js";import{wrap as O}from"../geometry/support/ray.js";import{Sphere as B}from"../geometry/support/sphere.js";import{geographicToWebMercator as D}from"../geometry/support/webMercatorUtils.js";import{Frustum as L}from"../views/3d/state/Frustum.js";import{minNearDistanceInMeters as N}from"../views/3d/state/NearFarHeuristic.js";import{createDirectionUp as J,directionToHeadingTilt 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=b(0,0,1),Z=p(v(),b(1,1,1)),$=c(),ee=v(),te=v();function re(e,r,o,s=J()){l(ee,e,Y),0===m(ee,ee)&&l(ee,e,Z),a($,-t(r),e),i($,$,-t(o),ee);const{up:n,direction:c}=s;return l(n,ee,e),p(n,n),u(n,n,$),p(c,e),f(c,c),u(c,c,$),s}function oe(e,t,r,o){const s=ee,n=te;return p(s,e),l(te,s,Y),0===m(te,te)&&l(te,s,Z),l(n,te,s),K(t,r,o,s,n)}function se(e,r,s,n){const a={eye:v(),up:null,tilt:n,heading:s},i=ee;i[0]=e[0],i[1]=e[2],i[2]=-e[1];const c=r,l=t(s),m=t(n),p=Math.sin(l),u=Math.cos(l),f=Math.sin(m),d=Math.cos(m),y=h(i);let M;if(Math.abs(m)<1e-8)M=c+y;else{const e=y/f,t=o(c/e),r=Math.PI-m-t;M=e*Math.sin(r)}const j=d*c,b=c*c*(f*f),x=u*u*b,T=M-j,w=T*T,C=x*(x+w-i[1]*i[1]);if(C<0)return g(a.eye,i,M/y),a.tilt=0,ae(a,e);const R=Math.sqrt(C),S=i[1]*T,U=x+w;let P;if(P=u>0?-R+S:R+S,Math.abs(U)<1e-8)return y<1e-8?(a.eye[0]=0,a.eye[1]=0,a.eye[2]=c):g(a.eye,i,M/y),a.tilt=0,ne(a.eye),ae(a,e);a.eye[1]=P/U;const q=p*p*b,H=f*c,I=u*H*a.eye[1],A=a.eye[1]*a.eye[1],E=1-A,k=Math.sqrt(E),F=x*A+q-2*I*k*T+E*w;return Math.abs(F)<1e-8?(g(a.eye,i,M/y),a.tilt=0,ne(a.eye),ae(a,e)):(a.eye[0]=(E*(M*i[0]-j*i[0])-H*k*(i[0]*a.eye[1]*u+i[2]*p))/F,a.eye[2]=(E*(M*i[2]-j*i[2])-H*k*(i[2]*a.eye[1]*u-i[0]*p))/F,g(a.eye,a.eye,M),ne(a.eye),ae(a,e))}function ne(e){const t=e[1];e[1]=-e[2],e[2]=t}function ae(e,t){const r=re(t,e.heading,e.tilt);return e.up=r.up,e}function ie(e,t,s){const n=h(t),a=Math.sqrt(s*s+n*n-2*s*n*Math.cos(Math.PI-e)),i=o(s/(a/Math.sin(e)));return r(e-i)}function ce(e,r,s){const n=t(e),a=h(r);return o(s/(a/Math.sin(n)))+n}function le(o,s,n,a,i){let c,l,m,p;const u=s.latitude,f=U(o.spatialReference).radius,h=s.longitude,g=V(u,n,f)/2;c=h-g,l=h+g;const d=t(u),y=(1+Math.sin(d))/(1-Math.sin(d)),M=(y+1)*Math.tan(a/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))),p=m+a/f,m=b(m),p=b(p),p<m){const e=p;p=m,m=e}if(m=Math.max(r(m),-90),p=Math.min(r(p),90),l=k.monotonic(c,l),l-c>180){const e=(l-c-180)/2;c+=e,l-=e}const v=o.spatialReference&&o.spatialReference.isGeographic?o.spatialReference:H.WGS84;return i?(i.xmin=c,i.ymin=m,i.xmax=l,i.ymax=p,i.spatialReference=v):i=new P(c,m,l,p,v),o.spatialReference&&o.spatialReference.isWebMercator&&D(i,!1,i),i}function me(e,t){const{renderCoordsHelper:r}=e,o=e.state.camera.clone(),a=new L(r);o.near=N,a.update(o);const i=r.getAltitude(t),c=e.spatialReference,l=r.referenceEllipsoid.radius,m=o.eye,p=1+d(m,t)/(l+i),u=Math.sqrt(p*p-1),{minCurvature:f,maxCurvature:h,minSamples:g,maxSamples:j}=ge,b=he(e),v=n((u-f)/(h-f),0,1),R=Math.round(s(g,j,v)),S=o.aboveGround,U=a.planes[5],P=[],H=F(x,de,G()),I=F(x,ye,G());w(Te,0,0,0,0);const A=e=>{};for(let n=0;n<4;n++){const e=1===n&&!S||3===n&&S?1-b:0,t=1===n&&S||3===n&&!S?b:1,o=a.lines[n],c=a.lines[3===n?0:n+1];for(let a=0;a<R;a++){const l=a/R,p=0===a?0:s(e,t,1===n?1-(1-l)**2:3===n?l**2:l),u=y(je,o.origin,c.origin,p),f=X(o.direction,c.direction,p,Me);r.intersectManifoldClosestSilhouette(O(u,f),i,be),Q(be,m,be,U),P.push(T(be)),0!==P.length&&A(M(P.at(-1),be));const h=(_(H,be)?1:0)|(_(I,be)?2:0);Te[h]=1}}P.length>2&&A(M(P[0],P.at(-1)));const E=pe(C(Te)>1?ue(fe(P,H),I):[P],r,c);return new q({rings:E,spatialReference:c})}function pe(e,t,r){const o=2*S();return e.map(e=>{const s=[];let n=!1;for(const a of e)t.fromRenderCoords(a,be,r),Math.abs(a[0])<o&&Math.abs(a[1])<o?(s.push([null,be[1]]),s.push([null,be[1]]),n=!0):s.push([be[0],be[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 ue(e,t){const r=[];for(const o of e)r.push(...fe(o,t));return r}function fe(e,t){const r=[],o=[],s=S();for(let a=0;a<e.length;a++){const n=e[a],i=a===e.length-1?e[0]:e[a+1],c=A(n,i,xe),l=z(t,c.origin,c.vector,0,be);switch(l){case 2:r.push(n);break;case 3:o.push(n);break;case 0:case 1:{const[e,a,i]=0===l?[1,r,o]:[-1,o,r],c=W(t),m=j(v(),be,c,e*s),p=j(v(),be,c,e*-s);a.push(n),a.push(m),i.push(p)}}}const n=[];return r.length&&n.push(r),o.length&&n.push(o),n}function he(e){const{renderCoordsHelper:t,state:r}=e,o=Math.abs(t.getAltitude(r.camera.center));return ve.radius=t.referenceEllipsoid.radius+o,r.camera.sphereFrustumCoverage(ve,t)}const ge={minCurvature:t(5),maxCurvature:t(50),minSamples:1,maxSamples:6},de=b(1,0,0),ye=b(0,1,0),Me=v(),je=v(),be=v(),ve=new B,xe=E(),Te=R(),we=Object.freeze(Object.defineProperty({__proto__:null,directionToHeadingTilt:oe,eyeForCenterWithHeadingTilt:se,eyeTiltToLookAtTilt:ce,headingTiltToDirectionUp:re,lookAtTiltToEyeTilt:ie,toArea:me,toExtent:le},Symbol.toStringTag,{value:"Module"}));export{ce as a,me as b,we as c,oe as d,se as e,re as h,ie as l,le as t};
package/chunks/vec32.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{create as t}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as n,RANDOM as a}from"../core/libs/gl-matrix-2/math/common.js";function r(t){const n=t[0],a=t[1],r=t[2];return Math.sqrt(n*n+a*a+r*r)}function s(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function o(t,n,a,r){return t[0]=n,t[1]=a,t[2]=r,t}function u(t,n,a){return t[0]=n[0]+a[0],t[1]=n[1]+a[1],t[2]=n[2]+a[2],t}function c(t,n,a){return t[0]=n[0]-a[0],t[1]=n[1]-a[1],t[2]=n[2]-a[2],t}function e(t,n,a){return t[0]=n[0]*a[0],t[1]=n[1]*a[1],t[2]=n[2]*a[2],t}function i(t,n,a){return t[0]=n[0]/a[0],t[1]=n[1]/a[1],t[2]=n[2]/a[2],t}function h(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t}function M(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t}function f(t,n){return t[0]=Math.abs(n[0]),t[1]=Math.abs(n[1]),t[2]=Math.abs(n[2]),t}function m(t,n){return t[0]=Math.sign(n[0]),t[1]=Math.sign(n[1]),t[2]=Math.sign(n[2]),t}function l(t,n,a){return t[0]=Math.min(n[0],a[0]),t[1]=Math.min(n[1],a[1]),t[2]=Math.min(n[2],a[2]),t}function d(t,n,a){return t[0]=Math.max(n[0],a[0]),t[1]=Math.max(n[1],a[1]),t[2]=Math.max(n[2],a[2]),t}function b(t,n=0,a=1){return t[0]=Math.min(Math.max(t[0],n),a),t[1]=Math.min(Math.max(t[1],n),a),t[2]=Math.min(Math.max(t[2],n),a),t}function x(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t}function g(t,n,a){return t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a,t}function q(t,n,a,r){return t[0]=n[0]+a[0]*r,t[1]=n[1]+a[1]*r,t[2]=n[2]+a[2]*r,t}function p(t,n){const a=n[0]-t[0],r=n[1]-t[1],s=n[2]-t[2];return Math.sqrt(a*a+r*r+s*s)}function v(t,n){const a=n[0]-t[0],r=n[1]-t[1],s=n[2]-t[2];return a*a+r*r+s*s}function j(t){const n=t[0],a=t[1],r=t[2];return n*n+a*a+r*r}function y(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t}function z(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t}function A(t,n){const a=n[0],r=n[1],s=n[2];let o=a*a+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o,t[2]=n[2]*o),t}function P(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function _(t,n,a){const r=n[0],s=n[1],o=n[2],u=a[0],c=a[1],e=a[2];return t[0]=s*e-o*c,t[1]=o*u-r*e,t[2]=r*c-s*u,t}function D(t,n,a){const r=n[0],s=n[1],o=n[2],u=a[0],c=a[1],e=a[2],i=s*e-o*c,h=o*u-r*e,M=r*c-s*u,f=Math.sqrt(i*i+h*h+M*M);return t[0]=i/f,t[1]=h/f,t[2]=M/f,t}function I(t,n,a,r){const s=n[0],o=n[1],u=n[2];return t[0]=s+r*(a[0]-s),t[1]=o+r*(a[1]-o),t[2]=u+r*(a[2]-u),t}function L(t,n,a,r,s,o){const u=o*o,c=u*(2*o-3)+1,e=u*(o-2)+o,i=u*(o-1),h=u*(3-2*o);return t[0]=n[0]*c+a[0]*e+r[0]*i+s[0]*h,t[1]=n[1]*c+a[1]*e+r[1]*i+s[1]*h,t[2]=n[2]*c+a[2]*e+r[2]*i+s[2]*h,t}function O(t,n,a,r,s,o){const u=1-o,c=u*u,e=o*o,i=c*u,h=3*o*c,M=3*e*u,f=e*o;return t[0]=n[0]*i+a[0]*h+r[0]*M+s[0]*f,t[1]=n[1]*i+a[1]*h+r[1]*M+s[1]*f,t[2]=n[2]*i+a[2]*h+r[2]*M+s[2]*f,t}function S(t,n=1){const r=a,s=2*r()*Math.PI,o=2*r()-1,u=Math.sqrt(1-o*o)*n;return t[0]=Math.cos(s)*u,t[1]=Math.sin(s)*u,t[2]=o*n,t}function E(t,n,a){const r=n[0],s=n[1],o=n[2];return t[0]=a[0]*r+a[4]*s+a[8]*o+a[12],t[1]=a[1]*r+a[5]*s+a[9]*o+a[13],t[2]=a[2]*r+a[6]*s+a[10]*o+a[14],t}function N(t,n,a){const r=n[0],s=n[1],o=n[2];return t[0]=r*a[0]+s*a[3]+o*a[6],t[1]=r*a[1]+s*a[4]+o*a[7],t[2]=r*a[2]+s*a[5]+o*a[8],t}function Q(t,n,a){const r=a[0],s=a[1],o=a[2],u=a[3],c=n[0],e=n[1],i=n[2],h=s*i-o*e,M=o*c-r*i,f=r*e-s*c,m=s*f-o*M,l=o*h-r*f,d=r*M-s*h,b=2*u;return t[0]=c+h*b+2*m,t[1]=e+M*b+2*l,t[2]=i+f*b+2*d,t}function T(t,n,a,r){const s=[],o=[];return s[0]=n[0]-a[0],s[1]=n[1]-a[1],s[2]=n[2]-a[2],o[0]=s[0],o[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),o[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),t[0]=o[0]+a[0],t[1]=o[1]+a[1],t[2]=o[2]+a[2],t}function k(t,n,a,r){const s=[],o=[];return s[0]=n[0]-a[0],s[1]=n[1]-a[1],s[2]=n[2]-a[2],o[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),o[1]=s[1],o[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),t[0]=o[0]+a[0],t[1]=o[1]+a[1],t[2]=o[2]+a[2],t}function w(t,n,a,r){const s=[],o=[];return s[0]=n[0]-a[0],s[1]=n[1]-a[1],s[2]=n[2]-a[2],o[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),o[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),o[2]=s[2],t[0]=o[0]+a[0],t[1]=o[1]+a[1],t[2]=o[2]+a[2],t}function B(t,n){A(C,t),A(F,n);const a=P(C,F);return a>1?0:a<-1?Math.PI:Math.acos(a)}const C=t(),F=t();function G(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function H(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]}function J(t,a){if(t===a)return!0;const r=t[0],s=t[1],o=t[2],u=a[0],c=a[1],e=a[2],i=n();return Math.abs(r-u)<=i*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(s-c)<=i*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-e)<=i*Math.max(1,Math.abs(o),Math.abs(e))}function K(t,n,a){const r=a[0]-n[0],s=a[1]-n[1],o=a[2]-n[2];let u=r*r+s*s+o*o;return u>0?(u=1/Math.sqrt(u),t[0]=r*u,t[1]=s*u,t[2]=o*u,t):(t[0]=0,t[1]=0,t[2]=0,t)}const R=c,U=e,V=i,W=p,X=v,Y=r,Z=j,$=Object.freeze(Object.defineProperty({__proto__:null,abs:f,add:u,angle:B,bezier:O,ceil:h,clamp:b,copy:s,cross:_,crossAndNormalize:D,direction:K,dist:W,distance:p,div:V,divide:i,dot:P,equals:J,exactEquals:H,floor:M,hermite:L,inverse:z,len:Y,length:r,lerp:I,max:d,min:l,mul:U,multiply:e,negate:y,normalize:A,random:S,rotateX:T,rotateY:k,rotateZ:w,round:x,scale:g,scaleAndAdd:q,set:o,sign:m,sqrDist:X,sqrLen:Z,squaredDistance:v,squaredLength:j,str:G,sub:R,subtract:c,transformMat3:N,transformMat4:E,transformQuat:Q},Symbol.toStringTag,{value:"Module"}));export{m as A,e as B,i as C,p as D,K as E,j as F,J as G,W as H,x as I,$ as J,M as K,w as L,h as M,b as N,D as O,L as P,O as Q,S as R,T as S,k as T,G as U,U as V,V as W,R as a,r as b,q as c,s as d,c as e,_ as f,P as g,o as h,u as i,g as j,B as k,I as l,H as m,A as n,z as o,E as p,y as q,Q as r,v as s,N as t,Y as u,f as v,X as w,Z as x,d as y,l as z};
5
+ import{create as t}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{getEpsilon as n,RANDOM as a}from"../core/libs/gl-matrix-2/math/common.js";function r(t){const n=t[0],a=t[1],r=t[2];return Math.sqrt(n*n+a*a+r*r)}function s(t,n){return t[0]=n[0],t[1]=n[1],t[2]=n[2],t}function o(t,n,a,r){return t[0]=n,t[1]=a,t[2]=r,t}function u(t,n,a){return t[0]=n[0]+a[0],t[1]=n[1]+a[1],t[2]=n[2]+a[2],t}function c(t,n,a){return t[0]=n[0]-a[0],t[1]=n[1]-a[1],t[2]=n[2]-a[2],t}function e(t,n,a){return t[0]=n[0]*a[0],t[1]=n[1]*a[1],t[2]=n[2]*a[2],t}function i(t,n,a){return t[0]=n[0]/a[0],t[1]=n[1]/a[1],t[2]=n[2]/a[2],t}function h(t,n){return t[0]=Math.ceil(n[0]),t[1]=Math.ceil(n[1]),t[2]=Math.ceil(n[2]),t}function M(t,n){return t[0]=Math.floor(n[0]),t[1]=Math.floor(n[1]),t[2]=Math.floor(n[2]),t}function f(t,n){return t[0]=Math.abs(n[0]),t[1]=Math.abs(n[1]),t[2]=Math.abs(n[2]),t}function m(t,n){return t[0]=Math.sign(n[0]),t[1]=Math.sign(n[1]),t[2]=Math.sign(n[2]),t}function l(t,n,a){return t[0]=Math.min(n[0],a[0]),t[1]=Math.min(n[1],a[1]),t[2]=Math.min(n[2],a[2]),t}function d(t,n,a){return t[0]=Math.max(n[0],a[0]),t[1]=Math.max(n[1],a[1]),t[2]=Math.max(n[2],a[2]),t}function b(t,n=0,a=1){return t[0]=Math.min(Math.max(t[0],n),a),t[1]=Math.min(Math.max(t[1],n),a),t[2]=Math.min(Math.max(t[2],n),a),t}function x(t,n){return t[0]=Math.round(n[0]),t[1]=Math.round(n[1]),t[2]=Math.round(n[2]),t}function g(t,n,a){return t[0]=n[0]*a,t[1]=n[1]*a,t[2]=n[2]*a,t}function q(t,n,a,r){return t[0]=n[0]+a[0]*r,t[1]=n[1]+a[1]*r,t[2]=n[2]+a[2]*r,t}function p(t,n){const a=n[0]-t[0],r=n[1]-t[1],s=n[2]-t[2];return Math.sqrt(a*a+r*r+s*s)}function v(t,n){const a=n[0]-t[0],r=n[1]-t[1],s=n[2]-t[2];return a*a+r*r+s*s}function j(t){const n=t[0],a=t[1],r=t[2];return n*n+a*a+r*r}function y(t,n){return t[0]=-n[0],t[1]=-n[1],t[2]=-n[2],t}function z(t,n){return t[0]=1/n[0],t[1]=1/n[1],t[2]=1/n[2],t}function A(t,n){const a=n[0],r=n[1],s=n[2];let o=a*a+r*r+s*s;return o>0&&(o=1/Math.sqrt(o),t[0]=n[0]*o,t[1]=n[1]*o,t[2]=n[2]*o),t}function P(t,n){return t[0]*n[0]+t[1]*n[1]+t[2]*n[2]}function _(t,n,a){const r=n[0],s=n[1],o=n[2],u=a[0],c=a[1],e=a[2];return t[0]=s*e-o*c,t[1]=o*u-r*e,t[2]=r*c-s*u,t}function D(t,n,a){const r=n[0],s=n[1],o=n[2],u=a[0],c=a[1],e=a[2],i=s*e-o*c,h=o*u-r*e,M=r*c-s*u,f=Math.sqrt(i*i+h*h+M*M);return t[0]=i/f,t[1]=h/f,t[2]=M/f,t}function I(t,n,a,r){const s=n[0],o=n[1],u=n[2];return t[0]=s+r*(a[0]-s),t[1]=o+r*(a[1]-o),t[2]=u+r*(a[2]-u),t}function L(t,n,a,r,s,o){const u=o*o,c=u*(2*o-3)+1,e=u*(o-2)+o,i=u*(o-1),h=u*(3-2*o);return t[0]=n[0]*c+a[0]*e+r[0]*i+s[0]*h,t[1]=n[1]*c+a[1]*e+r[1]*i+s[1]*h,t[2]=n[2]*c+a[2]*e+r[2]*i+s[2]*h,t}function O(t,n,a,r,s,o){const u=1-o,c=u*u,e=o*o,i=c*u,h=3*o*c,M=3*e*u,f=e*o;return t[0]=n[0]*i+a[0]*h+r[0]*M+s[0]*f,t[1]=n[1]*i+a[1]*h+r[1]*M+s[1]*f,t[2]=n[2]*i+a[2]*h+r[2]*M+s[2]*f,t}function S(t,n=1){const r=a,s=2*r()*Math.PI,o=2*r()-1,u=Math.sqrt(1-o*o)*n;return t[0]=Math.cos(s)*u,t[1]=Math.sin(s)*u,t[2]=o*n,t}function E(t,n,a){const r=n[0],s=n[1],o=n[2];return t[0]=a[0]*r+a[4]*s+a[8]*o+a[12],t[1]=a[1]*r+a[5]*s+a[9]*o+a[13],t[2]=a[2]*r+a[6]*s+a[10]*o+a[14],t}function N(t,n,a){const r=n[0],s=n[1],o=n[2];return t[0]=r*a[0]+s*a[3]+o*a[6],t[1]=r*a[1]+s*a[4]+o*a[7],t[2]=r*a[2]+s*a[5]+o*a[8],t}function Q(t,n,a){const r=a[0],s=a[1],o=a[2],u=a[3],c=n[0],e=n[1],i=n[2],h=s*i-o*e,M=o*c-r*i,f=r*e-s*c,m=s*f-o*M,l=o*h-r*f,d=r*M-s*h,b=2*u;return t[0]=c+h*b+2*m,t[1]=e+M*b+2*l,t[2]=i+f*b+2*d,t}function T(t,n,a,r){const s=[],o=[];return s[0]=n[0]-a[0],s[1]=n[1]-a[1],s[2]=n[2]-a[2],o[0]=s[0],o[1]=s[1]*Math.cos(r)-s[2]*Math.sin(r),o[2]=s[1]*Math.sin(r)+s[2]*Math.cos(r),t[0]=o[0]+a[0],t[1]=o[1]+a[1],t[2]=o[2]+a[2],t}function k(t,n,a,r){const s=[],o=[];return s[0]=n[0]-a[0],s[1]=n[1]-a[1],s[2]=n[2]-a[2],o[0]=s[2]*Math.sin(r)+s[0]*Math.cos(r),o[1]=s[1],o[2]=s[2]*Math.cos(r)-s[0]*Math.sin(r),t[0]=o[0]+a[0],t[1]=o[1]+a[1],t[2]=o[2]+a[2],t}function w(t,n,a,r){const s=[],o=[];return s[0]=n[0]-a[0],s[1]=n[1]-a[1],s[2]=n[2]-a[2],o[0]=s[0]*Math.cos(r)-s[1]*Math.sin(r),o[1]=s[0]*Math.sin(r)+s[1]*Math.cos(r),o[2]=s[2],t[0]=o[0]+a[0],t[1]=o[1]+a[1],t[2]=o[2]+a[2],t}function B(t,n){A(C,t),A(F,n);const a=P(C,F);return a>1?0:a<-1?Math.PI:Math.acos(a)}const C=t(),F=t();function G(t){return"vec3("+t[0]+", "+t[1]+", "+t[2]+")"}function H(t,n){return t[0]===n[0]&&t[1]===n[1]&&t[2]===n[2]}function J(t,a){if(t===a)return!0;const r=t[0],s=t[1],o=t[2],u=a[0],c=a[1],e=a[2],i=n();return Math.abs(r-u)<=i*Math.max(1,Math.abs(r),Math.abs(u))&&Math.abs(s-c)<=i*Math.max(1,Math.abs(s),Math.abs(c))&&Math.abs(o-e)<=i*Math.max(1,Math.abs(o),Math.abs(e))}function K(t,n,a){const r=a[0]-n[0],s=a[1]-n[1],o=a[2]-n[2];let u=r*r+s*s+o*o;return u>0?(u=1/Math.sqrt(u),t[0]=r*u,t[1]=s*u,t[2]=o*u,t):(t[0]=0,t[1]=0,t[2]=0,t)}const R=c,U=e,V=i,W=p,X=v,Y=r,Z=j,$=Object.freeze(Object.defineProperty({__proto__:null,abs:f,add:u,angle:B,bezier:O,ceil:h,clamp:b,copy:s,cross:_,crossAndNormalize:D,direction:K,dist:W,distance:p,div:V,divide:i,dot:P,equals:J,exactEquals:H,floor:M,hermite:L,inverse:z,len:Y,length:r,lerp:I,max:d,min:l,mul:U,multiply:e,negate:y,normalize:A,random:S,rotateX:T,rotateY:k,rotateZ:w,round:x,scale:g,scaleAndAdd:q,set:o,sign:m,sqrDist:X,sqrLen:Z,squaredDistance:v,squaredLength:j,str:G,sub:R,subtract:c,transformMat3:N,transformMat4:E,transformQuat:Q},Symbol.toStringTag,{value:"Module"}));export{i as A,p as B,K as C,j as D,J as E,W as F,X as G,Z as H,x as I,$ as J,M as K,w as L,h as M,b as N,D as O,L as P,O as Q,S as R,T as S,k as T,G as U,U as V,V as W,R as a,r as b,q as c,s as d,c as e,_ as f,P as g,o as h,u as i,g as j,B as k,I as l,H as m,A as n,z as o,E as p,y as q,Q as r,v as s,N as t,Y as u,f as v,d as w,l as x,m as y,e as z};
package/config.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- 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.0.0-next.60";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
5
+ 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.0.0-next.61";s.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@${e}/assets`}s.defaultAssetsPath=s.assetsPath}export{s as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../factories/vec3f64.js";import"./common.js";export{v as abs,i as add,k as angle,Q as bezier,M as ceil,N as clamp,d as copy,f as cross,O as crossAndNormalize,E as direction,H as dist,D as distance,W as div,C as divide,g as dot,G as equals,m as exactEquals,K as floor,P as hermite,o as inverse,u as len,b as length,l as lerp,y as max,z as min,V as mul,B as multiply,q as negate,n as normalize,R as random,S as rotateX,T as rotateY,L as rotateZ,I as round,j as scale,c as scaleAndAdd,h as set,A as sign,w as sqrDist,x as sqrLen,s as squaredDistance,F as squaredLength,U as str,a as sub,e as subtract,t as transformMat3,p as transformMat4,r as transformQuat}from"../../../../chunks/vec32.js";
5
+ import"../factories/vec3f64.js";import"./common.js";export{v as abs,i as add,k as angle,Q as bezier,M as ceil,N as clamp,d as copy,f as cross,O as crossAndNormalize,C as direction,F as dist,B as distance,W as div,A as divide,g as dot,E as equals,m as exactEquals,K as floor,P as hermite,o as inverse,u as len,b as length,l as lerp,w as max,x as min,V as mul,z as multiply,q as negate,n as normalize,R as random,S as rotateX,T as rotateY,L as rotateZ,I as round,j as scale,c as scaleAndAdd,h as set,y as sign,G as sqrDist,H as sqrLen,s as squaredDistance,D as squaredLength,U as str,a as sub,e as subtract,t as transformMat3,p as transformMat4,r as transformQuat}from"../../../../chunks/vec32.js";
@@ -3,7 +3,7 @@ import type FocusArea from "./FocusArea.js";
3
3
  import type { Clonable, ClonableMixinProperties } from "../core/Clonable.js";
4
4
  import type { JSONSupportMixin, JSONSupportMixinProperties } from "../core/JSONSupport.js";
5
5
  import type { FocusAreaProperties } from "./FocusArea.js";
6
- import type { FocusAreaStyle } from "./FocusAreaStyle.js";
6
+ import type { FocusAreaStyle } from "./types.js";
7
7
  import type { ReadonlyArrayOrCollection } from "../core/Collection.js";
8
8
 
9
9
  export interface FocusAreasProperties extends ClonableMixinProperties, JSONSupportMixinProperties, Partial<Pick<FocusAreas, "style">> {
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../core/mathUtils.js";import{ObjectStack as r}from"../../core/ObjectStack.js";import{d as n,e as o,g as e,F as i,j as c,i as s,s as u}from"../../chunks/vec32.js";import{create as a,clone as g}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as f}from"./vectorStacks.js";function v(t){return t?{origin:g(t.origin),vector:g(t.vector)}:{origin:a(),vector:a()}}function m(t,r){const n=S.get();return n.origin=t,n.vector=r,n}function p(t,r=v()){return b(t.origin,t.vector,r)}function b(t,r,o=v()){return n(o.origin,t),n(o.vector,r),o}function h(t,r,e=v()){return n(e.origin,t),o(e.vector,r,t),e}function j(r,n){const i=o(f.get(),n,r.origin),s=e(r.vector,i),u=e(r.vector,r.vector),a=t(s/u,0,1),g=o(f.get(),c(f.get(),r.vector,a),i);return e(g,g)}function M(t,r,n){return A(t,r,0,1,n)}function l(t,r,n){return s(n,t.origin,c(n,t.vector,r))}function A(r,n,u,a,g){const{vector:v,origin:m}=r,p=o(f.get(),n,m),b=e(v,p)/i(v);return c(g,v,t(b,u,a)),s(g,g,r.origin)}function d(t,r){if(k(t,m(r.origin,r.direction),!1,x)){const{tA:r,pB:n,distance2:o}=x;if(r>=0&&r<=1)return o;if(r<0)return u(t.origin,n);if(r>1)return u(s(f.get(),t.origin,t.vector),n)}return null}function B(t,r,o){return!!k(t,r,!0,x)&&(n(o,x.pA),!0)}function k(r,n,o,e){const i=1e-6,c=r.origin,a=s(f.get(),c,r.vector),g=n.origin,v=s(f.get(),g,n.vector),m=f.get(),p=f.get();if(m[0]=c[0]-g[0],m[1]=c[1]-g[1],m[2]=c[2]-g[2],p[0]=v[0]-g[0],p[1]=v[1]-g[1],p[2]=v[2]-g[2],Math.abs(p[0])<i&&Math.abs(p[1])<i&&Math.abs(p[2])<i)return!1;const b=f.get();if(b[0]=a[0]-c[0],b[1]=a[1]-c[1],b[2]=a[2]-c[2],Math.abs(b[0])<i&&Math.abs(b[1])<i&&Math.abs(b[2])<i)return!1;const h=m[0]*p[0]+m[1]*p[1]+m[2]*p[2],j=p[0]*b[0]+p[1]*b[1]+p[2]*b[2],M=m[0]*b[0]+m[1]*b[1]+m[2]*b[2],l=p[0]*p[0]+p[1]*p[1]+p[2]*p[2],A=(b[0]*b[0]+b[1]*b[1]+b[2]*b[2])*l-j*j;if(Math.abs(A)<i)return!1;let d=(h*j-M*l)/A,B=(h+j*d)/l;o&&(d=t(d,0,1),B=t(B,0,1));const k=f.get(),x=f.get();return k[0]=c[0]+d*b[0],k[1]=c[1]+d*b[1],k[2]=c[2]+d*b[2],x[0]=g[0]+B*p[0],x[1]=g[1]+B*p[1],x[2]=g[2]+B*p[2],e.tA=d,e.tB=B,e.pA=k,e.pB=x,e.distance2=u(k,x),!0}const x={tA:0,tB:0,pA:a(),pB:a(),distance2:0},S=new r(()=>v());export{B as closestLineSegmentPoint,d as closestRayDistance2,p as copy,v as create,j as distance2,h as fromPoints,b as fromValues,l as pointAt,M as projectPoint,A as projectPointClamp,m as wrap};
5
+ import{clamp as t}from"../../core/mathUtils.js";import{ObjectStack as r}from"../../core/ObjectStack.js";import{d as n,e as o,g as e,D as i,j as c,i as s,s as u}from"../../chunks/vec32.js";import{create as a,clone as g}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as f}from"./vectorStacks.js";function v(t){return t?{origin:g(t.origin),vector:g(t.vector)}:{origin:a(),vector:a()}}function m(t,r){const n=S.get();return n.origin=t,n.vector=r,n}function p(t,r=v()){return b(t.origin,t.vector,r)}function b(t,r,o=v()){return n(o.origin,t),n(o.vector,r),o}function h(t,r,e=v()){return n(e.origin,t),o(e.vector,r,t),e}function j(r,n){const i=o(f.get(),n,r.origin),s=e(r.vector,i),u=e(r.vector,r.vector),a=t(s/u,0,1),g=o(f.get(),c(f.get(),r.vector,a),i);return e(g,g)}function M(t,r,n){return A(t,r,0,1,n)}function l(t,r,n){return s(n,t.origin,c(n,t.vector,r))}function A(r,n,u,a,g){const{vector:v,origin:m}=r,p=o(f.get(),n,m),b=e(v,p)/i(v);return c(g,v,t(b,u,a)),s(g,g,r.origin)}function d(t,r){if(k(t,m(r.origin,r.direction),!1,x)){const{tA:r,pB:n,distance2:o}=x;if(r>=0&&r<=1)return o;if(r<0)return u(t.origin,n);if(r>1)return u(s(f.get(),t.origin,t.vector),n)}return null}function B(t,r,o){return!!k(t,r,!0,x)&&(n(o,x.pA),!0)}function k(r,n,o,e){const i=1e-6,c=r.origin,a=s(f.get(),c,r.vector),g=n.origin,v=s(f.get(),g,n.vector),m=f.get(),p=f.get();if(m[0]=c[0]-g[0],m[1]=c[1]-g[1],m[2]=c[2]-g[2],p[0]=v[0]-g[0],p[1]=v[1]-g[1],p[2]=v[2]-g[2],Math.abs(p[0])<i&&Math.abs(p[1])<i&&Math.abs(p[2])<i)return!1;const b=f.get();if(b[0]=a[0]-c[0],b[1]=a[1]-c[1],b[2]=a[2]-c[2],Math.abs(b[0])<i&&Math.abs(b[1])<i&&Math.abs(b[2])<i)return!1;const h=m[0]*p[0]+m[1]*p[1]+m[2]*p[2],j=p[0]*b[0]+p[1]*b[1]+p[2]*b[2],M=m[0]*b[0]+m[1]*b[1]+m[2]*b[2],l=p[0]*p[0]+p[1]*p[1]+p[2]*p[2],A=(b[0]*b[0]+b[1]*b[1]+b[2]*b[2])*l-j*j;if(Math.abs(A)<i)return!1;let d=(h*j-M*l)/A,B=(h+j*d)/l;o&&(d=t(d,0,1),B=t(B,0,1));const k=f.get(),x=f.get();return k[0]=c[0]+d*b[0],k[1]=c[1]+d*b[1],k[2]=c[2]+d*b[2],x[0]=g[0]+B*p[0],x[1]=g[1]+B*p[1],x[2]=g[2]+B*p[2],e.tA=d,e.tB=B,e.pA=k,e.pB=x,e.distance2=u(k,x),!0}const x={tA:0,tB:0,pA:a(),pB:a(),distance2:0},S=new r(()=>v());export{B as closestLineSegmentPoint,d as closestRayDistance2,p as copy,v as create,j as distance2,h as fromPoints,b as fromValues,l as pointAt,M as projectPoint,A as projectPointClamp,m as wrap};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../core/Logger.js";import{G as t,i as r,j as o}from"../../../chunks/vec32.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../MeshComponent.js";import{MeshVertexAttributes as i}from"../MeshVertexAttributes.js";import{addMeshMaterialCloneContext as l,addMeshTextureCloneContext as a,getMeshMaterialCloneContext as c}from"./meshCloneUtils.js";import{convertVertexSpace as u}from"./vertexSpaceConversion.js";const f=()=>e.getLogger("esri.geometry.support.triangleMeshMerge");function p(e,t){if(0===e.length)return f().error("merge()","Must specify one more geometries to merge"),null;const r=e[0].spatialReference;for(const l of e){if(!l.spatialReference.equals(r))return f().error("merge()","Geometries must all be in the same spatial reference"),null;if(!l.loaded)return f().error("merge()","Geometries must all be loaded before merging"),null}const o=m(e);if(null==o)return null;const n=w(e),s=[],i={position:0,uv:0,normal:0,tangent:0,color:0},p=l(a()),g=c(p);for(const l of e){const e=o.rebake?u(l,o.vertexSpace,{allowBufferReuse:!0}):l.vertexAttributes;if(!e)return f().error("merge()","Failed to convert vertex space due to projection errors"),null;if(t&&t.reuseMaterials&&l.components)for(const t of l.components)t.material&&g?.materialMap?.set(t.material,t.material);h(l,i,p,s),x("position",e,n,i,0),x("normal",e,n,i,0),x("tangent",e,n,i,0),x("uv",l.vertexAttributes,n,i,0),x("color",l.vertexAttributes,n,i,255)}return{vertexAttributes:n,components:s,vertexSpace:o.vertexSpace,transform:o.rebake?null:o.transform,spatialReference:r}}function m(e){let s=null,i=null,l=!0,a=!0,c=null;const u=n();let p=0;for(const o of e){const{vertexSpace:e,transform:n}=o;if(null==i){i=e;const t=i.origin;t&&(c=t)}if(i.type!==e.type)return f().error("merge()",`Inconsistent mesh vertex space for provided geometries. One was ${i.type} while another is ${e.type}. Unable to merge geometries.`),null;null==s||null!=n&&n.equals(s)||(l=!1),null!=n&&null==s&&(s=n);const m=e.origin;m&&(c&&!t(m,c)&&(a=!1),p++,r(u,u,m))}if(null==i)throw new Error;const m=i.clone();if(null==m.origin)return{rebake:!1,vertexSpace:m};if(a&&l)return{rebake:!1,vertexSpace:m,transform:s?.clone()};const g=o(u,u,1/p);return m.origin=g,{rebake:!0,vertexSpace:m}}function g(e,t){return t.normal>0&&!e.vertexAttributes.normal}function v(e,t,r){g(e,t)&&"source"===r.shading&&(r.shading="flat")}function h(e,t,r,o){if(e.components)for(const n of e.components){const s=n.clone(r),i=t.position/3;if(s.faces)for(let e=0;e<s.faces.length;e++)s.faces[e]+=i;else{s.faces=new Uint32Array(e.vertexAttributes.position.length/3);for(let e=0;e<s.faces.length;e++)s.faces[e]=e+i}v(e,t,s),o.push(s)}else if(e.vertexAttributes&&e.vertexAttributes.position){const r=e.vertexAttributes.position.length/3,n=new Uint32Array(r),i=t.position/3;for(let e=0;e<r;e++)n[e]=e+i;const l=new s({faces:n});v(e,t,l),o.push(l)}}function x(e,t,r,o,n){if(!t)return;const s=t.position;if(!s)return;const i=t[e],l=r[e];if(null==i){let t=o[e];const r=y[e];if(null!=l){for(let e=0;e<s.length;e+=3)for(let o=0;o<r;o++)l[t++]=n;o[e]=t}}else null!=l&&null!=i&&(b(i,0,l,o[e],i.length),o[e]+=i.length)}function b(e,t,r,o,n){for(let s=0;s<n;s++)r[o++]=e[t++];return r}function A(e){let t=!1,r=!1,o=!1,n=!1;for(const s of e){const e=s.vertexAttributes;if(e?.position&&(e.uv&&(t=!0),e.normal&&(r=!0),e.tangent&&(n=!0),e.color&&(o=!0),r&&t&&o&&n))break}return{normal:r,uv:t,color:o,tangent:n}}function w(e){let t=0,r=0,o=0,n=0,s=0;const l=A(e);for(const i of e){const e=i.vertexAttributes;e?.position&&(t+=e.position.length,l.uv&&(r+=e.position.length/y.position*y.uv),l.normal&&(o+=e.position.length/y.position*y.normal),l.color&&(n+=e.position.length/y.position*y.color),l.tangent&&(s+=e.position.length/y.position*y.tangent))}return new i({position:new Float64Array(t),uv:r?new Float32Array(r):null,normal:o?new Float32Array(o):null,tangent:s?new Float32Array(s):null,color:n?new Uint8Array(n):null})}const y={position:3,normal:3,tangent:4,uv:2,color:4};export{p as merge};
5
+ import e from"../../../core/Logger.js";import{E as t,i as r,j as o}from"../../../chunks/vec32.js";import{create as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../MeshComponent.js";import{MeshVertexAttributes as i}from"../MeshVertexAttributes.js";import{addMeshMaterialCloneContext as l,addMeshTextureCloneContext as a,getMeshMaterialCloneContext as c}from"./meshCloneUtils.js";import{convertVertexSpace as u}from"./vertexSpaceConversion.js";const f=()=>e.getLogger("esri.geometry.support.triangleMeshMerge");function p(e,t){if(0===e.length)return f().error("merge()","Must specify one more geometries to merge"),null;const r=e[0].spatialReference;for(const l of e){if(!l.spatialReference.equals(r))return f().error("merge()","Geometries must all be in the same spatial reference"),null;if(!l.loaded)return f().error("merge()","Geometries must all be loaded before merging"),null}const o=m(e);if(null==o)return null;const n=w(e),s=[],i={position:0,uv:0,normal:0,tangent:0,color:0},p=l(a()),g=c(p);for(const l of e){const e=o.rebake?u(l,o.vertexSpace,{allowBufferReuse:!0}):l.vertexAttributes;if(!e)return f().error("merge()","Failed to convert vertex space due to projection errors"),null;if(t&&t.reuseMaterials&&l.components)for(const t of l.components)t.material&&g?.materialMap?.set(t.material,t.material);h(l,i,p,s),x("position",e,n,i,0),x("normal",e,n,i,0),x("tangent",e,n,i,0),x("uv",l.vertexAttributes,n,i,0),x("color",l.vertexAttributes,n,i,255)}return{vertexAttributes:n,components:s,vertexSpace:o.vertexSpace,transform:o.rebake?null:o.transform,spatialReference:r}}function m(e){let s=null,i=null,l=!0,a=!0,c=null;const u=n();let p=0;for(const o of e){const{vertexSpace:e,transform:n}=o;if(null==i){i=e;const t=i.origin;t&&(c=t)}if(i.type!==e.type)return f().error("merge()",`Inconsistent mesh vertex space for provided geometries. One was ${i.type} while another is ${e.type}. Unable to merge geometries.`),null;null==s||null!=n&&n.equals(s)||(l=!1),null!=n&&null==s&&(s=n);const m=e.origin;m&&(c&&!t(m,c)&&(a=!1),p++,r(u,u,m))}if(null==i)throw new Error;const m=i.clone();if(null==m.origin)return{rebake:!1,vertexSpace:m};if(a&&l)return{rebake:!1,vertexSpace:m,transform:s?.clone()};const g=o(u,u,1/p);return m.origin=g,{rebake:!0,vertexSpace:m}}function g(e,t){return t.normal>0&&!e.vertexAttributes.normal}function v(e,t,r){g(e,t)&&"source"===r.shading&&(r.shading="flat")}function h(e,t,r,o){if(e.components)for(const n of e.components){const s=n.clone(r),i=t.position/3;if(s.faces)for(let e=0;e<s.faces.length;e++)s.faces[e]+=i;else{s.faces=new Uint32Array(e.vertexAttributes.position.length/3);for(let e=0;e<s.faces.length;e++)s.faces[e]=e+i}v(e,t,s),o.push(s)}else if(e.vertexAttributes&&e.vertexAttributes.position){const r=e.vertexAttributes.position.length/3,n=new Uint32Array(r),i=t.position/3;for(let e=0;e<r;e++)n[e]=e+i;const l=new s({faces:n});v(e,t,l),o.push(l)}}function x(e,t,r,o,n){if(!t)return;const s=t.position;if(!s)return;const i=t[e],l=r[e];if(null==i){let t=o[e];const r=y[e];if(null!=l){for(let e=0;e<s.length;e+=3)for(let o=0;o<r;o++)l[t++]=n;o[e]=t}}else null!=l&&null!=i&&(b(i,0,l,o[e],i.length),o[e]+=i.length)}function b(e,t,r,o,n){for(let s=0;s<n;s++)r[o++]=e[t++];return r}function A(e){let t=!1,r=!1,o=!1,n=!1;for(const s of e){const e=s.vertexAttributes;if(e?.position&&(e.uv&&(t=!0),e.normal&&(r=!0),e.tangent&&(n=!0),e.color&&(o=!0),r&&t&&o&&n))break}return{normal:r,uv:t,color:o,tangent:n}}function w(e){let t=0,r=0,o=0,n=0,s=0;const l=A(e);for(const i of e){const e=i.vertexAttributes;e?.position&&(t+=e.position.length,l.uv&&(r+=e.position.length/y.position*y.uv),l.normal&&(o+=e.position.length/y.position*y.normal),l.color&&(n+=e.position.length/y.position*y.color),l.tangent&&(s+=e.position.length/y.position*y.tangent))}return new i({position:new Float64Array(t),uv:r?new Float32Array(r):null,normal:o?new Float32Array(o):null,tangent:s?new Float32Array(s):null,color:n?new Uint8Array(n):null})}const y={position:3,normal:3,tangent:4,uv:2,color:4};export{p as merge};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import"../../core/has.js";import"../../core/Logger.js";import{acosClamped as t}from"../../core/mathUtils.js";import{getEpsilon as e}from"../../core/libs/gl-matrix-2/math/common.js";import{fromRotation as r}from"../../core/libs/gl-matrix-2/math/mat4.js";import{d as s,G as i,s as n,e as o,j as c,b as a,i as h,f as u,p as m,D as l,l as d,c as g,F as f,n as p,h as M}from"../../chunks/vec32.js";import{fromValues as j,fromArray as y,clone as _,create as x}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as b}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isVec3 as v}from"../../core/libs/gl-matrix-2/types/vec3.js";import{isVec4 as S}from"../../core/libs/gl-matrix-2/types/vec4.js";import{fromPoints as P,closestPoint as A}from"./ray.js";import{cartesianToSpherical as F}from"./sphereUtils.js";import{angle as R}from"./vector.js";import{sv3d as q,sm4d as O}from"./vectorStacks.js";class w{constructor(t=0,e=0,r=0,s=0){this.radius=s,"number"==typeof t?this._center=j(t,e,r):v(t)||S(t)?(this._center=y(t),this.radius=4===t.length?t[3]:e):(this._center=_(t.center),this.radius=t.radius)}get isValid(){return this.radius>=0}invalidate(){this.radius=-1}get center(){return this._center}set center(t){s(this.center,t)}exactEquals(t){return i(this._center,t.center)&&this.radius===t.radius}copyFrom(t){return t!==this&&(s(this._center,t.center),this.radius=t.radius),this}clone(){return new w(this.center,this.radius)}toVec4(){return b(this.center[0],this.center[1],this.center[2],this.radius)}contains(t){return n(this.center,t)<=this.radius**2}intersectRay(t,e){if(null==t)return!1;if(!this._intersect(t,V))return!1;let{t0:r,t1:s}=V;if((r<0||s<r&&s>0)&&(r=s),r<0)return!1;if(e){const{origin:s,direction:i}=t;e[0]=s[0]+i[0]*r,e[1]=s[1]+i[1]*r,e[2]=s[2]+i[2]*r}return!0}intersectLine(t,r){const s=P(t,r);if(!this._intersect(s,V))return[];const{origin:i,direction:n}=s,{t0:o,t1:c}=V,a=t=>{const e=x();return g(e,i,n,t),this.projectPoint(e,e)};return Math.abs(o-c)<e()?[a(o)]:[a(o),a(c)]}_intersect(t,e){const{origin:r,direction:s}=t,i=k;i[0]=r[0]-this.center[0],i[1]=r[1]-this.center[1],i[2]=r[2]-this.center[2];const n=s[0]*s[0]+s[1]*s[1]+s[2]*s[2];if(0===n)return!1;const o=2*(s[0]*i[0]+s[1]*i[1]+s[2]*i[2]),c=o*o-4*n*(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]-this.radius**2);if(c<0)return!1;const a=Math.sqrt(c);return e.t0=(-o-a)/(2*n),e.t1=(-o+a)/(2*n),!0}projectPoint(t,e){const r=o(q.get(),t,this.center),s=c(q.get(),r,this.radius/a(r));return h(e,s,this.center)}closestPointOnSilhouette(t,e){const s=q.get(),i=O.get();u(s,t.origin,t.direction),u(e,s,t.origin),c(e,e,1/a(e)*this.radius);const n=this._angleToSilhouette(t.origin),o=R(t.origin,e);return r(i,o+n,s),m(e,e,i),e}frustumCoverage(t,e,r){const s=this.radius,i=s*s,n=t+.5*Math.PI,o=e*e+i-2*Math.cos(n)*e*s,c=Math.sqrt(o),a=o-i;if(a<=0)return.5;const h=Math.sqrt(a),u=Math.acos(h/c)-Math.asin(s/(c/Math.sin(n)));return Math.min(1,(u+.5*r)/r)}_angleToSilhouette(e){const r=o(q.get(),e,this.center),s=a(r),i=this.radius,n=i+Math.abs(i-s);return t(i/n)}union(t){const e=l(this._center,t.center),r=this.radius,s=t.radius;return e+s<r?this:e+r<s?(this.copyFrom(t),this):(d(this._center,this._center,t.center,(e+s-r)/(2*e)),this.radius=(e+r+s)/2,this)}toJSON(){return{center:this.center,radius:this.radius}}}const E={create:t=>new w(t),copy:(t,e)=>e.copyFrom(t),setExtent:(t,e,r)=>r.copyFrom(t),getExtent:(t,e)=>e,elevate:(t,e,r)=>(r.copyFrom(t),r.radius+=e,r),axisAt(t,e,r,s){const i=o(C,e,t.center);switch(r){case 0:{const t=F(i,C)[2];return M(s,-Math.sin(t),Math.cos(t),0)}case 1:{const t=F(i,C),e=t[1],r=t[2],n=Math.sin(e);return M(s,-n*Math.cos(r),-n*Math.sin(r),Math.cos(e))}case 2:return p(s,i);default:return}},altitudeAt(t,e){const r=o(L,e,t.center);return a(r)-t.radius},setAltitudeAt(t,e,r,s){const i=E.altitudeAt(t,e),n=E.axisAt(t,e,2,L),o=c(L,n,r-i);return h(s,e,o)},intersectRay:(t,e,r)=>t.intersectRay(e,r),closestPoint:(t,e,r)=>t.intersectRay(e,r)?r:(A(e,t.center,r),t.projectPoint(r,r)),intersectRayClosestSilhouette(t,e,r){if(t.intersectRay(e,r))return r;const s=t.closestPointOnSilhouette(e,q.get());return h(r,e.origin,c(q.get(),e.direction,l(e.origin,s)/a(e.direction))),r},closestPointOnSilhouette:(t,e,r)=>t.closestPointOnSilhouette(e,r),distanceToSilhouette(t,e){const r=o(q.get(),e,t.center),s=f(r),i=t.radius**2;return Math.sqrt(Math.abs(s-i))}},T=new w,V={t0:0,t1:0},k=x(),C=x(),L=x();export{T as NullSphere,w as Sphere,E as sphereCSO};
5
+ import"../../core/has.js";import"../../core/Logger.js";import{acosClamped as t}from"../../core/mathUtils.js";import{getEpsilon as e}from"../../core/libs/gl-matrix-2/math/common.js";import{fromRotation as r}from"../../core/libs/gl-matrix-2/math/mat4.js";import{d as s,E as i,s as n,e as o,j as c,b as a,i as h,f as u,p as m,B as l,l as d,c as g,D as f,n as p,h as M}from"../../chunks/vec32.js";import{fromValues as j,fromArray as y,clone as _,create as x}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as b}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isVec3 as v}from"../../core/libs/gl-matrix-2/types/vec3.js";import{isVec4 as S}from"../../core/libs/gl-matrix-2/types/vec4.js";import{fromPoints as P,closestPoint as A}from"./ray.js";import{cartesianToSpherical as R}from"./sphereUtils.js";import{angle as q}from"./vector.js";import{sv3d as F,sm4d as O}from"./vectorStacks.js";class w{constructor(t=0,e=0,r=0,s=0){this.radius=s,"number"==typeof t?this._center=j(t,e,r):v(t)||S(t)?(this._center=y(t),this.radius=4===t.length?t[3]:e):(this._center=_(t.center),this.radius=t.radius)}get isValid(){return this.radius>=0}invalidate(){this.radius=-1}get center(){return this._center}set center(t){s(this.center,t)}exactEquals(t){return i(this._center,t.center)&&this.radius===t.radius}copyFrom(t){return t!==this&&(s(this._center,t.center),this.radius=t.radius),this}clone(){return new w(this.center,this.radius)}toVec4(){return b(this.center[0],this.center[1],this.center[2],this.radius)}contains(t){return n(this.center,t)<=this.radius**2}intersectRay(t,e){if(null==t)return!1;if(!this._intersect(t,V))return!1;let{t0:r,t1:s}=V;if((r<0||s<r&&s>0)&&(r=s),r<0)return!1;if(e){const{origin:s,direction:i}=t;e[0]=s[0]+i[0]*r,e[1]=s[1]+i[1]*r,e[2]=s[2]+i[2]*r}return!0}intersectLine(t,r){const s=P(t,r);if(!this._intersect(s,V))return[];const{origin:i,direction:n}=s,{t0:o,t1:c}=V,a=t=>{const e=x();return g(e,i,n,t),this.projectPoint(e,e)};return Math.abs(o-c)<e()?[a(o)]:[a(o),a(c)]}_intersect(t,e){const{origin:r,direction:s}=t,i=k;i[0]=r[0]-this.center[0],i[1]=r[1]-this.center[1],i[2]=r[2]-this.center[2];const n=s[0]*s[0]+s[1]*s[1]+s[2]*s[2];if(0===n)return!1;const o=2*(s[0]*i[0]+s[1]*i[1]+s[2]*i[2]),c=o*o-4*n*(i[0]*i[0]+i[1]*i[1]+i[2]*i[2]-this.radius**2);if(c<0)return!1;const a=Math.sqrt(c);return e.t0=(-o-a)/(2*n),e.t1=(-o+a)/(2*n),!0}projectPoint(t,e){const r=o(F.get(),t,this.center),s=c(F.get(),r,this.radius/a(r));return h(e,s,this.center)}closestPointOnSilhouette(t,e){const s=F.get(),i=O.get();u(s,t.origin,t.direction),u(e,s,t.origin),c(e,e,1/a(e)*this.radius);const n=this._angleToSilhouette(t.origin),o=q(t.origin,e);return r(i,o+n,s),m(e,e,i),e}frustumCoverage(t,e,r){const s=this.radius,i=s*s,n=t+.5*Math.PI,o=e*e+i-2*Math.cos(n)*e*s,c=Math.sqrt(o),a=o-i;if(a<=0)return.5;const h=Math.sqrt(a),u=Math.acos(h/c)-Math.asin(s/(c/Math.sin(n)));return Math.min(1,(u+.5*r)/r)}_angleToSilhouette(e){const r=o(F.get(),e,this.center),s=a(r),i=this.radius,n=i+Math.abs(i-s);return t(i/n)}union(t){const e=l(this._center,t.center),r=this.radius,s=t.radius;return e+s<r?this:e+r<s?(this.copyFrom(t),this):(d(this._center,this._center,t.center,(e+s-r)/(2*e)),this.radius=(e+r+s)/2,this)}toJSON(){return{center:this.center,radius:this.radius}}}const E={create:t=>new w(t),copy:(t,e)=>e.copyFrom(t),setExtent:(t,e,r)=>r.copyFrom(t),getExtent:(t,e)=>e,elevate:(t,e,r)=>(r.copyFrom(t),r.radius+=e,r),axisAt(t,e,r,s){const i=o(C,e,t.center);switch(r){case 0:{const t=R(i,C)[2];return M(s,-Math.sin(t),Math.cos(t),0)}case 1:{const t=R(i,C),e=t[1],r=t[2],n=Math.sin(e);return M(s,-n*Math.cos(r),-n*Math.sin(r),Math.cos(e))}case 2:return p(s,i);default:return}},altitudeAt(t,e){const r=o(L,e,t.center);return a(r)-t.radius},setAltitudeAt(t,e,r,s){const i=E.altitudeAt(t,e),n=E.axisAt(t,e,2,L),o=c(L,n,r-i);return h(s,e,o)},intersectRay:(t,e,r)=>t.intersectRay(e,r),closestPoint:(t,e,r)=>t.intersectRay(e,r)?r:(A(e,t.center,r),t.projectPoint(r,r)),intersectRayClosestSilhouette(t,e,r){if(t.intersectRay(e,r))return r;const s=t.closestPointOnSilhouette(e,F.get());return h(r,e.origin,c(F.get(),e.direction,l(e.origin,s)/a(e.direction))),r},closestPointOnSilhouette:(t,e,r)=>t.closestPointOnSilhouette(e,r),distanceToSilhouette(t,e){const r=o(F.get(),e,t.center),s=f(r),i=t.radius**2;return Math.sqrt(Math.abs(s-i))}},T=new w,V={t0:0,t1:0},k=x(),C=x(),L=x();export{T as NullSphere,w as Sphere,E as sphereCSO};
package/kernel.js CHANGED
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.0";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.0.0-next.60",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
5
+ import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,commitHash as revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.0";let s,r=e;function i(o){s=o}function t(e){const r=s?.findCredential(e);return r?.token?o(e,"token",r.token):e}r="5.0.0-next.61",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,r as fullVersion,s as id,i as setId,e as version};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import t from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as r,initial as a}from"../core/reactiveUtils.js";import{convertTime as n}from"../core/timeUtils.js";import{property as l,subclass as o}from"../core/accessorSupport/decorators.js";import{D as h}from"../chunks/vec32.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{loadVoxelWASM as _}from"../libs/vxl/VxlModule.js";import{VoxelGraphic as c}from"../views/3d/layers/VoxelGraphic.js";import{VoxelTarget as m}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as g}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as f}from"../views/3d/support/RenderCoordsHelper.js";import{SyncRenderPlugin as p}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as y}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let x=class extends p{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.produces=new Map([[21,()=>!!this._vxl&&"local"===this.view.viewingMode]]),this.type=9,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerViewUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(4===e?s.getLogger(this).error(t):s.getLogger(this).warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view.stage&&(this._dbg(1,"--removeRenderPlugin--"),this.view.stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(1,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([r(()=>this.view.ready,e=>{e&&"local"===this.view.viewingMode?(this._dbg(1,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view.stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(1,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())},a),r(()=>this.view?.qualityProfile,e=>{this._dbg(3,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))},a),r(()=>this.view?.timeExtent,()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(3,"sceneView timeExtent changed to useTime="+e.hasTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.hasTime),this._renderPluginContext.requestRender()}},a),r(()=>this.view?.stationary,e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()})])}initializeRenderContext(e){this._dbg(1,"--initializeRenderContext--");const t=e.renderContext.rctx;this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(1,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(4,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const s=!!this._rctx,i=!!this._renderTargetToRestore;if(!s||!i)return 0;const r=this._renderTargetToRestore.fbo.depthStencilTexture;return r?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(r,e,!0),1):(this._dbg(4,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(4,"modifyAllocation callback has no rendering context!");const i=e;1===s?this._rctx.instanceCounter.increment(i,t):this._rctx.instanceCounter.decrement(i,t)}_setBlendState(e,t,s,i){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(i)):this._dbg(4,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(4,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(519,0,255),this._rctx.setStencilOpSeparate(1028,7680,7682,7680),this._rctx.setStencilOpSeparate(1029,7680,7683,7680)):this._dbg(4,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case 1:this._rctx.setFaceCullingEnabled(!1);break;case 3:this._rctx.setCullFace(1029),this._rctx.setFaceCullingEnabled(!0);break;case 2:this._rctx.setCullFace(1028),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(4,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,i){this._rctx?this._rctx.setViewport(e,t,s,i):this._dbg(4,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl.estimate_memory_usage(t);s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}})}_syncRequestsResponses(){this._layers.forEach((e,s)=>{const r=[];e.responses.forEach((t,i)=>{r.push(i),this._dbg(2,"responding for requestID:"+i+" size:"+t.size),this._vxl.respond(s,i,t),0!==t.requestType&&4!==t.requestType||(e.needMemoryUsageUpdate=!0)});const a=e.responses;for(const t of r)a.delete(t);const n=this._vxl.get_new_requests(s),l=e.abortController.signal;for(const o in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const s=n[o],r={responseType:"array-buffer",signal:l,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(2,"making requestID:"+o+" url:"+s.url),t(s.url,r).then(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(2,"have response for requestID:"+o);let i=0;if(t.data.byteLength>0){i=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,i,t.data.byteLength),s=new Uint8Array(t.data);for(let i=0;i<t.data.byteLength;++i)e[i]=s[i]}a.set(+o,{responseType:s.responseType,ptr:i,size:t.data.byteLength,success:!0,requestType:s.requestType})}).catch(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(t)||(this._dbg(4,`requestID:${o} failed, error=${t.toString()}`),a.set(+o,{responseType:s.responseType,ptr:0,size:0,success:!1,requestType:s.requestType}))})}})}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(i,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}}),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach((s,i)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(i))}),t}setEnabled(e,t){this._layers.forEach((s,i)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(i,t),s.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())})}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this._renderPluginContext.requestRender())}setStaticSections(e,t){const s={mask:1,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:1024,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:8192,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,i){const r={mask:256,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:i}};return this._doMaskedUIUpdate(e,r,!0)}setVariableStyles(e,t){const s={mask:32768,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:65536,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:4096,containerIsVisible:t,container:1};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:4096,containerIsVisible:t,container:0};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:4096,containerIsVisible:t,container:2};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,i){const r={mask:131072,analysisSlice:{point:s,normal:i,enabled:t}};return this._doMaskedUIUpdate(e,r,!0)}updateLayerTimeProperties(e){if(!this._vxl)return;const t=this._layers.get(e.wasmLayerId);if(t){const s=t.layerView.layer;let i=0;s.timeOffset&&(i=n(s.timeOffset.value,s.timeOffset.unit,"seconds"));const r=this._getTimeArgs(s.timeExtent);this._vxl.set_layer_time_properties(e.wasmLayerId,r.startTime,r.endTime,r.hasTime,s.useViewTime,i),this._renderPluginContext.requestRender()}}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let i=!1;return this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(i=1===this._vxl.handle_masked_ui_update(r,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}}),i&&s&&this._renderPluginContext.requestRender(),i}_addTriangleToWasmBuffer(e,t,s,i,r){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),i=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),r=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,r,e),n=this._frustum.points[0],l=this._frustum.points[1],o=this._frustum.points[2],h=this._frustum.points[3],d=this._frustum.points[4],u=this._frustum.points[5],_=this._frustum.points[6],c=this._frustum.points[7];let m=0,g=0;const f=this._frustum.planes[4];m=this._addTriangleToWasmBuffer(i,m,o,l,n),g=this._addNormalToWasmBuffer(a,g,f),m=this._addTriangleToWasmBuffer(i,m,n,h,o),g=this._addNormalToWasmBuffer(a,g,f);const p=this._frustum.planes[5];m=this._addTriangleToWasmBuffer(i,m,d,u,_),g=this._addNormalToWasmBuffer(a,g,p),m=this._addTriangleToWasmBuffer(i,m,_,c,d),g=this._addNormalToWasmBuffer(a,g,p);const y=this._frustum.planes[3];m=this._addTriangleToWasmBuffer(i,m,_,o,h),g=this._addNormalToWasmBuffer(a,g,y),m=this._addTriangleToWasmBuffer(i,m,h,c,_),g=this._addNormalToWasmBuffer(a,g,y);const x=this._frustum.planes[2];m=this._addTriangleToWasmBuffer(i,m,n,l,u),g=this._addNormalToWasmBuffer(a,g,x),m=this._addTriangleToWasmBuffer(i,m,u,d,n),g=this._addNormalToWasmBuffer(a,g,x);const v=this._frustum.planes[0];m=this._addTriangleToWasmBuffer(i,m,h,n,d),g=this._addNormalToWasmBuffer(a,g,v),m=this._addTriangleToWasmBuffer(i,m,d,c,h),g=this._addNormalToWasmBuffer(a,g,v);const b=this._frustum.planes[1];m=this._addTriangleToWasmBuffer(i,m,o,_,u),g=this._addNormalToWasmBuffer(a,g,b),m=this._addTriangleToWasmBuffer(i,m,u,l,o),g=this._addNormalToWasmBuffer(a,g,b),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,r,e,255,0,0,64),this._vxl._free(s),this._vxl._free(r),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=f.create(2,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new g(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(s),this._renderPluginContext.requestRender())})}dropQueryRenderTarget(){this._vxl&&this._vxl.drop_query_rt()}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise((e,s)=>{t.resolveCallback=e,t.rejectCallback=s});return this._newLayers.push(t),s}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex(t=>e.uid===t.layerView.uid);t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(1," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}let t=-1;this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=i,s.abortController.abort(),this._vxl.remove_layer(t);const r=this.layerViewUid.indexOf(e.uid);-1!==r&&this.layerViewUid.splice(r,1)}}),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(1," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,i=!1;return null!=e&&(e.isAllTime?i=!0:(null!=e.start&&(i=!0,t=e.start.getTime()/1e3),null!=e.end&&(i=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,hasTime:i}}_addVoxelLayer(e){const t=e.layer;let i=-1;const r=t.getConfiguration();if(r.length<1)return-1;const a={str:r,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(a))return-1;const l=this._getTimeArgs(t.timeExtent),o=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;let h=0;if(t.timeOffset&&(h=n(t.timeOffset.value,t.timeOffset.unit,"seconds")),i=this._vxl.add_layer(t.serviceRoot,a.ptr,a.byteCount,o,o,l.startTime,l.endTime,l.hasTime,t.useViewTime,h,this._toWasmQuality(this.view.qualityProfile)),a.isReusable||this._vxl._free(a.ptr),i>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const r=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:r,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerViewUid.push(e.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let i="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let i="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&s.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bind.camera.viewForward,s=e.bind.camera.eye;this._vxl.update_camera_pos_and_direction(s[0],s[1],s[2],t[0],t[1],t[2]);const i=this._vxl.cull();this._dbg(2,"missingResourceCount="+i),this._moreToLoad=i>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}acquireTechniques(){return[]}render(e){if(!this._vxl)return;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(4,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view.stage.renderer.isFeatureEnabled(3),e.bind.lighting.mainLight.direction[0],e.bind.lighting.mainLight.direction[1],e.bind.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach(e=>{e.needMemoryUsageUpdate=!0})),0===t.x&&0===t.y||this._dbg(4,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bind.camera),this._captureFrustum&&(this._frustum.update(e.bind.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(1,"--destroy--"),this._vxl&&(this._layers.forEach(e=>{e.abortController.abort()}),this._wasmMemBlocks.forEach(e=>{0!==e&&this._vxl._free(e)}),this._vxl.uninitialize_voxel_wasm(),this._removeRenderPlugin(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=_(e).then(t=>{if(t.specialHTMLTargets.jsAPI3DRenderingContext=e,this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(1," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const s=this._getTimeArgs(this.view?.timeExtent),i=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),r=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),a=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),n=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),l=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),d=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),u=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(i,r,a,n,l,o,h,d,s.startTime,s.endTime,s.hasTime,u,_),this._renderPluginContext&&this._renderPluginContext.requestRender()}).catch(()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(4," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()})),this._vxlPromise)}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(4,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${i.toFixed(0)}]]`),null;this._beforeDraw();const r=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],r[0],r[1],r[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,i);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,i){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=Math.round(e),a=Math.round(t);if(r<0||r>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(4,`[js] pickObject: outOfRange, screenXY=[${r}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw();const n=s.viewForward,l=s.eye;this._vxl.update_camera_pos_and_direction(l[0],l[1],l[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let o=null;if(0===i.length)o=this._vxl.pick_object(r,a,0,0);else{const e={str:JSON.stringify({layerIds:i}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(o=this._vxl.pick_object(r,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),o}async getOtherFieldPopupValues(e,s){for(const i of e){const e=i.gpuResult;if(!e)continue;const r=this._layers.get(e.layerId);if(!r||!r.layerView.layer.url)continue;const a=r.layerView.layer,n={responseType:"array-buffer",signal:r.abortController.signal,query:{...r.layerView.layer.customParameters,token:r.layerView.layer.apiKey}},l=e.voxelSpacePosition,o=[Math.floor(l[0]/32),Math.floor(l[1]/32),Math.floor(l[2]/32)],h=[-4&o[0],-4&o[1],-4&o[2]];let d=0;if(e.epochTime){const t=this._vxl.get_layer_epoch_times(r.layerView.wasmLayerId,a.currentVariableId);for(let s=0;s<t.length;++s)if(t[s]===e.epochTime/1e3){d=s;break}}const u=[],_={varIds:[],ptrs:[],sizes:[]};for(const i of s){const e=a.variables.findIndex(e=>e.name===i);if(-1===e)continue;const s=a.variables.getItemAt(e)?.id;if(null==s)continue;const r=`${a.url}/variables/${s}/${d}/bundles/0/${h[0]}-${h[1]}-${h[2]}`;u.push(t(r,n).then(e=>e.data)),_.varIds.push(s)}const c=await Promise.allSettled(u),m=c.length;for(let t=0;t<m;++t){const e=c[t];if("fulfilled"===e.status){const t=e.value,s=this._vxl._malloc(t.byteLength);new Uint8Array(this._vxl.HEAPU8.buffer,s,t.byteLength).set(new Uint8Array(t)),_.ptrs.push(s),_.sizes.push(t.byteLength)}else _.varIds.splice(t,1)}const g=this._vxl.get_other_field_popup_values(e,_);for(let t=0;t<_.ptrs.length;++t)this._vxl._free(_.ptrs[t]);if(g.continuousValues)for(const t in g.continuousValues)i.attributes[t]=g.continuousValues[t];if(g.uniqueValues)for(const t in g.uniqueValues)i.attributes[t]=g.uniqueValues[t]}return e}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,s,i,r){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered||!e.camera)return;if(null==r||r[0]<0||r[0]>e.camera.viewport[2]||r[1]<0||r[1]>e.camera.viewport[3])return this._dbg(4,r?`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${r[0].toFixed(0)}, ${r[1].toFixed(0)}]`:"[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=null"),null;const a=[];this._layers.forEach(t=>{e.options.filteredLayerViewUids.includes(t.layerView.uid)&&a.push(t.layerView.wasmLayerId)});const n=this.pickObject(r[0],r[1],e.camera,a);if(null==n||-1===n.layerId)return;const l=this._layers.get(n.layerId);if(l){const t=l.layerView.layer.uid,r=n.distanceToCamera/h(s,i),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const o={},u=l.layerView.layer,_=u.variables.findIndex(e=>e.id===u.currentVariableId);if(_>=0){const e=u.variables.getItemAt(_);null!=e&&(null!=n.continuousValue?o[e.name]=n.continuousValue:null!=n.uniqueValueLabel&&null!=n.uniqueValue?o[e.name]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(o[e.name]=`${n.uniqueValue}`),e.description.length>0?o["Voxel.CurrentVariable"]=e.description:e.name?.length>0&&(o["Voxel.CurrentVariable"]=e.name))}if(o["Voxel.Position"]=`[${n.voxelSpacePosition.toString()}]`,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);o["Voxel.LocalTime"]=e,o["Voxel.SourceTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&(o["Voxel.Depth"]=n.depth);const c=n.faceNormal;o["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const g=e=>{const s=new m(a,t,()=>this._createVoxelGraphic(l.layerView.layer,o,n));e.set(this.type,s,r,c)},f=e.results,p=2===e.options.store;if((null==f.min.distance||r<f.min.distance)&&g(f.min),(null==f.max.distance||r>f.max.distance)&&g(f.max),p){const t=new y(e.ray);g(t),e.results.all.push(t)}}}_createVoxelGraphic(e,t,s){return new c({layer:e,sourceLayer:e,origin:e.graphicOrigin,attributes:t,gpuResult:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}hasHighlight(){return!1}};e([l({constructOnly:!0})],x.prototype,"view",void 0),x=e([o("esri.layers.VoxelWasmPerSceneView")],x);const v=x;export{v as default};
5
+ import{__decorate as e}from"tslib";import t from"../request.js";import has from"../core/has.js";import s from"../core/Logger.js";import{isAbortError as i}from"../core/promiseUtils.js";import{watch as r,initial as a}from"../core/reactiveUtils.js";import{convertTime as n}from"../core/timeUtils.js";import{property as l,subclass as o}from"../core/accessorSupport/decorators.js";import{B as h}from"../chunks/vec32.js";import{create as d}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{renderSRFromViewSR as u}from"../geometry/support/coordinateSystem.js";import{loadVoxelWASM as _}from"../libs/vxl/VxlModule.js";import{VoxelGraphic as c}from"../views/3d/layers/VoxelGraphic.js";import{VoxelTarget as m}from"../views/3d/layers/i3s/Intersector.js";import{Frustum as g}from"../views/3d/state/Frustum.js";import{RenderCoordsHelper as f}from"../views/3d/support/RenderCoordsHelper.js";import{SyncRenderPlugin as p}from"../views/3d/webgl-engine/effects/RenderPlugin.js";import{IntersectorResult as y}from"../views/3d/webgl-engine/lib/IntersectorResult.js";let x=class extends p{constructor(e){super(e),this._halfIntTexturesAvailable=!1,this._textureFloatLinearAvailable=!1,this._havePreparedWithAllLayers=!1,this._renderPluginContext=null,this._vxlPromise=null,this._vxl=null,this._pluginIsActive=!1,this._moreToLoad=!1,this._viewportWidth=-1,this._viewportHeight=-1,this._newLayers=[],this._layers=new Map,this._rctx=null,this._renderTargetToRestore=null,this._lastFrameWasStationary=!1,this._wasmMemBlockSizes=[512,1024,2048,4096,8192,16384,32768,65536],this._wasmMemBlocks=new Map,this._dbgFlags=new Set,this._captureFrustum=!1,this._frustum=null,this._frustumRenderableId=-1,this._renderCoordsHelper=null,this.produces=new Map([[21,()=>!!this._vxl&&"local"===this.view.viewingMode]]),this.type=9,this.slicePlaneEnabled=!0,this.isGround=!1,this.layerViewUid=[]}_dbg(e,t){this._dbgFlags.has(e)&&(4===e?s.getLogger(this).error(t):s.getLogger(this).warn(t))}_removeRenderPlugin(){this._pluginIsActive&&this.view.stage&&(this._dbg(1,"--removeRenderPlugin--"),this.view.stage.removeRenderPlugin(this)),this._pluginIsActive=!1}initialize(){this._dbg(1,"--initialize--");for(const e of this._wasmMemBlockSizes)this._wasmMemBlocks.set(e,0);this.addHandles([r(()=>this.view.ready,e=>{e&&"local"===this.view.viewingMode?(this._dbg(1,"view ready status changed to ready on a local view, calling addRenderPlugin"),this.view.stage.addRenderPlugin(this),this._pluginIsActive=!0):(this._dbg(1,"view ready status changed, not ready or not a local view!"),this._removeRenderPlugin())},a),r(()=>this.view?.qualityProfile,e=>{this._dbg(3,"qualityProfile changed to "+e),this._vxl&&this._vxl.set_quality(this._toWasmQuality(e))},a),r(()=>this.view?.timeExtent,()=>{if(this._vxl){const e=this._getTimeArgs(this.view?.timeExtent);this._dbg(3,"sceneView timeExtent changed to useTime="+e.hasTime+" st="+e.startTime+" et="+e.endTime),this._vxl.set_scene_time_extent(e.startTime,e.endTime,e.hasTime),this._renderPluginContext.requestRender()}},a),r(()=>this.view?.stationary,e=>{this._vxl&&e&&!this._lastFrameWasStationary&&this._renderPluginContext.requestRender()})])}initializeRenderContext(e){this._dbg(1,"--initializeRenderContext--");const t=e.renderContext.rctx;this._renderPluginContext=e,this._rctx=e.renderContext.rctx,this._halfIntTexturesAvailable=!!this._rctx.capabilities.textureNorm16,this._textureFloatLinearAvailable=this._rctx.capabilities.textureFloatLinear,this._initializeWasm(t.gl)}uninitializeRenderContext(){this._renderPluginContext=null,this._rctx=null,this._dbg(1,"--uninitializeRenderContext--")}_restoreFramebuffer(){if(!this._renderTargetToRestore)return;const e=this._renderTargetToRestore.fbo;if(!!!this._rctx)return void this._dbg(4,"no context in restoreFramebuffer!");this._rctx.bindFramebuffer(e,!0);const t=this._renderTargetToRestore.viewport;this._rctx.setViewport(t.x,t.y,t.width,t.height)}_bindPreviousDepthToSlot(e,t){const s=!!this._rctx,i=!!this._renderTargetToRestore;if(!s||!i)return 0;const r=this._renderTargetToRestore.fbo.depthStencilTexture;return r?(0===t?this._rctx.bindTexture(null,e,!0):this._rctx.bindTexture(r,e,!0),1):(this._dbg(4,"no depth/stencil texture exists!"),0)}_modifyResourceCount(e,t,s){if(!this._rctx)return void this._dbg(4,"modifyAllocation callback has no rendering context!");const i=e;1===s?this._rctx.instanceCounter.increment(i,t):this._rctx.instanceCounter.decrement(i,t)}_setBlendState(e,t,s,i){this._rctx?(this._rctx.setBlendingEnabled(1===e),this._rctx.setBlendFunction(t,s),this._rctx.setBlendEquation(i)):this._dbg(4,"setBlendState callback has no rendering context!")}_setFrontFace(e){this._rctx?this._rctx.setFrontFace(e):this._dbg(4,"setFrontFace callback has no rendering context!")}_setDepthStencilStateFunction(e,t,s){this._rctx?(this._rctx.setDepthFunction(s),this._rctx.setDepthTestEnabled(1===e),this._rctx.setDepthWriteEnabled(1===t),this._rctx.setStencilTestEnabled(!1),this._rctx.setStencilFunction(519,0,255),this._rctx.setStencilOpSeparate(1028,7680,7682,7680),this._rctx.setStencilOpSeparate(1029,7680,7683,7680)):this._dbg(4,"setDepthStencilStateFunction callback has no rendering context!")}_setRasterizerState(e){if(this._rctx)switch(e){case 1:this._rctx.setFaceCullingEnabled(!1);break;case 3:this._rctx.setCullFace(1029),this._rctx.setFaceCullingEnabled(!0);break;case 2:this._rctx.setCullFace(1028),this._rctx.setFaceCullingEnabled(!0)}else this._dbg(4,"setRasterizerState callback has no rendering context!")}_setViewport(e,t,s,i){this._rctx?this._rctx.setViewport(e,t,s,i):this._dbg(4,"setViewport callback has no rendering context!")}_updateMemoryUsage(){this._layers.forEach((e,t)=>{if(e.needMemoryUsageUpdate){const s=this._vxl.estimate_memory_usage(t);s>=0&&(e.needMemoryUsageUpdate=!1,e.layerView.setUsedMemory(s))}})}_syncRequestsResponses(){this._layers.forEach((e,s)=>{const r=[];e.responses.forEach((t,i)=>{r.push(i),this._dbg(2,"responding for requestID:"+i+" size:"+t.size),this._vxl.respond(s,i,t),0!==t.requestType&&4!==t.requestType||(e.needMemoryUsageUpdate=!0)});const a=e.responses;for(const t of r)a.delete(t);const n=this._vxl.get_new_requests(s),l=e.abortController.signal;for(const o in n){e.outstandingRequestCount+=1,1===e.outstandingRequestCount&&e.layerView.updatingFlagChanged();const s=n[o],r={responseType:"array-buffer",signal:l,query:{...e.layerView.layer.customParameters,token:e.layerView.layer.apiKey}};this._dbg(2,"making requestID:"+o+" url:"+s.url),t(s.url,r).then(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),this._dbg(2,"have response for requestID:"+o);let i=0;if(t.data.byteLength>0){i=this._vxl._malloc(t.data.byteLength);const e=new Uint8Array(this._vxl.HEAPU8.buffer,i,t.data.byteLength),s=new Uint8Array(t.data);for(let i=0;i<t.data.byteLength;++i)e[i]=s[i]}a.set(+o,{responseType:s.responseType,ptr:i,size:t.data.byteLength,success:!0,requestType:s.requestType})}).catch(t=>{e.outstandingRequestCount-=1,0===e.outstandingRequestCount&&e.layerView.updatingFlagChanged(),i(t)||(this._dbg(4,`requestID:${o} failed, error=${t.toString()}`),a.set(+o,{responseType:s.responseType,ptr:0,size:0,success:!1,requestType:s.requestType}))})}})}updateWasmCamera(e){this._vxl.set_projection_matrix.apply(this._vxl,e.projectionMatrix),this._vxl.set_view_matrix.apply(this._vxl,e.viewMatrix),this._vxl.set_near_far(e.near,e.far)}isUpdating(e){if(!this._vxl&&this._vxlPromise)return!0;const t=this._layers.get(e);return!!t&&t.outstandingRequestCount>0}getLayerTimes(e){const t=[];return this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const s=this._vxl.get_layer_epoch_times(i,e.layer.currentVariableId);for(let e=0;e<s.length;++e)t.push(s[e])}}),t}getCurrentLayerTimeIndex(e){let t=0;return this._layers.forEach((s,i)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(t=this._vxl.get_layer_current_time_id(i))}),t}setEnabled(e,t){this._layers.forEach((s,i)=>{s.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.set_enabled(i,t),s.needMemoryUsageUpdate=!0,this._renderPluginContext.requestRender())})}setIsInScaleRange(e,t){const s=this._layers.get(e.wasmLayerId);s&&t!==s.isInScaleRange&&(s.isInScaleRange=t,this._vxl.set_is_in_scale_range(e.wasmLayerId,t),s.needMemoryUsageUpdate=!t,this._renderPluginContext.requestRender())}setStaticSections(e,t){const s={mask:1,staticSections:t};return this._doMaskedUIUpdate(e,s,!0)}setCurrentVariable(e,t){const s={mask:1024,currentVariable:t};return this._doMaskedUIUpdate(e,s,!0)}setRenderMode(e,t){const s={mask:8192,renderMode:t};return this._doMaskedUIUpdate(e,s,!0)}setVerticalExaggerationAndOffset(e,t,s,i){const r={mask:256,volStyleDesc:{volumeId:t,verticalExaggeration:s,verticalOffset:i}};return this._doMaskedUIUpdate(e,r,!0)}setVariableStyles(e,t){const s={mask:32768,variableStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setVolumeStyles(e,t){const s={mask:65536,volumeStyles:t};return this._doMaskedUIUpdate(e,s,!0)}setEnableDynamicSections(e,t){const s={mask:4096,containerIsVisible:t,container:1};return this._doMaskedUIUpdate(e,s,!0)}setEnableIsosurfaces(e,t){const s={mask:4096,containerIsVisible:t,container:0};return this._doMaskedUIUpdate(e,s,!0)}setEnableSections(e,t){const s={mask:4096,containerIsVisible:t,container:2};return this._doMaskedUIUpdate(e,s,!0)}setAnalysisSlice(e,t,s,i){const r={mask:131072,analysisSlice:{point:s,normal:i,enabled:t}};return this._doMaskedUIUpdate(e,r,!0)}updateLayerTimeProperties(e){if(!this._vxl)return;const t=this._layers.get(e.wasmLayerId);if(t){const s=t.layerView.layer;let i=0;s.timeOffset&&(i=n(s.timeOffset.value,s.timeOffset.unit,"seconds"));const r=this._getTimeArgs(s.timeExtent);this._vxl.set_layer_time_properties(e.wasmLayerId,r.startTime,r.endTime,r.hasTime,s.useViewTime,i),this._renderPluginContext.requestRender()}}_doMaskedUIUpdate(e,t,s){if(!this._vxl)return!1;let i=!1;return this._layers.forEach((s,r)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){const e={str:JSON.stringify(t),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(i=1===this._vxl.handle_masked_ui_update(r,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}}),i&&s&&this._renderPluginContext.requestRender(),i}_addTriangleToWasmBuffer(e,t,s,i,r){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],e[3*(t+=1)]=i[0],e[3*t+1]=i[1],e[3*t+2]=i[2],e[3*(t+=1)]=r[0],e[3*t+1]=r[1],e[3*t+2]=r[2],t+=1}_addNormalToWasmBuffer(e,t,s){return e[3*t]=s[0],e[3*t+1]=s[1],e[3*t+2]=s[2],t+=1}_doCaptureFrustum(){if(!this._vxl)return;const e=36,t=e/3,s=this._vxl._malloc(3*e*Float32Array.BYTES_PER_ELEMENT),i=new Float32Array(this._vxl.HEAPF32.buffer,s,3*e),r=this._vxl._malloc(3*t*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(this._vxl.HEAPF32.buffer,r,e),n=this._frustum.points[0],l=this._frustum.points[1],o=this._frustum.points[2],h=this._frustum.points[3],d=this._frustum.points[4],u=this._frustum.points[5],_=this._frustum.points[6],c=this._frustum.points[7];let m=0,g=0;const f=this._frustum.planes[4];m=this._addTriangleToWasmBuffer(i,m,o,l,n),g=this._addNormalToWasmBuffer(a,g,f),m=this._addTriangleToWasmBuffer(i,m,n,h,o),g=this._addNormalToWasmBuffer(a,g,f);const p=this._frustum.planes[5];m=this._addTriangleToWasmBuffer(i,m,d,u,_),g=this._addNormalToWasmBuffer(a,g,p),m=this._addTriangleToWasmBuffer(i,m,_,c,d),g=this._addNormalToWasmBuffer(a,g,p);const y=this._frustum.planes[3];m=this._addTriangleToWasmBuffer(i,m,_,o,h),g=this._addNormalToWasmBuffer(a,g,y),m=this._addTriangleToWasmBuffer(i,m,h,c,_),g=this._addNormalToWasmBuffer(a,g,y);const x=this._frustum.planes[2];m=this._addTriangleToWasmBuffer(i,m,n,l,u),g=this._addNormalToWasmBuffer(a,g,x),m=this._addTriangleToWasmBuffer(i,m,u,d,n),g=this._addNormalToWasmBuffer(a,g,x);const v=this._frustum.planes[0];m=this._addTriangleToWasmBuffer(i,m,h,n,d),g=this._addNormalToWasmBuffer(a,g,v),m=this._addTriangleToWasmBuffer(i,m,d,c,h),g=this._addNormalToWasmBuffer(a,g,v);const b=this._frustum.planes[1];m=this._addTriangleToWasmBuffer(i,m,o,_,u),g=this._addNormalToWasmBuffer(a,g,b),m=this._addTriangleToWasmBuffer(i,m,u,l,o),g=this._addNormalToWasmBuffer(a,g,b),-1!==this._frustumRenderableId&&this._vxl.remove_generic_mesh(this._frustumRenderableId),this._frustumRenderableId=this._vxl.add_generic_mesh(s,3*e,r,e,255,0,0,64),this._vxl._free(s),this._vxl._free(r),this._captureFrustum=!1,this._renderPluginContext.requestRender()}captureFrustum(){null===this._renderCoordsHelper&&(this._renderCoordsHelper=f.create(2,u(!1,this.view.spatialReference))),null===this._frustum&&(this._frustum=new g(this._renderCoordsHelper)),this._captureFrustum=!0,null!==this._renderPluginContext&&this._renderPluginContext.requestRender()}toggleFullVolumeExtentDraw(e){this._vxl&&this._layers.forEach((t,s)=>{t.layerView.wasmLayerId===e.wasmLayerId&&(this._vxl.toggle_full_volume_extent_draw(s),this._renderPluginContext.requestRender())})}dropQueryRenderTarget(){this._vxl&&this._vxl.drop_query_rt()}addVoxelLayer(e){if(!this._vxl){const t={layerView:e,resolveCallback:null,rejectCallback:null},s=new Promise((e,s)=>{t.resolveCallback=e,t.rejectCallback=s});return this._newLayers.push(t),s}const t=this._addVoxelLayer(e);return t<0?Promise.reject(-1):Promise.resolve(t)}removeVoxelLayer(e){if(!this._vxl){const t=this._newLayers.findIndex(t=>e.uid===t.layerView.uid);t>=0&&(this._newLayers[t].resolveCallback(-1),this._newLayers.splice(t,1));const s=this._newLayers.length;return 0===s&&(this._dbg(1," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}let t=-1;this._layers.forEach((s,i)=>{if(s.layerView.wasmLayerId===e.wasmLayerId){t=i,s.abortController.abort(),this._vxl.remove_layer(t);const r=this.layerViewUid.indexOf(e.uid);-1!==r&&this.layerViewUid.splice(r,1)}}),t>=0&&this._layers.delete(t);const s=this._layers.size;return 0===s&&(this._dbg(1," no voxel layers left after removing a layer, removing RenderPlugin and destroying"),this.destroy()),s}_getBlockSize(e){for(const t of this._wasmMemBlockSizes)if(e<t)return t;return-1}_allocateBlock(e){e.byteCount=this._vxl.lengthBytesUTF8(e.str)+1;const t=this._getBlockSize(e.byteCount);return t<0?(e.isReusable=!1,e.ptr=this._vxl._malloc(e.byteCount)):(e.isReusable=!0,e.ptr=this._wasmMemBlocks.get(t),0===e.ptr&&(e.ptr=this._vxl._malloc(t),this._wasmMemBlocks.set(t,e.ptr))),0!==e.ptr&&(this._vxl.stringToUTF8(e.str,e.ptr,e.byteCount),!0)}_getTimeArgs(e){let t=-Number.MAX_VALUE,s=Number.MAX_VALUE,i=!1;return null!=e&&(e.isAllTime?i=!0:(null!=e.start&&(i=!0,t=e.start.getTime()/1e3),null!=e.end&&(i=!0,s=e.end.getTime()/1e3))),{startTime:t,endTime:s,hasTime:i}}_addVoxelLayer(e){const t=e.layer;let i=-1;const r=t.getConfiguration();if(r.length<1)return-1;const a={str:r,byteCount:0,ptr:0,isReusable:!1};if(!this._allocateBlock(a))return-1;const l=this._getTimeArgs(t.timeExtent),o=this.view.spatialReference.isWGS84&&t.spatialReference.isWGS84?111319.49079327357:1;let h=0;if(t.timeOffset&&(h=n(t.timeOffset.value,t.timeOffset.unit,"seconds")),i=this._vxl.add_layer(t.serviceRoot,a.ptr,a.byteCount,o,o,l.startTime,l.endTime,l.hasTime,t.useViewTime,h,this._toWasmQuality(this.view.qualityProfile)),a.isReusable||this._vxl._free(a.ptr),i>=0){t.test?.constantUpscaling&&(this._setUpscalingLimits(0,.25,.25),this._setUpscalingLimits(1,.5,.5),this._setUpscalingLimits(2,.75,.75));const r=new AbortController;if(this._layers.set(i,{layerView:e,responses:new Map,outstandingRequestCount:0,abortController:r,needMemoryUsageUpdate:!1,isInScaleRange:!0}),this.layerViewUid.push(e.uid),!this._halfIntTexturesAvailable||has("mac")){const t=[];let i="";for(const s of e.layer.variables)"Int16"!==s.renderingFormat.type&&"UInt16"!==s.renderingFormat.type||(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}if(!this._textureFloatLinearAvailable){const t=[];let i="";for(const s of e.layer.variables)"Float32"===s.renderingFormat.type&&(t.push(s.name),s.id===e.layer.currentVariableId&&(i=s.name));""!==i&&s.getLogger(this).error("#addVoxelLayer_error()",e.layer,`The voxel layer '${e.layer.title}' cannot render the current variable '${i}' in this browser`),t.length>0&&s.getLogger(this).warn("#addVoxelLayer_warning()",e.layer,`The voxel layer '${e.layer.title}' cannot render the variables '${t.toString()}' in this browser`)}return has("esri-mobile")&&s.getLogger(this).warnOnce("Mobile support differs across devices. Voxel layer might not display as expected."),i}return-1}prepareRender(e){if(!this._vxl)return;const t=e.bind.camera.viewForward,s=e.bind.camera.eye;this._vxl.update_camera_pos_and_direction(s[0],s[1],s[2],t[0],t[1],t[2]);const i=this._vxl.cull();this._dbg(2,"missingResourceCount="+i),this._moreToLoad=i>0,this._havePreparedWithAllLayers=0===this._newLayers.length,this._updateMemoryUsage()}acquireTechniques(){return[]}render(e){if(!this._vxl)return;for(const s of this._newLayers){const e=this._addVoxelLayer(s.layerView);-1===e?s.rejectCallback(-1):s.resolveCallback(e)}if(this._newLayers=[],0===this._layers.size)return void this._dbg(4,"No voxel layers but RenderPlugin instance is being asked to render!");this._lastFrameWasStationary=this.view.stationary,this._syncRequestsResponses(),this._beforeDraw(),this._vxl.begin_color_frame(!this.view.stage.renderer.isFeatureEnabled(3),e.bind.lighting.mainLight.direction[0],e.bind.lighting.mainLight.direction[1],e.bind.lighting.mainLight.direction[2]);const t=this._renderTargetToRestore.viewport;t.width===this._viewportWidth&&t.height===this._viewportHeight||(this._viewportWidth=t.width,this._viewportHeight=t.height,this._vxl.set_viewport(t.width,t.height),this._layers.forEach(e=>{e.needMemoryUsageUpdate=!0})),0===t.x&&0===t.y||this._dbg(4,"Unsupported viewport parameters detected!"),this.updateWasmCamera(e.bind.camera),this._captureFrustum&&(this._frustum.update(e.bind.camera),this._doCaptureFrustum()),this._vxl.draw(),this._afterDraw(),(this._moreToLoad||!this._havePreparedWithAllLayers&&this._layers.size>0)&&this._renderPluginContext.requestRender()}destroy(){this._dbg(1,"--destroy--"),this._vxl&&(this._layers.forEach(e=>{e.abortController.abort()}),this._wasmMemBlocks.forEach(e=>{0!==e&&this._vxl._free(e)}),this._vxl.uninitialize_voxel_wasm(),this._removeRenderPlugin(),this._vxl=null)}_initializeWasm(e){return this._vxl?Promise.resolve():(this._vxlPromise||(this._vxlPromise=_(e).then(t=>{if(t.specialHTMLTargets.jsAPI3DRenderingContext=e,this._vxl=t,this._vxlPromise=null,this._newLayers.length<=0)return this._dbg(1," no voxel layers left after WASM downloaded, removing RenderPlugin and destroying"),void this.destroy();const s=this._getTimeArgs(this.view?.timeExtent),i=this._vxl.addFunction(this._restoreFramebuffer.bind(this),"v"),r=this._vxl.addFunction(this._setBlendState.bind(this),"viiii"),a=this._vxl.addFunction(this._setFrontFace.bind(this),"vi"),n=this._vxl.addFunction(this._setRasterizerState.bind(this),"vi"),l=this._vxl.addFunction(this._setDepthStencilStateFunction.bind(this),"viii"),o=this._vxl.addFunction(this._setViewport.bind(this),"viiii"),h=this._vxl.addFunction(this._bindPreviousDepthToSlot.bind(this),"iii"),d=this._vxl.addFunction(this._modifyResourceCount.bind(this),"viii"),u=this._halfIntTexturesAvailable&&!has("mac"),_=this._textureFloatLinearAvailable;this._vxl.initialize_voxel_wasm(i,r,a,n,l,o,h,d,s.startTime,s.endTime,s.hasTime,u,_),this._renderPluginContext&&this._renderPluginContext.requestRender()}).catch(()=>{for(const e of this._newLayers)e.rejectCallback(-2);this._dbg(4," WASM failed to download, removing RenderPlugin and destroying"),this.destroy()})),this._vxlPromise)}pickDepth(e,t,s){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const i=s.viewport[3]-t;if(e<0||e>s.viewport[2]||t<0||t>s.viewport[3])return this._dbg(4,`[js] pickDepth: outOfRange, screenXY=[${e.toFixed(0)}, ${i.toFixed(0)}]]`),null;this._beforeDraw();const r=s.viewForward,a=s.eye;this._vxl.update_camera_pos_and_direction(a[0],a[1],a[2],r[0],r[1],r[2]),this.updateWasmCamera(s),this._vxl.begin_frame();const n=this._vxl.pick_depth(e,i);if(this._afterDraw(),n.success){return n.distanceToCamera}return null}pickObject(e,t,s,i){if(!this._vxl||!this._rctx||0===this._layers.size)return null;const r=Math.round(e),a=Math.round(t);if(r<0||r>s.viewport[2]||a<0||a>s.viewport[3])return this._dbg(4,`[js] pickObject: outOfRange, screenXY=[${r}, ${a}], vp=[${s.viewport.toString()}]`),null;this._beforeDraw();const n=s.viewForward,l=s.eye;this._vxl.update_camera_pos_and_direction(l[0],l[1],l[2],n[0],n[1],n[2]),this.updateWasmCamera(s),this._vxl.begin_frame();let o=null;if(0===i.length)o=this._vxl.pick_object(r,a,0,0);else{const e={str:JSON.stringify({layerIds:i}),byteCount:0,ptr:0,isReusable:!1};this._allocateBlock(e)&&(o=this._vxl.pick_object(r,a,e.ptr,e.byteCount),e.isReusable||this._vxl._free(e.ptr))}return this._afterDraw(),o}async getOtherFieldPopupValues(e,s){for(const i of e){const e=i.gpuResult;if(!e)continue;const r=this._layers.get(e.layerId);if(!r||!r.layerView.layer.url)continue;const a=r.layerView.layer,n={responseType:"array-buffer",signal:r.abortController.signal,query:{...r.layerView.layer.customParameters,token:r.layerView.layer.apiKey}},l=e.voxelSpacePosition,o=[Math.floor(l[0]/32),Math.floor(l[1]/32),Math.floor(l[2]/32)],h=[-4&o[0],-4&o[1],-4&o[2]];let d=0;if(e.epochTime){const t=this._vxl.get_layer_epoch_times(r.layerView.wasmLayerId,a.currentVariableId);for(let s=0;s<t.length;++s)if(t[s]===e.epochTime/1e3){d=s;break}}const u=[],_={varIds:[],ptrs:[],sizes:[]};for(const i of s){const e=a.variables.findIndex(e=>e.name===i);if(-1===e)continue;const s=a.variables.getItemAt(e)?.id;if(null==s)continue;const r=`${a.url}/variables/${s}/${d}/bundles/0/${h[0]}-${h[1]}-${h[2]}`;u.push(t(r,n).then(e=>e.data)),_.varIds.push(s)}const c=await Promise.allSettled(u),m=c.length;for(let t=0;t<m;++t){const e=c[t];if("fulfilled"===e.status){const t=e.value,s=this._vxl._malloc(t.byteLength);new Uint8Array(this._vxl.HEAPU8.buffer,s,t.byteLength).set(new Uint8Array(t)),_.ptrs.push(s),_.sizes.push(t.byteLength)}else _.varIds.splice(t,1)}const g=this._vxl.get_other_field_popup_values(e,_);for(let t=0;t<_.ptrs.length;++t)this._vxl._free(_.ptrs[t]);if(g.continuousValues)for(const t in g.continuousValues)i.attributes[t]=g.continuousValues[t];if(g.uniqueValues)for(const t in g.uniqueValues)i.attributes[t]=g.uniqueValues[t]}return e}_beforeDraw(){this._renderTargetToRestore={fbo:this._rctx.getBoundFramebufferObject(),viewport:this._rctx.getViewport()},this._rctx.setPolygonOffsetFillEnabled(!1),this._rctx.setScissorTestEnabled(!1),this._rctx.setColorMask(!0,!0,!0,!0)}_afterDraw(){this._renderTargetToRestore.fbo=null,this._rctx.externalTextureUnitUpdate(this._vxl.get_texture_units_bound_in_frame(),this._vxl.get_active_texture_unit()),this._rctx.externalVertexArrayObjectUpdate(),this._rctx.externalVertexBufferUpdate(),this._rctx.externalProgramUpdate()}intersect(e,t,s,i,r){if(!this._vxl||!this._rctx||0===this._layers.size||!e.options.selectionMode||e.options.isFiltered||!e.camera)return;if(null==r||r[0]<0||r[0]>e.camera.viewport[2]||r[1]<0||r[1]>e.camera.viewport[3])return this._dbg(4,r?`[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=[${r[0].toFixed(0)}, ${r[1].toFixed(0)}]`:"[js] VoxelWasmPerScene.intersect: outOfRange, screenXY=null"),null;const a=[];this._layers.forEach(t=>{e.options.filteredLayerViewUids.includes(t.layerView.uid)&&a.push(t.layerView.wasmLayerId)});const n=this.pickObject(r[0],r[1],e.camera,a);if(null==n||-1===n.layerId)return;const l=this._layers.get(n.layerId);if(l){const t=l.layerView.layer.uid,r=n.distanceToCamera/h(s,i),a=d();a[0]=n.worldX,a[1]=n.worldY,a[2]=n.worldZ;const o={},u=l.layerView.layer,_=u.variables.findIndex(e=>e.id===u.currentVariableId);if(_>=0){const e=u.variables.getItemAt(_);null!=e&&(null!=n.continuousValue?o[e.name]=n.continuousValue:null!=n.uniqueValueLabel&&null!=n.uniqueValue?o[e.name]=`${n.uniqueValueLabel} (${n.uniqueValue})`:null!=n.uniqueValue&&(o[e.name]=`${n.uniqueValue}`),e.description.length>0?o["Voxel.CurrentVariable"]=e.description:e.name?.length>0&&(o["Voxel.CurrentVariable"]=e.name))}if(o["Voxel.Position"]=`[${n.voxelSpacePosition.toString()}]`,null!=n.epochTime&&null!=n.nativeTime&&null!=n.nativeTimeUnits){const e=new Date(n.epochTime);o["Voxel.LocalTime"]=e,o["Voxel.SourceTime"]=`${n.nativeTime.toLocaleString()} ${n.nativeTimeUnits}`}null!=n.depth&&(o["Voxel.Depth"]=n.depth);const c=n.faceNormal;o["Voxel.WorldPosition"]=`[${a[0]}, ${a[1]}, ${a[2]}]`;const g=e=>{const s=new m(a,t,()=>this._createVoxelGraphic(l.layerView.layer,o,n));e.set(this.type,s,r,c)},f=e.results,p=2===e.options.store;if((null==f.min.distance||r<f.min.distance)&&g(f.min),(null==f.max.distance||r>f.max.distance)&&g(f.max),p){const t=new y(e.ray);g(t),e.results.all.push(t)}}}_createVoxelGraphic(e,t,s){return new c({layer:e,sourceLayer:e,origin:e.graphicOrigin,attributes:t,gpuResult:s})}_toWasmQuality(e){switch(e){case"low":return 0;case"medium":return 1;case"high":return 2}}_setUpscalingLimits(e,t,s){this._vxl&&this._vxl.set_upscaling_limits(e,t,s)}hasHighlight(){return!1}};e([l({constructOnly:!0})],x.prototype,"view",void 0),x=e([o("esri.layers.VoxelWasmPerSceneView")],x);const v=x;export{v as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{D as o,a as n}from"../../../chunks/vec32.js";import{webMercatorToGeographic as e}from"../../../geometry/support/webMercatorUtils.js";import{getWebMercatorScalingFactor as i,convertOrientationToPixelLocation as c,validatePointsToTransform as s,validateRotationMatrix as m}from"./utils.js";import{normalizeDegrees as f}from"../../../widgets/OrientedImageryViewer/components/imageNavigationUtils.js";function l(t,a){const{cameraLocation:r,pointsToTransform:o,scalingFactor:n}=h(t,a.cameraLocation,a.rotationMatrix),e=new Array;return p(o,e,{...a,cameraLocation:r,scalingFactor:n,...d(a)}),Array.isArray(t)?e:e[0]}function u(t,a,r){return l(t?a.map(t=>e(t)):a,r).map(t=>({...t,z:1}))}function p(t,a,o){const{affineTransformations:e,cameraLocation:i,focalLengthX:c,focalLengthY:s,principalOffsetPoint:m,radialDistortionCoefficients:f,rotationMatrix:l,scalingFactor:u,tangentialDistortionCoefficients:p}=o;for(const g of t){const t=r();n(t,g,i),t[0]=t[0]/u,t[1]=t[1]/u;const o=-c*((l[0]*t[0]+l[3]*t[1]+l[6]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),h=-s*((l[1]*t[0]+l[4]*t[1]+l[7]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),y=o*o+h*h;let L=0,A=0,d=0,w=0,T=0,b=0,M=0;f&&(L=f[0]??0,A=f[1]??0,d=f[2]??0),p&&(w=p[0],T=p[1]),m&&(b=m[0]??0,M=m[1]??0);const N=1+L*y+A*y*y+d*y*y*y;let j=o*N+w*(y+2*o**2)+2*T*o*h,F=h*N+T*(y+2*h**2)+2*w*o*h;j+=b,F+=M;const v=Number(e[0])+Number(e[1])*j+Number(e[2])*F,x=Number(e[3])+Number(e[4])*j+Number(e[5])*F;a.push({x:v,y:x})}}function g(a,r){const{cameraHeading:n,imageHeight:e,imageWidth:s}=r,{cameraLocation:m,pointsToTransform:l}=y(a,r.cameraLocation),u=new Array,p=i(m[1],r.cameraLocation.spatialReference);for(const i of l){const a=o([m[0],m[1],m[2]*p],[i[0],i[1],i[2]*p]),r=[(i[0]-m[0])/a,(i[1]-m[1])/a,(i[2]-m[2])*p/a],l=0!==r[0]&&0!==r[1]?f(t(Math.atan2(r[0],r[1]))-n):0,g=t(Math.acos(-r[2]));u.push(c(l,g,s,e))}return Array.isArray(a)?u:u[0]}function h(t,a,r){const o=Array.isArray(t)||"items"in t?t:[t];s(o,a),L(o,a),m(r);const n=i(a.y,a.spatialReference);return{pointsToTransform:o.map(t=>t.toArray()),scalingFactor:n,cameraLocation:a.toArray()}}function y(t,a){const r=Array.isArray(t)||"items"in t?t:[t];return s(r,a),L(r,a),{pointsToTransform:r.map(t=>t.toArray()),cameraLocation:a.toArray()}}function L(t,a){if(t.some(t=>!t.spatialReference.equals(a.spatialReference)))throw new Error("Input points and camera location must have the same spatial reference")}function A(t){return null!=t?.focalLength}function d(t){if(A(t))return{focalLengthX:t.focalLength,focalLengthY:t.focalLength};const{imageWidth:r,imageHeight:o,horizontalFieldOfView:n,verticalFieldOfView:e}=t;return{focalLengthX:r/(2*Math.tan(a(n)/2)),focalLengthY:o/(2*Math.tan(a(e)/2))}}export{l as worldToImage,g as worldToImagePanoramic,u as worldToImageWithLTPFlag};
5
+ import{rad2deg as t,deg2rad as a}from"../../../core/mathUtils.js";import{create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{B as o,a as n}from"../../../chunks/vec32.js";import{webMercatorToGeographic as e}from"../../../geometry/support/webMercatorUtils.js";import{getWebMercatorScalingFactor as i,convertOrientationToPixelLocation as c,validatePointsToTransform as s,validateRotationMatrix as m}from"./utils.js";import{normalizeDegrees as f}from"../../../widgets/OrientedImageryViewer/components/imageNavigationUtils.js";function l(t,a){const{cameraLocation:r,pointsToTransform:o,scalingFactor:n}=h(t,a.cameraLocation,a.rotationMatrix),e=new Array;return p(o,e,{...a,cameraLocation:r,scalingFactor:n,...d(a)}),Array.isArray(t)?e:e[0]}function u(t,a,r){return l(t?a.map(t=>e(t)):a,r).map(t=>({...t,z:1}))}function p(t,a,o){const{affineTransformations:e,cameraLocation:i,focalLengthX:c,focalLengthY:s,principalOffsetPoint:m,radialDistortionCoefficients:f,rotationMatrix:l,scalingFactor:u,tangentialDistortionCoefficients:p}=o;for(const g of t){const t=r();n(t,g,i),t[0]=t[0]/u,t[1]=t[1]/u;const o=-c*((l[0]*t[0]+l[3]*t[1]+l[6]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),h=-s*((l[1]*t[0]+l[4]*t[1]+l[7]*t[2])/(l[2]*t[0]+l[5]*t[1]+l[8]*t[2])),y=o*o+h*h;let L=0,A=0,d=0,w=0,T=0,b=0,M=0;f&&(L=f[0]??0,A=f[1]??0,d=f[2]??0),p&&(w=p[0],T=p[1]),m&&(b=m[0]??0,M=m[1]??0);const N=1+L*y+A*y*y+d*y*y*y;let j=o*N+w*(y+2*o**2)+2*T*o*h,F=h*N+T*(y+2*h**2)+2*w*o*h;j+=b,F+=M;const v=Number(e[0])+Number(e[1])*j+Number(e[2])*F,x=Number(e[3])+Number(e[4])*j+Number(e[5])*F;a.push({x:v,y:x})}}function g(a,r){const{cameraHeading:n,imageHeight:e,imageWidth:s}=r,{cameraLocation:m,pointsToTransform:l}=y(a,r.cameraLocation),u=new Array,p=i(m[1],r.cameraLocation.spatialReference);for(const i of l){const a=o([m[0],m[1],m[2]*p],[i[0],i[1],i[2]*p]),r=[(i[0]-m[0])/a,(i[1]-m[1])/a,(i[2]-m[2])*p/a],l=0!==r[0]&&0!==r[1]?f(t(Math.atan2(r[0],r[1]))-n):0,g=t(Math.acos(-r[2]));u.push(c(l,g,s,e))}return Array.isArray(a)?u:u[0]}function h(t,a,r){const o=Array.isArray(t)||"items"in t?t:[t];s(o,a),L(o,a),m(r);const n=i(a.y,a.spatialReference);return{pointsToTransform:o.map(t=>t.toArray()),scalingFactor:n,cameraLocation:a.toArray()}}function y(t,a){const r=Array.isArray(t)||"items"in t?t:[t];return s(r,a),L(r,a),{pointsToTransform:r.map(t=>t.toArray()),cameraLocation:a.toArray()}}function L(t,a){if(t.some(t=>!t.spatialReference.equals(a.spatialReference)))throw new Error("Input points and camera location must have the same spatial reference")}function A(t){return null!=t?.focalLength}function d(t){if(A(t))return{focalLengthX:t.focalLength,focalLengthY:t.focalLength};const{imageWidth:r,imageHeight:o,horizontalFieldOfView:n,verticalFieldOfView:e}=t;return{focalLengthX:r/(2*Math.tan(a(n)/2)),focalLengthY:o/(2*Math.tan(a(e)/2))}}export{l as worldToImage,g as worldToImagePanoramic,u as worldToImageWithLTPFlag};
@@ -8,7 +8,8 @@ import type Field from "./Field.js";
8
8
  *
9
9
  * @since 4.12
10
10
  */
11
- export default abstract class FieldsIndex<T extends Field = Field> {
11
+ export default class FieldsIndex<T extends Field = Field> {
12
+ constructor(fields?: T[] | null | undefined);
12
13
  /**
13
14
  * An array of date fields or field json objects.
14
15
  *
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{rad2deg as e}from"../../core/mathUtils.js";import{e as t,i as r,p as n,d as o,z as i,y as s,a as m}from"../../chunks/vec32.js";import{fromValues as a,create as h}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WGS84ECEFSpatialReferenceLike as l}from"../../geometry/ellipsoidUtils.js";import c from"../../geometry/Extent.js";import f from"../../geometry/HeightModelInfo.js";import x from"../../geometry/SpatialReference.js";import{projectBuffer as u}from"../../geometry/projection/projectBuffer.js";function g(e,t){if(!Array.isArray(e)||e.length<t)return!1;for(const r of e)if("number"!=typeof r)return!1;return!0}const d=7645211,p={xmin:-180,ymin:-90,zmin:-450,xmax:180,ymax:90,zmax:8850},S=new Map([[5773,new f({heightModel:"gravity-related-height",heightUnit:"meters",vertCRS:"EGM96_Geoid"})],[3855,new f({heightModel:"gravity-related-height",heightUnit:"meters",vertCRS:"EGM2008_Geoid"})],[115700,new f({heightModel:"ellipsoidal",heightUnit:"meters",vertCRS:"WGS_1984"})],[115701,new f({heightModel:"ellipsoidal",heightUnit:"meters",vertCRS:"ETRS_1989"})],[6360,new f({heightModel:"gravity-related-height",heightUnit:"us-feet",vertCRS:"NAVD88_height_(ftUS)"})],[7837,new f({heightModel:"gravity-related-height",heightUnit:"meters",vertCRS:"DHHN2016_(height) "})]]);function _(e){if(!e)return null;const t=e.vcsWkid||e.latestVcsWkid;return t?S.get(t):null}function R(e){return!(!(e.extensions?.ESRI_crs?.wkid||e.extensions?.ESRI_crs?.latestWkid||e.extensions?.ESRI_crs?.wkt)||!e.root?.extensions?.ESRI_crs?.boundingVolume?.box&&!e.root?.extensions?.ESRI_crs?.boundingVolume?.sphere)}function E(f,S=!1){let _=new x({wkid:4326,vcsWkid:115700}),R=f.root?.boundingVolume,E=!1,b=f?.root?.transform;if(S&&(f.extensions?.ESRI_crs?.wkid||f.extensions?.ESRI_crs?.latestWkid||f.extensions?.ESRI_crs?.wkt)&&(f.root?.extensions?.ESRI_crs?.boundingVolume?.box||f.root?.extensions?.ESRI_crs?.boundingVolume?.sphere))_=new x(f.extensions?.ESRI_crs),R=f.root?.extensions?.ESRI_crs?.boundingVolume,b=f.root?.transform,E=!0;else if(!R)return new c(-180,-90,180,90,_);if(R.box){const e=R?.box;if(e[3]>d&&e[7]>d&&e[11]>d)return new c({...p,spatialReference:_})}const y=h();if(!E&&R.region&&g(R.region,6)){const t=R.region,r=e(t[0]),n=e(t[1]),o=t[4],i=e(t[2]),s=e(t[3]),m=t[5];return new c({xmin:r,ymin:n,zmin:o,xmax:i,ymax:s,zmax:m,spatialReference:_})}if(R.sphere&&g(R.sphere,4)){const e=R.sphere,m=a(e[0],e[1],e[2]),f=e[3]/Math.sqrt(3),d=h();t(d,m,a(f,f,f));const p=h();if(r(p,m,a(f,f,f)),b&&g(b,16)){const e=b;n(y,d,e),o(d,y),n(y,p,e),o(p,y)}E||(u(d,l,0,d,x.WGS84,0),u(p,l,0,p,x.WGS84,0));const S=h(),w=h();return i(S,d,p),s(w,d,p),new c({xmin:S[0],ymin:S[1],zmin:S[2],xmax:w[0],ymax:w[1],zmax:w[2],spatialReference:_})}if(R.box&&g(R.box,12)){const e=R.box,t=a(e[0],e[1],e[2]),o=a(e[3],e[4],e[5]),f=a(e[6],e[7],e[8]),d=a(e[9],e[10],e[11]),p=[];for(let r=0;r<8;++r)p.push(h());if(r(p[0],t,o),r(p[0],p[0],f),r(p[0],p[0],d),m(p[1],t,o),r(p[1],p[1],f),r(p[1],p[1],d),r(p[2],t,o),m(p[2],p[2],f),r(p[2],p[2],d),m(p[3],t,o),m(p[3],p[3],f),r(p[3],p[3],d),r(p[4],t,o),r(p[4],p[4],f),m(p[4],p[4],d),m(p[5],t,o),r(p[5],p[5],f),m(p[5],p[5],d),r(p[6],t,o),m(p[6],p[6],f),m(p[6],p[6],d),m(p[7],t,o),m(p[7],p[7],f),m(p[7],p[7],d),b&&g(b,16)){const e=b;for(let t=0;t<8;++t)n(p[t],p[t],e)}const S=a(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),y=a(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let r=0;r<8;++r)E||u(p[r],l,0,p[r],x.WGS84,0),i(y,y,p[r]),s(S,S,p[r]);return new c({xmin:y[0],ymin:y[1],zmin:y[2],xmax:S[0],ymax:S[1],zmax:S[2],spatialReference:_})}return new c(-180,-90,180,90,_)}export{_ as getHeightModelInfoFromVCS,R as hasEsriCrs,E as initFullExtent,g as verifyArray};
5
+ import{rad2deg as e}from"../../core/mathUtils.js";import{e as t,i as r,p as n,d as o,x as i,w as s,a as m}from"../../chunks/vec32.js";import{fromValues as a,create as h}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{WGS84ECEFSpatialReferenceLike as l}from"../../geometry/ellipsoidUtils.js";import c from"../../geometry/Extent.js";import f from"../../geometry/HeightModelInfo.js";import x from"../../geometry/SpatialReference.js";import{projectBuffer as u}from"../../geometry/projection/projectBuffer.js";function g(e,t){if(!Array.isArray(e)||e.length<t)return!1;for(const r of e)if("number"!=typeof r)return!1;return!0}const d=7645211,p={xmin:-180,ymin:-90,zmin:-450,xmax:180,ymax:90,zmax:8850},S=new Map([[5773,new f({heightModel:"gravity-related-height",heightUnit:"meters",vertCRS:"EGM96_Geoid"})],[3855,new f({heightModel:"gravity-related-height",heightUnit:"meters",vertCRS:"EGM2008_Geoid"})],[115700,new f({heightModel:"ellipsoidal",heightUnit:"meters",vertCRS:"WGS_1984"})],[115701,new f({heightModel:"ellipsoidal",heightUnit:"meters",vertCRS:"ETRS_1989"})],[6360,new f({heightModel:"gravity-related-height",heightUnit:"us-feet",vertCRS:"NAVD88_height_(ftUS)"})],[7837,new f({heightModel:"gravity-related-height",heightUnit:"meters",vertCRS:"DHHN2016_(height) "})]]);function _(e){if(!e)return null;const t=e.vcsWkid||e.latestVcsWkid;return t?S.get(t):null}function R(e){return!(!(e.extensions?.ESRI_crs?.wkid||e.extensions?.ESRI_crs?.latestWkid||e.extensions?.ESRI_crs?.wkt)||!e.root?.extensions?.ESRI_crs?.boundingVolume?.box&&!e.root?.extensions?.ESRI_crs?.boundingVolume?.sphere)}function E(f,S=!1){let _=new x({wkid:4326,vcsWkid:115700}),R=f.root?.boundingVolume,E=!1,b=f?.root?.transform;if(S&&(f.extensions?.ESRI_crs?.wkid||f.extensions?.ESRI_crs?.latestWkid||f.extensions?.ESRI_crs?.wkt)&&(f.root?.extensions?.ESRI_crs?.boundingVolume?.box||f.root?.extensions?.ESRI_crs?.boundingVolume?.sphere))_=new x(f.extensions?.ESRI_crs),R=f.root?.extensions?.ESRI_crs?.boundingVolume,b=f.root?.transform,E=!0;else if(!R)return new c(-180,-90,180,90,_);if(R.box){const e=R?.box;if(e[3]>d&&e[7]>d&&e[11]>d)return new c({...p,spatialReference:_})}const w=h();if(!E&&R.region&&g(R.region,6)){const t=R.region,r=e(t[0]),n=e(t[1]),o=t[4],i=e(t[2]),s=e(t[3]),m=t[5];return new c({xmin:r,ymin:n,zmin:o,xmax:i,ymax:s,zmax:m,spatialReference:_})}if(R.sphere&&g(R.sphere,4)){const e=R.sphere,m=a(e[0],e[1],e[2]),f=e[3]/Math.sqrt(3),d=h();t(d,m,a(f,f,f));const p=h();if(r(p,m,a(f,f,f)),b&&g(b,16)){const e=b;n(w,d,e),o(d,w),n(w,p,e),o(p,w)}E||(u(d,l,0,d,x.WGS84,0),u(p,l,0,p,x.WGS84,0));const S=h(),y=h();return i(S,d,p),s(y,d,p),new c({xmin:S[0],ymin:S[1],zmin:S[2],xmax:y[0],ymax:y[1],zmax:y[2],spatialReference:_})}if(R.box&&g(R.box,12)){const e=R.box,t=a(e[0],e[1],e[2]),o=a(e[3],e[4],e[5]),f=a(e[6],e[7],e[8]),d=a(e[9],e[10],e[11]),p=[];for(let r=0;r<8;++r)p.push(h());if(r(p[0],t,o),r(p[0],p[0],f),r(p[0],p[0],d),m(p[1],t,o),r(p[1],p[1],f),r(p[1],p[1],d),r(p[2],t,o),m(p[2],p[2],f),r(p[2],p[2],d),m(p[3],t,o),m(p[3],p[3],f),r(p[3],p[3],d),r(p[4],t,o),r(p[4],p[4],f),m(p[4],p[4],d),m(p[5],t,o),r(p[5],p[5],f),m(p[5],p[5],d),r(p[6],t,o),m(p[6],p[6],f),m(p[6],p[6],d),m(p[7],t,o),m(p[7],p[7],f),m(p[7],p[7],d),b&&g(b,16)){const e=b;for(let t=0;t<8;++t)n(p[t],p[t],e)}const S=a(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),w=a(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE);for(let r=0;r<8;++r)E||u(p[r],l,0,p[r],x.WGS84,0),i(w,w,p[r]),s(S,S,p[r]);return new c({xmin:w[0],ymin:w[1],zmin:w[2],xmax:S[0],ymax:S[1],zmax:S[2],spatialReference:_})}return new c(-180,-90,180,90,_)}export{_ as getHeightModelInfoFromVCS,R as hasEsriCrs,E as initFullExtent,g as verifyArray};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{__decorate as e}from"tslib";import{JSONSupport as i}from"../../core/JSONSupport.js";import s from"../../core/Logger.js";import{offsetDateUTC as r}from"../../core/timeUtils.js";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import{e as o,C as a,B as l,i as p}from"../../chunks/vec32.js";import{fromValues as u,fromArray as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import g from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{equals as h}from"../../geometry/support/spatialReferenceUtils.js";import{parseTimeDimensionUnit as d}from"./NCTimeParser.js";import y from"./VoxelDimension.js";let f=class extends i{constructor(e){super(e),this.id=0,this.dimensions=null,this.spatialReference=c.WGS84}get zDimension(){if(!this.dimensions)return-1;if(!Array.isArray(this.dimensions))return-1;if(4!==this.dimensions.length)return-1;for(let e=2;e<4;++e)if(this.dimensions[e].size>0)return e;return-1}get isValid(){return!!this.dimensions&&(!!Array.isArray(this.dimensions)&&(4===this.dimensions.length&&(!(this.dimensions[0].size<1||this.dimensions[1].size<1)&&!(-1===this.zDimension||this.dimensions[this.zDimension].size<1))))}get originInLayerSpace3D(){if(!this.isValid||"xyt"===this.volumeType)return[0,0,0];const e=this.dimensions[0].getRange(),i=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size];return[e[0],i[0],r[0]]}get voxelSizeInLayerSpaceSigned(){if(!this.isValid||"xyt"===this.volumeType)return[0,0,0];const e=this.dimensions[0].getRange(),i=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size],t=[this.sizeInVoxels[0],this.sizeInVoxels[1],this.sizeInVoxels[2]];for(let n=0;n<3;++n)t[n]<2?t[n]=1:t[n]-=1;return s.isRegular&&!s.isPositiveUp&&(t[2]*=-1),[(e[1]-e[0])/t[0],(i[1]-i[0])/t[1],(r[1]-r[0])/t[2]]}get volumeType(){if(this.isValid){const e=this.dimensions[2].size>0;let i=this.dimensions[3].size>0;if(i){const e=this.dimensions[3];if(i="time"===e.quantity,i&&null!==e.unit){i=d(e.unit).didParse}}if(!e&&i)return"xyt";if(e&&i)return"xyzt"}return"xyz"}get sizeInVoxels(){if(!this.isValid)return[0,0,0];const e=this.zDimension;return[this.dimensions[0].size,this.dimensions[1].size,this.dimensions[e].size]}get timeStops(){if("xyzt"!==this.volumeType)return[];const e=this.dimensions[3],i=[],s=d(e.unit);if(s.didParse)if(e.isRegular){const t=e.regularSpacing?.offset??0,n=e.regularSpacing?.scale||1;for(let o=0;o<e.size;++o){const e=t+n*o;i.push(r(s.reference,e,s.unit))}}else if(Array.isArray(e.irregularSpacing?.values)&&e.irregularSpacing.values.length>0)for(let t=0;t<e.irregularSpacing.values.length;++t){const n=e.irregularSpacing.values[t];i.push(r(s.reference,n,s.unit))}return i}computeVoxelSpaceLocation(e){if(!this.isValid)return[0,0,0];if("xyt"===this.volumeType)return s.getLogger(this).error("computeVoxelSpacePosition cannot be used with XYT volumes."),[0,0,0];if(!h(this.spatialReference,e.spatialReference))return s.getLogger(this).error("pos argument should have the same spatial reference as the VoxelLayer."),[0,0,0];const i=u(e.x,e.y,e.z??0);o(i,i,this.originInLayerSpace3D),a(i,i,this.voxelSizeInLayerSpaceSigned);const r=this.dimensions[this.zDimension];if(!r.isRegular&&Array.isArray(r.irregularSpacing?.values)&&r.irregularSpacing.values.length>1){const s=e.z??0,t=r.irregularSpacing.values,n=r.isPositiveUp?1:-1,o=t.reduce((e,i)=>Math.abs(n*i-s)<Math.abs(n*e-s)?i:e);for(let e=0;e<t.length;++e)if(t[e]===o){i[2]=e;break}}return[i[0],i[1],i[2]]}computeLayerSpaceLocation(e){if(!this.isValid)return new g({x:0,y:0,spatialReference:this.spatialReference});const i=m(e);if(l(i,i,this.voxelSizeInLayerSpaceSigned),p(i,i,this.originInLayerSpace3D),"xyt"===this.volumeType)return new g({x:i[0],y:i[1],spatialReference:this.spatialReference});const s=this.dimensions[this.zDimension];return s.isRegular||Array.isArray(s.irregularSpacing?.values)&&(e[2]<0?i[2]=s.irregularSpacing.values[0]:e[2]<s.irregularSpacing.values.length?i[2]=s.irregularSpacing.values[e[2]]:i[2]=s.irregularSpacing.values[s.irregularSpacing.values.length-1],s.isPositiveUp||(i[2]*=-1)),new g({x:i[0],y:i[1],z:i[2],spatialReference:this.spatialReference})}};e([t({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],f.prototype,"id",void 0),e([t({type:[y],json:{write:{enabled:!0,isRequired:!0}}})],f.prototype,"dimensions",void 0),e([t({type:c,json:{read:{enabled:!1}}})],f.prototype,"spatialReference",void 0),e([t({type:Number,json:{read:!1}})],f.prototype,"zDimension",null),e([t({type:[Boolean],json:{read:!1}})],f.prototype,"isValid",null),e([t({type:[Number],json:{read:!1}})],f.prototype,"originInLayerSpace3D",null),e([t({type:[Number],json:{read:!1}})],f.prototype,"voxelSizeInLayerSpaceSigned",null),e([t({type:["xyz","xyzt","xyt"],json:{read:{enabled:!1}}})],f.prototype,"volumeType",null),e([t({type:[Number],json:{read:!1}})],f.prototype,"sizeInVoxels",null),e([t({type:[Date],json:{read:!1,write:!1}})],f.prototype,"timeStops",null),f=e([n("esri.layers.voxel.VoxelVolume")],f);export{f as default};
5
+ import{__decorate as e}from"tslib";import{JSONSupport as i}from"../../core/JSONSupport.js";import s from"../../core/Logger.js";import{offsetDateUTC as r}from"../../core/timeUtils.js";import{property as t,subclass as n}from"../../core/accessorSupport/decorators.js";import{e as o,A as a,z as l,i as p}from"../../chunks/vec32.js";import{fromValues as u,fromArray as m}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import g from"../../geometry/Point.js";import c from"../../geometry/SpatialReference.js";import{equals as h}from"../../geometry/support/spatialReferenceUtils.js";import{parseTimeDimensionUnit as d}from"./NCTimeParser.js";import y from"./VoxelDimension.js";let f=class extends i{constructor(e){super(e),this.id=0,this.dimensions=null,this.spatialReference=c.WGS84}get zDimension(){if(!this.dimensions)return-1;if(!Array.isArray(this.dimensions))return-1;if(4!==this.dimensions.length)return-1;for(let e=2;e<4;++e)if(this.dimensions[e].size>0)return e;return-1}get isValid(){return!!this.dimensions&&(!!Array.isArray(this.dimensions)&&(4===this.dimensions.length&&(!(this.dimensions[0].size<1||this.dimensions[1].size<1)&&!(-1===this.zDimension||this.dimensions[this.zDimension].size<1))))}get originInLayerSpace3D(){if(!this.isValid||"xyt"===this.volumeType)return[0,0,0];const e=this.dimensions[0].getRange(),i=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size];return[e[0],i[0],r[0]]}get voxelSizeInLayerSpaceSigned(){if(!this.isValid||"xyt"===this.volumeType)return[0,0,0];const e=this.dimensions[0].getRange(),i=this.dimensions[1].getRange(),s=this.dimensions[2],r=s.isRegular?s.getRange():[0,s.size],t=[this.sizeInVoxels[0],this.sizeInVoxels[1],this.sizeInVoxels[2]];for(let n=0;n<3;++n)t[n]<2?t[n]=1:t[n]-=1;return s.isRegular&&!s.isPositiveUp&&(t[2]*=-1),[(e[1]-e[0])/t[0],(i[1]-i[0])/t[1],(r[1]-r[0])/t[2]]}get volumeType(){if(this.isValid){const e=this.dimensions[2].size>0;let i=this.dimensions[3].size>0;if(i){const e=this.dimensions[3];if(i="time"===e.quantity,i&&null!==e.unit){i=d(e.unit).didParse}}if(!e&&i)return"xyt";if(e&&i)return"xyzt"}return"xyz"}get sizeInVoxels(){if(!this.isValid)return[0,0,0];const e=this.zDimension;return[this.dimensions[0].size,this.dimensions[1].size,this.dimensions[e].size]}get timeStops(){if("xyzt"!==this.volumeType)return[];const e=this.dimensions[3],i=[],s=d(e.unit);if(s.didParse)if(e.isRegular){const t=e.regularSpacing?.offset??0,n=e.regularSpacing?.scale||1;for(let o=0;o<e.size;++o){const e=t+n*o;i.push(r(s.reference,e,s.unit))}}else if(Array.isArray(e.irregularSpacing?.values)&&e.irregularSpacing.values.length>0)for(let t=0;t<e.irregularSpacing.values.length;++t){const n=e.irregularSpacing.values[t];i.push(r(s.reference,n,s.unit))}return i}computeVoxelSpaceLocation(e){if(!this.isValid)return[0,0,0];if("xyt"===this.volumeType)return s.getLogger(this).error("computeVoxelSpacePosition cannot be used with XYT volumes."),[0,0,0];if(!h(this.spatialReference,e.spatialReference))return s.getLogger(this).error("pos argument should have the same spatial reference as the VoxelLayer."),[0,0,0];const i=u(e.x,e.y,e.z??0);o(i,i,this.originInLayerSpace3D),a(i,i,this.voxelSizeInLayerSpaceSigned);const r=this.dimensions[this.zDimension];if(!r.isRegular&&Array.isArray(r.irregularSpacing?.values)&&r.irregularSpacing.values.length>1){const s=e.z??0,t=r.irregularSpacing.values,n=r.isPositiveUp?1:-1,o=t.reduce((e,i)=>Math.abs(n*i-s)<Math.abs(n*e-s)?i:e);for(let e=0;e<t.length;++e)if(t[e]===o){i[2]=e;break}}return[i[0],i[1],i[2]]}computeLayerSpaceLocation(e){if(!this.isValid)return new g({x:0,y:0,spatialReference:this.spatialReference});const i=m(e);if(l(i,i,this.voxelSizeInLayerSpaceSigned),p(i,i,this.originInLayerSpace3D),"xyt"===this.volumeType)return new g({x:i[0],y:i[1],spatialReference:this.spatialReference});const s=this.dimensions[this.zDimension];return s.isRegular||Array.isArray(s.irregularSpacing?.values)&&(e[2]<0?i[2]=s.irregularSpacing.values[0]:e[2]<s.irregularSpacing.values.length?i[2]=s.irregularSpacing.values[e[2]]:i[2]=s.irregularSpacing.values[s.irregularSpacing.values.length-1],s.isPositiveUp||(i[2]*=-1)),new g({x:i[0],y:i[1],z:i[2],spatialReference:this.spatialReference})}};e([t({type:Number,json:{write:{enabled:!0,isRequired:!0}}})],f.prototype,"id",void 0),e([t({type:[y],json:{write:{enabled:!0,isRequired:!0}}})],f.prototype,"dimensions",void 0),e([t({type:c,json:{read:{enabled:!1}}})],f.prototype,"spatialReference",void 0),e([t({type:Number,json:{read:!1}})],f.prototype,"zDimension",null),e([t({type:[Boolean],json:{read:!1}})],f.prototype,"isValid",null),e([t({type:[Number],json:{read:!1}})],f.prototype,"originInLayerSpace3D",null),e([t({type:[Number],json:{read:!1}})],f.prototype,"voxelSizeInLayerSpaceSigned",null),e([t({type:["xyz","xyzt","xyt"],json:{read:{enabled:!1}}})],f.prototype,"volumeType",null),e([t({type:[Number],json:{read:!1}})],f.prototype,"sizeInVoxels",null),e([t({type:[Date],json:{read:!1,write:!1}})],f.prototype,"timeStops",null),f=e([n("esri.layers.voxel.VoxelVolume")],f);export{f as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/core",
3
- "version": "5.0.0-next.60",
3
+ "version": "5.0.0-next.61",
4
4
  "homepage": "https://js.arcgis.com",
5
5
  "description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
6
6
  "keywords": [
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- const e="20251211",d="04eeb2732e879144e06282900dba2276f2ddd56c";export{e as buildDate,d as commitHash};
5
+ const f="20251211",a="a79cfbbff587f555aae2057a94f66f66214b22eb";export{f as buildDate,a as commitHash};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{moduloPositive as e,deg2rad as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import o from"../../../../core/RandomLCG.js";import i from"../../../../geometry/Extent.js";import{getInfo as l}from"../../../../geometry/support/spatialReferenceUtils.js";const s=()=>t.getLogger("esri.views.2d.engine.flow.dataUtils"),a=10;async function c(t,e,n,o){const i=performance.now(),l=f(e,n),c=performance.now(),h=d(e,l,n.width,n.height),u=performance.now(),m=w(h,!0),y=performance.now(),x="Streamlines"===t?p(m,a):g(m),M=performance.now();return has("esri-2d-profiler")&&(s().info("I.1","_createFlowFieldFromData (ms)",Math.round(c-i)),s().info("I.2","_getStreamlines (ms)",Math.round(u-c)),s().info("I.3","createAnimatedLinesData (ms)",Math.round(y-u)),s().info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(M-y)),s().info("I.5","createFlowMesh (ms)",Math.round(M-i)),s().info("I.6","Mesh size (bytes)",x.vertexData.buffer.byteLength+x.indexData.buffer.byteLength)),await Promise.resolve(),r(o),x}function f(t,e){const n=m(e.data,e.width,e.height,t.smoothing);if(t.interpolate){return(t,r)=>{const o=Math.floor(t),i=Math.floor(r);if(o<0||o>=e.width)return[0,0];if(i<0||i>=e.height)return[0,0];const l=t-o,s=r-i,a=o,c=i,f=o<e.width-1?o+1:o,h=i<e.height-1?i+1:i,u=n[2*(c*e.width+a)],d=n[2*(c*e.width+f)],m=n[2*(h*e.width+a)],w=n[2*(h*e.width+f)],p=n[2*(c*e.width+a)+1],g=n[2*(c*e.width+f)+1];return[(u*(1-s)+m*s)*(1-l)+(d*(1-s)+w*s)*l,(p*(1-s)+n[2*(h*e.width+a)+1]*s)*(1-l)+(g*(1-s)+n[2*(h*e.width+f)+1]*s)*l]}}return(t,r)=>{const o=Math.round(t),i=Math.round(r);return o<0||o>=e.width||i<0||i>=e.height?[0,0]:[n[2*(i*e.width+o)],n[2*(i*e.width+o)+1]]}}function h(t,n,r,o,i,l,s,a){const c=[],{raster:f,width:h,height:u,resolutionFactor:d}=a;let m=o,w=i,p=0,[g,y]=r(m,w);g*=n.velocityScale,y*=n.velocityScale;const x=Math.sqrt(g*g+y*y);let M,A;c.push({x:m,y:w,t:p,speed:x});for(let v=0;v<n.verticesPerLine;v++){let[o,i]=r(m,w);o*=n.velocityScale,i*=n.velocityScale;const a=Math.sqrt(o*o+i*i);if(a<n.minSpeedThreshold)return c;const g=t*o/a,y=t*i/a;m+=g*n.segmentLength,w+=y*n.segmentLength,n.wrapAround&&(m=e(m,l[0]));if(p+=t*n.segmentLength/a,Math.acos(g*M+y*A)>n.maxTurnAngle)return c;if(n.collisions){let t=Math.round(m*d);const r=Math.round(w*d);if(n.wrapAround&&(t=e(t,h)),t<0||t>h-1||r<0||r>u-1)return c;const o=f[r*h+t];if(-1!==o&&o!==s)return c;f[r*h+t]=s}c.push({x:m,y:w,t:p,speed:a}),M=g,A=y}return c}function u(t,e,n,r,o,i,l,s){const a=Math.round((.2+.6*l.getFloat())*t.verticesPerLine),c=t.verticesPerLine-a,f=h(-1,{...t,verticesPerLine:c},e,n,r,o,i,s),u=h(1,{...t,verticesPerLine:a},e,n,r,o,i,s),d=f.reverse();d.splice(-1,1);return d.concat(u)}function d(t,e,n,r,i={positions:[]}){if(t.density<=0)return[];const{positions:l}=i,s=[],a=new o,c=1/Math.max(t.lineCollisionWidth,1),f=Math.round(n*c),d=Math.round(r*c),m=new Int32Array(f*d);for(let o=0;o<m.length;o++)m[o]=-1;const w={raster:m,width:f,height:d,resolutionFactor:c},p={},g=t.lineSpacing/Math.sqrt(t.density),y=Math.floor(r/g),x=Math.floor(n/g);for(let o=0;o<y;o++){const t=o*g;for(let e=0;e<x;e++){const n=e*g;p[`${e}-${o}`]={x:n,y:t,positions:[]}}}for(const{x:o,y:h}of l){const t=p[`${Math.floor(o/g)}-${Math.floor(h/g)}`];t&&t.positions.push([o,h])}const M=[];for(const o in p){const t=p[o];if(0===t.positions.length)M.push({x:t.x+g/2,y:t.y+g/2,sort:.66+.33*a.getFloat(),stage:0});else{const[e]=t.positions.splice(0,1);M.push({x:e[0],y:e[1],sort:.33*a.getFloat(),stage:1});for(const[n,r]of t.positions)M.push({x:n,y:r,sort:.33+.33*a.getFloat(),stage:2})}}M.sort((t,e)=>t.sort-e.sort);for(const{x:o,y:A,stage:v}of M){const i=t.onlyForwardTracing?h(1,t,e,o,A,[n,r],s.length,w):u(t,e,o,A,[n,r],s.length,a,w);i.length<2||s.push({stage:v,vertices:i})}return s}function m(t,e,n,r){if(0===r)return t;const o=Math.round(3*r),i=new Array(2*o+1);let l=0;for(let c=-o;c<=o;c++){const t=Math.exp(-c*c/(r*r));i[c+o]=t,l+=t}for(let c=-o;c<=o;c++)i[c+o]/=l;const s=new Float32Array(t.length);for(let c=0;c<n;c++)for(let n=0;n<e;n++){let r=0,l=0;for(let s=-o;s<=o;s++){if(n+s<0||n+s>=e)continue;const a=i[s+o];r+=a*t[2*(c*e+(n+s))],l+=a*t[2*(c*e+(n+s))+1]}s[2*(c*e+n)]=r,s[2*(c*e+n)+1]=l}const a=new Float32Array(t.length);for(let c=0;c<e;c++)for(let t=0;t<n;t++){let r=0,l=0;for(let a=-o;a<=o;a++){if(t+a<0||t+a>=n)continue;const f=i[a+o];r+=f*s[2*((t+a)*e+c)],l+=f*s[2*((t+a)*e+c)+1]}a[2*(t*e+c)]=r,a[2*(t*e+c)+1]=l}return a}function w(t,e){const n=new o,r=t.reduce((t,e)=>t+e.vertices.length,0),i=new Float32Array(4*r),l=new Array(t.length);let s=0,a=0;for(const{vertices:o}of t){const t=s;for(const e of o)i[4*s]=e.x,i[4*s+1]=e.y,i[4*s+2]=e.t,i[4*s+3]=e.speed,s++;l[a++]={startVertex:t,numberOfVertices:o.length,totalTime:o[o.length-1].t,timeSeed:e?n.getFloat():0}}return{lineVertices:i,lineDescriptors:l}}function p(t,e){const n=9,{lineVertices:r,lineDescriptors:o}=t;let i=0,l=0;for(const d of o){i+=2*d.numberOfVertices;l+=6*(d.numberOfVertices-1)}const s=new Float32Array(i*n),a=new Uint32Array(l);let c=0,f=0;function h(){a[f++]=c-2,a[f++]=c,a[f++]=c-1,a[f++]=c,a[f++]=c+1,a[f++]=c-1}function u(t,e,r,o,i,l,a,f){const h=c*n;let u=0;s[h+u++]=t,s[h+u++]=e,s[h+u++]=1,s[h+u++]=r,s[h+u++]=l,s[h+u++]=a,s[h+u++]=o/2,s[h+u++]=i/2,s[h+u++]=f,c++,s[h+u++]=t,s[h+u++]=e,s[h+u++]=-1,s[h+u++]=r,s[h+u++]=l,s[h+u++]=a,s[h+u++]=-o/2,s[h+u++]=-i/2,s[h+u++]=f,c++}for(const d of o){const{totalTime:t,timeSeed:n}=d;let o=null,i=null,l=null,s=null,a=null,c=null;for(let f=0;f<d.numberOfVertices;f++){const m=r[4*(d.startVertex+f)],w=r[4*(d.startVertex+f)+1],p=r[4*(d.startVertex+f)+2],g=r[4*(d.startVertex+f)+3];let y=null,x=null,M=null,A=null;if(f>0){y=m-o,x=w-i;const r=Math.sqrt(y*y+x*x);if(y/=r,x/=r,f>1){let t=y+a,n=x+c;const r=Math.sqrt(t*t+n*n);t/=r,n/=r;const o=Math.min(1/(t*y+n*x),e);t*=o,n*=o,M=-n,A=t}else M=-x,A=y;null!==M&&null!==A&&(u(o,i,l,M,A,t,n,g),h())}o=m,i=w,l=p,a=y,c=x,s=g}u(o,i,l,-c,a,t,n,s)}return{vertexData:s,indexData:a}}function g(t){const e=16,n=1,r=2,{lineVertices:o,lineDescriptors:i}=t;let l=0,s=0;for(const S of i){const t=S.numberOfVertices-1;l+=4*t*2,s+=6*t*2}const a=new Float32Array(l*e),c=new Uint32Array(s);let f,h,u,d,m,w,p,g,y,x,M,A,v,F,I=0,V=0;function L(){c[V++]=I-8,c[V++]=I-7,c[V++]=I-6,c[V++]=I-7,c[V++]=I-5,c[V++]=I-6,c[V++]=I-4,c[V++]=I-3,c[V++]=I-2,c[V++]=I-3,c[V++]=I-1,c[V++]=I-2}function b(t,o,i,l,s,c,f,h,u,d,m,w,p,g){const y=I*e;let x=0;for(const e of[n,r])for(const n of[1,2,3,4])a[y+x++]=t,a[y+x++]=o,a[y+x++]=i,a[y+x++]=l,a[y+x++]=f,a[y+x++]=h,a[y+x++]=u,a[y+x++]=d,a[y+x++]=e,a[y+x++]=n,a[y+x++]=p,a[y+x++]=g,a[y+x++]=s/2,a[y+x++]=c/2,a[y+x++]=m/2,a[y+x++]=w/2,I++}function k(t,e){let n=y+M,r=x+A;const o=Math.sqrt(n*n+r*r);n/=o,r/=o;const i=y*n+x*r;n/=i,r/=i;let l=M+v,s=A+F;const a=Math.sqrt(l*l+s*s);l/=a,s/=a;const c=M*l+A*s;l/=c,s/=c,b(f,h,u,d,-r,n,m,w,p,g,-s,l,t,e),L()}function D(t,e,n,r,o,i){if(y=M,x=A,M=v,A=F,null==y&&null==x&&(y=M,x=A),null!=m&&null!=w){v=t-m,F=e-w;const n=Math.sqrt(v*v+F*F);v/=n,F/=n}null!=y&&null!=x&&k(o,i),f=m,h=w,u=p,d=g,m=t,w=e,p=n,g=r}function P(t,e){y=M,x=A,M=v,A=F,null==y&&null==x&&(y=M,x=A),null!=y&&null!=x&&k(t,e)}for(const S of i){f=null,h=null,u=null,d=null,m=null,w=null,p=null,g=null,y=null,x=null,M=null,A=null,v=null,F=null;const{totalTime:t,timeSeed:e}=S;for(let n=0;n<S.numberOfVertices;n++){D(o[4*(S.startVertex+n)],o[4*(S.startVertex+n)+1],o[4*(S.startVertex+n)+2],o[4*(S.startVertex+n)+3],t,e)}P(t,e)}return{vertexData:a,indexData:c}}function y(t,e,r=e.width,o=e.height,i=0,l=0){const s=e.pixels,a=r*o,c=2,f=new Float32Array(a*c),h=e.width,u=(t,e)=>t+i+(e+l)*h,d=(t,e)=>t+e*r;let m;if(null!=e.mask)if(r!==e.width||o!==e.height||0!==i||0!==l){m=new Uint8Array(a*c);const t=e.mask;for(let e=0;e<o;++e)for(let n=0;n<r;++n){const r=u(n,e),o=d(n,e);m[c*o]=t[c*r],m[c*o+1]=t[c*r+1]}}else m=e.mask;else m=new Uint8Array(a*c),m.fill(255);if("vector-uv"===t)for(let n=0;n<o;++n)for(let t=0;t<r;++t){const e=u(t,n),r=d(t,n);f[c*r]=s[0][e],f[c*r+1]=-s[1][e]}else if("vector-magdir"===t){const{cos:t,sin:e}=Math;for(let i=0;i<o;++i)for(let o=0;o<r;++o){const r=u(o,i),l=d(o,i),a=s[0][r],h=n(s[1][r]),m=t(h-Math.PI/2),w=e(h-Math.PI/2);f[c*l]=m*a,f[c*l+1]=w*a}}return{data:f,mask:m,width:r,height:o}}async function x(t,e,n,r,o,a){const c=performance.now(),f=l(e.spatialReference);if(!f){const i=await M(t,e,n,r,o,a);return has("esri-2d-profiler")&&s().info("I.7","loadImagery, early exit (ms)",Math.round(performance.now()-c)),has("esri-2d-profiler")&&s().info("I.9","Number of parts",1),i}const[h,u]=f.valid,d=u-h,m=Math.ceil(e.width/d),w=e.width/m,p=Math.round(n/m);let g=e.xmin;const y=[],x=performance.now();for(let l=0;l<m;l++){const n=new i({xmin:g,xmax:g+w,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference});y.push(M(t,n,p,r,o,a)),g+=w}const A=await Promise.all(y);if(has("esri-2d-profiler")&&s().info("I.8","All calls to _fetchPart (ms)",Math.round(performance.now()-x)),has("esri-2d-profiler")&&s().info("I.9","Number of parts",A.length),1===A.length)return has("esri-2d-profiler")&&s().info("I.10","loadImagery, general exit without stitching back (ms)",Math.round(performance.now()-c)),A[0];const v={data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};let F=0;for(const i of A){for(let t=0;t<i.height;t++)for(let e=0;e<i.width;e++)F+e>=n||(v.data[2*(t*n+F+e)]=i.data[2*(t*i.width+e)],v.data[2*(t*n+F+e)+1]=i.data[2*(t*i.width+e)+1],v.mask[t*n+F+e]=i.mask[t*i.width+e]);F+=i.width}return has("esri-2d-profiler")&&s().info("I.10","loadImagery, general exit (ms)",Math.round(performance.now()-c)),v}async function M(t,e,n,r,o,i){const l={requestProjectedLocalDirections:!0,signal:i};if(null!=o&&(l.timeExtent=o),"imagery"===t.type){await t.load({signal:i});const o=await t.internalFetchImage(e,n,r,l);if(null==o?.pixelData?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return y(t.rasterInfo.dataType,o.pixelData.pixelBlock)}await t.load({signal:i});const s=await t.fetchPixels(e,n,r,l);if(null==s?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return y(t.serviceRasterInfo.dataType,s.pixelBlock)}export{w as createAnimatedLinesData,f as createFlowFieldFromData,c as createFlowMesh,g as createParticlesMesh,p as createStreamlinesMesh,x as loadImagery,y as toFlowData,d as traceFlowPaths};
5
+ import has from"../../../../core/has.js";import t from"../../../../core/Logger.js";import{moduloPositive as e,deg2rad as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r}from"../../../../core/promiseUtils.js";import o from"../../../../core/RandomLCG.js";import{Seconds as i}from"../../../../core/time.js";import s from"../../../../geometry/Extent.js";import{getInfo as l}from"../../../../geometry/support/spatialReferenceUtils.js";const a=()=>t.getLogger("esri.views.2d.engine.flow.dataUtils"),c=10;async function f(t,e,n,o){const i=performance.now(),s=h(e,n),l=performance.now(),f=m(e,s,n.width,n.height),u=performance.now(),d=p(f,!0),w=performance.now(),x="Streamlines"===t?g(d,c):y(d),M=performance.now();return has("esri-2d-profiler")&&(a().info("I.1","_createFlowFieldFromData (ms)",Math.round(l-i)),a().info("I.2","_getStreamlines (ms)",Math.round(u-l)),a().info("I.3","createAnimatedLinesData (ms)",Math.round(w-u)),a().info("I.4","create{Streamlines|Particles}Mesh (ms)",Math.round(M-w)),a().info("I.5","createFlowMesh (ms)",Math.round(M-i)),a().info("I.6","Mesh size (bytes)",x.vertexData.buffer.byteLength+x.indexData.buffer.byteLength)),await Promise.resolve(),r(o),x}function h(t,e){const n=w(e.data,e.width,e.height,t.smoothing);if(t.interpolate){return(t,r)=>{const o=Math.floor(t),i=Math.floor(r);if(o<0||o>=e.width)return[0,0];if(i<0||i>=e.height)return[0,0];const s=t-o,l=r-i,a=o,c=i,f=o<e.width-1?o+1:o,h=i<e.height-1?i+1:i,u=n[2*(c*e.width+a)],d=n[2*(c*e.width+f)],m=n[2*(h*e.width+a)],w=n[2*(h*e.width+f)],p=n[2*(c*e.width+a)+1],g=n[2*(c*e.width+f)+1];return[(u*(1-l)+m*l)*(1-s)+(d*(1-l)+w*l)*s,(p*(1-l)+n[2*(h*e.width+a)+1]*l)*(1-s)+(g*(1-l)+n[2*(h*e.width+f)+1]*l)*s]}}return(t,r)=>{const o=Math.round(t),i=Math.round(r);return o<0||o>=e.width||i<0||i>=e.height?[0,0]:[n[2*(i*e.width+o)],n[2*(i*e.width+o)+1]]}}function u(t,n,r,o,s,l,a,c){const f=[],{raster:h,width:u,height:d,resolutionFactor:m}=c;let w=o,p=s,g=i(0),[y,x]=r(w,p);y*=n.velocityScale,x*=n.velocityScale;const M=Math.sqrt(y*y+x*x);let A,v;f.push({x:w,y:p,time:g,speed:M});for(let F=0;F<n.verticesPerLine;F++){let[o,s]=r(w,p);o*=n.velocityScale,s*=n.velocityScale;const c=Math.sqrt(o*o+s*s);if(c<n.minSpeedThreshold)return f;const y=t*o/c,x=t*s/c;w+=y*n.segmentLength,p+=x*n.segmentLength,n.wrapAround&&(w=e(w,l[0]));const M=t*n.segmentLength/c;if(g=i(g+M),Math.acos(y*A+x*v)>n.maxTurnAngle)return f;if(n.collisions){let t=Math.round(w*m);const r=Math.round(p*m);if(n.wrapAround&&(t=e(t,u)),t<0||t>u-1||r<0||r>d-1)return f;const o=h[r*u+t];if(-1!==o&&o!==a)return f;h[r*u+t]=a}f.push({x:w,y:p,time:g,speed:c}),A=y,v=x}return f}function d(t,e,n,r,o,i,s,l){const a=Math.round((.2+.6*s.getFloat())*t.verticesPerLine),c=t.verticesPerLine-a,f=u(-1,{...t,verticesPerLine:c},e,n,r,o,i,l),h=u(1,{...t,verticesPerLine:a},e,n,r,o,i,l),d=f.reverse();d.splice(-1,1);return d.concat(h)}function m(t,e,n,r,i={positions:[]}){if(t.density<=0)return[];const{positions:s}=i,l=[],a=new o,c=1/Math.max(t.lineCollisionWidth,1),f=Math.round(n*c),h=Math.round(r*c),m=new Int32Array(f*h);for(let o=0;o<m.length;o++)m[o]=-1;const w={raster:m,width:f,height:h,resolutionFactor:c},p={},g=t.lineSpacing/Math.sqrt(t.density),y=Math.floor(r/g),x=Math.floor(n/g);for(let o=0;o<y;o++){const t=o*g;for(let e=0;e<x;e++){const n=e*g;p[`${e}-${o}`]={x:n,y:t,positions:[]}}}for(const{x:o,y:u}of s){const t=p[`${Math.floor(o/g)}-${Math.floor(u/g)}`];t&&t.positions.push([o,u])}const M=[];for(const o in p){const t=p[o];if(0===t.positions.length)M.push({x:t.x+g/2,y:t.y+g/2,sort:.66+.33*a.getFloat(),stage:0});else{const[e]=t.positions.splice(0,1);M.push({x:e[0],y:e[1],sort:.33*a.getFloat(),stage:1});for(const[n,r]of t.positions)M.push({x:n,y:r,sort:.33+.33*a.getFloat(),stage:2})}}M.sort((t,e)=>t.sort-e.sort);for(const{x:o,y:A,stage:v}of M){const i=t.onlyForwardTracing?u(1,t,e,o,A,[n,r],l.length,w):d(t,e,o,A,[n,r],l.length,a,w);i.length<2||l.push({stage:v,vertices:i})}return l}function w(t,e,n,r){if(0===r)return t;const o=Math.round(3*r),i=new Array(2*o+1);let s=0;for(let c=-o;c<=o;c++){const t=Math.exp(-c*c/(r*r));i[c+o]=t,s+=t}for(let c=-o;c<=o;c++)i[c+o]/=s;const l=new Float32Array(t.length);for(let c=0;c<n;c++)for(let n=0;n<e;n++){let r=0,s=0;for(let l=-o;l<=o;l++){if(n+l<0||n+l>=e)continue;const a=i[l+o];r+=a*t[2*(c*e+(n+l))],s+=a*t[2*(c*e+(n+l))+1]}l[2*(c*e+n)]=r,l[2*(c*e+n)+1]=s}const a=new Float32Array(t.length);for(let c=0;c<e;c++)for(let t=0;t<n;t++){let r=0,s=0;for(let a=-o;a<=o;a++){if(t+a<0||t+a>=n)continue;const f=i[a+o];r+=f*l[2*((t+a)*e+c)],s+=f*l[2*((t+a)*e+c)+1]}a[2*(t*e+c)]=r,a[2*(t*e+c)+1]=s}return a}function p(t,e){const n=new o,r=t.reduce((t,e)=>t+e.vertices.length,0),i=new Float32Array(4*r),s=new Array(t.length);let l=0,a=0;for(const{vertices:o}of t){const t=l;for(const e of o)i[4*l]=e.x,i[4*l+1]=e.y,i[4*l+2]=e.time,i[4*l+3]=e.speed,l++;s[a++]={startVertex:t,numberOfVertices:o.length,totalTime:o[o.length-1].time,timeSeed:e?n.getFloat():0}}return{lineVertices:i,lineDescriptors:s}}function g(t,e){const n=9,{lineVertices:r,lineDescriptors:o}=t;let i=0,s=0;for(const d of o){i+=2*d.numberOfVertices;s+=6*(d.numberOfVertices-1)}const l=new Float32Array(i*n),a=new Uint32Array(s);let c=0,f=0;function h(){a[f++]=c-2,a[f++]=c,a[f++]=c-1,a[f++]=c,a[f++]=c+1,a[f++]=c-1}function u(t,e,r,o,i,s,a,f){const h=c*n;let u=0;l[h+u++]=t,l[h+u++]=e,l[h+u++]=1,l[h+u++]=r,l[h+u++]=s,l[h+u++]=a,l[h+u++]=o/2,l[h+u++]=i/2,l[h+u++]=f,c++,l[h+u++]=t,l[h+u++]=e,l[h+u++]=-1,l[h+u++]=r,l[h+u++]=s,l[h+u++]=a,l[h+u++]=-o/2,l[h+u++]=-i/2,l[h+u++]=f,c++}for(const d of o){const{totalTime:t,timeSeed:n}=d;let o=null,i=null,s=null,l=null,a=null,c=null;for(let f=0;f<d.numberOfVertices;f++){const m=r[4*(d.startVertex+f)],w=r[4*(d.startVertex+f)+1],p=r[4*(d.startVertex+f)+2],g=r[4*(d.startVertex+f)+3];let y=null,x=null,M=null,A=null;if(f>0){y=m-o,x=w-i;const r=Math.sqrt(y*y+x*x);if(y/=r,x/=r,f>1){let t=y+a,n=x+c;const r=Math.sqrt(t*t+n*n);t/=r,n/=r;const o=Math.min(1/(t*y+n*x),e);t*=o,n*=o,M=-n,A=t}else M=-x,A=y;null!==M&&null!==A&&(u(o,i,s,M,A,t,n,g),h())}o=m,i=w,s=p,a=y,c=x,l=g}u(o,i,s,-c,a,t,n,l)}return{vertexData:l,indexData:a}}function y(t){const e=16,n=1,r=2,{lineVertices:o,lineDescriptors:i}=t;let s=0,l=0;for(const S of i){const t=S.numberOfVertices-1;s+=4*t*2,l+=6*t*2}const a=new Float32Array(s*e),c=new Uint32Array(l);let f,h,u,d,m,w,p,g,y,x,M,A,v,F,I=0,V=0;function L(){c[V++]=I-8,c[V++]=I-7,c[V++]=I-6,c[V++]=I-7,c[V++]=I-5,c[V++]=I-6,c[V++]=I-4,c[V++]=I-3,c[V++]=I-2,c[V++]=I-3,c[V++]=I-1,c[V++]=I-2}function b(t,o,i,s,l,c,f,h,u,d,m,w,p,g){const y=I*e;let x=0;for(const e of[n,r])for(const n of[1,2,3,4])a[y+x++]=t,a[y+x++]=o,a[y+x++]=i,a[y+x++]=s,a[y+x++]=f,a[y+x++]=h,a[y+x++]=u,a[y+x++]=d,a[y+x++]=e,a[y+x++]=n,a[y+x++]=p,a[y+x++]=g,a[y+x++]=l/2,a[y+x++]=c/2,a[y+x++]=m/2,a[y+x++]=w/2,I++}function k(t,e){let n=y+M,r=x+A;const o=Math.sqrt(n*n+r*r);n/=o,r/=o;const i=y*n+x*r;n/=i,r/=i;let s=M+v,l=A+F;const a=Math.sqrt(s*s+l*l);s/=a,l/=a;const c=M*s+A*l;s/=c,l/=c,b(f,h,u,d,-r,n,m,w,p,g,-l,s,t,e),L()}function D(t,e,n,r,o,i){if(y=M,x=A,M=v,A=F,null==y&&null==x&&(y=M,x=A),null!=m&&null!=w){v=t-m,F=e-w;const n=Math.sqrt(v*v+F*F);v/=n,F/=n}null!=y&&null!=x&&k(o,i),f=m,h=w,u=p,d=g,m=t,w=e,p=n,g=r}function P(t,e){y=M,x=A,M=v,A=F,null==y&&null==x&&(y=M,x=A),null!=y&&null!=x&&k(t,e)}for(const S of i){f=null,h=null,u=null,d=null,m=null,w=null,p=null,g=null,y=null,x=null,M=null,A=null,v=null,F=null;const{totalTime:t,timeSeed:e}=S;for(let n=0;n<S.numberOfVertices;n++){D(o[4*(S.startVertex+n)],o[4*(S.startVertex+n)+1],o[4*(S.startVertex+n)+2],o[4*(S.startVertex+n)+3],t,e)}P(t,e)}return{vertexData:a,indexData:c}}function x(t,e,r=e.width,o=e.height,i=0,s=0){const l=e.pixels,a=r*o,c=2,f=new Float32Array(a*c),h=e.width,u=(t,e)=>t+i+(e+s)*h,d=(t,e)=>t+e*r;let m;if(null!=e.mask)if(r!==e.width||o!==e.height||0!==i||0!==s){m=new Uint8Array(a*c);const t=e.mask;for(let e=0;e<o;++e)for(let n=0;n<r;++n){const r=u(n,e),o=d(n,e);m[c*o]=t[c*r],m[c*o+1]=t[c*r+1]}}else m=e.mask;else m=new Uint8Array(a*c),m.fill(255);if("vector-uv"===t)for(let n=0;n<o;++n)for(let t=0;t<r;++t){const e=u(t,n),r=d(t,n);f[c*r]=l[0][e],f[c*r+1]=-l[1][e]}else if("vector-magdir"===t){const{cos:t,sin:e}=Math;for(let i=0;i<o;++i)for(let o=0;o<r;++o){const r=u(o,i),s=d(o,i),a=l[0][r],h=n(l[1][r]),m=t(h-Math.PI/2),w=e(h-Math.PI/2);f[c*s]=m*a,f[c*s+1]=w*a}}return{data:f,mask:m,width:r,height:o}}async function M(t,e,n,r,o,i){const c=performance.now(),f=l(e.spatialReference);if(!f){const s=await A(t,e,n,r,o,i);return has("esri-2d-profiler")&&a().info("I.7","loadImagery, early exit (ms)",Math.round(performance.now()-c)),has("esri-2d-profiler")&&a().info("I.9","Number of parts",1),s}const[h,u]=f.valid,d=u-h,m=Math.ceil(e.width/d),w=e.width/m,p=Math.round(n/m);let g=e.xmin;const y=[],x=performance.now();for(let l=0;l<m;l++){const n=new s({xmin:g,xmax:g+w,ymin:e.ymin,ymax:e.ymax,spatialReference:e.spatialReference});y.push(A(t,n,p,r,o,i)),g+=w}const M=await Promise.all(y);if(has("esri-2d-profiler")&&a().info("I.8","All calls to _fetchPart (ms)",Math.round(performance.now()-x)),has("esri-2d-profiler")&&a().info("I.9","Number of parts",M.length),1===M.length)return has("esri-2d-profiler")&&a().info("I.10","loadImagery, general exit without stitching back (ms)",Math.round(performance.now()-c)),M[0];const v={data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};let F=0;for(const s of M){for(let t=0;t<s.height;t++)for(let e=0;e<s.width;e++)F+e>=n||(v.data[2*(t*n+F+e)]=s.data[2*(t*s.width+e)],v.data[2*(t*n+F+e)+1]=s.data[2*(t*s.width+e)+1],v.mask[t*n+F+e]=s.mask[t*s.width+e]);F+=s.width}return has("esri-2d-profiler")&&a().info("I.10","loadImagery, general exit (ms)",Math.round(performance.now()-c)),v}async function A(t,e,n,r,o,i){const s={requestProjectedLocalDirections:!0,signal:i};if(null!=o&&(s.timeExtent=o),"imagery"===t.type){await t.load({signal:i});const o=await t.internalFetchImage(e,n,r,s);if(null==o?.pixelData?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return x(t.rasterInfo.dataType,o.pixelData.pixelBlock)}await t.load({signal:i});const l=await t.fetchPixels(e,n,r,s);if(null==l?.pixelBlock)return{data:new Float32Array(n*r*2),mask:new Uint8Array(n*r),width:n,height:r};return x(t.serviceRasterInfo.dataType,l.pixelBlock)}export{p as createAnimatedLinesData,h as createFlowFieldFromData,f as createFlowMesh,y as createParticlesMesh,g as createStreamlinesMesh,M as loadImagery,x as toFlowData,m as traceFlowPaths};
@@ -2,4 +2,4 @@
2
2
  All material copyright Esri, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/5.0/esri/copyright.txt for details.
4
4
  */
5
- import{pt2px as e}from"../../../../core/screenUtils.js";import{isFlowPathBuffer as t,valuesPerFlowVertex as n}from"../../../3d/support/flow/loadUtils.js";function i(t){const n=o(r(t)),i=n,s=!0,a=Math.max(n/2,5),l=Math.round(e(t.maxPathLength)/a)+1,u=10,{density:c}=t;return{smoothing:e(t.smoothing),interpolate:!0,velocityScale:"flow-from"===t.flowRepresentation?1:-1,verticesPerLine:l,minSpeedThreshold:.001,segmentLength:a,maxTurnAngle:1,collisions:s,lineCollisionWidth:i,lineSpacing:u,density:c,onlyForwardTracing:!0,wrapAround:!1}}function o(e){return"constant"===e.kind?e.value[0]:e.values[e.values.length-1]}function s(e){const t=e.toRgba();return[t[0]/255,t[1]/255,t[2]/255,t[3]]}function a(e){return{kind:"constant",value:[.1,.1,.1,1]}}function r(t){if(!t.hasVisualVariables("size"))return{kind:"constant",value:[e(t.trailWidth)]};const n=t.getVisualVariablesForType("size")[0],i=[],o=[];let s;if(n.stops){for(const t of n.stops)i.push(t.value),o.push(e(t.size));s=n.stops.length}else i.push(n.minDataValue,n.maxDataValue),o.push(e(n.minSize),e(n.maxSize)),s=2;return{kind:"ramp",stops:i,values:o,count:s}}function l(e){if(!e.hasVisualVariables("color"))return{kind:"constant",value:s(e.color)};const t=e.getVisualVariablesForType("color")[0],n=[],i=[];for(const o of t.stops)n.push(o.value),Array.prototype.push.apply(i,s(o.color));return{kind:"ramp",stops:n,values:i,count:t.stops.length}}function u(e){if(!e.hasVisualVariables("opacity"))return{kind:"constant",value:[1]};const t=e.getVisualVariablesForType("opacity")[0],n=[],i=[];for(const o of t.stops)n.push(o.value),i.push(o.opacity);return{kind:"ramp",stops:n,values:i,count:t.stops.length}}function c(e,t,n,i){switch(t){case"int":e.setUniform1iv(n,i);break;case"float":e.setUniform1fv(n,i);break;case"vec2":e.setUniform2fv(n,i);break;case"vec3":e.setUniform3fv(n,i);break;case"vec4":e.setUniform4fv(n,i)}}function m(e,t,n,i){"constant"===i.kind?c(e,n,`u_${t}`,i.value):(c(e,"float",`u_${t}_stops`,i.stops),c(e,n,`u_${t}_values`,i.values),e.setUniform1i(`u_${t}_count`,i.count))}function p(e,t){let n=!0;return n=n&&e.collisions===t.collisions,n=n&&e.density===t.density,n=n&&e.interpolate===t.interpolate,n=n&&e.lineCollisionWidth===t.lineCollisionWidth,n=n&&e.lineSpacing===t.lineSpacing,n=n&&e.maxTurnAngle===t.maxTurnAngle,n=n&&e.minSpeedThreshold===t.minSpeedThreshold,n=n&&e.segmentLength===t.segmentLength,n=n&&e.smoothing===t.smoothing,n=n&&e.velocityScale===t.velocityScale,n=n&&e.verticesPerLine===t.verticesPerLine,n}function f(e,t){return e===t||null!=e&&null!=t&&e.equals(t)}function h(e,t){if(!p(e.simulationSettings,t.simulationSettings))return!1;if(!f(e.timeExtent,t.timeExtent))return!1;let n=!0;return n=n&&e.loadImagery===t.loadImagery,n=n&&e.createFlowMesh===t.createFlowMesh,n=n&&e.color.kind===t.color.kind,n=n&&e.opacity.kind===t.opacity.kind,n=n&&e.size.kind===t.size.kind,n}function d(e,t,n,i){return e/=n.size[0],t=1-(t/=n.size[1]),e*=n.extent.xmax-n.extent.xmin,t*=n.extent.ymax-n.extent.ymin,e+=n.extent.xmin,t+=n.extent.ymin,e-=i.extent.xmin,t-=i.extent.ymin,e/=i.extent.xmax-i.extent.xmin,t=1-(t/=i.extent.ymax-i.extent.ymin),{x:e*=i.size[0],y:t*=i.size[1]}}function x(e,i,o,s){const a=[],r=o.time-i.time;if(0===e.length)return[];const l=t(e),u=l?n(e[0].hasMagnitude):1,c=l?({vertices:e},t)=>{const n=e,i=t*u;return{x:n[i],y:n[i+1],t:n[i+2],speed:0}}:({vertices:e},t)=>e[t];for(const t of e){const{stage:e,vertices:n}=t;if(2===e)continue;const l=n.length/u,m=c(t,0),p=m.t,f=(r*s-p)%(c(t,l-1).t-p)+p;let h,x=m.x,g=m.y,v=m.t;for(h=1;h<l&&v<f;h++){const e=c(t,h),n=Math.min(e.t,f)-v,i=e.t-v;x+=(e.x-x)*(n/i),g+=(e.y-g)*(n/i),v+=n}a.push(d(x,g,i,o))}return a}export{h as areStreamlinesCompatible,d as changeQuery,l as getColor,i as getFlowSimulationSettings,a as getForegroundColor,o as getMax,u as getOpacity,x as getPositions,r as getSize,c as setUniform,m as setUniforms,p as simulationSettingsEqual,f as timeExtentsEqual,s as toRgba};
5
+ import{pt2px as e}from"../../../../core/screenUtils.js";import{Seconds as t}from"../../../../core/time.js";import{isFlowPathBuffer as n,valuesPerFlowVertex as i}from"../../../3d/support/flow/loadUtils.js";function o(t){const n=s(l(t)),i=n,o=!0,r=Math.max(n/2,5),a=Math.round(e(t.maxPathLength)/r)+1,u=10,{density:c}=t;return{smoothing:e(t.smoothing),interpolate:!0,velocityScale:"flow-from"===t.flowRepresentation?1:-1,verticesPerLine:a,minSpeedThreshold:.001,segmentLength:r,maxTurnAngle:1,collisions:o,lineCollisionWidth:i,lineSpacing:u,density:c,onlyForwardTracing:!0,wrapAround:!1}}function s(e){return"constant"===e.kind?e.value[0]:e.values[e.values.length-1]}function r(e){const t=e.toRgba();return[t[0]/255,t[1]/255,t[2]/255,t[3]]}function a(e){return{kind:"constant",value:[.1,.1,.1,1]}}function l(t){if(!t.hasVisualVariables("size"))return{kind:"constant",value:[e(t.trailWidth)]};const n=t.getVisualVariablesForType("size")[0],i=[],o=[];let s;if(n.stops){for(const t of n.stops)i.push(t.value),o.push(e(t.size));s=n.stops.length}else i.push(n.minDataValue,n.maxDataValue),o.push(e(n.minSize),e(n.maxSize)),s=2;return{kind:"ramp",stops:i,values:o,count:s}}function u(e){if(!e.hasVisualVariables("color"))return{kind:"constant",value:r(e.color)};const t=e.getVisualVariablesForType("color")[0],n=[],i=[];for(const o of t.stops)n.push(o.value),Array.prototype.push.apply(i,r(o.color));return{kind:"ramp",stops:n,values:i,count:t.stops.length}}function c(e){if(!e.hasVisualVariables("opacity"))return{kind:"constant",value:[1]};const t=e.getVisualVariablesForType("opacity")[0],n=[],i=[];for(const o of t.stops)n.push(o.value),i.push(o.opacity);return{kind:"ramp",stops:n,values:i,count:t.stops.length}}function m(e,t,n,i){switch(t){case"int":e.setUniform1iv(n,i);break;case"float":e.setUniform1fv(n,i);break;case"vec2":e.setUniform2fv(n,i);break;case"vec3":e.setUniform3fv(n,i);break;case"vec4":e.setUniform4fv(n,i)}}function p(e,t,n,i){"constant"===i.kind?m(e,n,`u_${t}`,i.value):(m(e,"float",`u_${t}_stops`,i.stops),m(e,n,`u_${t}_values`,i.values),e.setUniform1i(`u_${t}_count`,i.count))}function f(e,t){let n=!0;return n=n&&e.collisions===t.collisions,n=n&&e.density===t.density,n=n&&e.interpolate===t.interpolate,n=n&&e.lineCollisionWidth===t.lineCollisionWidth,n=n&&e.lineSpacing===t.lineSpacing,n=n&&e.maxTurnAngle===t.maxTurnAngle,n=n&&e.minSpeedThreshold===t.minSpeedThreshold,n=n&&e.segmentLength===t.segmentLength,n=n&&e.smoothing===t.smoothing,n=n&&e.velocityScale===t.velocityScale,n=n&&e.verticesPerLine===t.verticesPerLine,n}function h(e,t){return e===t||null!=e&&null!=t&&e.equals(t)}function d(e,t){if(!f(e.simulationSettings,t.simulationSettings))return!1;if(!h(e.timeExtent,t.timeExtent))return!1;let n=!0;return n=n&&e.loadImagery===t.loadImagery,n=n&&e.createFlowMesh===t.createFlowMesh,n=n&&e.color.kind===t.color.kind,n=n&&e.opacity.kind===t.opacity.kind,n=n&&e.size.kind===t.size.kind,n}function x(e,t,n,i){return e/=n.size[0],t=1-(t/=n.size[1]),e*=n.extent.xmax-n.extent.xmin,t*=n.extent.ymax-n.extent.ymin,e+=n.extent.xmin,t+=n.extent.ymin,e-=i.extent.xmin,t-=i.extent.ymin,e/=i.extent.xmax-i.extent.xmin,t=1-(t/=i.extent.ymax-i.extent.ymin),{x:e*=i.size[0],y:t*=i.size[1]}}function g(e,o,s,r){if(0===e.length)return[];const a=[],l=s.time-o.time,u=n(e),c=u?i(e[0].hasMagnitude):1,m=u?({vertices:e},n)=>{const i=e,o=n*c;return{x:i[o],y:i[o+1],time:t(i[o+2]),speed:0}}:({vertices:e},t)=>e[t];for(const n of e){const{stage:e,vertices:i}=n;if(2===e)continue;const u=i.length/c,p=m(n,0),f=p.time,h=(l*r-f)%(m(n,u-1).time-f)+f;let d=p.x,g=p.y,v=p.time;for(let o=1;o<u&&v<h;o++){const e=m(n,o),i=Math.min(e.time,h)-v,s=e.time-v;d+=(e.x-d)*(i/s),g+=(e.y-g)*(i/s),v=t(v+i)}a.push(x(d,g,o,s))}return a}export{d as areStreamlinesCompatible,x as changeQuery,u as getColor,o as getFlowSimulationSettings,a as getForegroundColor,s as getMax,c as getOpacity,g as getPositions,l as getSize,m as setUniform,p as setUniforms,f as simulationSettingsEqual,h as timeExtentsEqual,r as toRgba};