@arcgis/core 4.28.0-next.20230920 → 4.28.0-next.20230921

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 (146) hide show
  1. package/WebScene.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/1cbaba30f55f00f7498b.js +1 -0
  4. package/assets/esri/core/workers/chunks/21a9c8aa2a9e9990df41.js +1 -0
  5. package/assets/esri/core/workers/chunks/24629402c647ef6b5f6b.js +1 -0
  6. package/assets/esri/core/workers/chunks/{b428fcb53ecc82b49e66.js → 332689bf60d246485993.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{b558a402e2ce2616cf37.js → 3ca759f72d3bb29e9ea9.js} +22 -22
  8. package/assets/esri/core/workers/chunks/4339ce8aaf87fabb80cc.js +1 -0
  9. package/assets/esri/core/workers/chunks/4369a6c1e0a82ab4db6a.js +1 -0
  10. package/assets/esri/core/workers/chunks/43ba2bacd0f7d19915f7.js +1 -0
  11. package/assets/esri/core/workers/chunks/44b8e75593b7df1843e1.js +1 -0
  12. package/assets/esri/core/workers/chunks/53097659f31750c03a6d.js +1 -0
  13. package/assets/esri/core/workers/chunks/{7c72d5368bb2d7484b9b.js → 580039dd491854ca325c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/59c00d6fba0fd1c03d01.js +1 -0
  15. package/assets/esri/core/workers/chunks/5edb99b58549cd66b394.js +1 -0
  16. package/assets/esri/core/workers/chunks/6203ddf6caad3d356327.js +1 -0
  17. package/assets/esri/core/workers/chunks/652749dc847fcb887234.js +1 -0
  18. package/assets/esri/core/workers/chunks/74d3ecb1a06d9f81e2c5.js +1 -0
  19. package/assets/esri/core/workers/chunks/7ea33aa455c5143affb1.js +1 -0
  20. package/assets/esri/core/workers/chunks/90771b0de3e520a1df9a.js +1 -0
  21. package/assets/esri/core/workers/chunks/a277c980ba8704939688.js +1 -0
  22. package/assets/esri/core/workers/chunks/bbc0dcd316c5598bc9ad.js +1 -0
  23. package/assets/esri/core/workers/chunks/bc1dc6383e60e7e61d50.js +1 -0
  24. package/assets/esri/core/workers/chunks/c4bb67150ccd01ea6014.js +1 -0
  25. package/assets/esri/core/workers/chunks/{aa021bc97b4a18a749dd.js → cad260881653567bc8f9.js} +1 -1
  26. package/assets/esri/core/workers/chunks/cec607d0138351a4952e.js +1 -0
  27. package/assets/esri/core/workers/chunks/{f147269d85adfb4588ed.js → d9061beaa43065316062.js} +1 -1
  28. package/assets/esri/core/workers/chunks/e55f7fc7eff0074ce0fc.js +1 -0
  29. package/assets/esri/core/workers/chunks/{9c40e7ed387071544f8c.js → ed1fbc1bc8d50453e2f5.js} +1 -1
  30. package/assets/esri/core/workers/chunks/eef27d305023034084a4.js +1 -0
  31. package/assets/esri/images/portal/onlinemedialayer16.png +0 -0
  32. package/chunks/LaserlinePath.glsl.js +5 -1
  33. package/core/sql.js +1 -1
  34. package/interfaces.d.ts +1 -17
  35. package/layers/graphics/sources/WFSSourceWorker.js +1 -1
  36. package/layers/mixins/SceneService.js +1 -1
  37. package/layers/save/utils.js +1 -1
  38. package/layers/support/editableLayers.js +1 -1
  39. package/package.json +1 -1
  40. package/portal/PortalItem.js +1 -1
  41. package/rest/geometryService/cut.js +1 -1
  42. package/rest/query/operations/query.js +1 -1
  43. package/rest/versionManagement/deleteVersion.js +1 -1
  44. package/rest/versionManagement/gdbVersion/alterVersion.js +1 -1
  45. package/rest/versionManagement/gdbVersion/post.js +1 -1
  46. package/rest/versionManagement/gdbVersion/reconcile.js +1 -1
  47. package/rest/versionManagement/gdbVersion/serverVersionUtils.js +5 -0
  48. package/support/revision.js +1 -1
  49. package/views/2d/engine/Stage.js +1 -1
  50. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  51. package/views/3d/analysis/Dimension/lengthDimensionConstraintUtils.js +1 -1
  52. package/views/3d/analysis/Slice/RotateManipulator.js +1 -1
  53. package/views/3d/environment/LocalAtmosphere.js +1 -1
  54. package/views/3d/interactive/manipulatorUtils.js +1 -1
  55. package/views/3d/interactive/visualElements/MeasurementAreaVisualElement.js +1 -1
  56. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  57. package/views/3d/interactive/visualElements/PointVisualElement.js +1 -1
  58. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  59. package/views/3d/layers/MediaLayerView3D.js +1 -1
  60. package/views/3d/layers/SceneLayerGraphicsView3D.js +1 -1
  61. package/views/3d/layers/graphics/Deconflictor.js +1 -1
  62. package/views/3d/layers/graphics/ElevationAligners.js +1 -1
  63. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  64. package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
  65. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  66. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  67. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  68. package/views/3d/layers/graphics/polygonUtils.js +1 -1
  69. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  70. package/views/3d/layers/i3s/I3SUtil.js +1 -1
  71. package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
  72. package/views/3d/layers/support/overlayImageUtils.js +1 -1
  73. package/views/3d/layers/support/patternUtils.js +1 -1
  74. package/views/3d/support/dito.js +1 -1
  75. package/views/3d/support/engineContent/line.js +1 -1
  76. package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
  77. package/views/3d/support/pointsOfInterest/Focus.js +1 -1
  78. package/views/3d/terrain/TerrainRenderer.js +1 -1
  79. package/views/3d/webgl-engine/collections/Component/ComponentIntersectionData.js +1 -1
  80. package/views/3d/webgl-engine/collections/Component/IntersectionGeometry.js +1 -1
  81. package/views/3d/webgl-engine/core/shaderLibrary/attributes/InstancedDoublePrecision.glsl.js +6 -6
  82. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  83. package/views/3d/webgl-engine/lib/Attribute.js +1 -1
  84. package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
  85. package/views/3d/webgl-engine/lib/Camera.js +1 -1
  86. package/views/3d/webgl-engine/lib/Geometry.js +1 -1
  87. package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
  88. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  89. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  90. package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
  91. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  92. package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
  93. package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
  94. package/views/3d/webgl-engine/materials/DefaultBufferWriter.js +1 -1
  95. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  96. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  97. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  98. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  99. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  100. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  101. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  102. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  103. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  104. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  105. package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
  106. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  107. package/views/draw/DrawGraphicTool.js +1 -1
  108. package/views/interactive/keybindings.js +1 -1
  109. package/views/interactive/tooltip/SketchTooltipInfo.js +1 -1
  110. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  111. package/views/interactive/tooltip/content/Fields.js +5 -0
  112. package/views/interactive/tooltip/content/TooltipContentDrawPoint.js +1 -1
  113. package/views/interactive/tooltip/content/TooltipContentDrawPolygon.js +1 -1
  114. package/views/interactive/tooltip/content/TooltipContentDrawPolyline.js +1 -1
  115. package/webdoc/saveAPIKeyUtils.js +5 -0
  116. package/webdoc/webdocSaveUtils.js +1 -1
  117. package/widgets/BasemapGallery.js +1 -1
  118. package/widgets/BasemapLayerList.js +1 -1
  119. package/widgets/Expand.js +1 -1
  120. package/widgets/Feature/FeatureRelationship.js +1 -1
  121. package/widgets/Fullscreen.js +1 -1
  122. package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
  123. package/widgets/Swipe.js +1 -1
  124. package/widgets/support/globalCss.js +1 -1
  125. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +0 -1
  126. package/assets/esri/core/workers/chunks/084a85e2e31b4d5fa924.js +0 -1
  127. package/assets/esri/core/workers/chunks/1a449168d30a688e6128.js +0 -1
  128. package/assets/esri/core/workers/chunks/21f0fafafcd754f5fb88.js +0 -1
  129. package/assets/esri/core/workers/chunks/273167b2dd46e58b8739.js +0 -1
  130. package/assets/esri/core/workers/chunks/2bf58296a6ea4eee960b.js +0 -1
  131. package/assets/esri/core/workers/chunks/3c2c64832fb498bbaa83.js +0 -1
  132. package/assets/esri/core/workers/chunks/4b3a5cc435435c81e6a5.js +0 -1
  133. package/assets/esri/core/workers/chunks/56afd89d08c874f620a1.js +0 -1
  134. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +0 -1
  135. package/assets/esri/core/workers/chunks/74ddc14e4b576ddbb582.js +0 -1
  136. package/assets/esri/core/workers/chunks/7f680cf24dd97d61bcd2.js +0 -1
  137. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +0 -1
  138. package/assets/esri/core/workers/chunks/a838dc6653ec29503053.js +0 -1
  139. package/assets/esri/core/workers/chunks/b10a91cae610aba62bf8.js +0 -1
  140. package/assets/esri/core/workers/chunks/b8eb842ea98a9734e161.js +0 -1
  141. package/assets/esri/core/workers/chunks/bbb63392485ed57703e0.js +0 -1
  142. package/assets/esri/core/workers/chunks/bdf13091bd0e1ab0db7e.js +0 -1
  143. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +0 -1
  144. package/assets/esri/core/workers/chunks/e54ae2a4281dd58e0707.js +0 -1
  145. package/assets/esri/core/workers/chunks/e5fcfd41f0ec12dcb7f2.js +0 -1
  146. package/assets/esri/core/workers/chunks/f07a0ea10428adecea1a.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{disposeMaybe as e}from"../../../core/maybe.js";import{h as t}from"../../../chunks/mat4.js";import{a as r}from"../../../chunks/mat4f64.js";import{AtmosphereType as s}from"./AtmosphereType.js";import{S as o}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as i}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as a,SimpleAtmosphereGeometry as m}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as n}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{newLayout as c}from"../support/buffer/InterleavedLayout.js";import{Default3D as u}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as f}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as h}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as l}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{TextureWrapMode as g,PrimitiveType as j,Usage as _}from"../../webgl/enums.js";import{Texture as x}from"../../webgl/Texture.js";import{TextureDescriptor as w}from"../../webgl/TextureDescriptor.js";import{vertexCount as A}from"../../webgl/Util.js";class d{constructor(e,t){this.type=s.Local,this._configuration=new a,this._passParameters=new o,this._configuration.geometry=m.Cylinder,this._technique=t.techniqueRepository.acquire(i,this._configuration);const r=t.renderContext.rctx;this._vao=this._createVertexArrayObject(r),this._vaoCount=A(this._vao,"geometry");const p=new w;p.wrapMode=g.CLAMP_TO_EDGE,p.flipped=!0,p.width=1,p.height=512,this._passParameters.texture=new x(r,p,n)}destroy(){this._passParameters.texture=e(this._passParameters.texture),this._vao.dispose(),this._technique.release()}render(e){const t=e.rctx,r=t.bindTechnique(this._technique,this._passParameters,e.bindParameters);y(T,e.bindParameters.camera.viewMatrix),r.setUniformMatrix4fv("view",T),t.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(j.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const t=f(1,2,!1),r=t[0][1].data,s=t[0][2],o=v.createBuffer(s.length),i=o.position;for(let a=0;a<s.length;++a){const e=3*s[a%3==0?a+2:a%3==2?a-2:a];i.set(a,0,r[e]),i.set(a,1,r[e+1]),i.set(a,2,r[e+2])}return new h(e,u,{geometry:p(v)},{geometry:b.createVertex(e,_.STATIC_DRAW,o.buffer)})}}function y(e,r){t(e,r),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const T=r(),v=c().vec3f(l.POSITION);export{d as LocalAtmosphere};
5
+ import{disposeMaybe as e}from"../../../core/maybe.js";import{h as t}from"../../../chunks/mat4.js";import{a as r}from"../../../chunks/mat4f64.js";import{AtmosphereType as s}from"./AtmosphereType.js";import{S as i}from"../../../chunks/SimpleAtmosphere.glsl.js";import{SimpleAtmosphereTechnique as o}from"./SimpleAtmosphereTechnique.js";import{SimpleAtmosphereTechniqueConfiguration as a,SimpleAtmosphereGeometry as m}from"./SimpleAtmosphereTechniqueConfiguration.js";import{earthAtmosphereTextureSimple as n}from"./resources/SimpleAtmosphereTexture.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{newLayout as c}from"../support/buffer/InterleavedLayout.js";import{Default3D as u}from"../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{createPolySphereData as f}from"../webgl-engine/lib/GeometryUtil.js";import{VertexArrayObject as h}from"../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as l}from"../webgl-engine/lib/VertexAttribute.js";import{BufferObject as b}from"../../webgl/BufferObject.js";import{TextureWrapMode as g,PrimitiveType as j,Usage as _}from"../../webgl/enums.js";import{Texture as x}from"../../webgl/Texture.js";import{TextureDescriptor as w}from"../../webgl/TextureDescriptor.js";import{vertexCount as d}from"../../webgl/Util.js";class A{constructor(e,t){this.type=s.Local,this._configuration=new a,this._passParameters=new i,this._configuration.geometry=m.Cylinder,this._technique=t.techniqueRepository.acquire(o,this._configuration);const r=t.renderContext.rctx;this._vao=this._createVertexArrayObject(r),this._vaoCount=d(this._vao,"geometry");const p=new w;p.wrapMode=g.CLAMP_TO_EDGE,p.flipped=!0,p.width=1,p.height=512,this._passParameters.texture=new x(r,p,n)}destroy(){this._passParameters.texture=e(this._passParameters.texture),this._vao.dispose(),this._technique.release()}render(e){const t=e.rctx,r=t.bindTechnique(this._technique,this._passParameters,e.bindParameters);y(T,e.bindParameters.camera.viewMatrix),r.setUniformMatrix4fv("view",T),t.bindVAO(this._vao),r.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(j.TRIANGLES,0,this._vaoCount)}renderHaze(){return!1}_createVertexArrayObject(e){const t=f(1,2,!1),{data:r,indices:s}=t[0][1],i=v.createBuffer(s.length),o=i.position;for(let a=0;a<s.length;++a){const e=3*s[a%3==0?a+2:a%3==2?a-2:a];o.set(a,0,r[e]),o.set(a,1,r[e+1]),o.set(a,2,r[e+2])}return new h(e,u,{geometry:p(v)},{geometry:b.createVertex(e,_.STATIC_DRAW,i.buffer)})}}function y(e,r){t(e,r),e[12]=0,e[13]=0,e[14]=0,e[15]=1}const T=r(),v=c().vec3f(l.POSITION);export{A as LocalAtmosphere};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{i as t}from"../../../chunks/mat4.js";import{f as r,b as n,e as o,n as i}from"../../../chunks/vec3.js";import{sv3d as c,sm4d as a}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as l}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as s}from"./Manipulator3D.js";import{RenderObject as u}from"./RenderObject.js";import{computeCentroid as m}from"../layers/graphics/graphicUtils.js";import{Attribute as d}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as p}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as f}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as g,createSphereGeometry as w}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../webgl-engine/lib/Material.js";import{VertexAttribute as j}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as h}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as O}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as y}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as D}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as A,ManipulatorStateFlags as F}from"../../interactive/interfaces.js";function S(t,r=b.OccludeAndTransparent,n=!0){const o=e(t),i=!(t[3]<1);return n?new D({color:o,writeDepth:i,cullFace:p.Back,renderOccluded:r,isDecoration:!0}):new h({color:o,writeDepth:i,cullFace:p.Back,renderOccluded:r,isDecoration:!0})}function v(t,r=b.OccludeAndTransparent){const n=e(t);return new h({color:n,writeDepth:!0,cullFace:p.Front,renderOccluded:r,isDecoration:!0})}const R=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1});function k(e,t){const r=new s({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:t.metadata});return L(r,t),r}function L(e,t){const r=t.material??new O({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:b.Opaque,isDecoration:!0}),n=t.focusMultiplier??R.focusMultiplier,o=t.calloutLength??R.calloutLength,i=R.discRadius*(t.discScale??1),c=i*n,a=(e,t)=>{const r=[0,1,2,2,3,0];return new f(t,[[j.POSITION,new d([o-e,-e,0,o+e,-e,0,o+e,e,0,o-e,e,0],3,!0),r],[j.UV0,new d([0,0,1,0,1,1,0,1],2,!0),r]])},l=t.calloutWidth??R.calloutWidth,s=new(l>1?y:M)({width:l,color:t.calloutColor,renderOccluded:b.OccludeAndTransparent,isDecoration:!0}),m=g(s,[[0,0,0],[o-i,0,0]]),p=g(s,[[0,0,0],[o-c,0,0]]),w=t.customStateMask??A.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[o,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=i,e.renderObjects=[new u(a(i,r),F.Unfocused|w),new u(m,F.Unfocused|w),new u(a(c,r),F.Focused|w),new u(p,F.Focused|w)]}function U(e,t,r=A.None){const n=S(t),o=[new u(w(n,1,32,32),r)];return new s({view:e,renderObjects:o})}const I=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function T(e,i,l,s){const u=r(c.get(),e,l),m=x(u,n(c.get(),s,u),l,a.get());t(m,m);const d=o(c.get(),i,m);return Math.atan2(d[1],d[0])}function x(e,t,r,o){const a=i(c.get(),e),l=i(c.get(),t),s=n(c.get(),a,l);return o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=0,o[4]=l[0],o[5]=l[1],o[6]=l[2],o[7]=0,o[8]=s[0],o[9]=s[1],o[10]=s[2],o[11]=0,o[12]=r[0],o[13]=r[1],o[14]=r[2],o[15]=1,o}function N(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function z(e,t,r){const n=N(e,r);null==n?C(t,r.geometry):t.elevationAlignedLocation=n}function C(e,t){if(null==t)return;const r="mesh"===t.type?t.anchor:m(t);null!=r&&(e.location=l(r))}function G(e,t={}){return e>1?new y({...t,width:e}):new M(t)}export{T as calculateInputRotationTransform,x as calculateTranslateRotateFromBases,G as createLineMaterial,S as createManipulatorMaterial,v as createManipulatorOutlineMaterial,k as createRotateManipulator,U as createSphereManipulator,N as getGraphicAttachmentOrigin,z as placeAtGraphic,R as rotateManipulatorDefaults,L as updateRotateManipulator,I as worldScaledManipulatorSettings};
5
+ import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{i as t}from"../../../chunks/mat4.js";import{f as r,b as n,e as o,n as i}from"../../../chunks/vec3.js";import{sv3d as c,sm4d as a}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as l}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as s}from"./Manipulator3D.js";import{RenderObject as u}from"./RenderObject.js";import{computeCentroid as m}from"../layers/graphics/graphicUtils.js";import{Attribute as d}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as p}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as f}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as g,createSphereGeometry as w}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../webgl-engine/lib/Material.js";import{VertexAttribute as j}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as h}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as O}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as y}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as D}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as A,ManipulatorStateFlags as F}from"../../interactive/interfaces.js";function S(t,r=b.OccludeAndTransparent,n=!0){const o=e(t),i=!(t[3]<1);return n?new D({color:o,writeDepth:i,cullFace:p.Back,renderOccluded:r,isDecoration:!0}):new h({color:o,writeDepth:i,cullFace:p.Back,renderOccluded:r,isDecoration:!0})}function v(t,r=b.OccludeAndTransparent){const n=e(t);return new h({color:n,writeDepth:!0,cullFace:p.Front,renderOccluded:r,isDecoration:!0})}const R=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1});function k(e,t){const r=new s({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:t.metadata});return L(r,t),r}function L(e,t){const r=t.material??new O({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:b.Opaque,isDecoration:!0}),n=t.focusMultiplier??R.focusMultiplier,o=t.calloutLength??R.calloutLength,i=R.discRadius*(t.discScale??1),c=i*n,a=(e,t)=>{const r=[0,1,2,2,3,0];return new f(t,[[j.POSITION,new d([o-e,-e,0,o+e,-e,0,o+e,e,0,o-e,e,0],r,3,!0)],[j.UV0,new d([0,0,1,0,1,1,0,1],r,2,!0)]])},l=t.calloutWidth??R.calloutWidth,s=new(l>1?y:M)({width:l,color:t.calloutColor,renderOccluded:b.OccludeAndTransparent,isDecoration:!0}),m=g(s,[[0,0,0],[o-i,0,0]]),p=g(s,[[0,0,0],[o-c,0,0]]),w=t.customStateMask??A.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[o,0,0]},e.focusMultiplier=n,e.metadata=t.metadata,e.radius=i,e.renderObjects=[new u(a(i,r),F.Unfocused|w),new u(m,F.Unfocused|w),new u(a(c,r),F.Focused|w),new u(p,F.Focused|w)]}function U(e,t,r=A.None){const n=S(t),o=[new u(w(n,1,32,32),r)];return new s({view:e,renderObjects:o})}const I=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function T(e,i,l,s){const u=r(c.get(),e,l),m=x(u,n(c.get(),s,u),l,a.get());t(m,m);const d=o(c.get(),i,m);return Math.atan2(d[1],d[0])}function x(e,t,r,o){const a=i(c.get(),e),l=i(c.get(),t),s=n(c.get(),a,l);return o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=0,o[4]=l[0],o[5]=l[1],o[6]=l[2],o[7]=0,o[8]=s[0],o[9]=s[1],o[10]=s[2],o[11]=0,o[12]=r[0],o[13]=r[1],o[14]=r[2],o[15]=1,o}function N(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function z(e,t,r){const n=N(e,r);null==n?C(t,r.geometry):t.elevationAlignedLocation=n}function C(e,t){if(null==t)return;const r="mesh"===t.type?t.anchor:m(t);null!=r&&(e.location=l(r))}function G(e,t={}){return e>1?new y({...t,width:e}):new M(t)}export{T as calculateInputRotationTransform,x as calculateTranslateRotateFromBases,G as createLineMaterial,S as createManipulatorMaterial,v as createManipulatorOutlineMaterial,k as createRotateManipulator,U as createSphereManipulator,N as getGraphicAttachmentOrigin,z as placeAtGraphic,R as rotateManipulatorDefaults,L as updateRotateManipulator,I as worldScaledManipulatorSettings};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{B as e}from"../../../../chunks/mat4.js";import{j as r}from"../../../../chunks/vec2.js";import{f as t}from"../../../../chunks/vec2f64.js";import{f as s}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{h as i,c}from"../../../../chunks/vec4.js";import{f as a}from"../../../../chunks/vec4f64.js";import{Object3DVisualElement as l}from"./Object3DVisualElement.js";import{Attribute as n}from"../../webgl-engine/lib/Attribute.js";import{Geometry as h}from"../../webgl-engine/lib/Geometry.js";import{RenderOccludedFlag as d}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as u}from"../../webgl-engine/lib/VertexAttribute.js";import{CheckerBoardMaterial as m}from"../../webgl-engine/materials/CheckerBoardMaterial.js";class _ extends l{constructor(e){super(e),this._checkerBoardMaterial=null,this._renderOccluded=d.OccludeAndTransparent,this._geometry=null,this._size=t(1,1),this._color1=a(1,.5,0,.5),this._color2=a(1,1,1,.5),this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){r(this._size,e),this._updateMaterial()}get color1(){return this._color1}set color1(e){i(e,this._color1)||(c(this._color1,e),this._updateMaterial())}get color2(){return this._color2}set color2(e){i(e,this._color2)||(c(this._color2,e),this._updateMaterial())}_updateMaterial(){null!=this._checkerBoardMaterial&&this._checkerBoardMaterial.setParameters({size:this._size,color1:this._color1,color2:this._color2,renderOccluded:this._renderOccluded})}createExternalResources(){this._checkerBoardMaterial=new m({size:this._size,color1:this._color1,color2:this._color2,transparent:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:d.OccludeAndTransparent,isDecoration:this.isDecoration})}destroyExternalResources(){this._checkerBoardMaterial=null}forEachExternalMaterial(e){null!=this._checkerBoardMaterial&&e(this._checkerBoardMaterial)}createGeometries(r){if(null==this._geometry||null==this._checkerBoardMaterial)return;const t=p;e(t,this.transform);const i=this._geometry,c=[],a=o();i.position.forEach((e=>{s(a,e,t),c.push(a[0],a[1],a[2])}));const l=[];i.uv.forEach((e=>{l.push(e[0],e[1])}));const d=new h(this._checkerBoardMaterial,[[u.POSITION,new n(c,3,!0),i.triangleIndices],[u.UV0,new n(l,2,!0),i.triangleIndices]]);r.addGeometry(d)}}const p=o();export{_ as MeasurementAreaVisualElement};
5
+ import{B as e}from"../../../../chunks/mat4.js";import{j as r}from"../../../../chunks/vec2.js";import{f as t}from"../../../../chunks/vec2f64.js";import{f as s}from"../../../../chunks/vec3.js";import{c as o}from"../../../../chunks/vec3f64.js";import{h as i,c}from"../../../../chunks/vec4.js";import{f as a}from"../../../../chunks/vec4f64.js";import{Object3DVisualElement as l}from"./Object3DVisualElement.js";import{Attribute as n}from"../../webgl-engine/lib/Attribute.js";import{Geometry as h}from"../../webgl-engine/lib/Geometry.js";import{RenderOccludedFlag as d}from"../../webgl-engine/lib/Material.js";import{VertexAttribute as u}from"../../webgl-engine/lib/VertexAttribute.js";import{CheckerBoardMaterial as m}from"../../webgl-engine/materials/CheckerBoardMaterial.js";class _ extends l{constructor(e){super(e),this._checkerBoardMaterial=null,this._renderOccluded=d.OccludeAndTransparent,this._geometry=null,this._size=t(1,1),this._color1=a(1,.5,0,.5),this._color2=a(1,1,1,.5),this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){r(this._size,e),this._updateMaterial()}get color1(){return this._color1}set color1(e){i(e,this._color1)||(c(this._color1,e),this._updateMaterial())}get color2(){return this._color2}set color2(e){i(e,this._color2)||(c(this._color2,e),this._updateMaterial())}_updateMaterial(){null!=this._checkerBoardMaterial&&this._checkerBoardMaterial.setParameters({size:this._size,color1:this._color1,color2:this._color2,renderOccluded:this._renderOccluded})}createExternalResources(){this._checkerBoardMaterial=new m({size:this._size,color1:this._color1,color2:this._color2,transparent:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:d.OccludeAndTransparent,isDecoration:this.isDecoration})}destroyExternalResources(){this._checkerBoardMaterial=null}forEachExternalMaterial(e){null!=this._checkerBoardMaterial&&e(this._checkerBoardMaterial)}createGeometries(r){if(null==this._geometry||null==this._checkerBoardMaterial)return;const t=p;e(t,this.transform);const i=this._geometry,c=[],a=o();i.position.forEach((e=>{s(a,e,t),c.push(a[0],a[1],a[2])}));const l=[];i.uv.forEach((e=>{l.push(e[0],e[1])}));const d=new h(this._checkerBoardMaterial,[[u.POSITION,new n(c,i.triangleIndices,3,!0)],[u.UV0,new n(l,i.triangleIndices,2,!0)]]);r.addGeometry(d)}}const p=o();export{_ as MeasurementAreaVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../core/Evented.js";import{s as t,g as r,i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{h as n,c as o}from"../../../../chunks/vec4.js";import{f as a,c as l}from"../../../../chunks/vec4f32.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{expandWithBuffer as c}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as u}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationMode as p}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as _}from"./EngineVisualElement.js";import{LaserlineVisualElement as f}from"./LaserlineVisualElement.js";import{ElevationContext as g}from"../../layers/graphics/ElevationContext.js";import{createGeometry as y}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as O,geometryToRenderInfo as C}from"../../support/renderInfoUtils/line.js";import{RenderOccludedFlag as R}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as v}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as j}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends _{constructor(t){super(t),this._attachmentOrigin=u(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=a(1,0,1,1),this._innerWidth=0,this._innerColor=a(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=R.OccludeAndTransparentStencil,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new f({view:t.view,isDecoration:t.isDecoration}),this.applyProperties(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()}}}get _laserlineAttached(){return this.attached&&this.visible&&null!=this._laserlineStyle&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){n(e,this._color)||(o(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){n(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=null!=e!=(null!=this._stipplePattern);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&n(e,this._stippleOffColor)||(this._stippleOffColor=e?l(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,null!=e&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=this.object3dResources.resources?.geometries;if(!e||0===e.length)return null;t(P,0,0,0);let s=0;for(const t of e)t.computeAttachmentOrigin(D)&&(r(P,P,D),s++);return 0===s?null:(i(P,P,1/s),this.view.renderCoordsHelper.fromRenderCoords(P,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){null!=this.object3dResources.resources&&this.object3dResources.resources.material.setParameters(this._materialParameters),null!=this.drapedResources.resources&&this.drapedResources.resources.material.setParameters(this._materialParameters)}get _isClosed(){return null!=this.geometry&&"polygon"===this.geometry.type}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",hasPolygonOffset:!0,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===R.OccludeAndTransparentStencil?R.OccludeAndTransparent:this._renderOccluded}_recreateGeometry(e,t,r){this._createRenderGeometries(t,r);for(const i of r)e.addGeometry(i);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}_destroyExternalResources(e){e.geometries=[]}_createObject3DResources(e){const t=new j(this._materialParameters),r=new Array;return this._recreateGeometry(e,t,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_createDrapedResources(){const e=new j(this._materialParameters);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const{geometry:t,view:r}=this,i=r.basemapTerrain.spatialReference;if(null==t||null==i)return[];return O(t,i).lines.map((({position:t})=>{const s={overlayInfo:{spatialReference:i,renderCoordsHelper:r.renderCoordsHelper},attributeData:{position:t},removeDuplicateStartEnd:this._isClosed};return new v(y(e,s))}))}calculateMapBounds(e){if(null==this.object3dResources.resources)return!1;const t=this.view.renderCoordsHelper;for(const r of this.object3dResources.resources.geometries){const i=r.vertexAttributes.get(b.POSITION),s=d(i.data.length);h(i.data,t.spatialReference,0,s,this.view.spatialReference,0,i.data.length/3),c(e,s)}return!0}_createRenderGeometries(e,t){const r=this.geometry;if(null==r)return;const i=C(r,this.view.elevationProvider,this.view.renderCoordsHelper,g.fromElevationInfo(this.elevationInfo??new m({mode:p(r,null)}))),s=new Array;for(const{position:n,mapPositions:o}of i.lines){const r={mapPositions:o,attributeData:{position:n},removeDuplicateStartEnd:this._isClosed};t.push(y(e,r)),s.push(n)}this._laserline.pathVerticalPlane=s}}const D=s(),P=s();export{w as OutlineVisualElement};
5
+ import e from"../../../../core/Evented.js";import{s as t,g as r,i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{h as n,c as o}from"../../../../chunks/vec4.js";import{f as a,c as l}from"../../../../chunks/vec4f32.js";import{projectBuffer as h}from"../../../../geometry/projection/projectBuffer.js";import{expandWithBuffer as c}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as u}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationMode as p}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as _}from"./EngineVisualElement.js";import{LaserlineVisualElement as f}from"./LaserlineVisualElement.js";import{ElevationContext as g}from"../../layers/graphics/ElevationContext.js";import{createGeometry as y}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as O,geometryToRenderInfo as C}from"../../support/renderInfoUtils/line.js";import{RenderOccludedFlag as R}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as v}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{RibbonLineMaterial as j}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends _{constructor(t){super(t),this._attachmentOrigin=u(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=a(1,0,1,1),this._innerWidth=0,this._innerColor=a(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=R.OccludeAndTransparentStencil,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new f({view:t.view,isDecoration:t.isDecoration}),this.applyProperties(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyExternalResources(e),recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()}}}get _laserlineAttached(){return this.attached&&this.visible&&null!=this._laserlineStyle&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){n(e,this._color)||(o(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){n(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){const t=null!=e!=(null!=this._stipplePattern);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){e&&this._stippleOffColor&&n(e,this._stippleOffColor)||(this._stippleOffColor=e?l(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,null!=e&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;const e=this.object3dResources.resources?.geometries;if(!e||0===e.length)return null;t(P,0,0,0);let s=0;for(const t of e)t.computeAttachmentOrigin(D)&&(r(P,P,D),s++);return 0===s?null:(i(P,P,1/s),this.view.renderCoordsHelper.fromRenderCoords(P,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){null!=this.object3dResources.resources&&this.object3dResources.resources.material.setParameters(this._materialParameters),null!=this.drapedResources.resources&&this.drapedResources.resources.material.setParameters(this._materialParameters)}get _isClosed(){return null!=this.geometry&&"polygon"===this.geometry.type}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:"round",hasPolygonOffset:!0,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===R.OccludeAndTransparentStencil?R.OccludeAndTransparent:this._renderOccluded}_recreateGeometry(e,t,r){this._createRenderGeometries(t,r);for(const i of r)e.addGeometry(i);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit("attachment-origin-changed")}_destroyExternalResources(e){e.geometries=[]}_createObject3DResources(e){const t=new j(this._materialParameters),r=new Array;return this._recreateGeometry(e,t,r),{material:t,geometries:r,forEach:e=>{e(t),r.forEach(e)}}}_createDrapedResources(){const e=new j(this._materialParameters);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){const{geometry:t,view:r}=this,i=r.basemapTerrain.spatialReference;if(null==t||null==i)return[];return O(t,i).lines.map((({position:t})=>{const s={overlayInfo:{spatialReference:i,renderCoordsHelper:r.renderCoordsHelper},attributeData:{position:t},removeDuplicateStartEnd:this._isClosed};return new v(y(e,s))}))}calculateMapBounds(e){if(null==this.object3dResources.resources)return!1;const t=this.view.renderCoordsHelper;for(const r of this.object3dResources.resources.geometries){const i=r.attributes.get(b.POSITION),s=d(i.data.length);h(i.data,t.spatialReference,0,s,this.view.spatialReference,0,i.data.length/3),c(e,s)}return!0}_createRenderGeometries(e,t){const r=this.geometry;if(null==r)return;const i=C(r,this.view.elevationProvider,this.view.renderCoordsHelper,g.fromElevationInfo(this.elevationInfo??new m({mode:p(r,null)}))),s=new Array;for(const{position:n,mapPositions:o}of i.lines){const r={mapPositions:o,attributeData:{position:n},removeDuplicateStartEnd:this._isClosed};t.push(y(e,r)),s.push(n)}this._laserline.pathVerticalPlane=s}}const D=s(),P=s();export{w as OutlineVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../../core/mathUtils.js";import{s as t}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{h as r,c as s}from"../../../../chunks/vec4.js";import{f as o}from"../../../../chunks/vec4f64.js";import{projectVectorToVector as n}from"../../../../geometry/projection/projectVectorToVector.js";import{expandWithBuffer as l}from"../../../../geometry/support/aaBoundingBox.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as h}from"./Object3DVisualElement.js";import{evaluateElevationAlignmentAtPoint as u}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as m}from"../../layers/graphics/ElevationContext.js";import{requiresHalfTexelOffset as p,createTexture as _,defaultSymbolSizeRatio as c}from"../../support/engineContent/sdfPrimitives.js";import{createPointGeometry as g}from"../../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as d}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as f}from"../../webgl-engine/materials/HUDMaterial.js";class x extends h{constructor(e){super(e),this._material=null,this._texture=null,this._geometry=null,this._size=3,this._color=o(1,0,1,1),this._pixelSnappingEnabled=!0,this._primitive="square",this._outlineSize=1,this._outlineColor=o(1,1,1,1),this._elevationInfo=null,this.applyProperties(e)}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){if(e!==this._size){const t=this._preferredTextureSize;this._size=e,t<this._preferredTextureSize?this.recreate():this._updateSizeAttribute()}}get color(){return this._color}set color(e){r(e,this._color)||(s(this._color,e),this._updateMaterial())}get pixelSnappingEnabled(){return this._pixelSnappingEnabled}set pixelSnappingEnabled(e){this._pixelSnappingEnabled!==e&&(this._pixelSnappingEnabled=e,this._updateMaterial())}get primitive(){return this._primitive}set primitive(e){this._primitive!==e&&(this._primitive=e,this.recreate())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this._updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){r(e,this._outlineColor)||(s(this._outlineColor,e),this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}_updateMaterial(){this._material&&this._material.setParameters(this._materialParameters)}_updateSizeAttribute(){const e=this.object;if(null==e)return;const t=e.geometries[0];if(null==t)return;const i=t.getMutableAttribute(d.SIZE).data,r=this._geometrySize;i[0]=r,i[1]=r,e.geometryVertexAttrsUpdated(e.geometries[0])}get _materialParameters(){return{color:this._color,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:p(this._primitive),distanceFieldBoundingBox:v,occlusionTest:!1,outlineColor:this._outlineColor,outlineSize:this._outlineSize,textureId:this._texture?.id,polygonOffset:!1,shaderPolygonOffset:0,drawInSecondSlot:!0,depthEnabled:!1,pixelSnappingEnabled:this.pixelSnappingEnabled,isDecoration:this.isDecoration}}get _geometrySize(){return this._size/S}createExternalResources(){this._texture=_(this._primitive,this._preferredTextureSize),this._material=new f(this._materialParameters);const e=this.view._stage;this._texture.load(e.renderView.renderingContext),e.add(this._texture)}destroyExternalResources(){if(this._texture){this.view._stage.remove(this._texture),this._texture.dispose(),this._texture=null}this._material=null}createGeometries(e){const t=this._createRenderGeometry();null!=t&&e.addGeometry(t)}forEachExternalMaterial(e){this._material&&e(this._material)}get _preferredTextureSize(){return e(2*this._geometrySize,16,128)}calculateMapBounds(e){const t=this.object?.geometries[0];if(!t)return!1;const i=t.vertexAttributes.get(d.POSITION);return n(i.data,this.view.renderCoordsHelper.spatialReference,y,this.view.spatialReference),l(e,y),!0}_createRenderGeometry(){const{geometry:e,_material:i}=this;if(null==e||null==i)return null;const{renderCoordsHelper:r,elevationProvider:s}=this.view,o=u(e,s,m.fromElevationInfo(this.elevationInfo),r),l=t(a.get(),e.x,e.y,o),h=a.get();n(l,e.spatialReference,h,r.spatialReference);const p=this._geometrySize;return g(i,null,h,null,[p,p],[0,0,0,1])}}const S=c,v=[S/2,S/2,1-S/2,1-S/2],y=i();export{x as PointVisualElement};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{s as t}from"../../../../chunks/vec3.js";import{c as i}from"../../../../chunks/vec3f64.js";import{h as r,c as s}from"../../../../chunks/vec4.js";import{f as o}from"../../../../chunks/vec4f64.js";import{projectVectorToVector as n}from"../../../../geometry/projection/projectVectorToVector.js";import{expandWithBuffer as l}from"../../../../geometry/support/aaBoundingBox.js";import{sv3d as a}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as h}from"./Object3DVisualElement.js";import{evaluateElevationAlignmentAtPoint as u}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as m}from"../../layers/graphics/ElevationContext.js";import{requiresHalfTexelOffset as p,createTexture as _,defaultSymbolSizeRatio as c}from"../../support/engineContent/sdfPrimitives.js";import{createPointGeometry as g}from"../../webgl-engine/lib/GeometryUtil.js";import{VertexAttribute as d}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as f}from"../../webgl-engine/materials/HUDMaterial.js";class x extends h{constructor(e){super(e),this._material=null,this._texture=null,this._geometry=null,this._size=3,this._color=o(1,0,1,1),this._pixelSnappingEnabled=!0,this._primitive="square",this._outlineSize=1,this._outlineColor=o(1,1,1,1),this._elevationInfo=null,this.applyProperties(e)}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get size(){return this._size}set size(e){if(e!==this._size){const t=this._preferredTextureSize;this._size=e,t<this._preferredTextureSize?this.recreate():this._updateSizeAttribute()}}get color(){return this._color}set color(e){r(e,this._color)||(s(this._color,e),this._updateMaterial())}get pixelSnappingEnabled(){return this._pixelSnappingEnabled}set pixelSnappingEnabled(e){this._pixelSnappingEnabled!==e&&(this._pixelSnappingEnabled=e,this._updateMaterial())}get primitive(){return this._primitive}set primitive(e){this._primitive!==e&&(this._primitive=e,this.recreate())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this._updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){r(e,this._outlineColor)||(s(this._outlineColor,e),this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}_updateMaterial(){this._material&&this._material.setParameters(this._materialParameters)}_updateSizeAttribute(){const e=this.object;if(null==e)return;const t=e.geometries[0];if(null==t)return;const i=t.getMutableAttribute(d.SIZE).data,r=this._geometrySize;i[0]=r,i[1]=r,e.geometryVertexAttrsUpdated(e.geometries[0])}get _materialParameters(){return{color:this._color,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:p(this._primitive),distanceFieldBoundingBox:v,occlusionTest:!1,outlineColor:this._outlineColor,outlineSize:this._outlineSize,textureId:this._texture?.id,polygonOffset:!1,shaderPolygonOffset:0,drawInSecondSlot:!0,depthEnabled:!1,pixelSnappingEnabled:this.pixelSnappingEnabled,isDecoration:this.isDecoration}}get _geometrySize(){return this._size/S}createExternalResources(){this._texture=_(this._primitive,this._preferredTextureSize),this._material=new f(this._materialParameters);const e=this.view._stage;this._texture.load(e.renderView.renderingContext),e.add(this._texture)}destroyExternalResources(){if(this._texture){this.view._stage.remove(this._texture),this._texture.dispose(),this._texture=null}this._material=null}createGeometries(e){const t=this._createRenderGeometry();null!=t&&e.addGeometry(t)}forEachExternalMaterial(e){this._material&&e(this._material)}get _preferredTextureSize(){return e(2*this._geometrySize,16,128)}calculateMapBounds(e){const t=this.object?.geometries[0];if(!t)return!1;const i=t.attributes.get(d.POSITION);return n(i.data,this.view.renderCoordsHelper.spatialReference,y,this.view.spatialReference),l(e,y),!0}_createRenderGeometry(){const{geometry:e,_material:i}=this;if(null==e||null==i)return null;const{renderCoordsHelper:r,elevationProvider:s}=this.view,o=u(e,s,m.fromElevationInfo(this.elevationInfo),r),l=t(a.get(),e.x,e.y,o),h=a.get();n(l,e.spatialReference,h,r.spatialReference);const p=this._geometrySize;return g(i,null,h,null,[p,p],[0,0,0,1])}}const S=c,v=[S/2,S/2,1-S/2,1-S/2],y=i();export{x as PointVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{watch as e}from"../../../../core/reactiveUtils.js";import{d as t,b as r}from"../../../../chunks/mat4.js";import{a as i}from"../../../../chunks/mat4f64.js";import{o as s,n as a,f as o,c as n,h as c,g as u}from"../../../../chunks/vec3.js";import{c as l,Z as d}from"../../../../chunks/vec3f64.js";import{c as h}from"../../../../chunks/vec4.js";import{f as m}from"../../../../chunks/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as f}from"./EngineVisualElement.js";import{drapedZ as g}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{Geometry as O}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as R}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as j}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as y}from"../../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as D}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class z extends f{constructor(e){super(e),this._maxSize=0,this._position=l(),this._up=l(),this._right=l(),this._renderOccluded=b.OccludeAndTransparent,this._color=m(1,0,0,1),this._outlineColor=m(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=b.Opaque,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyDrapedResources(e)}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get color(){return this._color}set color(e){h(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){h(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:r}){this._maxSize=Math.min(s(t,e),s(t,r))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,r,t)),n(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new D(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new w(this._outlineMaterialParameters);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r,forEach:e=>{e(t),r&&e(r)}}}_createObject3DGeometries(e,t,r){if(c(this._up,d)&&c(this._right,d))return;const i=this._createGeometries(t,r);for(const s of i)e.addGeometry(s);this._updateTransformObject3D(e)}_createDrapedResources(){const t=new D(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new w(this._outlineMaterialParameters),i=this._createGeometries(t,r).map((e=>new j(e)));this._setTransformDraped(i);return{quadMaterial:t,outlineMaterial:r,geometries:i,pixelRatioHandle:e((()=>this.view.state.contentPixelRatio),(()=>{this.drapedResources.recreateGeometry()}))}}_destroyDrapedResources(e){e.pixelRatioHandle.remove(),e.geometries=[]}_createGeometries(e,t){const{up:r,right:i,corner:s}=this._getVertices(),a=this._quadGeometryData(r,i,s,e);if(!t)return[a];return[a,R(t,[r,s,i])]}_getVertices(){let e=this._up,t=this._right;const r=u(_.get(),e,t);return this.isDraped&&(e=n(_.get(),e),t=n(_.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const i=this.view.state.camera,s=this._size*i.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,s);t(P,this._position),r(P,P,[a,a,a]),e.transformation=P}_setTransformDraped(e){if(0===e.length)return;const{view:{basemapTerrain:{overlayManager:i},state:{contentPixelRatio:s}}}=this,{_position:a,_size:o}=this,c=n(_.get(),a);c[2]=g;const u=v;u.spatialReference=i.renderer.spatialReference,u.x=c[0],u.y=c[1];const l=o*(this.view.overlayPixelSizeInMapUnits(u)*s),d=Math.min(this._maxSize,l);t(P,c),r(P,P,[d,d,1]);for(const t of e)t.transformation=P}_quadGeometryData(e,t,r,i){return new O(i,[[y.POSITION,new M([0,0,0,...t,...e,...r],3,!0),[0,1,2,1,2,3]]])}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}const P=i(),v=p(0,0,void 0,null);export{z as RightAngleQuadVisualElement};
5
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{d as t,b as r}from"../../../../chunks/mat4.js";import{a as i}from"../../../../chunks/mat4f64.js";import{o as s,n as a,f as o,c as n,h as c,g as u}from"../../../../chunks/vec3.js";import{c as l,Z as d}from"../../../../chunks/vec3f64.js";import{c as h}from"../../../../chunks/vec4.js";import{f as m}from"../../../../chunks/vec4f64.js";import{sv3d as _}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as p}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as f}from"./EngineVisualElement.js";import{drapedZ as g}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{Geometry as O}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as R}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as b}from"../../webgl-engine/lib/Material.js";import{RenderGeometry as j}from"../../webgl-engine/lib/RenderGeometry.js";import{VertexAttribute as y}from"../../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as D}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class z extends f{constructor(e){super(e),this._maxSize=0,this._position=l(),this._up=l(),this._right=l(),this._renderOccluded=b.OccludeAndTransparent,this._color=m(1,0,0,1),this._outlineColor=m(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=b.Opaque,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D()}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:e=>this._destroyDrapedResources(e)}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get color(){return this._color}set color(e){h(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){h(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){const t=0===this._outlineSize!=(0===e);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:r}){this._maxSize=Math.min(s(t,e),s(t,r))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,r,t)),n(this._position,t),this.recreateGeometry()}_createObject3DResources(e){const t=new D(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new w(this._outlineMaterialParameters);return this._createObject3DGeometries(e,t,r),{quadMaterial:t,outlineMaterial:r,forEach:e=>{e(t),r&&e(r)}}}_createObject3DGeometries(e,t,r){if(c(this._up,d)&&c(this._right,d))return;const i=this._createGeometries(t,r);for(const s of i)e.addGeometry(s);this._updateTransformObject3D(e)}_createDrapedResources(){const t=new D(this._quadMaterialParameters),r=0===this._outlineSize?void 0:new w(this._outlineMaterialParameters),i=this._createGeometries(t,r).map((e=>new j(e)));this._setTransformDraped(i);return{quadMaterial:t,outlineMaterial:r,geometries:i,pixelRatioHandle:e((()=>this.view.state.contentPixelRatio),(()=>{this.drapedResources.recreateGeometry()}))}}_destroyDrapedResources(e){e.pixelRatioHandle.remove(),e.geometries=[]}_createGeometries(e,t){const{up:r,right:i,corner:s}=this._getVertices(),a=this._quadGeometryData(r,i,s,e);if(!t)return[a];return[a,R(t,[r,s,i])]}_getVertices(){let e=this._up,t=this._right;const r=u(_.get(),e,t);return this.isDraped&&(e=n(_.get(),e),t=n(_.get(),t),e[2]=0,t[2]=0,r[2]=0),{up:e,right:t,corner:r}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;const i=this.view.state.camera,s=this._size*i.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,s);t(P,this._position),r(P,P,[a,a,a]),e.transformation=P}_setTransformDraped(e){if(0===e.length)return;const{view:{basemapTerrain:{overlayManager:i},state:{contentPixelRatio:s}}}=this,{_position:a,_size:o}=this,c=n(_.get(),a);c[2]=g;const u=v;u.spatialReference=i.renderer.spatialReference,u.x=c[0],u.y=c[1];const l=o*(this.view.overlayPixelSizeInMapUnits(u)*s),d=Math.min(this._maxSize,l);t(P,c),r(P,P,[d,d,1]);for(const t of e)t.transformation=P}_quadGeometryData(e,t,r,i){return new O(i,[[y.POSITION,new M([0,0,0,...t,...e,...r],[0,1,2,1,2,3],3,!0)]])}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:!0,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}const P=i(),v=p(0,0,void 0,null);export{z as RightAngleQuadVisualElement};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{makeHandle as r,handlesGroup as i,destroyHandle as n}from"../../../core/handleUtils.js";import{getProjectiveTransform as s}from"../../../core/perspectiveUtils.js";import{debounce as a,isPromiseLike as o}from"../../../core/promiseUtils.js";import{on as d}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{a as p}from"../../../chunks/mat3f64.js";import{toExtent as c}from"../../../geometry/support/aaBoundingRect.js";import{MediaElementView as h}from"../../../layers/support/MediaElementView.js";import{DrapeSourceType as u}from"./interfaces.js";import{LayerView3D as y}from"./LayerView3D.js";import{drapedZ as _}from"../terrain/OverlayRenderer.js";import{Attribute as g}from"../webgl-engine/lib/Attribute.js";import{Geometry as E}from"../webgl-engine/lib/Geometry.js";import{DirtyOperation as f,DirtyState as D}from"../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as w}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as v}from"../webgl-engine/lib/Texture.js";import{UpdatePolicy as b}from"../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as R}from"../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as j}from"../webgl-engine/materials/ImageMaterial.js";import T from"../../layers/LayerView.js";import{TextureWrapMode as A}from"../../webgl/enums.js";let x=class extends(y(T)){constructor(){super(...arguments),this.type="media-3d",this.drapeSourceType=u.RasterImage,this.updatePolicy=b.ASYNC,this._uidToElement=new Map,this._renderedElements=new Map,this._lastDrapingExtent=null,this._update=a((async(e,t,r)=>{const i=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(i)}),0)}initialize(){this._renderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this);const e=()=>this._updateWithLastDrapingExtent();this.addHandles([r((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))),d((()=>this.layer.effectiveSource),"change",e),d((()=>this.layer.effectiveSource),"refresh",e)]),this._updatingHandles.add((()=>this.suspended),e)}setDrapingExtent(e,t){this._lastDrapingExtent={overlays:e,spatialReference:t},this._updateWithLastDrapingExtent()}getHit(e){const t=this._uidToElement.get(e);return t?{type:"media",element:t,layer:this.layer}:null}_updateWithLastDrapingExtent(){if(null==this._lastDrapingExtent||this.suspended)return void(this._renderer&&this._synchronizeRenderElements(new Set));const{overlays:e,spatialReference:t}=this._lastDrapingExtent;this._updatingHandles.addPromise(this._update(e,t).catch((()=>{})))}async _collectMediaElements(e,t,r){const i=this.layer.effectiveSource;return null==i?new Set:new Set((await Promise.all(e.map((e=>i.queryElements(c(e.extent,t),{signal:r}))))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){const t=new Set,r=[];this._renderedElements.forEach(((i,n)=>{e.has(n)||(t.add(n),null!=i.renderData&&r.push(i.renderData.renderGeometry),this._removeElement(n,i))})),this._renderer.removeGeometries(r,f.REMOVE)}_synchronizeRenderElementsAdd(e){for(const t of e)this._renderedElements.has(t)||this._createRenderElement(t)}_removeElement(e,{renderData:t,handle:r}){this._destroyRenderData(t),this._renderedElements.delete(e),this._uidToElement.delete(e.uid),r.remove()}async _createRenderElement(e){const t=new h({spatialReference:this.view.spatialReference,element:e}),r={renderData:null,handle:i([this._updatingHandles.add((()=>e.opacity),(e=>{null!=r.renderData&&r.renderData.material.setParameters({opacity:e})})),this._updatingHandles.add((()=>t.coords),(()=>{null!=r.renderData?this._updateGeometry(t,r,r.renderData):this._initializeRenderData(t,r)})),this._updatingHandles.add((()=>e.content),(()=>this._initializeRenderData(t,r))),n(t)])};this._renderedElements.set(e,r),this._uidToElement.set(e.uid,e),this._updatingHandles.addPromise(e.load().catch((()=>{}))),this._initializeRenderData(t,r)}_initializeRenderData(e,t){const{coords:r,element:i}=e;if(null==r||null==i.content)return void(t.renderData=this._destroyRenderData(t.renderData));if(null!=t.renderData)return;const n=this._createTexture(i.content),s=n.load(this.view._stage.renderView.renderingContext);this.view._stage.add(n),o(s)&&this._updatingHandles.addPromise(s);const a=new j({initTextureTransparent:!0,textureId:n.id,opacity:i.opacity,transparent:!0,perspectiveInterpolation:!0}),d=this._getPositionAttributeArray(r),l=[0,0,1,0,1,1,0,1],m=this._getPerspectiveDivideAttributeArray(d,i.contentWidth,i.contentHeight),p=[0,1,2,0,2,3],c=new E(a,[[R.POSITION,new g(d,3,!0),p],[R.UV0,new g(l,2,!0),p],[R.PERSPECTIVEDIVIDE,new g(m,1,!0),p]]),h=new w(c,{layerUid:this.layer.uid,graphicUid:i.uid});this._renderer.addGeometries([h],f.ADD),t.renderData={renderGeometry:h,texture:n,material:a}}_updateGeometry(e,t,r){const{coords:i,element:n}=e;if(null==i||null==n.content)return void(t.renderData=this._destroyRenderData(t.renderData));const s=this._getPositionAttributeArray(i);r.renderGeometry.geometry.setAttributeData(R.POSITION,s);const a=this._getPerspectiveDivideAttributeArray(s,n.contentWidth,n.contentHeight);r.renderGeometry.geometry.setAttributeData(R.PERSPECTIVEDIVIDE,a),this._renderer.modifyGeometries([r.renderGeometry],D.GEOMETRY)}_getPositionAttributeArray(e){const[t,r,i,n]=e.rings[0];return[t[0],t[1],_,n[0],n[1],_,i[0],i[1],_,r[0],r[1],_]}_getPerspectiveDivideAttributeArray(e,t,r){s(P,[0,0,t,0,t,r,0,r],[e[0],e[1],e[3],e[4],e[6],e[7],e[9],e[10]]);const i=P[6]/P[8]*t,n=P[7]/P[8]*r;return[1,1+i,1+i+n,1+n]}_destroyRenderData(e){if(null==e)return null;const t=e.texture;return t.unload(),this.view._stage.remove(t),this._renderer.removeGeometries([e.renderGeometry],f.REMOVE),null}_createTexture(e){const r=e instanceof HTMLImageElement?e.naturalWidth:e.width,i=e instanceof HTMLImageElement?e.naturalHeight:e.height;if("getFrame"in e)throw new t("media-layer-view-3d","animation is not supported");return new v(e,{wrap:{s:A.CLAMP_TO_EDGE,t:A.CLAMP_TO_EDGE},preMultiplyAlpha:!0,width:r,height:i,mipmap:!0,updateCallback:()=>this.view.basemapTerrain.overlayManager.setDrawTexturesDirty()})}get test(){const e=this;return{get numberOfElements(){return e._renderedElements.size}}}};e([l({readOnly:!0})],x.prototype,"type",void 0),e([l()],x.prototype,"layer",void 0),x=e([m("esri.views.3d.layers.MediaLayerView3D")],x);const P=p(),M=x;export{M as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import{makeHandle as r,handlesGroup as i,destroyHandle as n}from"../../../core/handleUtils.js";import{getProjectiveTransform as s}from"../../../core/perspectiveUtils.js";import{debounce as a,isPromiseLike as o}from"../../../core/promiseUtils.js";import{on as d}from"../../../core/reactiveUtils.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as m}from"../../../core/accessorSupport/decorators/subclass.js";import{a as p}from"../../../chunks/mat3f64.js";import{toExtent as c}from"../../../geometry/support/aaBoundingRect.js";import{MediaElementView as h}from"../../../layers/support/MediaElementView.js";import{DrapeSourceType as u}from"./interfaces.js";import{LayerView3D as y}from"./LayerView3D.js";import{drapedZ as _}from"../terrain/OverlayRenderer.js";import{Attribute as g}from"../webgl-engine/lib/Attribute.js";import{Geometry as E}from"../webgl-engine/lib/Geometry.js";import{DirtyOperation as f,DirtyState as D}from"../webgl-engine/lib/ModelDirtyTypes.js";import{RenderGeometry as w}from"../webgl-engine/lib/RenderGeometry.js";import{Texture as v}from"../webgl-engine/lib/Texture.js";import{UpdatePolicy as b}from"../webgl-engine/lib/UpdatePolicy.js";import{VertexAttribute as R}from"../webgl-engine/lib/VertexAttribute.js";import{ImageMaterial as j}from"../webgl-engine/materials/ImageMaterial.js";import T from"../../layers/LayerView.js";import{TextureWrapMode as A}from"../../webgl/enums.js";let x=class extends(y(T)){constructor(){super(...arguments),this.type="media-3d",this.drapeSourceType=u.RasterImage,this.updatePolicy=b.ASYNC,this._uidToElement=new Map,this._renderedElements=new Map,this._lastDrapingExtent=null,this._update=a((async(e,t,r)=>{const i=await this._collectMediaElements(e,t,r);this._synchronizeRenderElements(i)}),0)}initialize(){this._renderer=this.view.basemapTerrain.overlayManager.registerGeometryDrapeSource(this);const e=()=>this._updateWithLastDrapingExtent();this.addHandles([r((()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))),d((()=>this.layer.effectiveSource),"change",e),d((()=>this.layer.effectiveSource),"refresh",e)]),this._updatingHandles.add((()=>this.suspended),e)}setDrapingExtent(e,t){this._lastDrapingExtent={overlays:e,spatialReference:t},this._updateWithLastDrapingExtent()}getHit(e){const t=this._uidToElement.get(e);return t?{type:"media",element:t,layer:this.layer}:null}_updateWithLastDrapingExtent(){if(null==this._lastDrapingExtent||this.suspended)return void(this._renderer&&this._synchronizeRenderElements(new Set));const{overlays:e,spatialReference:t}=this._lastDrapingExtent;this._updatingHandles.addPromise(this._update(e,t).catch((()=>{})))}async _collectMediaElements(e,t,r){const i=this.layer.effectiveSource;return null==i?new Set:new Set((await Promise.all(e.map((e=>i.queryElements(c(e.extent,t),{signal:r}))))).flat())}_synchronizeRenderElements(e){this._synchronizeRenderElementsRemove(e),this._synchronizeRenderElementsAdd(e)}_synchronizeRenderElementsRemove(e){const t=new Set,r=[];this._renderedElements.forEach(((i,n)=>{e.has(n)||(t.add(n),null!=i.renderData&&r.push(i.renderData.renderGeometry),this._removeElement(n,i))})),this._renderer.removeGeometries(r,f.REMOVE)}_synchronizeRenderElementsAdd(e){for(const t of e)this._renderedElements.has(t)||this._createRenderElement(t)}_removeElement(e,{renderData:t,handle:r}){this._destroyRenderData(t),this._renderedElements.delete(e),this._uidToElement.delete(e.uid),r.remove()}async _createRenderElement(e){const t=new h({spatialReference:this.view.spatialReference,element:e}),r={renderData:null,handle:i([this._updatingHandles.add((()=>e.opacity),(e=>{null!=r.renderData&&r.renderData.material.setParameters({opacity:e})})),this._updatingHandles.add((()=>t.coords),(()=>{null!=r.renderData?this._updateGeometry(t,r,r.renderData):this._initializeRenderData(t,r)})),this._updatingHandles.add((()=>e.content),(()=>this._initializeRenderData(t,r))),n(t)])};this._renderedElements.set(e,r),this._uidToElement.set(e.uid,e),this._updatingHandles.addPromise(e.load().catch((()=>{}))),this._initializeRenderData(t,r)}_initializeRenderData(e,t){const{coords:r,element:i}=e;if(null==r||null==i.content)return void(t.renderData=this._destroyRenderData(t.renderData));if(null!=t.renderData)return;const n=this._createTexture(i.content),s=n.load(this.view._stage.renderView.renderingContext);this.view._stage.add(n),o(s)&&this._updatingHandles.addPromise(s);const a=new j({initTextureTransparent:!0,textureId:n.id,opacity:i.opacity,transparent:!0,perspectiveInterpolation:!0}),d=this._getPositionAttributeArray(r),l=[0,0,1,0,1,1,0,1],m=this._getPerspectiveDivideAttributeArray(d,i.contentWidth,i.contentHeight),p=[0,1,2,0,2,3],c=new E(a,[[R.POSITION,new g(d,p,3,!0)],[R.UV0,new g(l,p,2,!0)],[R.PERSPECTIVEDIVIDE,new g(m,p,1,!0)]]),h=new w(c,{layerUid:this.layer.uid,graphicUid:i.uid});this._renderer.addGeometries([h],f.ADD),t.renderData={renderGeometry:h,texture:n,material:a}}_updateGeometry(e,t,r){const{coords:i,element:n}=e;if(null==i||null==n.content)return void(t.renderData=this._destroyRenderData(t.renderData));const s=this._getPositionAttributeArray(i);r.renderGeometry.geometry.setAttributeData(R.POSITION,s);const a=this._getPerspectiveDivideAttributeArray(s,n.contentWidth,n.contentHeight);r.renderGeometry.geometry.setAttributeData(R.PERSPECTIVEDIVIDE,a),this._renderer.modifyGeometries([r.renderGeometry],D.GEOMETRY)}_getPositionAttributeArray(e){const[t,r,i,n]=e.rings[0];return[t[0],t[1],_,n[0],n[1],_,i[0],i[1],_,r[0],r[1],_]}_getPerspectiveDivideAttributeArray(e,t,r){s(P,[0,0,t,0,t,r,0,r],[e[0],e[1],e[3],e[4],e[6],e[7],e[9],e[10]]);const i=P[6]/P[8]*t,n=P[7]/P[8]*r;return[1,1+i,1+i+n,1+n]}_destroyRenderData(e){if(null==e)return null;const t=e.texture;return t.unload(),this.view._stage.remove(t),this._renderer.removeGeometries([e.renderGeometry],f.REMOVE),null}_createTexture(e){const r=e instanceof HTMLImageElement?e.naturalWidth:e.width,i=e instanceof HTMLImageElement?e.naturalHeight:e.height;if("getFrame"in e)throw new t("media-layer-view-3d","animation is not supported");return new v(e,{wrap:{s:A.CLAMP_TO_EDGE,t:A.CLAMP_TO_EDGE},preMultiplyAlpha:!0,width:r,height:i,mipmap:!0,updateCallback:()=>this.view.basemapTerrain.overlayManager.setDrawTexturesDirty()})}get test(){const e=this;return{get numberOfElements(){return e._renderedElements.size}}}};e([l({readOnly:!0})],x.prototype,"type",void 0),e([l()],x.prototype,"layer",void 0),x=e([m("esri.views.3d.layers.MediaLayerView3D")],x);const P=p(),M=x;export{M as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{initial as o,watch as a}from"../../../core/reactiveUtils.js";import{estimateSize as n}from"../../../core/typedArrayUtil.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as u}from"../../../chunks/vec3.js";import{c as h}from"../../../chunks/vec3f64.js";import{projectBuffer as c}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as p}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as g,extentContainsCoords2D as m}from"../../../geometry/support/contains.js";import{newDoubleArray as y,doubleArrayFrom as f}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as _}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as b}from"../../../layers/LayerConstants.js";import{estimateSize as v}from"../../../layers/graphics/dehydratedFeatures.js";import{makeDehydratedPoint as E}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as x}from"../../../layers/graphics/hydratedFeatures.js";import I from"../../../layers/graphics/controllers/I3SOnDemandController.js";import w from"../../../layers/support/FeatureFilter.js";import N from"../../../rest/support/Query.js";import{isBasemapLayer as O}from"../../../support/basemapUtils.js";import{I3SPointsWorkerHandle as j}from"./I3SPointsWorkerHandle.js";import{LayerView3D as C}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as F}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as D}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as S,processAttributeEdits as G}from"./i3s/featureEditing.js";import{I3SGraphicsMap as A}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as P}from"./i3s/I3SOverrides.js";import{checkRecyclable as L,checkSpatialReferences as V,containsDraco as M,whenGraphicAttributes as R,getCachedAttributeValue as H}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as U}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as q}from"./support/fieldProperties.js";import{PopupSceneLayerView as Q}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as T}from"./support/SceneLayerViewRequiredFields.js";import{debugFlags as B}from"../support/debugFlags.js";import{compute as k}from"../support/orientedBoundingBox.js";import{updatingProgress as z}from"../support/updatingProperties.js";import{Attribute as W}from"../webgl-engine/lib/Attribute.js";import{UpdatePolicy as Z}from"../webgl-engine/lib/UpdatePolicy.js";import K from"../../layers/SceneLayerView.js";import{hasPopupTemplate as Y}from"../../layers/support/popupUtils.js";import{TaskPriority as $}from"../../support/Scheduler.js";const J=q();class X{constructor(e,t,r,i){this.graphics=e,this.featureIds=t,this.attributeInfo=r,this.node=i}}let ee=class extends(U(Q(C(K)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new A(((e,t,r)=>se(e,t,r)),(e=>this.processor.graphicsCore.recreateGraphics(e))),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then((()=>{L(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this._i3sOverrides=new P({view:this.view,layer:e,memoryController:t}),s(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})):null}initialize(){this.addResolvingPromise(this.layer.indexInfo);const e=this.view.resourceController?.memoryController;this._i3sOverrides=new P({view:this.view,layer:this.layer,memoryController:e}),V(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new T({layerView:this}),this._updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),o),this._updatingHandles.add((()=>this.layer.renderer),((e,t)=>this._rendererChange(e,t))),this._updatingHandles.add((()=>[this.parsedDefinitionExpression,this._excludeObjectIdsSorted]),(()=>this._filterChange())),this.addHandles(a((()=>B.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&B.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||B.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),o)),this._set("processor",new F({owner:this,preferredUpdatePolicy:Z.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",(e=>this._controller.updateElevationChanged(e.extent,e.spatialReference))),this.supportsHeightUnitConversion&&(this._verticalScale=_("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.initializePromise),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new I({layerView:this,scaleVisibilityEnabled:!1}),M(this.layer.geometryDefinitions)&&(this._worker=new j((e=>this.view.resourceController.immediate.schedule(e)))),this.addHandles(this.layer.on("apply-edits",(e=>this._updatingHandles.addPromise(e.result)))),this.addHandles(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{this._setupQueryEngine(),this._updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),o),this._updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=s(this._treeDebugger),this._i3sOverrides=s(this._i3sOverrides),this._set("processor",s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._worker=s(this._worker),this._memCache=s(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=s(this._fieldsHelper)}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??1}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}async whenGraphicAttributes(e,t){return R(this.layer,e,this._getObjectIdField(),t,(()=>[...this.loadedGraphics.nodes()]))}getHit(e){if(!this.loadedGraphics)return null;const t=x(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return S(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};null==this._worker&&(this._worker=new j((e=>this.view.resourceController.immediate.schedule(e))));const i=await this._worker.invoke(r,t);if(null==i)throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,t,r){if(!ie(t)&&!re(t))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void i.getLogger(this).error("I3S node "+e.id+" already added");const s=null!=this.layer.fullExtent?ae(this.layer.fullExtent.clone(),.5):null,o=[],{featureIds:a,pointPositions:n}=ie(t)?await this._extractBinaryPointPositions(e,t,r):this._extractLegacyPointPositions(t);this._validatePositions(e,a,n,s,o);const l=this._controller.crsVertex,d=this.view.spatialReference;c(n,l,0,n,d,0,a.length);const u=ie(t)?e.level:0,h=this._createGraphics(a,n,e.index,u),p=new X(h,a,t.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(p.featureIds,t.attributeDataInfo,r),e.numFeatures=p.graphics.length,this._updateNodeMemory(e),oe(p),o.length>0&&(this._computeObb(e,o,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(p);if(null!=this._verticalScale)for(const i of p.graphics)this._verticalScale(i.geometry);const g=this.view._stage.renderView.objectAndLayerIdRenderHelper;if(null!=g){const e=O(this.view.map,this.layer.uid);for(let t=0;t<p.featureIds.length;t++){const r=p.featureIds[t];g.setUidToObjectAndLayerId(r,p.graphics[t].uid,this.layer.id,this.layer.uid,this.layer.popupEnabled&&!e&&Y(this.layer,this.view.popup?.defaultPopupTemplateEnabled),p.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,p),this._controller.updateLoadStatus(e.index,!0),this._filterNode(p),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;c(t,r,0,t,s,0,t.length/3),e.serviceObb=k(new W(t,3)),i.isGeographic&&p(e.serviceObb.center,s,e.serviceObb.center,i)}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,a=s.length/o,n=y(3*a),l=null!=e.serviceObb?e.serviceObb.center:[0,0,0],d=Math.abs(l[2])*2**-20;for(let u=0;u<a;u++){const e=u*o;n[e]=s[e]+l[0],n[e+1]=s[e+1]+l[1],n[e+2]=s[e+2]+l[2],Math.abs(n[e+2])<d&&(n[e+2]=0)}return{featureIds:i.featureIds?f(i.featureIds):[],pointPositions:n}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=y(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??ne[a],l=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const d=n.params.vertexAttributes?.position??[0,0,0],u=3*i.length;r[u]=o[0]+d[0],r[u+1]=o[1]+d[1],r[u+2]=3===a?o[2]+d[2]:NaN,i.push(l)}return{featureIds:i,pointPositions:r}}_validatePositions(e,t,r,s,o){if(null==s&&e.serviceObb)return;const a=t.length,n=3;for(let l=0;l<a;l++){const t=l*n;u(le,r[t],r[t+1],r[t+2]);const a=!Number.isNaN(r[2]);null==s||(a?g(s,le):m(s,le))||(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&i.getLogger(this).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&i.getLogger(this).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObb||o.push(le[0],le[1],le[2])}}_createGraphics(e,r,i,s){const o=e.length,a=3,n=this._getObjectIdField(),l=this.processor.graphicsCore,d=new Array,u=this.view.spatialReference;for(let h=0;h<o;h++){const o=e[h],c={};null!=o&&(c[n]=o);const p=o??t.generateUID(),g=h*a,m=isNaN(r[g+2])?void 0:r[g+2],y=E(r[g],r[g+1],m,u),f=this.loadedGraphics.get(p);if(null!=f)(null==f.level||f.level<s)&&(de.property="geometry",de.graphic=f,de.oldValue=f.geometry,de.newValue=y,f.geometry=y,f.level=s,l.graphicUpdateHandler(de)),d.push(f);else{const e=t.generateUID();d.push({objectId:p,uid:e,geometry:y,attributes:c,visible:!0,nodeIndex:i,level:s})}}return d}_updateNodeMemory(e){e.memory=4096+(null!=e.numFeatures?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>v(t)+e),n(e.featureIds)+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode(((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)})),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return null==t?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,s){this.loadedGraphics.hasNode(e.index)?i.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(t.featureIds,r,s),this.loadedGraphics.addNode(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),t.attributeInfo=r,this._attributeValuesChanged(t),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(null!=t&&null!=t.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(null!=t&&null!=t.attributeInfo)return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);null!=r&&null!=r.attributeInfo&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);null!=i&&(await this._i3sOverrides.applyAttributeOverrides(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){if(oe(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||b}_getGlobalIdField(){return this.layer.associatedLayer?.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this._excludeObjectIdsSorted,s=this._getObjectIdField();for(const o of e.graphics){const e=o.visible,a=!t||this._evaluateClause(t,o),n=null==i||r(i,o.attributes[s])<0;o.visible=a&&n,e!==o.visible&&(de.graphic=o,de.property="visible",de.oldValue=e,de.newValue=o.visible,this.processor.graphicsCore.graphicUpdateHandler(de))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new N(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():N.from(e))}_setupQueryEngine(){const e=()=>this.processor.featureStore;this._queryEngine=new D({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:$.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){G(this._attributeEditingContext,e)}get _attributeEditingContext(){const e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(null!=i){const t=this.loadedGraphics.get(i.attributes[e]);null!=t&&this.processor.graphicsCore.recreateGraphics([t])}else null!=s&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this.loadedGraphics.nodeCount,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this.loadedGraphics.nodeCount,loadedGraphics:this.loadedGraphics}}};e([l()],ee.prototype,"processor",void 0),e([l({type:w})],ee.prototype,"filter",void 0),e([l()],ee.prototype,"loadedGraphics",void 0),e([l()],ee.prototype,"i3slayer",null),e([l()],ee.prototype,"_controller",void 0),e([l()],ee.prototype,"updating",void 0),e([l()],ee.prototype,"suspended",void 0),e([l()],ee.prototype,"holeFilling",void 0),e([l(z)],ee.prototype,"updatingProgress",void 0),e([l()],ee.prototype,"updatingProgressValue",null),e([l(J.requiredFields)],ee.prototype,"requiredFields",null),e([l(J.availableFields)],ee.prototype,"availableFields",void 0),e([l()],ee.prototype,"_fieldsHelper",void 0),e([l({type:Number})],ee.prototype,"maximumNumberOfFeatures",null),e([l({readOnly:!0})],ee.prototype,"maximumNumberOfFeaturesExceeded",null),e([l()],ee.prototype,"_excludeObjectIdsSorted",null),e([l({readOnly:!0})],ee.prototype,"lodFactor",null),e([l({readOnly:!0})],ee.prototype,"hasM",null),e([l({readOnly:!0})],ee.prototype,"hasZ",null),e([l()],ee.prototype,"contentVisible",null),e([l({readOnly:!0})],ee.prototype,"legendEnabled",null),ee=e([d("esri.views.3d.layers.SceneLayerGraphicsView3D")],ee);const te=ee;function re(e){return"pointData"in e}function ie(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function se(e,t,r){const i=t.attributeInfo;if(null==i||null==i.loadedAttributes||null==i.attributeData)return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=H(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function oe(e){const t=e.attributeInfo,r=e.node.index;if(null!=t&&null!=t.loadedAttributes&&null!=t.attributeData)for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=H(t.attributeData[e],i))}}}function ae(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const ne={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},le=h(),de={graphic:null,property:null,oldValue:null,newValue:null};export{te as default};
5
+ import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import{binaryIndexOf as r}from"../../../core/arrayUtils.js";import i from"../../../core/Logger.js";import{destroyMaybe as s}from"../../../core/maybe.js";import{initial as o,watch as a}from"../../../core/reactiveUtils.js";import{estimateSize as n}from"../../../core/typedArrayUtil.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../../core/accessorSupport/decorators/subclass.js";import{s as u}from"../../../chunks/vec3.js";import{c as h}from"../../../chunks/vec3f64.js";import{projectBuffer as c}from"../../../geometry/projection/projectBuffer.js";import{projectVectorToVector as p}from"../../../geometry/projection/projectVectorToVector.js";import{extentContainsCoords3D as g,extentContainsCoords2D as m}from"../../../geometry/support/contains.js";import{newDoubleArray as y,doubleArrayFrom as f}from"../../../geometry/support/DoubleArray.js";import{getGeometryZScaler as _}from"../../../geometry/support/zscale.js";import{fallbackObjectIDAttribute as b}from"../../../layers/LayerConstants.js";import{estimateSize as v}from"../../../layers/graphics/dehydratedFeatures.js";import{makeDehydratedPoint as E}from"../../../layers/graphics/dehydratedPoint.js";import{hydrateGraphic as x}from"../../../layers/graphics/hydratedFeatures.js";import I from"../../../layers/graphics/controllers/I3SOnDemandController.js";import w from"../../../layers/support/FeatureFilter.js";import N from"../../../rest/support/Query.js";import{isBasemapLayer as O}from"../../../support/basemapUtils.js";import{I3SPointsWorkerHandle as j}from"./I3SPointsWorkerHandle.js";import{LayerView3D as C}from"./LayerView3D.js";import{Graphics3DFeatureProcessor as F}from"./graphics/Graphics3DFeatureProcessor.js";import{QueryEngine as D}from"./graphics/QueryEngine.js";import{createInteractiveEditSession as S,processAttributeEdits as G}from"./i3s/featureEditing.js";import{I3SGraphicsMap as A}from"./i3s/I3SGraphicsMap.js";import{I3SOverrides as P}from"./i3s/I3SOverrides.js";import{checkRecyclable as L,checkSpatialReferences as V,containsDraco as M,whenGraphicAttributes as R,getCachedAttributeValue as H}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as U}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as q}from"./support/fieldProperties.js";import{PopupSceneLayerView as Q}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as T}from"./support/SceneLayerViewRequiredFields.js";import{debugFlags as B}from"../support/debugFlags.js";import{compute as k}from"../support/orientedBoundingBox.js";import{updatingProgress as z}from"../support/updatingProperties.js";import{Vertices as W}from"../webgl-engine/lib/Attribute.js";import{UpdatePolicy as Z}from"../webgl-engine/lib/UpdatePolicy.js";import K from"../../layers/SceneLayerView.js";import{hasPopupTemplate as Y}from"../../layers/support/popupUtils.js";import{TaskPriority as $}from"../../support/Scheduler.js";const J=q();class X{constructor(e,t,r,i){this.graphics=e,this.featureIds=t,this.attributeInfo=r,this.node=i}}let ee=class extends(U(Q(C(K)))){constructor(){super(...arguments),this.type="scene-layer-graphics-3d",this._queryEngine=null,this._memCache=null,this._interactiveEditingSessions=new Map,this.loadedGraphics=new A(((e,t,r)=>se(e,t,r)),(e=>this.processor.graphicsCore.recreateGraphics(e))),this.holeFilling="always",this.progressiveLoadFactor=1,this.supportsHeightUnitConversion=!0,this._coordinatesOutsideExtentErrors=0,this._maxCoordinatesOutsideExtentErrors=20}tryRecycleWith(e,t){return e.url===this.layer.url&&this._i3sOverrides.isEmpty?e.load(t).then((()=>{L(this.layer,e,this._i3sOverrides),this.layer=e,this._i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this._i3sOverrides=new P({view:this.view,layer:e,memoryController:t}),s(this._queryEngine),this._setupQueryEngine(),this.processor.resetObjectStates()})):null}initialize(){this.addResolvingPromise(this.layer.indexInfo);const e=this.view.resourceController?.memoryController;this._i3sOverrides=new P({view:this.view,layer:this.layer,memoryController:e}),V(this.layer,this.view.spatialReference,this.view.viewingMode),this._fieldsHelper=new T({layerView:this}),this._updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),o),this._updatingHandles.add((()=>this.layer.renderer),((e,t)=>this._rendererChange(e,t))),this._updatingHandles.add((()=>[this.parsedDefinitionExpression,this._excludeObjectIdsSorted]),(()=>this._filterChange())),this.addHandles(a((()=>B.I3S_TREE_SHOW_TILES),(e=>{if(e&&!this._treeDebugger){const e=this._controller.crsIndex;import("./support/I3STreeDebugger.js").then((({I3STreeDebugger:t})=>{!this._treeDebugger&&B.I3S_TREE_SHOW_TILES&&(this._treeDebugger=new t({lv:this,view:this.view,nodeSR:e}))}))}else e||!this._treeDebugger||B.I3S_TREE_SHOW_TILES||(this._treeDebugger.destroy(),this._treeDebugger=null)}),o)),this._set("processor",new F({owner:this,preferredUpdatePolicy:Z.ASYNC,scaleVisibilityEnabled:!0,filterVisibilityEnabled:!0,timeExtentEnabled:!1,frustumVisibilityEnabled:!1,elevationAlignmentEnabled:!0,elevationFeatureExpressionEnabled:!1,setUidToIdOnAdd:!1,dataExtent:this.layer.fullExtent,updateClippingExtent:e=>this._updateClippingExtent(e)})),this.processor.elevationAlignment?.events.on("invalidate-elevation",(e=>this._controller.updateElevationChanged(e.extent,e.spatialReference))),this.supportsHeightUnitConversion&&(this._verticalScale=_("point",this.layer.spatialReference,this.view.spatialReference)),this.addResolvingPromise(this.processor.initializePromise),this._memCache=this.view.resourceController.memoryController.newCache(`psl-${this.uid}`),this._controller=new I({layerView:this,scaleVisibilityEnabled:!1}),M(this.layer.geometryDefinitions)&&(this._worker=new j((e=>this.view.resourceController.immediate.schedule(e)))),this.addHandles(this.layer.on("apply-edits",(e=>this._updatingHandles.addPromise(e.result)))),this.addHandles(this.layer.on("edits",(e=>this._handleEdits(e)))),this.when((()=>{this._setupQueryEngine(),this._updatingHandles.add((()=>this.maximumNumberOfFeatures),(e=>this._controller.featureTarget=e),o),this._updatingHandles.add((()=>this.suspended),(e=>{e&&this._removeAllNodeData()}))}))}destroy(){this._treeDebugger=s(this._treeDebugger),this._i3sOverrides=s(this._i3sOverrides),this._set("processor",s(this.processor)),this._controller=s(this._controller),this._queryEngine=s(this._queryEngine),this._worker=s(this._worker),this._memCache=s(this._memCache),this.loadedGraphics.clear(),this._fieldsHelper=s(this._fieldsHelper)}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??1}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get maximumNumberOfFeatures(){const e=this.processor?.graphicsCore?.displayFeatureLimit;return e?.maximumNumberOfFeatures??0}set maximumNumberOfFeatures(e){null!=e?(this._override("maximumNumberOfFeatures",e),this._controller.fixedFeatureTarget=!0):(this._clearOverride("maximumNumberOfFeatures"),this._controller.fixedFeatureTarget=!1)}get maximumNumberOfFeaturesExceeded(){return!this.suspended&&(!!this._controller?.useMaximumNumberOfFeatures&&!this._controller.leavesReached)}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds;return e.length?e.toArray().sort(((e,t)=>e-t)):null}get lodFactor(){return"Labels"===this.layer.semantic?1:this.view.qualitySettings.sceneService.point.lodFactor}get hasM(){return!1}get hasZ(){return!0}get contentVisible(){return!this.suspended&&!!this._controller?.rootNodeVisible}get legendEnabled(){return this.contentVisible&&!0===this.i3slayer?.legendEnabled}async whenGraphicAttributes(e,t){return R(this.layer,e,this._getObjectIdField(),t,(()=>[...this.loadedGraphics.nodes()]))}getHit(e){if(!this.loadedGraphics)return null;const t=x(this.loadedGraphics.find((t=>t.uid===e)),this.layer),r=this._getObjectIdField();return t&&t.attributes&&t.attributes[r]?(t.layer=this.layer,t.sourceLayer=this.layer,{type:"graphic",graphic:t,layer:t.layer}):null}whenGraphicBounds(e,t){return this.processor.whenGraphicBounds(e,t)}computeAttachmentOrigin(e,t){return this.processor.computeAttachmentOrigin(e,t)}isUpdating(){return!!(this._controller?.updating||this.processor?.updating||this._fieldsHelper?.updating||this.layerFilterUpdating)}highlight(e){return this.processor.highlight(e,this.layer.objectIdField)}get updatePolicy(){return this.processor.graphicsCore.effectiveUpdatePolicy}createInteractiveEditSession(e){return S(this._attributeEditingContext,e)}async _decompressBinaryPointData(e,t){const r={geometryBuffer:e.geometryBuffer};null==this._worker&&(this._worker=new j((e=>this.view.resourceController.immediate.schedule(e))));const i=await this._worker.invoke(r,t);if(null==i)throw new Error("Failed to decompress Draco point data");return{positionData:i.positions,featureIds:i.featureIds}}async addNode(e,t,r){if(!ie(t)&&!re(t))throw new Error;if(this.loadedGraphics.hasNode(e.index))return void i.getLogger(this).error("I3S node "+e.id+" already added");const s=null!=this.layer.fullExtent?ae(this.layer.fullExtent.clone(),.5):null,o=[],{featureIds:a,pointPositions:n}=ie(t)?await this._extractBinaryPointPositions(e,t,r):this._extractLegacyPointPositions(t);this._validatePositions(e,a,n,s,o);const l=this._controller.crsVertex,d=this.view.spatialReference;c(n,l,0,n,d,0,a.length);const u=ie(t)?e.level:0,h=this._createGraphics(a,n,e.index,u),p=new X(h,a,t.attributeDataInfo,e);if(await this._i3sOverrides.applyAttributeOverrides(p.featureIds,t.attributeDataInfo,r),e.numFeatures=p.graphics.length,this._updateNodeMemory(e),oe(p),o.length>0&&(this._computeObb(e,o,l),this._controller.updateVisibility(e.index)),!this._controller.isGeometryVisible(e))return void this._cacheNodeData(p);if(null!=this._verticalScale)for(const i of p.graphics)this._verticalScale(i.geometry);const g=this.view._stage.renderView.objectAndLayerIdRenderHelper;if(null!=g){const e=O(this.view.map,this.layer.uid);for(let t=0;t<p.featureIds.length;t++){const r=p.featureIds[t];g.setUidToObjectAndLayerId(r,p.graphics[t].uid,this.layer.id,this.layer.uid,this.layer.popupEnabled&&!e&&Y(this.layer,this.view.popup?.defaultPopupTemplateEnabled),p.node.resources.attributes,t)}}this.loadedGraphics.addNode(e.index,p),this._controller.updateLoadStatus(e.index,!0),this._filterNode(p),this._treeDebugger&&this._treeDebugger.update()}_computeObb(e,t,r){const i=this._controller.crsIndex,s=i.isGeographic?this.view.renderSpatialReference:i;c(t,r,0,t,s,0,t.length/3),e.serviceObb=k(new W(t,3)),i.isGeographic&&p(e.serviceObb.center,s,e.serviceObb.center,i)}isNodeLoaded(e){return this.loadedGraphics.hasNode(e)}isNodeReloading(){return!1}updateNodeState(){}async _extractBinaryPointPositions(e,t,r){const i=await this._decompressBinaryPointData(t,r),s=i.positionData,o=3,a=s.length/o,n=y(3*a),l=null!=e.serviceObb?e.serviceObb.center:[0,0,0],d=Math.abs(l[2])*2**-20;for(let u=0;u<a;u++){const e=u*o;n[e]=s[e]+l[0],n[e+1]=s[e+1]+l[1],n[e+2]=s[e+2]+l[2],Math.abs(n[e+2])<d&&(n[e+2]=0)}return{featureIds:i.featureIds?f(i.featureIds):[],pointPositions:n}}_extractLegacyPointPositions(e){const t=e.pointData.length,r=y(3*t),i=new Array;for(let s=0;s<t;s++){const t=e.pointData[s],o=t.featureDataPosition,a=o.length,n=t.geometries?.[0]??ne[a],l=t.featureIds[0];if("Embedded"!==n.type||"points"!==n.params.type||a<2||a>3)continue;const d=n.params.vertexAttributes?.position??[0,0,0],u=3*i.length;r[u]=o[0]+d[0],r[u+1]=o[1]+d[1],r[u+2]=3===a?o[2]+d[2]:NaN,i.push(l)}return{featureIds:i,pointPositions:r}}_validatePositions(e,t,r,s,o){if(null==s&&e.serviceObb)return;const a=t.length,n=3;for(let l=0;l<a;l++){const t=l*n;u(le,r[t],r[t+1],r[t+2]);const a=!Number.isNaN(r[2]);null==s||(a?g(s,le):m(s,le))||(this._coordinatesOutsideExtentErrors<this._maxCoordinatesOutsideExtentErrors&&i.getLogger(this).error("Service Error: Coordinates outside of layer extent"),this._coordinatesOutsideExtentErrors+1===this._maxCoordinatesOutsideExtentErrors&&i.getLogger(this).error("Maximum number of errors reached. Further errors are ignored."),this._coordinatesOutsideExtentErrors++),e.serviceObb||o.push(le[0],le[1],le[2])}}_createGraphics(e,r,i,s){const o=e.length,a=3,n=this._getObjectIdField(),l=this.processor.graphicsCore,d=new Array,u=this.view.spatialReference;for(let h=0;h<o;h++){const o=e[h],c={};null!=o&&(c[n]=o);const p=o??t.generateUID(),g=h*a,m=isNaN(r[g+2])?void 0:r[g+2],y=E(r[g],r[g+1],m,u),f=this.loadedGraphics.get(p);if(null!=f)(null==f.level||f.level<s)&&(de.property="geometry",de.graphic=f,de.oldValue=f.geometry,de.newValue=y,f.geometry=y,f.level=s,l.graphicUpdateHandler(de)),d.push(f);else{const e=t.generateUID();d.push({objectId:p,uid:e,geometry:y,attributes:c,visible:!0,nodeIndex:i,level:s})}}return d}_updateNodeMemory(e){e.memory=4096+(null!=e.numFeatures?e.numFeatures*this.processor.graphicsCore.usedMemoryPerGraphic:0)}_cacheNodeData(e){const t=e.graphics.reduce(((e,t)=>v(t)+e),n(e.featureIds)+1024);this._memCache.put(this._getMemCacheKey(e.node),e,t)}_getMemCacheKey(e){return`${e.index}`}_removeAllNodeData(){this.loadedGraphics.forEachNode(((e,t)=>{if(e){const t=e.node;this._updateNodeMemory(t),this._cacheNodeData(e)}this._controller.updateLoadStatus(t,!1)})),this._treeDebugger&&this._treeDebugger.update(),this.loadedGraphics.clear()}removeNode(e){const t=this._removeNodeStageData(e);t&&(this._updateNodeMemory(t.node),this._cacheNodeData(t))}_removeNodeStageData(e){const t=this.loadedGraphics.getNode(e);return null==t?null:(this._controller.updateLoadStatus(e,!1),this.loadedGraphics.removeNode(e),this._treeDebugger&&this._treeDebugger.update(),t)}async loadCachedNodeData(e){return this._memCache?.pop(this._getMemCacheKey(e))}async addCachedNodeData(e,t,r,s){this.loadedGraphics.hasNode(e.index)?i.getLogger(this).error("I3S node "+e.id+" already added"):(await this._i3sOverrides.applyAttributeOverrides(t.featureIds,r,s),this.loadedGraphics.addNode(e.index,t),this._controller.updateLoadStatus(e.index,!0),this._updateNodeMemory(e),t.attributeInfo=r,this._attributeValuesChanged(t),this._filterNode(t),this._treeDebugger&&this._treeDebugger.update())}getLoadedNodeIds(){const e=[];return this.loadedGraphics.forEachNode((t=>e.push(t.node.id))),e.sort()}getVisibleNodes(){const e=new Array;return this.loadedGraphics.forEachNode((t=>e.push(t.node))),e}getLoadedNodeIndices(e){this.loadedGraphics.forEachNode(((t,r)=>e.push(r)))}getLoadedAttributes(e){const t=this.loadedGraphics.getNode(e);if(null!=t&&null!=t.attributeInfo)return t.attributeInfo.loadedAttributes}getAttributeData(e){const t=this.loadedGraphics.getNode(e);if(null!=t&&null!=t.attributeInfo)return t.attributeInfo.attributeData}_setAttributeData(e,t){const r=this.loadedGraphics.getNode(e);null!=r&&null!=r.attributeInfo&&(r.attributeInfo.attributeData=t,this._attributeValuesChanged(r))}async updateAttributes(e,t,r){const i=this.loadedGraphics.getNode(e);null!=i&&(await this._i3sOverrides.applyAttributeOverrides(i.featureIds,t,r),i.attributeInfo=t,this._attributeValuesChanged(i))}_attributeValuesChanged(e){if(oe(e),this._filterNode(e),this.processor.graphicsCore.labelsEnabled){const t=e.graphics.map((e=>e.uid));this.processor.graphicsCore.updateLabelingInfo(t)}}_updateClippingExtent(e){return this._controller&&this._controller.updateClippingArea(e),!1}_getObjectIdField(){return this.layer.objectIdField||b}_getGlobalIdField(){return this.layer.associatedLayer?.globalIdField}async _rendererChange(e,t){const{layer:{fieldsIndex:r}}=this,i=new Set;let s,o;e?(await e.collectRequiredFields(i,r),s=Array.from(i).sort()):s=[],i.clear(),t?(await t.collectRequiredFields(i,r),o=Array.from(i).sort()):o=[],s.length===o.length&&s.every(((e,t)=>s[t]===o[t]))||this._reloadAllNodes()}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}_filterChange(){this.loadedGraphics.forEachNode((e=>this._filterNode(e)))}_reloadAllNodes(){this._removeAllNodeData(),this._controller&&this._controller.restartNodeLoading()}_filterNode(e){const t=this.parsedDefinitionExpression,i=this._excludeObjectIdsSorted,s=this._getObjectIdField();for(const o of e.graphics){const e=o.visible,a=!t||this._evaluateClause(t,o),n=null==i||r(i,o.attributes[s])<0;o.visible=a&&n,e!==o.visible&&(de.graphic=o,de.property="visible",de.oldValue=e,de.newValue=o.visible,this.processor.graphicsCore.graphicUpdateHandler(de))}}createQuery(){const e={outFields:["*"],returnGeometry:!0,outSpatialReference:this.view.spatialReference};return null!=this.filter?this.filter.createQuery(e):new N(e)}queryFeatures(e,t){return this._queryEngine.executeQuery(this._ensureQuery(e),t?.signal)}queryObjectIds(e,t){return this._queryEngine.executeQueryForIds(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._queryEngine.executeQueryForCount(this._ensureQuery(e),t?.signal)}queryExtent(e,t){return this._queryEngine.executeQueryForExtent(this._ensureQuery(e),t?.signal)}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():N.from(e))}_setupQueryEngine(){const e=()=>this.processor.featureStore;this._queryEngine=new D({context:{spatialReference:this.view.spatialReference,layer:this.layer,scheduler:this.view.resourceController.scheduler,get featureStore(){return e()},hasZ:this.hasZ,hasM:this.hasM},priority:$.FEATURE_QUERY_ENGINE})}get usedMemory(){return this.processor?.graphicsCore?.usedMemory??0}get unloadedMemory(){return.8*((this._controller?.unloadedMemoryEstimate??0)+(this.processor?.graphicsCore?.unprocessedMemoryEstimate??0))}get ignoresMemoryFactor(){return this._controller&&this._controller.fixedFeatureTarget}_handleEdits(e){G(this._attributeEditingContext,e)}get _attributeEditingContext(){const e=this._getObjectIdField(),t=this._getGlobalIdField();return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:e,globalIdField:t,forEachNode:e=>this.loadedGraphics.forEachNode((t=>e(t.node,t.featureIds))),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this._i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(t,r,i)=>{this._setAttributeData(t,r);const s=this.loadedGraphics.getNode(t);if(null!=i){const t=this.loadedGraphics.get(i.attributes[e]);null!=t&&this.processor.graphicsCore.recreateGraphics([t])}else null!=s&&this.processor.graphicsCore.recreateGraphics(s.graphics)},clearMemCache:()=>{}}}get performanceInfo(){const e={displayedNumberOfFeatures:this.loadedGraphics.length,maximumNumberOfFeatures:this.maximumNumberOfFeatures,totalNumberOfFeatures:-1,nodes:this.loadedGraphics.nodeCount,core:this.processor.graphicsCore.performanceInfo};return this._controller&&this._controller.updateStats(e),e}get test(){return{controller:this._controller,numNodes:this.loadedGraphics.nodeCount,loadedGraphics:this.loadedGraphics}}};e([l()],ee.prototype,"processor",void 0),e([l({type:w})],ee.prototype,"filter",void 0),e([l()],ee.prototype,"loadedGraphics",void 0),e([l()],ee.prototype,"i3slayer",null),e([l()],ee.prototype,"_controller",void 0),e([l()],ee.prototype,"updating",void 0),e([l()],ee.prototype,"suspended",void 0),e([l()],ee.prototype,"holeFilling",void 0),e([l(z)],ee.prototype,"updatingProgress",void 0),e([l()],ee.prototype,"updatingProgressValue",null),e([l(J.requiredFields)],ee.prototype,"requiredFields",null),e([l(J.availableFields)],ee.prototype,"availableFields",void 0),e([l()],ee.prototype,"_fieldsHelper",void 0),e([l({type:Number})],ee.prototype,"maximumNumberOfFeatures",null),e([l({readOnly:!0})],ee.prototype,"maximumNumberOfFeaturesExceeded",null),e([l()],ee.prototype,"_excludeObjectIdsSorted",null),e([l({readOnly:!0})],ee.prototype,"lodFactor",null),e([l({readOnly:!0})],ee.prototype,"hasM",null),e([l({readOnly:!0})],ee.prototype,"hasZ",null),e([l()],ee.prototype,"contentVisible",null),e([l({readOnly:!0})],ee.prototype,"legendEnabled",null),ee=e([d("esri.views.3d.layers.SceneLayerGraphicsView3D")],ee);const te=ee;function re(e){return"pointData"in e}function ie(e){return"geometryBuffer"in e&&null!==e.geometryBuffer}function se(e,t,r){const i=t.attributeInfo;if(null==i||null==i.loadedAttributes||null==i.attributeData)return!1;let s=!1;for(const{name:o}of i.loadedAttributes)if(i.attributeData[o]){const t=H(i.attributeData[o],r);t!==e.attributes[o]&&(e.attributes[o]=t,s=!0)}return s}function oe(e){const t=e.attributeInfo,r=e.node.index;if(null!=t&&null!=t.loadedAttributes&&null!=t.attributeData)for(let i=0;i<e.graphics.length;i++){const s=e.graphics[i];if(s.nodeIndex===r){s.attributes||(s.attributes={});for(const{name:e}of t.loadedAttributes)t.attributeData[e]&&(s.attributes[e]=H(t.attributeData[e],i))}}}function ae(e,t){return e.xmin-=t,e.ymin-=t,e.xmax+=t,e.ymax+=t,null!=e.zmin&&null!=e.zmax&&(e.zmin-=t,e.zmax+=t),null!=e.mmin&&null!=e.mmax&&(e.mmin-=t,e.mmax+=t),e}const ne={2:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0]}}},3:{type:"Embedded",params:{type:"points",vertexAttributes:{position:[0,0,0]}}}},le=h(),de={graphic:null,property:null,oldValue:null,newValue:null};export{te as default};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as s}from"../../../../core/mathUtils.js";import e from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{p as o}from"../../../../chunks/mat4.js";import{a as c}from"../../../../chunks/mat4f64.js";import{a as n}from"../../../../chunks/vec2f64.js";import{e as l,i as h,s as p,c as u}from"../../../../chunks/vec3.js";import{Z as d,c as f}from"../../../../chunks/vec3f64.js";import{s as _,t as m,b as g}from"../../../../chunks/vec4.js";import{c as b}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{create as y,empty as G,offset as S,width as B,height as D,expand as w,intersects as N}from"../../../../geometry/support/aaBoundingRect.js";import{a as j,c as I,e as V}from"../../../../chunks/boundedPlane.js";import{create as C}from"../../../../geometry/support/ray.js";import{d as P,g as A,i as O,c as M}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as x,prepare as z,drawPoly as E}from"./deconflictorDebug.js";import{VisibilityGroup as T,VisibilityFlag as X}from"./enums.js";import{Camera as F}from"../../webgl-engine/lib/Camera.js";import{applyPrecomputedScaleFactor as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as k}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as R}from"../../webgl-engine/materials/ScaleInfo.js";const U=f(),W=b(),H=b(),Z=f(),q=c(),J=M(),K=C(),Q=f(),$=y();class ii{constructor(){this.aabr=y(),this.distance=0,this.culled=!1,this.visible=!1}}class ti{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.info={}}}var si;!function(i){i[i.Idle=0]="Idle",i[i.Process=1]="Process",i[i.Sort=2]="Sort",i[i.Deconflict=3]="Deconflict",i[i.NumStates=4]="NumStates"}(si||(si={}));class ei{constructor(){this.camera=new F,this.slicePlane=j(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),I(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ri=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._runningViewState=new ei,this._state=si.Idle,this._active=new Map,this._visible=new Map,this._iterators=new li,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this.accNumTests=0}destroy(){this._active.clear(),this._visible.clear(),this._iterators=null}setDirty(){!this._dirty&&this._active.size>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==si.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const i=this._state/si.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case si.Idle:this._startUpdate(),i.madeProgress();case si.Process:if(this._state=si.Process,!this._processActiveGraphics(i))return;case si.Sort:if(this._state=si.Sort,!this._sortVisibleGraphics(i))return;case si.Deconflict:if(this._state=si.Deconflict,!this._deconflictVisibleGraphics(i))return;default:x(this,this._visible),this._state=si.Idle,this.notifyChange("updating")}}modifyGraphics(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i))),this.setDirty()}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const s=t?.geometries[0],e=s?.material;return e instanceof k}_startUpdate(){z(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._runningViewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.info[this.visibilityGroup]=new ii,this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),ai(i,this.visibilityGroup),delete i.info[this.visibilityGroup],this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),s=o(q,this._runningViewState.camera.projectionMatrix),e="global"===this.view.viewingMode&&1===this.view.map.ground.opacity&&this._runningViewState.camera.relativeElevation>0?J:null;let r=0;for(null!=e&&(l(e,d,this._runningViewState.camera.viewMatrix),e[3]=v(this.view.spatialReference).radius,r=P(e,d));!i.done;){i.madeProgress();const a=t.next();if(!0===a.done)return this._resetActiveGraphicsIterator(),!0;const o=a.value,c=o&&o.info[this.visibilityGroup];c&&(this._collectGraphics3DGraphics(o,s,e,r),c.culled?this._visible.delete(o.graphics3DGraphic.graphic.uid):this._visible.set(o.graphics3DGraphic.graphic.uid,o))}return!1}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const s=t.next();if(i.madeProgress(),!0===s.done)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),s=this.visibilityGroup===T.LABEL;for(;!i.done;){i.madeProgress();const e=t.next();if(!0===e.done)return this._resetVisibleGraphicsIterator(),!0;const r=e.value,a=r.info[this.visibilityGroup];if(!a||a.culled){this._setGraphicVisibility(r,!1);continue}const o=r.graphics3DGraphic,c=!s||o.isVisible();a.visible=c&&!this._isConflicted(r),a.visible&&this._addToBins(r),this._setGraphicVisibility(r,a.visible),E(a,a.visible)}return!1}_resetIterators(){this._iterators.active=null,this._iterators.visible=null,this._iterators.sort=null}_ensureActiveGraphicsIterator(){return this._iterators.active||(this._iterators.active=oi(this._active)),this._iterators.active}_resetActiveGraphicsIterator(){this._iterators.active=null}_ensureVisibleGraphicsIterator(){return this._iterators.visible||(this._iterators.visible=oi(this._visible)),this._iterators.visible}_resetVisibleGraphicsIterator(){this._iterators.visible=null}_ensureSortGraphicsIterator(){return this._iterators.sort||(this._iterators.sort=ci(this._visible,this._iterators.sortArray,this.visibilityGroup)),this._iterators.sort}_resetSortGraphicsIterator(){this._iterators.sort=null}_collectGraphics3DGraphics(i,t,s,e){const r=i.graphics3DGraphic;if(r.destroyed)return;const a=i.info[this.visibilityGroup];if(!r.isVisible(T.GRAPHIC,X.DECONFLICTION))return void(a.culled=!0);const o=this.getGraphicsLayers(r);G(a.aabr);let c=null;for(const n of o){if(!this.layerSupportsDeconfliction(n))continue;const r=n.stageObject.geometries[0].material;if(null==c&&(c=ui,this._getProjectionInfo(n,t,c),c.isOutsideScreen||this._isCulledBySlice(i,U)||null!=s&&this._isCulledByHorizon(c,s,e)))return void(a.culled=!0);this._expandBoundingRect(a,n,r,c)}null==c?a.culled=!0:(a.distance=c.distance,a.culled=!1)}_getProjectionInfo(i,t,s){const e=this._runningViewState.camera,r=i.stageObject,a=r.geometries[0],o=a.material,c=A(r.boundingVolumeWorldSpace.bounds);l(U,c,e.viewMatrix);const n=a.vertexAttributes,u=n.get(Y.NORMAL).data,d=n.get(Y.AUXPOS1).data;o.applyShaderOffsetsView(U,u,r.transformation,d,e,s.scaleInfo,U),_(W,U[0],U[1],U[2],1),m(H,W,e.projectionMatrix),h(s.positionNDC,H,1/H[3]),o.applyShaderOffsetsNDC(s.positionNDC,d,e,s.positionNDC,Z),s.distanceWithoutPolygonOffset=e.depthNDCToWorld(Z[2]),s.distance=Z[2]===s.positionNDC[2]?s.distanceWithoutPolygonOffset:e.depthNDCToWorld(s.positionNDC[2]),_(H,s.positionNDC[0],s.positionNDC[1],s.positionNDC[2],1),m(W,H,t),g(W,W,1/W[3]),p(s.positionView,U[0],U[1],U[2])}_isCulledByHorizon(i,t,s){return u(K.direction,i.positionView),p(K.origin,0,0,0),!!O(t,K,Q)&&i.distanceWithoutPolygonOffset>s}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&V(this._runningViewState.slicePlane,t)}_expandBoundingRect(i,t,e,{positionNDC:r,scaleInfo:a}){const o=this._runningViewState.camera,c=t.getScreenSize(hi);L(c,a.factor,c),c[0]*=o.pixelRatio,c[1]*=o.pixelRatio;const n=S(e.calculateRelativeScreenBounds(c,a.factorAlignment.scale,$),s(0,o.fullWidth,.5+.5*r[0]),s(0,o.fullHeight,.5+.5*r[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(B(n),D(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}w(i.aabr,n,i.aabr)}_isConflicted(i){const t=i.graphics3DGraphic.graphic.uid,s=i.info[this.visibilityGroup];let e=!0;for(let r=Math.floor(s.aabr[0]/this._accBinsSizeX);r<=Math.floor(s.aabr[2]/this._accBinsSizeX);r++)if(!(r<0||r>=this._accBinsNumX))for(let i=Math.floor(s.aabr[1]/this._accBinsSizeY);i<=Math.floor(s.aabr[3]/this._accBinsSizeY);i++){if(i<0||i>=this._accBinsNumY)continue;e=!1;const a=this._accBins[r][i];for(let i=0;i<a.length;i++){const e=a.data[i],r=e.info[this.visibilityGroup];if(r&&r.visible&&e.graphics3DGraphic.graphic.uid!==t&&(this.accNumTests++,N(r.aabr,s.aabr)))return!0}}return e}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new e)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this.accNumTests=0}_addToBins(i){const t=i.info[this.visibilityGroup],s=Math.floor(t.aabr[0]/this._accBinsSizeX),e=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),a=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let o=s;o<=e;o++)if(!(o<0||o>=this._accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this._accBinsNumY||this._accBins[o][t].push(i)}_setGraphicVisibility(i,t){const s=i.graphics3DGraphic;s.destroyed||(s.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===T.LABEL&&this.view.labeler.setLabelGraphicVisibility(s,t))}};function ai(i,t){const s=i.graphics3DGraphic;s.destroyed||s.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*oi(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*ci(i,t,s){t.clear(),i.forEach(((i,e)=>{const r=t.pushNew();r.id=e,r.visible=i.graphics3DGraphic.getVisibilityFlag(s,X.DECONFLICTION);const a=i.info&&i.info[s];r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=a?a.distance:Number.MAX_VALUE})),yield;const e=t.iterableSort(((i,t)=>i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?i.visible?-1:1:i.id-t.id));for(let r=e.next();!r.done;r=e.next())yield;t.forAll((t=>{const s=i.get(t.id);s&&(i.delete(t.id),i.set(t.id,s))})),t.clear()}i([r({constructOnly:!0})],ri.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ri.prototype,"updating",null),ri=i([a("esri.views.3d.layers.graphics.Deconflictor")],ri);class ni{constructor(){this.id=0,this.visible=!1,this.prio=0,this.distance=0}}class li{constructor(i=null,t=null,s=null){this.active=i,this.visible=t,this.sort=s,this.sortArray=new e({allocator:i=>i||new ni})}}const hi=n();class pi{constructor(){this.positionView=f(),this.positionNDC=f(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new R}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1}}const ui=new pi;export{ri as Deconflictor,ti as DeconflictorGraphic,ei as DeconflictorViewState,si as State};
5
+ import{_ as i}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import{lerp as s}from"../../../../core/mathUtils.js";import e from"../../../../core/PooledArray.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/accessorSupport/ensureType.js";import"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{subclass as a}from"../../../../core/accessorSupport/decorators/subclass.js";import{p as o}from"../../../../chunks/mat4.js";import{a as c}from"../../../../chunks/mat4f64.js";import{a as n}from"../../../../chunks/vec2f64.js";import{e as l,i as h,s as p,c as u}from"../../../../chunks/vec3.js";import{Z as d,c as f}from"../../../../chunks/vec3f64.js";import{s as _,t as m,b as g}from"../../../../chunks/vec4.js";import{c as b}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{create as y,empty as G,offset as S,width as B,height as D,expand as w,intersects as N}from"../../../../geometry/support/aaBoundingRect.js";import{a as j,c as I,e as V}from"../../../../chunks/boundedPlane.js";import{create as C}from"../../../../geometry/support/ray.js";import{d as P,g as A,i as O,c as M}from"../../../../chunks/sphere.js";import{drawAccelerationStruct as x,prepare as z,drawPoly as E}from"./deconflictorDebug.js";import{VisibilityGroup as T,VisibilityFlag as X}from"./enums.js";import{Camera as F}from"../../webgl-engine/lib/Camera.js";import{applyPrecomputedScaleFactor as L}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../../webgl-engine/lib/VertexAttribute.js";import{HUDMaterial as k}from"../../webgl-engine/materials/HUDMaterial.js";import{ScaleInfo as R}from"../../webgl-engine/materials/ScaleInfo.js";const U=f(),W=b(),H=b(),Z=f(),q=c(),J=M(),K=C(),Q=f(),$=y();class ii{constructor(){this.aabr=y(),this.distance=0,this.culled=!1,this.visible=!1}}class ti{constructor(i,t){this.graphics3DGraphic=i,this.slicePlaneEnabled=t,this.info={}}}var si;!function(i){i[i.Idle=0]="Idle",i[i.Process=1]="Process",i[i.Sort=2]="Sort",i[i.Deconflict=3]="Deconflict",i[i.NumStates=4]="NumStates"}(si||(si={}));class ei{constructor(){this.camera=new F,this.slicePlane=j(),this.slicePlaneEnabled=!1}copyFrom(i){this.camera.copyFrom(i.camera),I(i.slicePlane,this.slicePlane),this.slicePlaneEnabled=i.slicePlaneEnabled}}let ri=class extends t{get dirty(){return this._dirty}get state(){return this._state}constructor(i){super(i),this._dirty=!1,this._runningViewState=new ei,this._state=si.Idle,this._active=new Map,this._visible=new Map,this._iterators=new li,this._accBinsNumX=15,this._accBinsNumY=20,this._accBinsSizeX=0,this._accBinsSizeY=0,this._accBins=null,this.accNumTests=0}destroy(){this._active.clear(),this._visible.clear(),this._iterators=null}setDirty(){!this._dirty&&this._active.size>0&&(this._dirty=!0,this.notifyChange("updating"))}get updating(){return this._state!==si.Idle||this._dirty}get updatingProgress(){if(!this.updating)return 1;const i=this._state/si.NumStates;return this._dirty?.5*i:i}get running(){return this.view.ready&&null!=this.view.state&&this.updating}runTask(i){switch(this._state){case si.Idle:this._startUpdate(),i.madeProgress();case si.Process:if(this._state=si.Process,!this._processActiveGraphics(i))return;case si.Sort:if(this._state=si.Sort,!this._sortVisibleGraphics(i))return;case si.Deconflict:if(this._state=si.Deconflict,!this._deconflictVisibleGraphics(i))return;default:x(this,this._visible),this._state=si.Idle,this.notifyChange("updating")}}modifyGraphics(i,t){t?i.forEach((i=>this.addToActiveGraphics(i))):i.forEach((i=>this.removeFromActiveGraphics(i))),this.setDirty()}layerSupportsDeconfliction(i){if(null==i||"object3d"!==i.type)return!1;const t=i.stageObject;if(1!==(t?.geometries.length??0))return!1;const s=t?.geometries[0],e=s?.material;return e instanceof k}_startUpdate(){z(this.view),this._dirty=!1,this._runningViewState.copyFrom(this.viewState);const{fullWidth:i,fullHeight:t}=this._runningViewState.camera;this._initBins(i,t),this._resetIterators()}addToActiveGraphics(i){i.info[this.visibilityGroup]=new ii,this._active.set(i.graphics3DGraphic.graphic.uid,i),this.setDirty()}removeFromActiveGraphics(i){this._visible.delete(i.graphics3DGraphic.graphic.uid),ai(i,this.visibilityGroup),delete i.info[this.visibilityGroup],this._active.delete(i.graphics3DGraphic.graphic.uid),this.setDirty()}_processActiveGraphics(i){const t=this._ensureActiveGraphicsIterator(),s=o(q,this._runningViewState.camera.projectionMatrix),e="global"===this.view.viewingMode&&1===this.view.map.ground.opacity&&this._runningViewState.camera.relativeElevation>0?J:null;let r=0;for(null!=e&&(l(e,d,this._runningViewState.camera.viewMatrix),e[3]=v(this.view.spatialReference).radius,r=P(e,d));!i.done;){i.madeProgress();const a=t.next();if(!0===a.done)return this._resetActiveGraphicsIterator(),!0;const o=a.value,c=o&&o.info[this.visibilityGroup];c&&(this._collectGraphics3DGraphics(o,s,e,r),c.culled?this._visible.delete(o.graphics3DGraphic.graphic.uid):this._visible.set(o.graphics3DGraphic.graphic.uid,o))}return!1}_sortVisibleGraphics(i){const t=this._ensureSortGraphicsIterator();for(;!i.done;){const s=t.next();if(i.madeProgress(),!0===s.done)return this._resetSortGraphicsIterator(),!0}return!1}_deconflictVisibleGraphics(i){const t=this._ensureVisibleGraphicsIterator(),s=this.visibilityGroup===T.LABEL;for(;!i.done;){i.madeProgress();const e=t.next();if(!0===e.done)return this._resetVisibleGraphicsIterator(),!0;const r=e.value,a=r.info[this.visibilityGroup];if(!a||a.culled){this._setGraphicVisibility(r,!1);continue}const o=r.graphics3DGraphic,c=!s||o.isVisible();a.visible=c&&!this._isConflicted(r),a.visible&&this._addToBins(r),this._setGraphicVisibility(r,a.visible),E(a,a.visible)}return!1}_resetIterators(){this._iterators.active=null,this._iterators.visible=null,this._iterators.sort=null}_ensureActiveGraphicsIterator(){return this._iterators.active||(this._iterators.active=oi(this._active)),this._iterators.active}_resetActiveGraphicsIterator(){this._iterators.active=null}_ensureVisibleGraphicsIterator(){return this._iterators.visible||(this._iterators.visible=oi(this._visible)),this._iterators.visible}_resetVisibleGraphicsIterator(){this._iterators.visible=null}_ensureSortGraphicsIterator(){return this._iterators.sort||(this._iterators.sort=ci(this._visible,this._iterators.sortArray,this.visibilityGroup)),this._iterators.sort}_resetSortGraphicsIterator(){this._iterators.sort=null}_collectGraphics3DGraphics(i,t,s,e){const r=i.graphics3DGraphic;if(r.destroyed)return;const a=i.info[this.visibilityGroup];if(!r.isVisible(T.GRAPHIC,X.DECONFLICTION))return void(a.culled=!0);const o=this.getGraphicsLayers(r);G(a.aabr);let c=null;for(const n of o){if(!this.layerSupportsDeconfliction(n))continue;const r=n.stageObject.geometries[0].material;if(null==c&&(c=ui,this._getProjectionInfo(n,t,c),c.isOutsideScreen||this._isCulledBySlice(i,U)||null!=s&&this._isCulledByHorizon(c,s,e)))return void(a.culled=!0);this._expandBoundingRect(a,n,r,c)}null==c?a.culled=!0:(a.distance=c.distance,a.culled=!1)}_getProjectionInfo(i,t,s){const e=this._runningViewState.camera,r=i.stageObject,a=r.geometries[0],o=a.material,c=A(r.boundingVolumeWorldSpace.bounds);l(U,c,e.viewMatrix);const n=a.attributes,u=n.get(Y.NORMAL).data,d=n.get(Y.AUXPOS1).data;o.applyShaderOffsetsView(U,u,r.transformation,d,e,s.scaleInfo,U),_(W,U[0],U[1],U[2],1),m(H,W,e.projectionMatrix),h(s.positionNDC,H,1/H[3]),o.applyShaderOffsetsNDC(s.positionNDC,d,e,s.positionNDC,Z),s.distanceWithoutPolygonOffset=e.depthNDCToWorld(Z[2]),s.distance=Z[2]===s.positionNDC[2]?s.distanceWithoutPolygonOffset:e.depthNDCToWorld(s.positionNDC[2]),_(H,s.positionNDC[0],s.positionNDC[1],s.positionNDC[2],1),m(W,H,t),g(W,W,1/W[3]),p(s.positionView,U[0],U[1],U[2])}_isCulledByHorizon(i,t,s){return u(K.direction,i.positionView),p(K.origin,0,0,0),!!O(t,K,Q)&&i.distanceWithoutPolygonOffset>s}_isCulledBySlice(i,t){return i.slicePlaneEnabled&&this._runningViewState.slicePlaneEnabled&&V(this._runningViewState.slicePlane,t)}_expandBoundingRect(i,t,e,{positionNDC:r,scaleInfo:a}){const o=this._runningViewState.camera,c=t.getScreenSize(hi);L(c,a.factor,c),c[0]*=o.pixelRatio,c[1]*=o.pixelRatio;const n=S(e.calculateRelativeScreenBounds(c,a.factorAlignment.scale,$),s(0,o.fullWidth,.5+.5*r[0]),s(0,o.fullHeight,.5+.5*r[1])),l=this.marginFactor;if(0!==l){const i=l*Math.min(B(n),D(n));n[0]-=i,n[1]-=i,n[2]+=i,n[3]+=i}w(i.aabr,n,i.aabr)}_isConflicted(i){const t=i.graphics3DGraphic.graphic.uid,s=i.info[this.visibilityGroup];let e=!0;for(let r=Math.floor(s.aabr[0]/this._accBinsSizeX);r<=Math.floor(s.aabr[2]/this._accBinsSizeX);r++)if(!(r<0||r>=this._accBinsNumX))for(let i=Math.floor(s.aabr[1]/this._accBinsSizeY);i<=Math.floor(s.aabr[3]/this._accBinsSizeY);i++){if(i<0||i>=this._accBinsNumY)continue;e=!1;const a=this._accBins[r][i];for(let i=0;i<a.length;i++){const e=a.data[i],r=e.info[this.visibilityGroup];if(r&&r.visible&&e.graphics3DGraphic.graphic.uid!==t&&(this.accNumTests++,N(r.aabr,s.aabr)))return!0}}return e}_initBins(i,t){if(null==this._accBins){this._accBins=[];for(let i=0;i<this._accBinsNumX;i++){this._accBins.push([]);const i=this._accBins[this._accBins.length-1];for(let t=0;t<this._accBinsNumY;t++)i.push(new e)}}else for(let s=0;s<this._accBinsNumX;s++)for(let i=0;i<this._accBinsNumY;i++)this._accBins[s][i].clear();this._accBinsSizeX=i/this._accBinsNumX,this._accBinsSizeY=t/this._accBinsNumY,this.accNumTests=0}_addToBins(i){const t=i.info[this.visibilityGroup],s=Math.floor(t.aabr[0]/this._accBinsSizeX),e=Math.floor(t.aabr[2]/this._accBinsSizeX),r=Math.floor(t.aabr[1]/this._accBinsSizeY),a=Math.floor(t.aabr[3]/this._accBinsSizeY);for(let o=s;o<=e;o++)if(!(o<0||o>=this._accBinsNumX))for(let t=r;t<=a;t++)t<0||t>=this._accBinsNumY||this._accBins[o][t].push(i)}_setGraphicVisibility(i,t){const s=i.graphics3DGraphic;s.destroyed||(s.setVisibilityFlag(this.visibilityGroup,X.DECONFLICTION,t),this.visibilityGroup===T.LABEL&&this.view.labeler.setLabelGraphicVisibility(s,t))}};function ai(i,t){const s=i.graphics3DGraphic;s.destroyed||s.setVisibilityFlag(t,X.DECONFLICTION,!0)}function*oi(i){if(Map.prototype.entries){const t=i.entries();for(let i=t.next();!i.done;i=t.next())yield i.value[1]}else yield*i.values()}function*ci(i,t,s){t.clear(),i.forEach(((i,e)=>{const r=t.pushNew();r.id=e,r.visible=i.graphics3DGraphic.getVisibilityFlag(s,X.DECONFLICTION);const a=i.info&&i.info[s];r.prio=i.graphics3DGraphic.deconflictionPriority,r.distance=a?a.distance:Number.MAX_VALUE})),yield;const e=t.iterableSort(((i,t)=>i.prio!==t.prio?t.prio-i.prio:i.distance!==t.distance?i.distance-t.distance:i.visible!==t.visible?i.visible?-1:1:i.id-t.id));for(let r=e.next();!r.done;r=e.next())yield;t.forAll((t=>{const s=i.get(t.id);s&&(i.delete(t.id),i.set(t.id,s))})),t.clear()}i([r({constructOnly:!0})],ri.prototype,"view",void 0),i([r({type:Boolean,readOnly:!0})],ri.prototype,"updating",null),ri=i([a("esri.views.3d.layers.graphics.Deconflictor")],ri);class ni{constructor(){this.id=0,this.visible=!1,this.prio=0,this.distance=0}}class li{constructor(i=null,t=null,s=null){this.active=i,this.visible=t,this.sort=s,this.sortArray=new e({allocator:i=>i||new ni})}}const hi=n();class pi{constructor(){this.positionView=f(),this.positionNDC=f(),this.distance=0,this.distanceWithoutPolygonOffset=0,this.scaleInfo=new R}get isOutsideScreen(){const i=this.positionNDC;return i[0]<-1||i[1]<-1||i[2]<-1||i[0]>=1||i[1]>=1}}const ui=new pi;export{ri as Deconflictor,ti as DeconflictorGraphic,ei as DeconflictorViewState,si as State};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{h as t}from"../../../../chunks/mat4.js";import{a as e}from"../../../../chunks/mat4f64.js";import{s as o}from"../../../../chunks/vec3.js";import{c as n}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as r}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as a}from"../../../../geometry/projection/projectBuffer.js";import{SampleElevationInfo as s}from"./elevationAlignmentUtils.js";import{updateVertexAttributeAuxpos1w as i}from"./graphicUtils.js";import{debugFlags as l}from"../../support/debugFlags.js";import{SamplePosition as m}from"../../support/ElevationProvider.js";import{isGeometryWithMapPositions as f}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{VertexAttribute as c}from"../../webgl-engine/lib/VertexAttribute.js";function u(t,e,o,n,r){const a=t.stageObject,s=a.geometries;let i=0;for(const l of s){if(!f(l))continue;const{update:t,averageGeometrySampledElevation:s}=A(l,e,o,n,r);i+=s,t&&a.geometryVertexAttrsUpdated(l)}return i/s.length}function p(e,n,a,s,m,f){const c=e.stageObject,u=n.centerPointInElevationSR;let p=0;if(c.usesVerticalDistanceToGround)s(u,j),i(c,j.verticalDistanceToGround),p=j.sampledElevation;else{s(u,j);"absolute-height"!==n.mode&&(p=j.sampledElevation)}const d=t(g,f??c.transformation),I=o(E,d[12],d[13],d[14]);l.TESTS_DISABLE_OPTIMIZATIONS?(T[0]=u.x,T[1]=u.y,T[2]=j.z,r(u.spatialReference,T,d,m.spatialReference)&&(f?t(f,d):c.transformation=d)):m.setAltitudeOfTransformation(j.z,d);const h=b/m.unitInMeters;return(Math.abs(d[12]-I[0])>=h||Math.abs(d[13]-I[1])>=h||Math.abs(d[14]-I[2])>=h)&&(f?t(f,d):c.transformation=d),p}const g=e();function d(t,e,n,a,s){const i=t.graphics3DSymbolLayer.lodRenderer;if(null==i)return 0;const m=e.centerPointInElevationSR;a(m,j);const f="absolute-height"!==e.mode?j.sampledElevation:0,c=i.instanceData,u=t.instanceIndex,p=v;c.getGlobalTransform(u,p);const g=o(E,p[12],p[13],p[14]);l.TESTS_DISABLE_OPTIMIZATIONS?(T[0]=m.x,T[1]=m.y,T[2]=j.z,r(m.spatialReference,T,p,s.spatialReference)&&c.setGlobalTransform(u,p)):s.setAltitudeOfTransformation(j.z,p);const d=b/s.unitInMeters;return(l.TESTS_DISABLE_OPTIMIZATIONS||Math.abs(p[12]-g[0])>=d||Math.abs(p[13]-g[1])>=d||Math.abs(p[14]-g[2])>=d)&&c.setGlobalTransform(u,p),f}function I(t,e,o,n,r){const a=t.stageObject,s=a.geometries;if(0===s.length)return 0;let i=0,l=null,m=0,u=!1;for(const p of s){if(!f(p))continue;const t=p.vertexAttributes.get(c.POSITION);if(t!==l){const{update:a,averageGeometrySampledElevation:s}=A(p,e,o,n,r);m=s,l=t,u=a}u&&a.geometryVertexAttrsUpdated(p),i+=m}return i/s.length}const b=.01,T=n(),h=n(),S=n(),v=e(),E=n(),j=new s;function A(t,e,o,n,r){let s=!1;const i=t.transformation,f=e.requiresSampledElevationInfo;h[0]=i[12],h[1]=i[13],h[2]=i[14],t.invalidateBoundingInfo();const u=t.getMutableAttribute(c.POSITION),p=u.data,g=u.size,d=p.length/g,I=new m(t.mapPositions,o);let v=0,E=0;for(let m=0;m<d;m++){if(S[0]=p[v],S[1]=p[v+1],S[2]=p[v+2],n(I,j),f&&(E+=j.sampledElevation),l.TESTS_DISABLE_OPTIMIZATIONS)p[v]=I.array[I.offset],p[v+1]=I.array[I.offset+1],p[v+2]=j.z,a(p,o,v,p,r.spatialReference,v,1),p[v]-=h[0],p[v+1]-=h[1],p[v+2]-=h[2],s=!0;else{T[0]=p[v]+h[0],T[1]=p[v+1]+h[1],T[2]=p[v+2]+h[2],r.setAltitude(T,j.z),p[v]=T[0]-h[0],p[v+1]=T[1]-h[1],p[v+2]=T[2]-h[2];const t=b/r.unitInMeters;(Math.abs(S[0]-p[v])>=t||Math.abs(S[1]-p[v+1])>=t||Math.abs(S[2]-p[v+2])>=t)&&(s=!0)}v+=g,I.offset+=3}return E/=d,{update:s,averageGeometrySampledElevation:E}}export{d as perLodInstanceElevationAligner,p as perObjectElevationAligner,u as perVertexElevationAligner,I as sharedGeometryElevationAligner};
5
+ import{h as t}from"../../../../chunks/mat4.js";import{a as e}from"../../../../chunks/mat4f64.js";import{s as o}from"../../../../chunks/vec3.js";import{c as n}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as a}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as r}from"../../../../geometry/projection/projectBuffer.js";import{SampleElevationInfo as s}from"./elevationAlignmentUtils.js";import{updateVertexAttributeAuxpos1w as i}from"./graphicUtils.js";import{debugFlags as l}from"../../support/debugFlags.js";import{SamplePosition as m}from"../../support/ElevationProvider.js";import{isGeometryWithMapPositions as f}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{VertexAttribute as c}from"../../webgl-engine/lib/VertexAttribute.js";function u(t,e,o,n,a){const r=t.stageObject,s=r.geometries;let i=0;for(const l of s){if(!f(l))continue;const{update:t,averageGeometrySampledElevation:s}=M(l,e,o,n,a);i+=s,t&&r.geometryVertexAttrsUpdated(l)}return i/s.length}function p(e,n,r,s,m,f){const c=e.stageObject,u=n.centerPointInElevationSR;let p=0;if(c.usesVerticalDistanceToGround)s(u,j),i(c,j.verticalDistanceToGround),p=j.sampledElevation;else{s(u,j);"absolute-height"!==n.mode&&(p=j.sampledElevation)}const d=t(g,f??c.transformation),I=o(E,d[12],d[13],d[14]);l.TESTS_DISABLE_OPTIMIZATIONS?(T[0]=u.x,T[1]=u.y,T[2]=j.z,a(u.spatialReference,T,d,m.spatialReference)&&(f?t(f,d):c.transformation=d)):m.setAltitudeOfTransformation(j.z,d);const h=b/m.unitInMeters;return(Math.abs(d[12]-I[0])>=h||Math.abs(d[13]-I[1])>=h||Math.abs(d[14]-I[2])>=h)&&(f?t(f,d):c.transformation=d),p}const g=e();function d(t,e,n,r,s){const i=t.graphics3DSymbolLayer.lodRenderer;if(null==i)return 0;const m=e.centerPointInElevationSR;r(m,j);const f="absolute-height"!==e.mode?j.sampledElevation:0,c=i.instanceData,u=t.instanceIndex,p=v;c.getGlobalTransform(u,p);const g=o(E,p[12],p[13],p[14]);l.TESTS_DISABLE_OPTIMIZATIONS?(T[0]=m.x,T[1]=m.y,T[2]=j.z,a(m.spatialReference,T,p,s.spatialReference)&&c.setGlobalTransform(u,p)):s.setAltitudeOfTransformation(j.z,p);const d=b/s.unitInMeters;return(l.TESTS_DISABLE_OPTIMIZATIONS||Math.abs(p[12]-g[0])>=d||Math.abs(p[13]-g[1])>=d||Math.abs(p[14]-g[2])>=d)&&c.setGlobalTransform(u,p),f}function I(t,e,o,n,a){const r=t.stageObject,s=r.geometries;if(0===s.length)return 0;let i=0,l=null,m=0,u=!1;for(const p of s){if(!f(p))continue;const t=p.attributes.get(c.POSITION);if(t!==l){const{update:r,averageGeometrySampledElevation:s}=M(p,e,o,n,a);m=s,l=t,u=r}u&&r.geometryVertexAttrsUpdated(p),i+=m}return i/s.length}const b=.01,T=n(),h=n(),S=n(),v=e(),E=n(),j=new s;function M(t,e,o,n,a){let s=!1;const i=t.transformation,f=e.requiresSampledElevationInfo;h[0]=i[12],h[1]=i[13],h[2]=i[14],t.invalidateBoundingInfo();const u=t.getMutableAttribute(c.POSITION),p=u.data,g=u.size,d=p.length/g,I=new m(t.mapPositions,o);let v=0,E=0;for(let m=0;m<d;m++){if(S[0]=p[v],S[1]=p[v+1],S[2]=p[v+2],n(I,j),f&&(E+=j.sampledElevation),l.TESTS_DISABLE_OPTIMIZATIONS)p[v]=I.array[I.offset],p[v+1]=I.array[I.offset+1],p[v+2]=j.z,r(p,o,v,p,a.spatialReference,v,1),p[v]-=h[0],p[v+1]-=h[1],p[v+2]-=h[2],s=!0;else{T[0]=p[v]+h[0],T[1]=p[v+1]+h[1],T[2]=p[v+2]+h[2],a.setAltitude(T,j.z),p[v]=T[0]-h[0],p[v+1]=T[1]-h[1],p[v+2]=T[2]-h[2];const t=b/a.unitInMeters;(Math.abs(S[0]-p[v])>=t||Math.abs(S[1]-p[v+1])>=t||Math.abs(S[2]-p[v+2])>=t)&&(s=!0)}v+=g,I.offset+=3}return E/=d,{update:s,averageGeometrySampledElevation:E}}export{d as perLodInstanceElevationAligner,p as perObjectElevationAligner,u as perVertexElevationAligner,I as sharedGeometryElevationAligner};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{n}from"../../../../chunks/mat3.js";import{a as i}from"../../../../chunks/mat3f64.js";import{i as o,p as a}from"../../../../chunks/mat4.js";import{a as l}from"../../../../chunks/mat4f64.js";import{c,n as m,s as h,f as p,b as g,e as d}from"../../../../chunks/vec3.js";import{e as u,c as f}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as y}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,empty as _,expandWithBuffer as j,intersectsClippingArea as x}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as P}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as S,getZeroIndexArray as w}from"../../../../geometry/support/Indices.js";import{t as E}from"../../../../chunks/vec32.js";import{makeVertexCandidate as v,makeEdgeCandidate as C}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as L}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as I,SampleElevationInfo as A}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as O}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as D}from"./graphicUtils.js";import{ApplyRendererDiffResult as G}from"./interfaces.js";import{geometryAsPolygon as R}from"./polygonUtils.js";import{createMaterial as U}from"../support/edgeUtils.js";import{debugFlags as T}from"../../support/debugFlags.js";import{SamplePosition as k}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as V}from"../../support/renderInfoUtils/polygon.js";import{NormalType as N}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as F}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as W}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as q}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as Z}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as J}from"../../webgl-engine/lib/Normals.js";import{Object3D as K}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as X}from"../../webgl-engine/materials/DefaultMaterial.js";const Y=["polygon","extent"];class $ extends z{constructor(e,t,s,r){super(e,t,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=B(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const t=this.symbolLayer?.material?.color,s=this._getCombinedOpacityAndColor(t),r=u(s),n=s[3],i=n<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:r,ambient:r,opacity:n,transparent:i,cullFace:i?F.None:F.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0,normalType:N.Compressed};this._materials[je.Main]=new X(o),this._materials[je.Bottom]=new X({...o,cullFace:F.Back}),this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Y,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t);return this._createAs3DShape(t,e.renderingInfo,s,r,t.uid)}layerOpacityChanged(e,t){const s=this.symbolLayer?.material?.color,r=this._getCombinedOpacity(s),n=r<1||this.needsDrivenTransparentPass;this._materials[je.Main]?.setParameters({opacity:r,transparent:n}),this._materials[je.Bottom]?.setParameters({opacity:r,transparent:n});const i=this._getLayerOpacity();e.forEach((e=>{const s=t(e);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._materials[je.Main]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[je.Bottom]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach((e=>{const s=t(e);null!=s&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[je.Main]?.setParameters(e),this._materials[je.Bottom]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?L(e.size,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?G.RecreateSymbol:G.RecreateGraphics}async queryForSnapping(e,r,n,i){const o=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/s(r),{objectId:a,target:l}=e,c=t(l);switch(c.z=(c.z??0)+o,e.type){case"edge":{const{start:s,end:r}=e,n=t(s),i=t(r);return n.z=(n.z??0)+o,i.z=(i.z??0)+o,[C(a,c,1/0,n,i)]}case"vertex":return[v(a,c,1/0),C(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,s,a,c){const m=R(e.geometry);if(null==m)return null;if(0===m.rings.length||!m.rings.some((e=>e.length>0)))return this._logGeometryValidationWarnings(m.rings,"rings","ExtrudeSymbol3DLayer"),null;const h=V(m,this._context.elevationProvider,this._context.renderCoordsHelper,a);this._logGeometryCreationWarnings(h,m.rings,"rings","ExtrudeSymbol3DLayer");const p=D(m);if(null==p)return null;const g=new Array,d=new Array,u=b(),w=l(),v=f(),C=this._context.renderCoordsHelper.viewingMode===M.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,v),y(m.spatialReference,[p.x,p.y,0],w,this._context.renderCoordsHelper.spatialReference);const L=l();o(L,w);const A=i();n(A,L);const{polygons:z,mapPositions:B,position:G}=h;for(const n of z){const e=n.count;if(this._context.clippingExtent&&(_(u),j(u,n.mapPositions),!x(u,this._context.clippingExtent)))continue;const i=r(n.mapPositions,n.holeIndices,3);if(0===i.length)continue;const o=i.length,a=6*e,l=S(a+o),m=S(o),h=P(3*a),p=P(3*a),f=P(3*a),y=P(a);te(G,B,i,n,h,f,p,y,l,m,this._getExtrusionSize(t),v,C),E(h,h,L);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerUid:this._context.layer.uid}),w=new xe(h,f,J(p),y);g.push(ee(this._materials[je.Main],l,l.length-m.length,w,s,b),ee(this._materials[je.Bottom],m,0,w,s,b)),d.push(w.heights)}if(0===g.length)return null;const T=new K({geometries:g,layerUid:this._context.layer.uid,graphicUid:c,isElevationSource:!0});T.transformation=w;const k=U(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._materials[je.Main],edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new O(this,T,g,null,null,((e,t,s,r,n)=>ge(e,t,s,r,n,d)),a,N);return H.alignedSampledElevation=h.sampledElevation,H.needsElevationUpdates=I(a.mode),H}}function ee(e,t,s,r,n,i){const o=w(t.length),a=[[Q.POSITION,new H(r.positions,3,!0),t],[Q.NORMALCOMPRESSED,new H(r.normals,2,!0),t],[Q.COLOR,new H(n,4,!0),o]];return new q(e,a,r.elevation,W.Mesh,i,s)}function te(e,t,s,r,n,i,o,a,l,c,m,h,p){const g=s.length/3;let d=0,u=2*r.count;se(e,t,r.index,r.count,s,0,g,n,i,o,a,l,c,u,m,h,p);let f=2*r.count;u=0,ie(n,i,a,o,d,r.pathLengths[0],r.count,f,l,u,m),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],d+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)ie(n,i,a,o,d,r.pathLengths[y],r.count,f,l,u,m),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],d+=r.pathLengths[y]}function se(e,t,s,r,n,i,o,a,l,h,p,g,d,u,f,y,b){c(ue,y);const _=f>0?1:-1;let j=3*s,x=0,P=3*x,S=r,w=3*S;for(let c=0;c<r;++c)b&&(ue[0]=e[j],ue[1]=e[j+1],ue[2]=e[j+2],m(ue,ue)),a[P]=e[j],a[P+1]=e[j+1],a[P+2]=e[j+2],l[P]=t[j],l[P+1]=t[j+1],l[P+2]=t[j+2],h[P]=-_*ue[0],h[P+1]=-_*ue[1],h[P+2]=-_*ue[2],p[x]=0,a[w]=e[j]+f*ue[0],a[w+1]=e[j+1]+f*ue[1],a[w+2]=e[j+2]+f*ue[2],l[w]=t[j],l[w+1]=t[j+1],l[w+2]=t[j+2],h[w]=_*ue[0],h[w+1]=_*ue[1],h[w+2]=_*ue[2],p[S]=f,P+=3,w+=3,j+=3,x+=1,S+=1;j=3*i,P=0,w=3*u;const E=f<0?be:ye,v=f<0?ye:be;for(let c=0;c<o;++c)d[P]=n[j+E[0]],d[P+1]=n[j+E[1]],d[P+2]=n[j+E[2]],g[w]=n[j+v[0]]+r,g[w+1]=n[j+v[1]]+r,g[w+2]=n[j+v[2]]+r,P+=3,w+=3,j+=3}function re(e,t,s,r,n,i,o){r[i]=r[o],o*=3,e[i*=3]=e[o],e[i+1]=e[o+1],e[i+2]=e[o+2],t[i]=t[o],t[i+1]=t[o+1],t[i+2]=t[o+2],s[i]=n[0],s[i+1]=n[1],s[i+2]=n[2]}const ne=f();function ie(e,t,s,r,n,i,o,a,l,c,m){let h=n,p=n+1,g=n+o,d=n+o+1,u=a,f=a+1,y=a+2*i,b=a+2*i+1;m<0&&(h=n+o+1,d=n),c*=3;for(let _=0;_<i;++_)_===i-1&&(m>0?(p=n,d=n+o):(p=n,h=n+o)),he(e,h,p,g,ne),re(e,t,r,s,ne,u,h),re(e,t,r,s,ne,f,p),re(e,t,r,s,ne,y,g),re(e,t,r,s,ne,b,d),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,h++,p++,g++,d++,u+=2,f+=2,y+=2,b+=2}const oe=f(),ae=f(),le=f(),ce=f(),me=f();function he(e,t,s,r,n){t*=3,s*=3,r*=3,h(oe,e[t++],e[t++],e[t++]),h(ae,e[s++],e[s++],e[s++]),h(le,e[r++],e[r++],e[r++]),p(ce,ae,oe),p(me,le,oe),g(n,me,ce),m(n,n)}const pe=f();function ge(e,t,s,r,n,i){const o=e.stageObject,c=o.geometries,m=c.length,p="absolute-height"!==t.mode;let g=0;const u=o.transformation,f=a(l(),u);for(let a=0;a<m;a+=2){const e=c[a];if(!Z(e))continue;const t=e.getMutableAttribute(Q.POSITION).data,l=i[a/2],m=new k(e.mapPositions),y=t.length/3;let b=0,_=!1,j=0;for(let i=0;i<y;i++){pe[0]=t[b],pe[1]=t[b+1],pe[2]=t[b+2],r(m,fe),p&&(j+=fe.sampledElevation),T.TESTS_DISABLE_OPTIMIZATIONS?(h(de,m.array[m.offset],m.array[m.offset+1],fe.z+l[b/3]),null!=s&&n.toRenderCoords(de,s,de),d(de,de,f)):(h(de,t[b],t[b+1],t[b+2]),d(de,de,u),n.setAltitude(de,fe.z+l[b/3]),d(de,de,f)),t[b]=de[0],t[b+1]=de[1],t[b+2]=de[2];const e=_e/n.unitInMeters;(Math.abs(pe[0]-t[b])>=e||Math.abs(pe[1]-t[b+1])>=e||Math.abs(pe[2]-t[b+2])>=e)&&(_=!0),m.offset+=3,b+=3}_&&(e.invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(c[a]),c[a+1].invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(c[a+1])),g+=j/y}return g/m}const de=f(),ue=f(),fe=new A,ye=[0,2,1],be=[0,1,2],_e=.01;var je;!function(e){e[e.Main=0]="Main",e[e.Bottom=1]="Bottom"}(je||(je={}));class xe{constructor(e,t,s,r){this.positions=e,this.elevation=t,this.normals=s,this.heights=r}}export{$ as Graphics3DExtrudeSymbolLayer};
5
+ import"../../../../core/has.js";import e from"../../../../core/Error.js";import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as s}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{n}from"../../../../chunks/mat3.js";import{a as i}from"../../../../chunks/mat3f64.js";import{i as o,p as a}from"../../../../chunks/mat4.js";import{a as l}from"../../../../chunks/mat4f64.js";import{c,n as m,s as h,f as p,b as g,e as d}from"../../../../chunks/vec3.js";import{e as u,c as f}from"../../../../chunks/vec3f64.js";import{computeTranslationToOriginAndRotation as y}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as b,empty as _,expandWithBuffer as j,intersectsClippingArea as x}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as P}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as S,getZeroIndexArray as w}from"../../../../geometry/support/Indices.js";import{t as E}from"../../../../chunks/vec32.js";import{makeVertexCandidate as v,makeEdgeCandidate as C}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as L}from"../../../../renderers/support/renderingInfoUtils.js";import{ViewingMode as M}from"../../../ViewingMode.js";import{needsElevationUpdates3D as I,SampleElevationInfo as A}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as O}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as B,computeCentroid as D}from"./graphicUtils.js";import{ApplyRendererDiffResult as G}from"./interfaces.js";import{geometryAsPolygon as R}from"./polygonUtils.js";import{createMaterial as U}from"../support/edgeUtils.js";import{debugFlags as T}from"../../support/debugFlags.js";import{SamplePosition as k}from"../../support/ElevationProvider.js";import{geometryToRenderInfo as V}from"../../support/renderInfoUtils/polygon.js";import{NormalType as N}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as F}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as W}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as q}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as Z}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as J}from"../../webgl-engine/lib/Normals.js";import{Object3D as K}from"../../webgl-engine/lib/Object3D.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as X}from"../../webgl-engine/materials/DefaultMaterial.js";const Y=["polygon","extent"];class $ extends z{constructor(e,t,s,r){super(e,t,s,r),this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=B(this._getSymbolSize());if(t)throw new e("graphics3dextrudesymbollayer:invalid-size",t)}const t=this.symbolLayer?.material?.color,s=this._getCombinedOpacityAndColor(t),r=u(s),n=s[3],i=n<1||this.needsDrivenTransparentPass,o={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,diffuse:r,ambient:r,opacity:n,transparent:i,cullFace:i?F.None:F.Back,hasVertexColors:!0,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0,normalType:N.Compressed};this._materials[je.Main]=new X(o),this._materials[je.Bottom]=new X({...o,cullFace:F.Back}),this._context.stage.addMany(this._materials)}destroy(){super.destroy(),this._context.stage.removeMany(this._materials),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Y,this.symbolLayer.type))return null;const s=this._getVertexOpacityAndColor(e.renderingInfo,255),r=this.setGraphicElevationContext(t);return this._createAs3DShape(t,e.renderingInfo,s,r,t.uid)}layerOpacityChanged(e,t){const s=this.symbolLayer?.material?.color,r=this._getCombinedOpacity(s),n=r<1||this.needsDrivenTransparentPass;this._materials[je.Main]?.setParameters({opacity:r,transparent:n}),this._materials[je.Bottom]?.setParameters({opacity:r,transparent:n});const i=this._getLayerOpacity();e.forEach((e=>{const s=t(e);null!=s&&s.layerOpacityChanged(i,this._context.isAsync)}))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,I)}slicePlaneEnabledChanged(e,t){return this._materials[je.Main]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[je.Bottom]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e.forEach((e=>{const s=t(e);null!=s&&s.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)})),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[je.Main]?.setParameters(e),this._materials[je.Bottom]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?L(e.size,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?G.RecreateSymbol:G.RecreateGraphics}async queryForSnapping(e,r,n,i){const o=this._getExtrusionSize(n)*this._context.renderCoordsHelper.unitInMeters/s(r),{objectId:a,target:l}=e,c=t(l);switch(c.z=(c.z??0)+o,e.type){case"edge":{const{start:s,end:r}=e,n=t(s),i=t(r);return n.z=(n.z??0)+o,i.z=(i.z??0)+o,[C(a,c,1/0,n,i)]}case"vertex":return[v(a,c,1/0),C(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,s,a,c){const m=R(e.geometry);if(null==m)return null;if(0===m.rings.length||!m.rings.some((e=>e.length>0)))return this._logGeometryValidationWarnings(m.rings,"rings","ExtrudeSymbol3DLayer"),null;const h=V(m,this._context.elevationProvider,this._context.renderCoordsHelper,a);this._logGeometryCreationWarnings(h,m.rings,"rings","ExtrudeSymbol3DLayer");const p=D(m);if(null==p)return null;const g=new Array,d=new Array,u=b(),w=l(),v=f(),C=this._context.renderCoordsHelper.viewingMode===M.Global;C||this._context.renderCoordsHelper.worldUpAtPosition(null,v),y(m.spatialReference,[p.x,p.y,0],w,this._context.renderCoordsHelper.spatialReference);const L=l();o(L,w);const A=i();n(A,L);const{polygons:z,mapPositions:B,position:G}=h;for(const n of z){const e=n.count;if(this._context.clippingExtent&&(_(u),j(u,n.mapPositions),!x(u,this._context.clippingExtent)))continue;const i=r(n.mapPositions,n.holeIndices,3);if(0===i.length)continue;const o=i.length,a=6*e,l=S(a+o),m=S(o),h=P(3*a),p=P(3*a),f=P(3*a),y=P(a);te(G,B,i,n,h,f,p,y,l,m,this._getExtrusionSize(t),v,C),E(h,h,L);const b=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerUid:this._context.layer.uid}),w=new xe(h,f,J(p),y);g.push(ee(this._materials[je.Main],l,l.length-m.length,w,s,b),ee(this._materials[je.Bottom],m,0,w,s,b)),d.push(w.heights)}if(0===g.length)return null;const T=new K({geometries:g,layerUid:this._context.layer.uid,graphicUid:c,isElevationSource:!0});T.transformation=w;const k=U(this.symbolLayer,{opacity:this._getLayerOpacity()}),N=null!=k?{baseMaterial:this._materials[je.Main],edgeMaterials:[k],properties:{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}}:null,H=new O(this,T,g,null,null,((e,t,s,r,n)=>ge(e,t,s,r,n,d)),a,N);return H.alignedSampledElevation=h.sampledElevation,H.needsElevationUpdates=I(a.mode),H}}function ee(e,t,s,r,n,i){const o=w(t.length),a=[[Q.POSITION,new H(r.positions,t,3,!0)],[Q.NORMALCOMPRESSED,new H(r.normals,t,2,!0)],[Q.COLOR,new H(n,o,4,!0)]];return new q(e,a,r.elevation,W.Mesh,i,s)}function te(e,t,s,r,n,i,o,a,l,c,m,h,p){const g=s.length/3;let d=0,u=2*r.count;se(e,t,r.index,r.count,s,0,g,n,i,o,a,l,c,u,m,h,p);let f=2*r.count;u=0,ie(n,i,a,o,d,r.pathLengths[0],r.count,f,l,u,m),f+=4*r.pathLengths[0],u+=2*r.pathLengths[0],d+=r.pathLengths[0];for(let y=1;y<r.pathLengths.length;++y)ie(n,i,a,o,d,r.pathLengths[y],r.count,f,l,u,m),f+=4*r.pathLengths[y],u+=2*r.pathLengths[y],d+=r.pathLengths[y]}function se(e,t,s,r,n,i,o,a,l,h,p,g,d,u,f,y,b){c(ue,y);const _=f>0?1:-1;let j=3*s,x=0,P=3*x,S=r,w=3*S;for(let c=0;c<r;++c)b&&(ue[0]=e[j],ue[1]=e[j+1],ue[2]=e[j+2],m(ue,ue)),a[P]=e[j],a[P+1]=e[j+1],a[P+2]=e[j+2],l[P]=t[j],l[P+1]=t[j+1],l[P+2]=t[j+2],h[P]=-_*ue[0],h[P+1]=-_*ue[1],h[P+2]=-_*ue[2],p[x]=0,a[w]=e[j]+f*ue[0],a[w+1]=e[j+1]+f*ue[1],a[w+2]=e[j+2]+f*ue[2],l[w]=t[j],l[w+1]=t[j+1],l[w+2]=t[j+2],h[w]=_*ue[0],h[w+1]=_*ue[1],h[w+2]=_*ue[2],p[S]=f,P+=3,w+=3,j+=3,x+=1,S+=1;j=3*i,P=0,w=3*u;const E=f<0?be:ye,v=f<0?ye:be;for(let c=0;c<o;++c)d[P]=n[j+E[0]],d[P+1]=n[j+E[1]],d[P+2]=n[j+E[2]],g[w]=n[j+v[0]]+r,g[w+1]=n[j+v[1]]+r,g[w+2]=n[j+v[2]]+r,P+=3,w+=3,j+=3}function re(e,t,s,r,n,i,o){r[i]=r[o],o*=3,e[i*=3]=e[o],e[i+1]=e[o+1],e[i+2]=e[o+2],t[i]=t[o],t[i+1]=t[o+1],t[i+2]=t[o+2],s[i]=n[0],s[i+1]=n[1],s[i+2]=n[2]}const ne=f();function ie(e,t,s,r,n,i,o,a,l,c,m){let h=n,p=n+1,g=n+o,d=n+o+1,u=a,f=a+1,y=a+2*i,b=a+2*i+1;m<0&&(h=n+o+1,d=n),c*=3;for(let _=0;_<i;++_)_===i-1&&(m>0?(p=n,d=n+o):(p=n,h=n+o)),he(e,h,p,g,ne),re(e,t,r,s,ne,u,h),re(e,t,r,s,ne,f,p),re(e,t,r,s,ne,y,g),re(e,t,r,s,ne,b,d),l[c++]=u,l[c++]=y,l[c++]=b,l[c++]=u,l[c++]=b,l[c++]=f,h++,p++,g++,d++,u+=2,f+=2,y+=2,b+=2}const oe=f(),ae=f(),le=f(),ce=f(),me=f();function he(e,t,s,r,n){t*=3,s*=3,r*=3,h(oe,e[t++],e[t++],e[t++]),h(ae,e[s++],e[s++],e[s++]),h(le,e[r++],e[r++],e[r++]),p(ce,ae,oe),p(me,le,oe),g(n,me,ce),m(n,n)}const pe=f();function ge(e,t,s,r,n,i){const o=e.stageObject,c=o.geometries,m=c.length,p="absolute-height"!==t.mode;let g=0;const u=o.transformation,f=a(l(),u);for(let a=0;a<m;a+=2){const e=c[a];if(!Z(e))continue;const t=e.getMutableAttribute(Q.POSITION).data,l=i[a/2],m=new k(e.mapPositions),y=t.length/3;let b=0,_=!1,j=0;for(let i=0;i<y;i++){pe[0]=t[b],pe[1]=t[b+1],pe[2]=t[b+2],r(m,fe),p&&(j+=fe.sampledElevation),T.TESTS_DISABLE_OPTIMIZATIONS?(h(de,m.array[m.offset],m.array[m.offset+1],fe.z+l[b/3]),null!=s&&n.toRenderCoords(de,s,de),d(de,de,f)):(h(de,t[b],t[b+1],t[b+2]),d(de,de,u),n.setAltitude(de,fe.z+l[b/3]),d(de,de,f)),t[b]=de[0],t[b+1]=de[1],t[b+2]=de[2];const e=_e/n.unitInMeters;(Math.abs(pe[0]-t[b])>=e||Math.abs(pe[1]-t[b+1])>=e||Math.abs(pe[2]-t[b+2])>=e)&&(_=!0),m.offset+=3,b+=3}_&&(e.invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(c[a]),c[a+1].invalidateBoundingInfo(),o.geometryVertexAttrsUpdated(c[a+1])),g+=j/y}return g/m}const de=f(),ue=f(),fe=new A,ye=[0,2,1],be=[0,1,2],_e=.01;var je;!function(e){e[e.Main=0]="Main",e[e.Bottom=1]="Bottom"}(je||(je={}));class xe{constructor(e,t,s,r){this.positions=e,this.elevation=t,this.normals=s,this.heights=r}}export{$ as Graphics3DExtrudeSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{c as r}from"../../../../chunks/vec3f64.js";import{c as i}from"../../../../chunks/vec4f64.js";import{textSymbolLayerSupportsVerticalOffset as n}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{SymbolUpdateType as s,elevationModeChangeUpdateType as o,needsElevationUpdates2D as l}from"./elevationAlignmentUtils.js";import{ElevationContext as c}from"./ElevationContext.js";import{Graphics3DGraphicCreationContext as m}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as d}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as p}from"./Graphics3DSymbolLayer.js";import{computeCentroid as u}from"./graphicUtils.js";import{createStageObject as f,extendPointGraphicElevationContext as g}from"./pointUtils.js";import{SymbolComplexity as y}from"./SymbolComplexity.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as b}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as C}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as _}from"../../webgl-engine/lib/VertexAttribute.js";import{LineCalloutMaterial as x,Parameters as O}from"../../webgl-engine/materials/LineCalloutMaterial.js";class j extends p{constructor(e,t){super(e,null,t,U),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._materials[0]=new x(this._materialParameters),this._context.stage.add(this._materials[0])}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}_perInstanceMaterialParameters(e){const t=this._materialParameters;return t.horizontalScreenOffset=e.horizontalScreenOffset??0,t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get _materialParameters(){const r=new O,i=this.symbol,n=i.callout;if(r.color=null!=n.color?e.toUnitRGBA(n.color):[0,0,0,0],r.color[3]*=this._getLayerOpacity(),r.size=t(n.size||0),i.verticalOffset){const{screenLength:e,minWorldLength:n,maxWorldLength:a}=i.verticalOffset;r.verticalOffset={screenLength:t(e),minWorldLength:n||0,maxWorldLength:null!=a?a:1/0}}r.borderColor=null!=n.border&&null!=n.border.color?e.toUnitRGBA(n.border.color):null;const a="object"===i.symbolLayers.at(0).type,s="label-3d"===i.type;return r.occlusionTest=!a,r.shaderPolygonOffset=a?0:void 0,r.depthHUDAlignStart=s,r.hasSlicePlane=this._context.slicePlaneEnabled,r.screenSizePerspective=this._context.screenSizePerspectiveEnabled?this._context.sharedResources.screenSizePerspectiveSettings:null,r}_defaultElevationInfoNoZ(){return E}createGraphics3DGraphic(e){const t=e.renderingInfo,r=e.graphic,i=this.setGraphicElevationContext(r,new c,t.elevationOffset||0),a=t.symbol,s="on-the-ground"===this._elevationContext.mode&&("cim"===a.type||!a.symbolLayers.some((e=>"object"===e.type||"text"===e.type)));if("label-3d"!==a.type&&s)return null;if("point-3d"===a.type&&a.symbolLayers.every((e=>"text"===e.type&&!n(e))))return null;const o=u(r.geometry);return null==o?null:this._createAs3DShape(o,i,t,r.uid)}layerOpacityChanged(){this._materials[0]?.setParameters(this._materialParameters)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,n=o(j.elevationModeChangeTypes,r,i);return n!==s.UPDATE||e.forEach((e=>{const r=t(e);null!=r&&this.updateGraphicElevationContext(e.graphic,r)})),n}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}setGraphicElevationContext(e,t,r=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(r),t}updateGraphicElevationContext(e,t){this.setGraphicElevationContext(e,t.elevationContext,null!=t.metadata?t.metadata.elevationOffset:0),t.needsElevationUpdates=l(t.elevationContext.mode)}computeComplexity(){return new y({verticesPerFeature:6})}_createVertexData(e){const{translation:t,centerOffset:r}=e,i=new v(t?[t[0],t[1],t[2]]:[0,0,0],3,!0),n=new v(r?[r[0],r[1],r[2],r[3]]:[0,0,0,1],4,!0);return[[_.POSITION,i,P],[_.NORMAL,new v([0,0,1],3,!0),P],[_.AUXPOS1,n,P]]}_getOrCreateMaterial(e){const t=this._perInstanceMaterialParameters(e),r=x.uniqueMaterialIdentifier(t);if(r===this._materials[0]?.uniqueMaterialIdentifier)return{material:this._materials[0],isUnique:!1};if(null!=e.materialCollection){let i=e.materialCollection.get(r);return null==i&&(i=new x(t),e.materialCollection.add(r,i)),{material:i,isUnique:!1}}return{material:new x(t),isUnique:!0}}_createAs3DShape(e,t,r,i){const n=this._context.layer.uid,s=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:i,layerUid:n}),o=this._getOrCreateMaterial(r),c=new C(o.material,this._createVertexData(r),null,b.Point,s),m=f(this._context,e,c,t,i);if(null==m)return null;const p=new h(this,m.object,[c],o.isUnique?[o.material]:null,null,a,t);return p.metadata=new d(r.elevationOffset),p.alignedSampledElevation=m.sampledElevation,p.needsElevationUpdates=l(t.mode),g(p,e,this._context.elevationProvider),p}}j.elevationModeChangeTypes={definedChanged:s.UPDATE,staysOnTheGround:s.UPDATE,onTheGroundChanged:s.RECREATE};const P=[0],E={mode:"relative-to-ground",offset:0},U={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};class w{constructor(e,t,n=r(),a=i(),s=0,o="world",l=0,c=null){this.renderer=e,this.symbol=t,this.translation=n,this.centerOffset=a,this.horizontalScreenOffset=s,this.centerOffsetUnits=o,this.elevationOffset=l,this.materialCollection=c}}class G extends m{}export{j as Graphics3DLineCalloutSymbolLayer,G as LineCalloutCreationContext,w as LineCalloutSymbolLayerRenderingInfo};
5
+ import e from"../../../../Color.js";import{pt2px as t}from"../../../../core/screenUtils.js";import{c as r}from"../../../../chunks/vec3f64.js";import{c as i}from"../../../../chunks/vec4f64.js";import{textSymbolLayerSupportsVerticalOffset as n}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as a}from"./ElevationAligners.js";import{SymbolUpdateType as s,elevationModeChangeUpdateType as o,needsElevationUpdates2D as l}from"./elevationAlignmentUtils.js";import{ElevationContext as c}from"./ElevationContext.js";import{Graphics3DGraphicCreationContext as m}from"./Graphics3DGraphicCreationContext.js";import{Graphics3DObject3DGraphicLayer as h}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as d}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as p}from"./Graphics3DSymbolLayer.js";import{computeCentroid as u}from"./graphicUtils.js";import{createStageObject as f,extendPointGraphicElevationContext as g}from"./pointUtils.js";import{SymbolComplexity as y}from"./SymbolComplexity.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as b}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as C}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as _}from"../../webgl-engine/lib/VertexAttribute.js";import{LineCalloutMaterial as x,Parameters as O}from"../../webgl-engine/materials/LineCalloutMaterial.js";class j extends p{constructor(e,t){super(e,null,t,U),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){this._materials[0]=new x(this._materialParameters),this._context.stage.add(this._materials[0])}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}_perInstanceMaterialParameters(e){const t=this._materialParameters;return t.horizontalScreenOffset=e.horizontalScreenOffset??0,t.centerOffsetUnits=e.centerOffsetUnits||"world",t}get _materialParameters(){const r=new O,i=this.symbol,n=i.callout;if(r.color=null!=n.color?e.toUnitRGBA(n.color):[0,0,0,0],r.color[3]*=this._getLayerOpacity(),r.size=t(n.size||0),i.verticalOffset){const{screenLength:e,minWorldLength:n,maxWorldLength:a}=i.verticalOffset;r.verticalOffset={screenLength:t(e),minWorldLength:n||0,maxWorldLength:null!=a?a:1/0}}r.borderColor=null!=n.border&&null!=n.border.color?e.toUnitRGBA(n.border.color):null;const a="object"===i.symbolLayers.at(0).type,s="label-3d"===i.type;return r.occlusionTest=!a,r.shaderPolygonOffset=a?0:void 0,r.depthHUDAlignStart=s,r.hasSlicePlane=this._context.slicePlaneEnabled,r.screenSizePerspective=this._context.screenSizePerspectiveEnabled?this._context.sharedResources.screenSizePerspectiveSettings:null,r}_defaultElevationInfoNoZ(){return E}createGraphics3DGraphic(e){const t=e.renderingInfo,r=e.graphic,i=this.setGraphicElevationContext(r,new c,t.elevationOffset||0),a=t.symbol,s="on-the-ground"===this._elevationContext.mode&&("cim"===a.type||!a.symbolLayers.some((e=>"object"===e.type||"text"===e.type)));if("label-3d"!==a.type&&s)return null;if("point-3d"===a.type&&a.symbolLayers.every((e=>"text"===e.type&&!n(e))))return null;const o=u(r.geometry);return null==o?null:this._createAs3DShape(o,i,t,r.uid)}layerOpacityChanged(){this._materials[0]?.setParameters(this._materialParameters)}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,n=o(j.elevationModeChangeTypes,r,i);return n!==s.UPDATE||e.forEach((e=>{const r=t(e);null!=r&&this.updateGraphicElevationContext(e.graphic,r)})),n}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}setGraphicElevationContext(e,t,r=0){return super.setGraphicElevationContext(e,t),t.addOffsetRenderUnits(r),t}updateGraphicElevationContext(e,t){this.setGraphicElevationContext(e,t.elevationContext,null!=t.metadata?t.metadata.elevationOffset:0),t.needsElevationUpdates=l(t.elevationContext.mode)}computeComplexity(){return new y({verticesPerFeature:6})}_createVertexData(e){const{translation:t,centerOffset:r}=e,i=new v(t?[t[0],t[1],t[2]]:[0,0,0],P,3,!0),n=new v(r?[r[0],r[1],r[2],r[3]]:[0,0,0,1],P,4,!0);return[[_.POSITION,i],[_.NORMAL,new v([0,0,1],P,3,!0)],[_.AUXPOS1,n]]}_getOrCreateMaterial(e){const t=this._perInstanceMaterialParameters(e),r=x.uniqueMaterialIdentifier(t);if(r===this._materials[0]?.uniqueMaterialIdentifier)return{material:this._materials[0],isUnique:!1};if(null!=e.materialCollection){let i=e.materialCollection.get(r);return null==i&&(i=new x(t),e.materialCollection.add(r,i)),{material:i,isUnique:!1}}return{material:new x(t),isUnique:!0}}_createAs3DShape(e,t,r,i){const n=this._context.layer.uid,s=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:i,layerUid:n}),o=this._getOrCreateMaterial(r),c=new C(o.material,this._createVertexData(r),null,b.Point,s),m=f(this._context,e,c,t,i);if(null==m)return null;const p=new h(this,m.object,[c],o.isUnique?[o.material]:null,null,a,t);return p.metadata=new d(r.elevationOffset),p.alignedSampledElevation=m.sampledElevation,p.needsElevationUpdates=l(t.mode),g(p,e,this._context.elevationProvider),p}}j.elevationModeChangeTypes={definedChanged:s.UPDATE,staysOnTheGround:s.UPDATE,onTheGroundChanged:s.RECREATE};const P=[0],E={mode:"relative-to-ground",offset:0},U={ignoreDrivers:!0,renderPriority:0,renderPriorityStep:1};class w{constructor(e,t,n=r(),a=i(),s=0,o="world",l=0,c=null){this.renderer=e,this.symbol=t,this.translation=n,this.centerOffset=a,this.horizontalScreenOffset=s,this.centerOffsetUnits=o,this.elevationOffset=l,this.materialCollection=c}}class G extends m{}export{j as Graphics3DLineCalloutSymbolLayer,G as LineCalloutCreationContext,w as LineCalloutSymbolLayerRenderingInfo};