@arcgis/core 5.1.0-next.57 → 5.1.0-next.59

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 (199) hide show
  1. package/applications/Components/SelectionOperation.d.ts +2 -2
  2. package/applications/Components/SelectionOperation.js +1 -1
  3. package/assets/esri/core/workers/RemoteClient.js +1 -1
  4. package/assets/esri/core/workers/chunks/04ea806b933d4dd41609.js +1 -0
  5. package/assets/esri/core/workers/chunks/{278eecd729bed2832702.js → 0622e238693c257abacb.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{05bc675c029ed311427f.js → 155c741a9839d24f04a2.js} +1 -1
  7. package/assets/esri/core/workers/chunks/1ae4e43a399e1974f106.js +1 -0
  8. package/assets/esri/core/workers/chunks/1f8e22df08c2f5fbb8c8.js +1 -0
  9. package/assets/esri/core/workers/chunks/{2327b368673a974dee8b.js → 2339465190c9d5ede25f.js} +1 -1
  10. package/assets/esri/core/workers/chunks/23f6d24bf850bc3280ec.js +1 -0
  11. package/assets/esri/core/workers/chunks/2541ac6e0ed1184edc9b.js +1 -0
  12. package/assets/esri/core/workers/chunks/34207774bc371e95ba3c.js +1 -0
  13. package/assets/esri/core/workers/chunks/{01777e91cd4e0bf04fd0.js → 35217befc8f9882d139e.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{40bcfc4f8efe7de7ec9d.js → 3de17e89973160b42923.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{992e74570b76f3f9e52e.js → 48d289db3145ce6c02bb.js} +1 -1
  16. package/assets/esri/core/workers/chunks/4c73c2f4331351e2a50c.js +1 -0
  17. package/assets/esri/core/workers/chunks/{2757cf54656b5d318b11.js → 55a0b69cf034ac32fc25.js} +1 -1
  18. package/assets/esri/core/workers/chunks/{4d54beab8ae5ff31e7b0.js → 5a9f5a49dc68b42762bb.js} +1 -1
  19. package/assets/esri/core/workers/chunks/{7cec3252e3ee56424b9e.js → 5c6e5f22450dd0583074.js} +1 -1
  20. package/assets/esri/core/workers/chunks/{b39b4db86a1049f0b901.js → 6be9d00839002f24fafd.js} +1 -1
  21. package/assets/esri/core/workers/chunks/6c886f19875291d02407.js +1 -0
  22. package/assets/esri/core/workers/chunks/75e28458e08b0738b35a.js +2 -0
  23. package/assets/esri/core/workers/chunks/{c460ca93ed8e20d8b53a.js → 86a6dd19903fa5023cc7.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{4afddb66242438b38df0.js → 8ccf2f65d8ed3c48ffff.js} +1 -1
  25. package/assets/esri/core/workers/chunks/{fcfaaced184f8da3e28d.js → 9b53aa2429573f1b977f.js} +1 -1
  26. package/assets/esri/core/workers/chunks/9d580b5bcd59857a5702.js +1405 -0
  27. package/assets/esri/core/workers/chunks/a37697ef360e2425768a.js +1 -0
  28. package/assets/esri/core/workers/chunks/{a787fe09d3df9d4254ba.js → ab3183f2327ff26e2b45.js} +1 -1
  29. package/assets/esri/core/workers/chunks/b0f2ce61d3cad413898e.js +1 -0
  30. package/assets/esri/core/workers/chunks/{53c149bca42595b7dd1e.js → bbdf27bc34fadbe8e6fe.js} +1 -1
  31. package/assets/esri/core/workers/chunks/be42fe0b7ba0e27030b2.js +1 -0
  32. package/assets/esri/core/workers/chunks/d0c3ab70f390cd579fed.js +1 -0
  33. package/assets/esri/core/workers/chunks/{5a573fa1012092328b88.js → d816d1a4220d827faf63.js} +1 -1
  34. package/assets/esri/core/workers/chunks/e26894655823849947f4.js +1 -0
  35. package/assets/esri/core/workers/chunks/e59f5dc8c85bcea66e98.js +1 -0
  36. package/assets/esri/core/workers/chunks/{ccf845ac0ac354507a25.js → ec1b2eb05410848081c9.js} +1 -1
  37. package/assets/esri/core/workers/chunks/{851dd71d28681d4eccfd.js → f7af90c5f9d371eb7009.js} +1 -1
  38. package/assets/esri/core/workers/chunks/fa6e1ad099b43a6f5501.js +1 -0
  39. package/assets/esri/core/workers/chunks/{4a6186001323b47c23a4.js → fee1d873127dca02459f.js} +1 -1
  40. package/chunks/GlobalIllumination.glsl.js +101 -0
  41. package/chunks/GlobalIlluminationBlur.glsl.js +68 -0
  42. package/chunks/ScreenSpaceShadowHighlight.glsl.js +6 -0
  43. package/chunks/ShadowCastAccumulate.glsl.js +1 -1
  44. package/chunks/ShadowHighlight.glsl.js +15 -8
  45. package/config.js +1 -1
  46. package/geometry/Mesh.js +1 -1
  47. package/geometry/support/polygonUtils.js +1 -1
  48. package/geometry/support/{triangulationUtils.js → triangulationUtilsDeprecated.js} +1 -1
  49. package/kernel.js +1 -1
  50. package/layers/support/SceneModification.js +1 -1
  51. package/networks/support/jsonTypes.d.ts +6 -0
  52. package/package.json +2 -2
  53. package/renderers/ClassBreaksRenderer.js +1 -1
  54. package/renderers/DictionaryRenderer.js +1 -1
  55. package/renderers/DotDensityRenderer.js +1 -1
  56. package/renderers/HeatmapRenderer.js +1 -1
  57. package/renderers/PieChartRenderer.js +1 -1
  58. package/renderers/Renderer.js +1 -1
  59. package/renderers/SimpleRenderer.js +1 -1
  60. package/renderers/UniqueValueRenderer.js +1 -1
  61. package/renderers/support/AttributeColorInfo.js +1 -1
  62. package/renderers/support/ClassBreakInfo.d.ts +6 -0
  63. package/renderers/support/ClassBreakInfo.js +1 -1
  64. package/renderers/support/UniqueValueClass.d.ts +12 -0
  65. package/renderers/support/UniqueValueClass.js +1 -1
  66. package/renderers/support/UniqueValueInfo.d.ts +12 -0
  67. package/renderers/support/UniqueValueInfo.js +1 -1
  68. package/renderers/visualVariables/ColorVariable.js +1 -1
  69. package/renderers/visualVariables/OpacityVariable.js +1 -1
  70. package/renderers/visualVariables/SizeVariable.js +1 -1
  71. package/renderers/visualVariables/VisualVariable.js +1 -1
  72. package/rest/networks/support/FunctionResult.d.ts +6 -0
  73. package/rest/networks/support/FunctionResult.js +1 -1
  74. package/support/revision.js +1 -1
  75. package/symbols/cim/CIMSymbolDrawHelper.js +1 -1
  76. package/views/2d/engine/vectorTiles/VTLPainter3D.js +1 -1
  77. package/views/2d/engine/webgl/GlyphMosaic.js +1 -1
  78. package/views/2d/engine/webgl/GlyphSource.js +1 -1
  79. package/views/2d/engine/webgl/mesh/templates/shapingUtils.js +1 -1
  80. package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
  81. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
  82. package/views/2d/engine/webgl/shaderGraph/techniques/text/TextShader.js +1 -1
  83. package/views/2d/engine/webgl/shaderGraph/techniques/vectorTiles/VTLTechniqueFill.js +1 -1
  84. package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
  85. package/views/2d/engine/webgl/util/IntervalMatcher.js +1 -1
  86. package/views/2d/engine/webgl/util/MapMatcher.js +1 -1
  87. package/views/2d/layers/features/schema/processor/MatcherSchema.js +1 -1
  88. package/views/2d/layers/features/schema/processor/SimpleProcessorSchema.js +1 -1
  89. package/views/3d/FocusAreasView.js +1 -1
  90. package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
  91. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  92. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
  93. package/views/3d/interactive/visualElements/MeasurementArrowVisualElement.js +1 -1
  94. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  95. package/views/3d/layers/Lyr3DWorker.js +1 -1
  96. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  97. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  98. package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
  99. package/views/3d/layers/graphics/extrudeUtils.js +1 -1
  100. package/views/3d/layers/graphics/extrudeUtilsDeprecated.js +2 -0
  101. package/views/3d/layers/graphics/tessellationUtils.js +2 -0
  102. package/views/3d/layers/i3s/PointCloudHighlights.js +1 -1
  103. package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
  104. package/views/3d/layers/i3s/PointCloudRendererNode.js +1 -1
  105. package/views/3d/layers/support/Tiles3DBVH.js +1 -1
  106. package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
  107. package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
  108. package/views/3d/support/gaussianSplatting/GaussianTile.js +1 -1
  109. package/views/3d/support/renderInfoUtils/line.js +1 -1
  110. package/views/3d/support/renderInfoUtils/polygon.js +1 -1
  111. package/views/3d/support/renderInfoUtils/polygonDeprecated.js +2 -0
  112. package/views/3d/terrain/OverlayRenderer.js +1 -1
  113. package/views/3d/terrain/TerrainRenderer.js +1 -1
  114. package/views/3d/terrain/TerrainSurface.js +1 -1
  115. package/views/3d/webgl/RenderNode.js +1 -1
  116. package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
  117. package/views/3d/webgl-engine/collections/Component/ComponentObject.js +1 -1
  118. package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
  119. package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
  120. package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
  121. package/views/3d/webgl-engine/collections/Component/RenderGeometry.js +1 -1
  122. package/views/3d/webgl-engine/collections/Component/RenderSubmitSystem.js +1 -1
  123. package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
  124. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  125. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js +6 -5
  126. package/views/3d/webgl-engine/core/shaderLibrary/output/ReadDepthLastFrame.glsl.js +4 -0
  127. package/views/3d/webgl-engine/core/shaderLibrary/shading/EncodingColor.glsl.js +7 -0
  128. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientLighting.glsl.js +6 -6
  129. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +93 -72
  130. package/views/3d/webgl-engine/core/shaderLibrary/shading/PhysicallyBasedRendering.glsl.js +46 -22
  131. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadGlobalIllumination.glsl.js +20 -0
  132. package/views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js +18 -13
  133. package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceReflections.glsl.js +23 -9
  134. package/views/3d/webgl-engine/core/shaderLibrary/shading/WaterColor.glsl.js +1 -1
  135. package/views/3d/webgl-engine/core/shaderLibrary/util/CloudsParallaxShading.glsl.js +1 -1
  136. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  137. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  138. package/views/3d/webgl-engine/effects/emissive/emissions.js +2 -0
  139. package/views/3d/webgl-engine/effects/globalIllumination/BlueNoise.js +2 -0
  140. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +2 -0
  141. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationBlurTechnique.js +2 -0
  142. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechnique.js +2 -0
  143. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +2 -0
  144. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlight.glsl.js +2 -0
  145. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightRenderNode.js +2 -0
  146. package/views/3d/webgl-engine/effects/highlight/ScreenSpaceShadowHighlightTechnique.js +2 -0
  147. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  148. package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
  149. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  150. package/views/3d/webgl-engine/effects/transparency/OITBlend.js +1 -1
  151. package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
  152. package/views/3d/webgl-engine/lib/Material.js +1 -1
  153. package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
  154. package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
  155. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  156. package/views/3d/webgl-engine/lib/ReprojectionUniforms.js +1 -1
  157. package/views/3d/webgl-engine/lib/lodRendering/LodComponentData.js +1 -1
  158. package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
  159. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  160. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  161. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  162. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  163. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  164. package/views/3d/webgl-engine/materials/PathTechniqueConfiguration.js +1 -1
  165. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  166. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  167. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  168. package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
  169. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  170. package/views/3d/webgl-engine/parts/RenderView.js +1 -1
  171. package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
  172. package/views/3d/webgl-engine/shaders/GaussianSplatTechniqueConfiguration.js +1 -1
  173. package/views/3d/webgl-engine/shaders/GlobalIllumination.glsl.js +2 -0
  174. package/views/3d/webgl-engine/shaders/GlobalIlluminationBlur.glsl.js +2 -0
  175. package/views/3d/webgl-engine/shaders/MeasurementArrowTechnique.js +1 -1
  176. package/views/3d/webgl-engine/shaders/MeasurementArrowTechniqueConfiguration.js +1 -1
  177. package/views/3d/webgl-engine/shaders/ReceiveShadowsConfiguration.js +1 -1
  178. package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
  179. package/views/3d/webgl.js +1 -1
  180. package/views/selection/SelectionOperation.d.ts +190 -0
  181. package/views/selection/SelectionOperation.js +2 -0
  182. package/views/selection/types.d.ts +146 -1
  183. package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
  184. package/assets/esri/core/workers/chunks/009db7b459b18f6a668b.js +0 -1
  185. package/assets/esri/core/workers/chunks/0fc60b4c44c4e865b699.js +0 -2
  186. package/assets/esri/core/workers/chunks/34484afe767d60f85982.js +0 -1
  187. package/assets/esri/core/workers/chunks/55bb5b7817c2963c8bfa.js +0 -1
  188. package/assets/esri/core/workers/chunks/572fcd33ae3648ed4f9c.js +0 -1
  189. package/assets/esri/core/workers/chunks/66a4d764937918a2779f.js +0 -1
  190. package/assets/esri/core/workers/chunks/6b56c8ba978ec6edd6b8.js +0 -1
  191. package/assets/esri/core/workers/chunks/9806cc96414065ae0afe.js +0 -1
  192. package/assets/esri/core/workers/chunks/9b365a6242b0287f8727.js +0 -1
  193. package/assets/esri/core/workers/chunks/a029db48079af4b5cccd.js +0 -1
  194. package/assets/esri/core/workers/chunks/ea068f75397c3b3337ec.js +0 -1034
  195. package/assets/esri/core/workers/chunks/ec91d5081f423755cb07.js +0 -1
  196. package/assets/esri/core/workers/chunks/f9fe89ced41b49608667.js +0 -1
  197. package/assets/esri/core/workers/chunks/fce30184f354fb7d11af.js +0 -1
  198. package/widgets/support/Selector2D/SelectionOperation.js +0 -2
  199. /package/assets/esri/core/workers/chunks/{0fc60b4c44c4e865b699.js.LICENSE.txt → 75e28458e08b0738b35a.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{resizeFilled as r}from"../../../../../core/arrayUtils.js";import{deg2rad as o}from"../../../../../core/mathUtils.js";import{abortMaybe as s}from"../../../../../core/maybe.js";import{debounce as i,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{valueInUnit as a}from"../../../../../core/quantity.js";import{lengthUnitFromSpatialReference as l,areaUnitFromSpatialReference as d}from"../../../../../core/units.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{e as m}from"../../../../../chunks/earcut.js";import{set as c}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as _,set as g,cross as f,subtract as P,dot as j,scale as x,add as v}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as C}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../../../geometry/Polygon.js";import R from"../../../../../geometry/SpatialReference.js";import{isPCPF as U}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{i as W,e as M}from"../../../../../chunks/simplifyOperator.js";import{projectDirection as D}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as A}from"../../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as V}from"../../../../../geometry/projection/projectVectorToVector.js";import{compactIndices as b}from"../../../../../geometry/support/Indices.js";import{Sphere as F}from"../../../../../geometry/support/sphere.js";import{triangulate as S}from"../../../../../geometry/support/triangulationUtils.js";import{bestFitPlane as I,planePointDistance as T,boundingSphere as O}from"../../support/measurementUtils.js";import{getElevationAtPoint as k}from"../../../support/ElevationProvider.js";import{midpoint3d as z,makeOrthonormal as q}from"../../../support/mathUtils.js";import{flatten2DVertexDataToArray as E}from"../../../../support/euclideanAreaMeasurementUtils.js";import{computeEuclideanMeasurementSR as H}from"../../../../support/measurementUtils.js";import{MeasurementWorkerHandle as L}from"../../../../support/MeasurementWorkerHandle.js";import{autoMeasurementMode as B}from"../../../../support/measurementWorkerUtils.js";class G{constructor(t){this.positionsWorld=[],this.positionsRender=[],this.positionsFittedRender=[],this.positionsFittedRenderComplex=[],this.positionsFittedWorldPlaneProjectedComplex=[],this.triangleIndices=null,this.areaPolygon=new y({rings:[[]],spatialReference:t}),this.positionsFittedWorldPlaneProjected=this.areaPolygon.rings[0],this.trianglePositions=this.positionsFittedRender,this.triangleUvs=this.positionsFittedWorldPlaneProjected}}class Z{constructor(t,e=null,r=null,o=null,s=null,i=null,n=null){this.mode=t,this.area=e,this.geodesicArea=r,this.perimeter=o,this.geodesicPerimeter=s,this.areaCentroidRenderCoords=i,this.geodesicAreaCentroidRenderCoords=n}}let J=class extends e{get numVertices(){return this._length}get hasStagedVertex(){return null!=this._lastCursorPoint}get fittingMode(){return this._fittingMode}get measurements(){return this._measurements}get updateId(){return this._updateId}constructor(t){super(t),this._length=0,this._lastCursorPoint=null,this._fittingMode=null,this._measurements=null,this._updateId=0,this._centroidRenderCoords=w(),this._planeWorldCoords=C(),this._worldUp=w(),this._worldTangent=w(),this._frame=[w(),w(),w()],this._worldOrigin=w(),this._updateAxisU=w(),this._updateAxisV=w(),this._updateWorldOrigin=w(),this._lastPathVersion=-1,this._mode=null,this._tempU=w(),this._tempV=w(),this._tempVec3=w(),this._tempSphere=new F,this._measurementWorker=new L({preloadGeodetic:!0}),this._updateAbortController=null,this._updateMeasurements=i(async(t,e,r,o,s,i)=>{const a=t.spatialReference,l=0===B(a);_(this._updateAxisU,this._frame[0]),_(this._updateAxisV,this._frame[1]),_(this._updateWorldOrigin,this._worldOrigin);const d=(e,r)=>(e&&t.renderCoordsHelper.toRenderCoords(e,r)||g(r,0,0,0),r),h=e.areaMeasurement?.geometry,p=l&&1!==r&&h?await this._measurementWorker.geodeticLength(h,{stagedPoint:o?s:null}):null;n(i);const m=this._calculateMode(r,p),c="geodesic"===m,[u,f]=await Promise.all([c?null:this._measurementWorker.area2D(this.vertexData.areaPolygon,{unit:this._areaMeasurementUnit,lengthUnit:this._lengthMeasurementUnit,returnCentroid:!0,returnLength:!0}),c&&h?await this._measurementWorker.geodeticArea(h,{stagedPoint:o?s:null,returnCentroid:!0}):null]);n(i);const P=c?null:w();P&&u?.centroid&&this._projectWorldPlaneProjectedPointToRender(P,this._updateWorldOrigin,[u.centroid?.x??0,u.centroid?.y??0],this._updateAxisU,this._updateAxisV,this.view.renderSpatialReference,this._measurementSR);const j=f?.centroid?d(f.centroid,w()):null;this._measurements=new Z(m,c?null:u?.area,c?f?.area:null,c?null:u?.length,c?p:null,c?null:P,c?j:null)});const e=H(t.view.spatialReference);this._measurementSR=e,this._lengthMeasurementUnit=l(e)??"meters",this._areaMeasurementUnit=d(e)??"square-meters";const r=U(e)?R.WebMercator:e;this.vertexData=new G(r)}destroy(){this._measurementWorker.destroy()}update(t,e,r,o,s,i,n){const a=this._lastPathVersion===t.version,l=e?e.equals(this._lastCursorPoint):null==this._lastCursorPoint,d=this._mode===s;return!(a&&!i&&d&&l)&&(this._lastPathVersion=t.version,this._lastCursorPoint=e,this._update(t,e,r,o,s,n),!0)}_update(t,e,r,o,i,n){const a=this.view.renderSpatialReference,l=this._measurementSR;let d=t.numVertices;const h=!(null==e||e.equals(t.lastPoint)||d>2&&e.equals(t.firstPoint)||t.polygonIsClosed);h&&(d+=1);const p=!t.polygonIsClosed&&d>2,m=t.polygonIsClosed||p;this._resize(d);const{positionsWorld:c,positionsRender:u}=this.vertexData,_=(t,e)=>{K(r.elevationProvider,t),A(t,c[e],l),A(t,u[e],a)};if(t.forEachVertexPosition((t,e)=>_(t,e)),h&&_(e,d-1),this.vertexData.areaPolygon.clearCache(),!m)return this._measurements=null,this.vertexData.triangleIndices=null,this._updateId++,void(this._updateAbortController=s(this._updateAbortController));this._updateVertexData(r,a,l,o),this._updateId++,this._updateAbortController??=new AbortController,n.consumePromise(this._updateMeasurements(r,t,i,h,e,this._updateAbortController.signal))}_resize(t){const{positionsWorld:e,positionsRender:o,positionsFittedWorldPlaneProjected:s,positionsFittedRender:i}=this.vertexData;r(e,t,w),r(o,t,w),r(s,t,u),r(i,t,w),this._length=t}_updateVertexData(t,e,r,o){const s=t.renderCoordsHelper,{positionsWorld:i,positionsRender:n}=this.vertexData,a=this._planeWorldCoords,l=this._centroidRenderCoords;z(n,l),s.worldUpAtPosition(l,this._worldUp),s.worldBasisAtPosition(l,0,this._worldTangent),D(l,this._worldUp,e,this._worldUp,r),D(l,this._worldTangent,e,this._worldTangent,r),i.length>2&&I(i,a),this._fittingMode=this._selectFittingMode(a,i,this._worldUp,o);let d=0;if("horizontal"===this._fittingMode){let t=-1/0;n.forEach((e,r)=>{const o=s.getAltitude(n[r]);o>t&&(t=o,d=r)})}const{_worldOrigin:h}=this;_(this._worldOrigin,i[d]);let p=a,m=this._worldTangent;"horizontal"===this._fittingMode?p=this._worldUp:"vertical"===this._fittingMode&&(p=this._tempVec3,m=this._worldUp,q(a,this._worldUp,p));const u=this._frame[0],g=this._frame[1];_(this._frame[2],p),q(m,p,u),f(g,u,this._frame[2]);const{positionsFittedRender:x,positionsFittedWorldPlaneProjected:v}=this.vertexData,w=this._tempVec3;for(let _=0;_<this._length;++_){const t=v[_],o=x[_];P(w,i[_],h),c(t,j(u,w),j(g,w)),this._projectWorldPlaneProjectedPointToRender(o,h,t,u,g,e,r)}this._triangulate(new Q(h,u,g,e,r))}_triangulate(t){!W(this.vertexData.areaPolygon)&&this._triangulateComplexPolygon(t)||this._triangulateSimplePolygon()}_triangulateSimplePolygon(){const{positionsFittedWorldPlaneProjected:t}=this.vertexData;this.vertexData.triangleIndices=b(m(E(t),[],2)),this.vertexData.trianglePositions=this.vertexData.positionsFittedRender,this.vertexData.triangleUvs=t,this.vertexData.positionsFittedWorldPlaneProjectedComplex.length=0,this.vertexData.positionsFittedRenderComplex.length=0}_triangulateComplexPolygon({worldOrigin:t,axisU:e,axisV:o,renderSR:s,worldSR:i}){const{positionsFittedWorldPlaneProjectedComplex:n,positionsFittedRenderComplex:a,areaPolygon:l}=this.vertexData,d=M(l);if(!d)return!1;const{position:h,faces:p}=S(d),m=h.length/3;r(n,m,u),r(a,m,w);for(let r=0,u=0;r<h.length;r+=3,u++){const l=n[u];c(l,h[r],h[r+1]);const d=a[u];this._projectWorldPlaneProjectedPointToRender(d,t,l,e,o,s,i)}return this.vertexData.triangleIndices=p,this.vertexData.trianglePositions=a,this.vertexData.triangleUvs=n,!0}_projectWorldPlaneProjectedPointToRender(t,e,r,o,s,i,n){const a=this._tempU,l=this._tempV;x(a,o,r[0]),x(l,s,r[1]),v(t,a,l),v(t,t,e),V(t,n,t,i)}_selectFittingMode(t,e,r,s){const i=e.map(e=>Math.abs(T(t,e))).reduce((t,e)=>Math.max(t,e),0);O(e,this._tempSphere);const n=i/(2*this._tempSphere.radius),a=n<s.maxRelativeErrorCoplanar,l=n<s.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(a)d="oblique";else if(l){d=Math.abs(j(r,t))>Math.cos(o(s.verticalAngleThreshold))?"horizontal":"vertical"}return d}_calculateMode(t,e){return null!=e&&0===t?a(e,"meters")>N?"geodesic":"euclidean":null==e||1===t?"euclidean":"geodesic"}};function K(t,e){e.hasZ||(e.z=k(t,e,"ground")??0)}t([h()],J.prototype,"_measurements",void 0),t([h()],J.prototype,"_updateId",void 0),t([h()],J.prototype,"view",void 0),J=t([p("esri.views.3d.analysis.AreaMeasurement.support.MeasurementData")],J);const N=1e5;class Q{constructor(t,e,r,o,s){this.worldOrigin=t,this.axisU=e,this.axisV=r,this.renderSR=o,this.worldSR=s}}export{Z as AreaMeasurementQuantities,J as MeasurementData};
2
+ import{__decorate as t}from"tslib";import e from"../../../../../core/Accessor.js";import{resizeFilled as r}from"../../../../../core/arrayUtils.js";import{deg2rad as o}from"../../../../../core/mathUtils.js";import{abortMaybe as s}from"../../../../../core/maybe.js";import{debounce as i,throwIfAborted as n}from"../../../../../core/promiseUtils.js";import{valueInUnit as a}from"../../../../../core/quantity.js";import{lengthUnitFromSpatialReference as l,areaUnitFromSpatialReference as d}from"../../../../../core/units.js";import{property as h}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as p}from"../../../../../core/accessorSupport/decorators/subclass.js";import{e as m}from"../../../../../chunks/earcut.js";import{set as c}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as _,set as g,cross as f,subtract as P,dot as j,scale as x,add as v}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as C}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import y from"../../../../../geometry/Polygon.js";import R from"../../../../../geometry/SpatialReference.js";import{isPCPF as U}from"../../../../../geometry/spatialReferenceEllipsoidUtils.js";import{i as W,e as M}from"../../../../../chunks/simplifyOperator.js";import{projectDirection as D}from"../../../../../geometry/projection/projectDirection.js";import{projectPointToVector as A}from"../../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as V}from"../../../../../geometry/projection/projectVectorToVector.js";import{compactIndices as b}from"../../../../../geometry/support/Indices.js";import{Sphere as F}from"../../../../../geometry/support/sphere.js";import{triangulate as S}from"../../../../../geometry/support/triangulationUtilsDeprecated.js";import{bestFitPlane as I,planePointDistance as T,boundingSphere as O}from"../../support/measurementUtils.js";import{getElevationAtPoint as k}from"../../../support/ElevationProvider.js";import{midpoint3d as z,makeOrthonormal as q}from"../../../support/mathUtils.js";import{flatten2DVertexDataToArray as E}from"../../../../support/euclideanAreaMeasurementUtils.js";import{computeEuclideanMeasurementSR as H}from"../../../../support/measurementUtils.js";import{MeasurementWorkerHandle as L}from"../../../../support/MeasurementWorkerHandle.js";import{autoMeasurementMode as B}from"../../../../support/measurementWorkerUtils.js";class G{constructor(t){this.positionsWorld=[],this.positionsRender=[],this.positionsFittedRender=[],this.positionsFittedRenderComplex=[],this.positionsFittedWorldPlaneProjectedComplex=[],this.triangleIndices=null,this.areaPolygon=new y({rings:[[]],spatialReference:t}),this.positionsFittedWorldPlaneProjected=this.areaPolygon.rings[0],this.trianglePositions=this.positionsFittedRender,this.triangleUvs=this.positionsFittedWorldPlaneProjected}}class Z{constructor(t,e=null,r=null,o=null,s=null,i=null,n=null){this.mode=t,this.area=e,this.geodesicArea=r,this.perimeter=o,this.geodesicPerimeter=s,this.areaCentroidRenderCoords=i,this.geodesicAreaCentroidRenderCoords=n}}let J=class extends e{get numVertices(){return this._length}get hasStagedVertex(){return null!=this._lastCursorPoint}get fittingMode(){return this._fittingMode}get measurements(){return this._measurements}get updateId(){return this._updateId}constructor(t){super(t),this._length=0,this._lastCursorPoint=null,this._fittingMode=null,this._measurements=null,this._updateId=0,this._centroidRenderCoords=w(),this._planeWorldCoords=C(),this._worldUp=w(),this._worldTangent=w(),this._frame=[w(),w(),w()],this._worldOrigin=w(),this._updateAxisU=w(),this._updateAxisV=w(),this._updateWorldOrigin=w(),this._lastPathVersion=-1,this._mode=null,this._tempU=w(),this._tempV=w(),this._tempVec3=w(),this._tempSphere=new F,this._measurementWorker=new L({preloadGeodetic:!0}),this._updateAbortController=null,this._updateMeasurements=i(async(t,e,r,o,s,i)=>{const a=t.spatialReference,l=0===B(a);_(this._updateAxisU,this._frame[0]),_(this._updateAxisV,this._frame[1]),_(this._updateWorldOrigin,this._worldOrigin);const d=(e,r)=>(e&&t.renderCoordsHelper.toRenderCoords(e,r)||g(r,0,0,0),r),h=e.areaMeasurement?.geometry,p=l&&1!==r&&h?await this._measurementWorker.geodeticLength(h,{stagedPoint:o?s:null}):null;n(i);const m=this._calculateMode(r,p),c="geodesic"===m,[u,f]=await Promise.all([c?null:this._measurementWorker.area2D(this.vertexData.areaPolygon,{unit:this._areaMeasurementUnit,lengthUnit:this._lengthMeasurementUnit,returnCentroid:!0,returnLength:!0}),c&&h?await this._measurementWorker.geodeticArea(h,{stagedPoint:o?s:null,returnCentroid:!0}):null]);n(i);const P=c?null:w();P&&u?.centroid&&this._projectWorldPlaneProjectedPointToRender(P,this._updateWorldOrigin,[u.centroid?.x??0,u.centroid?.y??0],this._updateAxisU,this._updateAxisV,this.view.renderSpatialReference,this._measurementSR);const j=f?.centroid?d(f.centroid,w()):null;this._measurements=new Z(m,c?null:u?.area,c?f?.area:null,c?null:u?.length,c?p:null,c?null:P,c?j:null)});const e=H(t.view.spatialReference);this._measurementSR=e,this._lengthMeasurementUnit=l(e)??"meters",this._areaMeasurementUnit=d(e)??"square-meters";const r=U(e)?R.WebMercator:e;this.vertexData=new G(r)}destroy(){this._measurementWorker.destroy()}update(t,e,r,o,s,i,n){const a=this._lastPathVersion===t.version,l=e?e.equals(this._lastCursorPoint):null==this._lastCursorPoint,d=this._mode===s;return!(a&&!i&&d&&l)&&(this._lastPathVersion=t.version,this._lastCursorPoint=e,this._update(t,e,r,o,s,n),!0)}_update(t,e,r,o,i,n){const a=this.view.renderSpatialReference,l=this._measurementSR;let d=t.numVertices;const h=!(null==e||e.equals(t.lastPoint)||d>2&&e.equals(t.firstPoint)||t.polygonIsClosed);h&&(d+=1);const p=!t.polygonIsClosed&&d>2,m=t.polygonIsClosed||p;this._resize(d);const{positionsWorld:c,positionsRender:u}=this.vertexData,_=(t,e)=>{K(r.elevationProvider,t),A(t,c[e],l),A(t,u[e],a)};if(t.forEachVertexPosition((t,e)=>_(t,e)),h&&_(e,d-1),this.vertexData.areaPolygon.clearCache(),!m)return this._measurements=null,this.vertexData.triangleIndices=null,this._updateId++,void(this._updateAbortController=s(this._updateAbortController));this._updateVertexData(r,a,l,o),this._updateId++,this._updateAbortController??=new AbortController,n.consumePromise(this._updateMeasurements(r,t,i,h,e,this._updateAbortController.signal))}_resize(t){const{positionsWorld:e,positionsRender:o,positionsFittedWorldPlaneProjected:s,positionsFittedRender:i}=this.vertexData;r(e,t,w),r(o,t,w),r(s,t,u),r(i,t,w),this._length=t}_updateVertexData(t,e,r,o){const s=t.renderCoordsHelper,{positionsWorld:i,positionsRender:n}=this.vertexData,a=this._planeWorldCoords,l=this._centroidRenderCoords;z(n,l),s.worldUpAtPosition(l,this._worldUp),s.worldBasisAtPosition(l,0,this._worldTangent),D(l,this._worldUp,e,this._worldUp,r),D(l,this._worldTangent,e,this._worldTangent,r),i.length>2&&I(i,a),this._fittingMode=this._selectFittingMode(a,i,this._worldUp,o);let d=0;if("horizontal"===this._fittingMode){let t=-1/0;n.forEach((e,r)=>{const o=s.getAltitude(n[r]);o>t&&(t=o,d=r)})}const{_worldOrigin:h}=this;_(this._worldOrigin,i[d]);let p=a,m=this._worldTangent;"horizontal"===this._fittingMode?p=this._worldUp:"vertical"===this._fittingMode&&(p=this._tempVec3,m=this._worldUp,q(a,this._worldUp,p));const u=this._frame[0],g=this._frame[1];_(this._frame[2],p),q(m,p,u),f(g,u,this._frame[2]);const{positionsFittedRender:x,positionsFittedWorldPlaneProjected:v}=this.vertexData,w=this._tempVec3;for(let _=0;_<this._length;++_){const t=v[_],o=x[_];P(w,i[_],h),c(t,j(u,w),j(g,w)),this._projectWorldPlaneProjectedPointToRender(o,h,t,u,g,e,r)}this._triangulate(new Q(h,u,g,e,r))}_triangulate(t){!W(this.vertexData.areaPolygon)&&this._triangulateComplexPolygon(t)||this._triangulateSimplePolygon()}_triangulateSimplePolygon(){const{positionsFittedWorldPlaneProjected:t}=this.vertexData;this.vertexData.triangleIndices=b(m(E(t),[],2)),this.vertexData.trianglePositions=this.vertexData.positionsFittedRender,this.vertexData.triangleUvs=t,this.vertexData.positionsFittedWorldPlaneProjectedComplex.length=0,this.vertexData.positionsFittedRenderComplex.length=0}_triangulateComplexPolygon({worldOrigin:t,axisU:e,axisV:o,renderSR:s,worldSR:i}){const{positionsFittedWorldPlaneProjectedComplex:n,positionsFittedRenderComplex:a,areaPolygon:l}=this.vertexData,d=M(l);if(!d)return!1;const{position:h,faces:p}=S(d),m=h.length/3;r(n,m,u),r(a,m,w);for(let r=0,u=0;r<h.length;r+=3,u++){const l=n[u];c(l,h[r],h[r+1]);const d=a[u];this._projectWorldPlaneProjectedPointToRender(d,t,l,e,o,s,i)}return this.vertexData.triangleIndices=p,this.vertexData.trianglePositions=a,this.vertexData.triangleUvs=n,!0}_projectWorldPlaneProjectedPointToRender(t,e,r,o,s,i,n){const a=this._tempU,l=this._tempV;x(a,o,r[0]),x(l,s,r[1]),v(t,a,l),v(t,t,e),V(t,n,t,i)}_selectFittingMode(t,e,r,s){const i=e.map(e=>Math.abs(T(t,e))).reduce((t,e)=>Math.max(t,e),0);O(e,this._tempSphere);const n=i/(2*this._tempSphere.radius),a=n<s.maxRelativeErrorCoplanar,l=n<s.maxRelativeErrorAlmostCoplanar;let d="horizontal";if(a)d="oblique";else if(l){d=Math.abs(j(r,t))>Math.cos(o(s.verticalAngleThreshold))?"horizontal":"vertical"}return d}_calculateMode(t,e){return null!=e&&0===t?a(e,"meters")>N?"geodesic":"euclidean":null==e||1===t?"euclidean":"geodesic"}};function K(t,e){e.hasZ||(e.z=k(t,e,"ground")??0)}t([h()],J.prototype,"_measurements",void 0),t([h()],J.prototype,"_updateId",void 0),t([h()],J.prototype,"view",void 0),J=t([p("esri.views.3d.analysis.AreaMeasurement.support.MeasurementData")],J);const N=1e5;class Q{constructor(t,e,r,o,s){this.worldOrigin=t,this.axisU=e,this.axisV=r,this.renderSR=o,this.worldSR=s}}export{Z as AreaMeasurementQuantities,J as MeasurementData};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i}from"../../../../core/promiseUtils.js";import{createVolume as n}from"../../../../core/quantity.js";import{whenOnce as s,watch as a,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{e as m}from"../../../../chunks/earcut.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scaleAndAdd as d,sqrDist as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as g,clone as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as _}from"../../../../core/support/UpdatingHandles.js";import v from"../../../../geometry/Multipoint.js";import{projectOrLoad as w}from"../../../../geometry/projectionUtils.js";import{e as j}from"../../../../chunks/containsOperator.js";import{e as R}from"../../../../chunks/convexHullOperator.js";import{e as b}from"../../../../chunks/simplifyOperator.js";import{e as E}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as x}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as T,intersects as G,create as L,empty as O}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as I}from"../../../../geometry/support/DoubleArray.js";import{t as D}from"../../../../chunks/vec3.js";import H from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as M}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as P}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as V,VolumeMeasurementPerimeterTooLargeError as U,VolumeMeasurementUnsupportedCoordinateSystemError as N,VolumeMeasurementUnsupportedLayerTransparencyError as k}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as A}from"./VolumeMeasurementRawResult.js";import S from"./VolumeMeasurementResult.js";import{ElevationContext as F}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as W}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as z}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as q}from"../../terrain/tileUtils.js";import{CutFillComputationRenderNode as B,TargetGeometryRenderInfo as Z}from"../../webgl-engine/lib/CutFillComputationRenderNode.js";import{isIntegratedMeshLayerView as J}from"../../../support/layerViewUtils.js";import{MeasurementWorkerHandle as K}from"../../../support/MeasurementWorkerHandle.js";let Q=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new K,this._getElevationProvider=()=>this.view.elevationProvider,this.depthExtremaPositions=null,this._updatingHandles=new _,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new q,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computationRenderNode.done)return;const{renderCoordsHelper:i}=this.view,n=new P({extent:t,localOrigin:r,renderCoordsHelper:i});this._computationRenderNode.update(n,o),this._determineDataCoverage(n);const[a]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),s(()=>this._computationRenderNode.done).then(()=>{this._updateDepthExtremaPositions(n,this._computationRenderNode.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computationRenderNode.getResult();this._updateResult(n,l,"fulfilled"===a.status?a.value:null)}),this._determineDataCoverage=e=>{const{elevationAlignedGeometry:t}=this,{frustum:r}=this._computationRenderNode,{cameraDimensions:o}=e;t&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computationRenderNode=new B({view:e}),this.addHandles([this._createElevationUpdateHandle(),a(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfos:this._targetGeometryRenderInfos}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfos:r})=>{const o=e?.extent;if(!(e&&o&&t&&r))return this._rawResult=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(e,o,t,r))},l)])}destroy(){this._updatingHandles.destroy(),this._computationRenderNode.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=b(e),r=w(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&M(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?g(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return X(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfos(){const e=this.targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,n=z(e,o,i,F.fromElevationInfo(new H({mode:"absolute-height"}))),{polygons:s}=n;return s.map(e=>{const o=m(e.position,e.holeIndices,3),n=I(3*e.count),s=c(),a=c();return C(t.spatialReference,r,s,i.spatialReference),a[12]=-s[12],a[13]=-s[13],a[14]=-s[14],D(n,e.position,a),new Z(n,o)})}get updating(){return this._computationRenderNode.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new S({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>J(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new V}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeter,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new U:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeter,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new U:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new N:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new k:null}get _perimeter(){if(!this._targetGeometryRenderInfos)return null;let e=null;for(const t of this._targetGeometryRenderInfos){const r=$(ee(t.positions));e=r?Math.max(e??0,r):e}return null!=e?e/this.view.renderCoordsHelper.unitInMeters:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(x(e.extent,e.spatialReference,re,this.view.spatialReference),T(t,oe),G(re,oe)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:s},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(s/t.height),p=Y(t.cut.totalDepth,a,l)*u,m=Y(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new A({cutVolume:n(Math.abs(p*c),"cubic-meters"),fillVolume:n(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,g=f(s);return 0!==h&&(d(g,g,l,r*(m/t.width-.5)),d(g,g,a,o*(c/t.height-.5))),d(g,g,u,-Y(p,i,n)),g};this.depthExtremaPositions={cut:p(t.cut),fill:p(t.fill)}}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new v({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(te(e.radius,t)&&(e.getCorners(ne),n.points.length=0,ne.forEach(e=>{const t=r.fromRenderCoords(e,se,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=R(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=E(i);return!!s&&j(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;if(this._intersectingTiles.length=0,!e.extent)return;T(e.extent,ie);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(ie)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>te(t.radius*r,e))}};function X(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=W(e,t,"ground")??0))}function Y(e,t,r){return e*(r-t)+t}function $(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1],i[2]??0]),r?o+=h(r,i):r=[0,0,0],r[0]=i[0],r[1]=i[1],r[2]=i[2];return t&&r&&(o+=h(r,t)),Math.sqrt(o)}function*ee(e){const t=y();for(let r=0;r<e.length;r+=3)t[0]=e[r],t[1]=e[r+1],t[2]=e[r+2],yield t}e([u()],Q.prototype,"_projectedGeometry",null),e([u()],Q.prototype,"_localOrigin",null),e([u()],Q.prototype,"_getElevationProvider",void 0),e([u()],Q.prototype,"elevationAlignedGeometry",null),e([u()],Q.prototype,"targetGeometry",null),e([u()],Q.prototype,"_targetGeometryRenderInfos",null),e([u({constructOnly:!0})],Q.prototype,"analysis",void 0),e([u({constructOnly:!0})],Q.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],Q.prototype,"view",void 0),e([u()],Q.prototype,"updating",null),e([u()],Q.prototype,"result",null),e([u()],Q.prototype,"depthExtremaPositions",void 0),e([u()],Q.prototype,"error",null),e([u()],Q.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],Q.prototype,"_insufficientDataError",null),e([u()],Q.prototype,"_perimeterTooLargeError",null),e([u()],Q.prototype,"_perimeterTooLargeLocalError",null),e([u()],Q.prototype,"_perimeterTooLargeGlobalError",null),e([u()],Q.prototype,"_unsupportedCoordinateSystemError",null),e([u()],Q.prototype,"_unsupportedLayerTransparencyError",null),e([u()],Q.prototype,"_perimeter",null),e([u()],Q.prototype,"_computationRenderNode",void 0),e([u({readOnly:!0})],Q.prototype,"_updatingHandles",void 0),e([u()],Q.prototype,"_rawResult",void 0),e([u()],Q.prototype,"_sufficientDataCoverage",void 0),Q=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Q);const te=(e,t)=>e<(t.width+t.height)/2,re=O(),oe=O(),ie=L(),ne=new Array(8).fill(0).map(()=>y()),se=y();export{Q as VolumeMeasurementCutFillController};
2
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i}from"../../../../core/promiseUtils.js";import{createVolume as n}from"../../../../core/quantity.js";import{whenOnce as s,watch as a,syncAndInitial as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{e as m}from"../../../../chunks/earcut.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scaleAndAdd as d,sqrDist as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as g,clone as f,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as _}from"../../../../core/support/UpdatingHandles.js";import v from"../../../../geometry/Multipoint.js";import{projectOrLoad as w}from"../../../../geometry/projectionUtils.js";import{e as j}from"../../../../chunks/containsOperator.js";import{e as R}from"../../../../chunks/convexHullOperator.js";import{e as b}from"../../../../chunks/simplifyOperator.js";import{e as E}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as x}from"../../../../geometry/projection/projectBoundingRect.js";import{fromExtent as T,intersects as G,create as L,empty as O}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as D}from"../../../../geometry/support/DoubleArray.js";import{t as I}from"../../../../chunks/vec3.js";import H from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as M}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as P}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as V,VolumeMeasurementPerimeterTooLargeError as U,VolumeMeasurementUnsupportedCoordinateSystemError as N,VolumeMeasurementUnsupportedLayerTransparencyError as k}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as A}from"./VolumeMeasurementRawResult.js";import S from"./VolumeMeasurementResult.js";import{ElevationContext as F}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as W}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as z}from"../../support/renderInfoUtils/polygonDeprecated.js";import{IteratorPreorder as q}from"../../terrain/tileUtils.js";import{CutFillComputationRenderNode as B,TargetGeometryRenderInfo as Z}from"../../webgl-engine/lib/CutFillComputationRenderNode.js";import{isIntegratedMeshLayerView as J}from"../../../support/layerViewUtils.js";import{MeasurementWorkerHandle as K}from"../../../support/MeasurementWorkerHandle.js";let Q=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new K,this._getElevationProvider=()=>this.view.elevationProvider,this.depthExtremaPositions=null,this._updatingHandles=new _,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new q,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computationRenderNode.done)return;const{renderCoordsHelper:i}=this.view,n=new P({extent:t,localOrigin:r,renderCoordsHelper:i});this._computationRenderNode.update(n,o),this._determineDataCoverage(n);const[a]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),s(()=>this._computationRenderNode.done).then(()=>{this._updateDepthExtremaPositions(n,this._computationRenderNode.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computationRenderNode.getResult();this._updateResult(n,l,"fulfilled"===a.status?a.value:null)}),this._determineDataCoverage=e=>{const{elevationAlignedGeometry:t}=this,{frustum:r}=this._computationRenderNode,{cameraDimensions:o}=e;t&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computationRenderNode=new B({view:e}),this.addHandles([this._createElevationUpdateHandle(),a(()=>({projectedGeometry:this._projectedGeometry,localOrigin:this._localOrigin,targetGeometryRenderInfos:this._targetGeometryRenderInfos}),({projectedGeometry:e,localOrigin:t,targetGeometryRenderInfos:r})=>{const o=e?.extent;if(!(e&&o&&t&&r))return this._rawResult=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(e,o,t,r))},l)])}destroy(){this._updatingHandles.destroy(),this._computationRenderNode.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=b(e),r=w(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&M(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?g(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;if(!e)return null;const t=e.clone();return X(this._getElevationProvider(),t),t}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfos(){const e=this.targetGeometry,t=this._projectedGeometry?.extent,r=this._localOrigin;if(!e||!t||!r)return null;const{elevationProvider:o,renderCoordsHelper:i}=this.view,n=z(e,o,i,F.fromElevationInfo(new H({mode:"absolute-height"}))),{polygons:s}=n;return s.map(e=>{const o=m(e.position,e.holeIndices,3),n=D(3*e.count),s=c(),a=c();return C(t.spatialReference,r,s,i.spatialReference),a[12]=-s[12],a[13]=-s[13],a[14]=-s[14],I(n,e.position,a),new Z(n,o)})}get updating(){return this._computationRenderNode.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new S({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>J(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new V}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeter,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new U:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeter,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new U:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new N:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new k:null}get _perimeter(){if(!this._targetGeometryRenderInfos)return null;let e=null;for(const t of this._targetGeometryRenderInfos){const r=$(ee(t.positions));e=r?Math.max(e??0,r):e}return null!=e?e/this.view.renderCoordsHelper.unitInMeters:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(x(e.extent,e.spatialReference,re,this.view.spatialReference),T(t,oe),G(re,oe)&&(this._getElevationProvider=()=>this.view.elevationProvider))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:s},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(s/t.height),p=Y(t.cut.totalDepth,a,l)*u,m=Y(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new A({cutVolume:n(Math.abs(p*c),"cubic-meters"),fillVolume:n(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,g=f(s);return 0!==h&&(d(g,g,l,r*(m/t.width-.5)),d(g,g,a,o*(c/t.height-.5))),d(g,g,u,-Y(p,i,n)),g};this.depthExtremaPositions={cut:p(t.cut),fill:p(t.fill)}}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new v({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(te(e.radius,t)&&(e.getCorners(ne),n.points.length=0,ne.forEach(e=>{const t=r.fromRenderCoords(e,se,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=R(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=E(i);return!!s&&j(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;if(this._intersectingTiles.length=0,!e.extent)return;T(e.extent,ie);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(ie)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>te(t.radius*r,e))}};function X(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=W(e,t,"ground")??0))}function Y(e,t,r){return e*(r-t)+t}function $(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1],i[2]??0]),r?o+=h(r,i):r=[0,0,0],r[0]=i[0],r[1]=i[1],r[2]=i[2];return t&&r&&(o+=h(r,t)),Math.sqrt(o)}function*ee(e){const t=y();for(let r=0;r<e.length;r+=3)t[0]=e[r],t[1]=e[r+1],t[2]=e[r+2],yield t}e([u()],Q.prototype,"_projectedGeometry",null),e([u()],Q.prototype,"_localOrigin",null),e([u()],Q.prototype,"_getElevationProvider",void 0),e([u()],Q.prototype,"elevationAlignedGeometry",null),e([u()],Q.prototype,"targetGeometry",null),e([u()],Q.prototype,"_targetGeometryRenderInfos",null),e([u({constructOnly:!0})],Q.prototype,"analysis",void 0),e([u({constructOnly:!0})],Q.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],Q.prototype,"view",void 0),e([u()],Q.prototype,"updating",null),e([u()],Q.prototype,"result",null),e([u()],Q.prototype,"depthExtremaPositions",void 0),e([u()],Q.prototype,"error",null),e([u()],Q.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],Q.prototype,"_insufficientDataError",null),e([u()],Q.prototype,"_perimeterTooLargeError",null),e([u()],Q.prototype,"_perimeterTooLargeLocalError",null),e([u()],Q.prototype,"_perimeterTooLargeGlobalError",null),e([u()],Q.prototype,"_unsupportedCoordinateSystemError",null),e([u()],Q.prototype,"_unsupportedLayerTransparencyError",null),e([u()],Q.prototype,"_perimeter",null),e([u()],Q.prototype,"_computationRenderNode",void 0),e([u({readOnly:!0})],Q.prototype,"_updatingHandles",void 0),e([u()],Q.prototype,"_rawResult",void 0),e([u()],Q.prototype,"_sufficientDataCoverage",void 0),Q=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],Q);const te=(e,t)=>e<(t.width+t.height)/2,re=O(),oe=O(),ie=L(),ne=new Array(8).fill(0).map(()=>y()),se=y();export{Q as VolumeMeasurementCutFillController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../../../intl.js";import{volumeMeasurementConfiguration as o}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import{equals as n}from"../../../../core/arrayUtils.js";import{cyclicalPI as l}from"../../../../core/Cyclical.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{formatDecimal as c,preferredVolumePrecision as u}from"../../../../core/quantityFormatUtils.js";import{watch as m,initial as d}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as h}from"../../../../core/units.js";import{property as p,subclass as g}from"../../../../core/accessorSupport/decorators.js";import{e as y}from"../../../../chunks/earcut.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f,normalize as v,subtract as j,cross as L,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as C,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as P}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as G}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as V}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as x}from"../../../../geometry/support/vector.js";import{t as O}from"../../../../chunks/vec3.js";import R from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as A}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as M}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as D}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as F}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as E}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as U}from"../../layers/graphics/extrudeUtils.js";import{polygonToRenderInfo as S}from"../../support/renderInfoUtils/polygon.js";import{CutFillVisualizationRenderNode as N,VolumeGeometry as B}from"../../webgl-engine/lib/CutFillVisualizationRenderNode.js";import{createStipplePatternSimple as H}from"../../webgl-engine/materials/lineStippleUtils.js";let T=class extends r{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}get _extrusionHeights(){const{renderCoordsHelper:e}=this.view,{depthExtremaPositions:t,targetGeometry:i}=this.analysisViewData,{targetElevationRange:s}=o;if(!i||!t)return{cut:s,fill:-s};let r=-1/0;for(const o of i.rings)for(const e of o)r=Math.max(r,e[2]);const n=1,l=e.getAltitude(t.fill);return{cut:s,fill:Math.min(l-r,0)-n}}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=E.fromElevationInfo(new R({mode:"absolute-height"})),this._projectionLines=[]}initialize(){const{view:e}=this,i={view:e,isDecoration:!0},s=o,r={...i,width:s.geometryOutlineWidth};this._elevationAlignedGeometry=new D({...r,isDraped:!0,color:s.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new D(r);const n={...i,attached:!0,width:s.projectionLineWidth,renderOccluded:4,polygonOffset:3},l={...n,stipplePattern:H(s.projectionLineStippleSize)},a=s.cutProjectionLineColor.toUnitRGBA(),c=s.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new M({...n,color:a}),this._occludedCutProjectionLines=new M({...l,color:a}),this._fillProjectionLines=new M({...n,color:c,renderOccluded:8}),this._occludedFillProjectionLines=new M({...l,color:c});const u={...i,attached:!0};this._cutVolumeLabel=new A({...u,distance:s.labelDistance}),this._fillVolumeLabel=new A({...u,distance:-s.labelDistance}),this._renderNode=new N({view:e,cutColor:s.cutColor,fillColor:s.fillColor,borderColor:s.geometryOutlineColor}),this.addHandles([m(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},d),m(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i,this._renderNode.measureType=i},d),m(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),d),m(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},d),m(()=>[this.analysisViewData.targetGeometry,this._extrusionHeights],()=>this._updateCutFillGeometry(),d),m(()=>this.visible&&this.view.state.camera.aboveGround&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),d),m(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{depthExtremaPositions:s.depthExtremaPositions,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),m(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),d),t(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=a(this._elevationAlignedGeometry),this._targetGeometry=a(this._targetGeometry),this._cutProjectionLines=a(this._cutProjectionLines),this._occludedCutProjectionLines=a(this._occludedCutProjectionLines),this._fillProjectionLines=a(this._fillProjectionLines),this._occludedFillProjectionLines=a(this._occludedFillProjectionLines),this._cutVolumeLabel=a(this._cutVolumeLabel),this._fillVolumeLabel=a(this._fillVolumeLabel),this._renderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],r=[],l=[],a=[],c=[],u=e.spatialReference;for(let m=0;m<e.rings.length;m++){const i=e.rings[m],d=i.length>1&&n(i[0],i[i.length-1]),h=i.length-(d?1:0),p=[];for(let e=0;e<h;++e){const o=i[e],r=f(C(),o[0],o[1],o[2]);s.toRenderCoords(r,u,r);const n=t.rings[m][e],l=f(C(),n[0],n[1],n[2]);s.toRenderCoords(l,u,l);const a=new F(r,l);p.push(a)}const g=this.view.state.camera;for(let s=0;s<p.length;++s){const i=p[s],n=p[0===s?p.length-1:s-1],u=p[s===p.length-1?0:s+1],d=e.rings[m][s],h=t.rings[m][s],y=d[2]>h[2],_=new I(i,n,u,y);o.push(_),_.updateOccluded(g);const f=_.isOccluded;y?(f?l:r).push(i):(f?c:a).push(i)}}this._projectionLines=o,this._cutProjectionLines.setGeometryFromSegments(r),this._occludedCutProjectionLines.setGeometryFromSegments(l),this._fillProjectionLines.setGeometryFromSegments(a),this._occludedFillProjectionLines.setGeometryFromSegments(c)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,n=!1;for(const l of this._projectionLines){l.updateOccluded(e)&&(r||=l.isCut,n||=!l.isCut);const a=l.isOccluded;(l.isCut?a?i:t:a?o:s).push(l.segment)}n&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,t,i){const{geometryOutlineColor:s,cutColor:r,fillColor:n,cutColorMuted:l,fillColorMuted:a,cutProjectionLineColor:c,fillProjectionLineColor:u}=o;if(this._renderNode.cutColor=i?r:l,this._renderNode.fillColor=i?n:a,e){const e=t.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._renderNode.borderColor=t}else{this._targetGeometry.color=s.toUnitRGBA();const e=(i?c:l).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const t=(i?u:a).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._renderNode.borderColor=s}}_updateLabels(e){const{effectiveDisplayUnits:t,depthExtremaPositions:s,messages:o,unitsMessages:r,result:n,visible:l}=e;if(this._cutVolumeLabel.visible=l,this._fillVolumeLabel.visible=l,this._cutVolumeLabel.geometry=s?{type:"point",point:s.cut}:null,this._fillVolumeLabel.geometry=s?{type:"point",point:s.fill}:null,null==n||null==o||null==r)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const a=t.volume,c=i(o.labels.cut,{volume:z(r,n.cutVolume,a)}),u=i(o.labels.fill,{volume:z(r,n.fillVolume,a)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=u}_updateCutFillVisibility(e){e?this._renderNode.enable():this._renderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData,{cut:i,fill:s}=this._extrusionHeights;if(!t?.extent)return;const{center:o}=t.extent,r=w(o.x,o.y,0),n=C();e.toRenderCoords(r,t.spatialReference,n);const l=this._getExtrudedVolumes(t,i,r,n),a=this._getExtrudedVolumes(t,s,r,n);this._renderNode.updateGeometries(l,a,n)}_getExtrudedVolumes(e,t,i,s){const{renderCoordsHelper:o,spatialReference:r,elevationProvider:n}=this.view,l=C(),a=1===o.viewingMode;o.worldUpAtPosition(s,l);const c=S(e,n,o,this._elevationContext),{polygons:u,mapPositions:m,position:d}=c;return u.map(e=>{const s=e.count,n=y(e.mapPositions,e.holeIndices,3),c=n.length,u=6*s,h=V(u+c),p=V(c),g=G(3*u),f=G(3*u);U(d,m,n,e,g,null,f,null,h,p,t,l,a);const v=_(),j=_();if(P(r,i,v,o.spatialReference),j[12]=-v[12],j[13]=-v[13],j[14]=-v[14],O(g,g,j),"stockpile"===this.analysis.measureType)for(let t=0;t<f.length;t+=3)f[t]=l[0],f[t+1]=l[1],f[t+2]=l[2];return new B(g,p,h,f)})}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await s("esri/core/t9n/Units"),this.messages=await s("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function z(e,t,i){if(!t||!e)return null;const s=h(t.value,t.unit,i),o=u(s);return c(e,t,s,o)}e([p({constructOnly:!0})],T.prototype,"view",void 0),e([p({constructOnly:!0})],T.prototype,"analysis",void 0),e([p({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([p()],T.prototype,"unitsMessages",void 0),e([p()],T.prototype,"messages",void 0),e([p()],T.prototype,"loadingMessages",void 0),e([p({readOnly:!0})],T.prototype,"visible",null),e([p()],T.prototype,"updating",null),e([p()],T.prototype,"hasUnsupportedError",null),e([p()],T.prototype,"_extrusionHeights",null),T=e([g("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class I{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=C(),this._n2=C();const o=v(k,j(k,e.endRenderSpace,e.startRenderSpace));v(this._n1,L(this._n1,o,v(W,j(W,t.startRenderSpace,e.startRenderSpace)))),v(this._n2,L(this._n2,o,v(W,j(W,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=l.normalize(x(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){j(k,this.segment.startRenderSpace,e.eye);const t=b(this._n1,k)<0,i=b(this._n2,k)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const k=C(),W=C();export{T as VolumeMeasurementCutFillVisualization};
2
+ import{__decorate as e}from"tslib";import{onLocaleChange as t,substitute as i,fetchMessageBundle as s}from"../../../../intl.js";import{volumeMeasurementConfiguration as o}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import{equals as n}from"../../../../core/arrayUtils.js";import{cyclicalPI as l}from"../../../../core/Cyclical.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import{formatDecimal as c,preferredVolumePrecision as u}from"../../../../core/quantityFormatUtils.js";import{watch as m,initial as d}from"../../../../core/reactiveUtils.js";import{adaptiveVolumeUnit as h}from"../../../../core/units.js";import{property as p,subclass as g}from"../../../../core/accessorSupport/decorators.js";import{e as y}from"../../../../chunks/earcut.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f,normalize as v,subtract as j,cross as L,dot as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as C,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{computeTranslationToOriginAndRotation as P}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{newDoubleArray as G}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as V}from"../../../../geometry/support/Indices.js";import{angleAroundAxis as x}from"../../../../geometry/support/vector.js";import{t as D}from"../../../../chunks/vec3.js";import O from"../../../../symbols/support/ElevationInfo.js";import{LabelVisualElement as R}from"../../interactive/visualElements/LabelVisualElement.js";import{LineVisualElement as A}from"../../interactive/visualElements/LineVisualElement.js";import{OutlineVisualElement as M}from"../../interactive/visualElements/OutlineVisualElement.js";import{EuclideanSegment as F}from"../../interactive/visualElements/support/Segment.js";import{ElevationContext as E}from"../../layers/graphics/ElevationContext.js";import{extrudePolygon as U}from"../../layers/graphics/extrudeUtilsDeprecated.js";import{polygonToRenderInfo as S}from"../../support/renderInfoUtils/polygonDeprecated.js";import{CutFillVisualizationRenderNode as N,VolumeGeometry as B}from"../../webgl-engine/lib/CutFillVisualizationRenderNode.js";import{createStipplePatternSimple as H}from"../../webgl-engine/materials/lineStippleUtils.js";let T=class extends r{get visible(){return this.analysisViewData.visible&&null!=this.analysisViewData.elevationAlignedGeometry&&null!=this.analysisViewData.targetGeometry}get updating(){return this.loadingMessages}get hasUnsupportedError(){const{error:e}=this.analysisViewData;return!!e&&["unsupported-coordinate-system","unsupported-layer-transparency"].includes(e.name)}get _extrusionHeights(){const{renderCoordsHelper:e}=this.view,{depthExtremaPositions:t,targetGeometry:i}=this.analysisViewData,{targetElevationRange:s}=o;if(!i||!t)return{cut:s,fill:-s};let r=-1/0;for(const o of i.rings)for(const e of o)r=Math.max(r,e[2]);const n=1,l=e.getAltitude(t.fill);return{cut:s,fill:Math.min(l-r,0)-n}}constructor(e){super(e),this.unitsMessages=null,this.messages=null,this.loadingMessages=!0,this._elevationContext=E.fromElevationInfo(new O({mode:"absolute-height"})),this._projectionLines=[]}initialize(){const{view:e}=this,i={view:e,isDecoration:!0},s=o,r={...i,width:s.geometryOutlineWidth};this._elevationAlignedGeometry=new M({...r,isDraped:!0,color:s.geometryOutlineColor.toUnitRGBA()}),this._targetGeometry=new M(r);const n={...i,attached:!0,width:s.projectionLineWidth,renderOccluded:4,polygonOffset:3},l={...n,stipplePattern:H(s.projectionLineStippleSize)},a=s.cutProjectionLineColor.toUnitRGBA(),c=s.fillProjectionLineColor.toUnitRGBA();this._cutProjectionLines=new A({...n,color:a}),this._occludedCutProjectionLines=new A({...l,color:a}),this._fillProjectionLines=new A({...n,color:c,renderOccluded:8}),this._occludedFillProjectionLines=new A({...l,color:c});const u={...i,attached:!0};this._cutVolumeLabel=new R({...u,distance:s.labelDistance}),this._fillVolumeLabel=new R({...u,distance:-s.labelDistance}),this._renderNode=new N({view:e,cutColor:s.cutColor,fillColor:s.fillColor,borderColor:s.geometryOutlineColor}),this.addHandles([m(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry}),({elevationAlignedGeometry:e,targetGeometry:t})=>{this._elevationAlignedGeometry.geometry=e,this._targetGeometry.geometry=t},d),m(()=>({interactive:this.analysisViewData.interactive,measureType:this.analysis.measureType,visible:this.visible}),({visible:e,interactive:t,measureType:i})=>{this._elevationAlignedGeometry.visible=e&&!t,this._targetGeometry.visible=e&&"cut-fill"===i,this._renderNode.measureType=i},d),m(()=>({elevationAlignedGeometry:this.analysisViewData.elevationAlignedGeometry,targetGeometry:this.analysisViewData.targetGeometry,visible:this.visible}),({elevationAlignedGeometry:e,targetGeometry:t,visible:i})=>this._updateProjectionLines(e,t,i),d),m(()=>({interactive:this.analysisViewData.interactive,accentColor:this.view.effectiveTheme.accentColor,hasResult:!!this.analysisViewData.result}),({interactive:e,accentColor:t,hasResult:i})=>{this._updateColors(e,t,i)},d),m(()=>[this.analysisViewData.targetGeometry,this._extrusionHeights],()=>this._updateCutFillGeometry(),d),m(()=>this.visible&&this.view.state.camera.aboveGround&&!this.hasUnsupportedError,e=>this._updateCutFillVisibility(e),d),m(()=>{const{messages:e,unitsMessages:t,visible:i,analysisViewData:s}=this;return{depthExtremaPositions:s.depthExtremaPositions,effectiveDisplayUnits:s.effectiveDisplayUnits,messages:e,unitsMessages:t,result:s.result,visible:i&&!!s.result}},e=>this._updateLabels(e)),m(()=>this.view.state.camera,e=>this._updateProjectionLineOcclusion(e),d),t(()=>this._updateMessageBundle())]),this._updateMessageBundle()}destroy(){this._elevationAlignedGeometry=a(this._elevationAlignedGeometry),this._targetGeometry=a(this._targetGeometry),this._cutProjectionLines=a(this._cutProjectionLines),this._occludedCutProjectionLines=a(this._occludedCutProjectionLines),this._fillProjectionLines=a(this._fillProjectionLines),this._occludedFillProjectionLines=a(this._occludedFillProjectionLines),this._cutVolumeLabel=a(this._cutVolumeLabel),this._fillVolumeLabel=a(this._fillVolumeLabel),this._renderNode.destroy()}_updateProjectionLines(e,t,i){if(this._cutProjectionLines.visible=i,this._occludedCutProjectionLines.visible=i,this._fillProjectionLines.visible=i,this._occludedFillProjectionLines.visible=i,!e||!t)return;const{renderCoordsHelper:s}=this.view,o=[],r=[],l=[],a=[],c=[],u=e.spatialReference;for(let m=0;m<e.rings.length;m++){const i=e.rings[m],d=i.length>1&&n(i[0],i[i.length-1]),h=i.length-(d?1:0),p=[];for(let e=0;e<h;++e){const o=i[e],r=f(C(),o[0],o[1],o[2]);s.toRenderCoords(r,u,r);const n=t.rings[m][e],l=f(C(),n[0],n[1],n[2]);s.toRenderCoords(l,u,l);const a=new F(r,l);p.push(a)}const g=this.view.state.camera;for(let s=0;s<p.length;++s){const i=p[s],n=p[0===s?p.length-1:s-1],u=p[s===p.length-1?0:s+1],d=e.rings[m][s],h=t.rings[m][s],y=d[2]>h[2],_=new I(i,n,u,y);o.push(_),_.updateOccluded(g);const f=_.isOccluded;y?(f?l:r).push(i):(f?c:a).push(i)}}this._projectionLines=o,this._cutProjectionLines.setGeometryFromSegments(r),this._occludedCutProjectionLines.setGeometryFromSegments(l),this._fillProjectionLines.setGeometryFromSegments(a),this._occludedFillProjectionLines.setGeometryFromSegments(c)}_updateProjectionLineOcclusion(e){const t=[],i=[],s=[],o=[];let r=!1,n=!1;for(const l of this._projectionLines){l.updateOccluded(e)&&(r||=l.isCut,n||=!l.isCut);const a=l.isOccluded;(l.isCut?a?i:t:a?o:s).push(l.segment)}n&&(this._fillProjectionLines.setGeometryFromSegments(s),this._occludedFillProjectionLines.setGeometryFromSegments(o)),r&&(this._cutProjectionLines.setGeometryFromSegments(t),this._occludedCutProjectionLines.setGeometryFromSegments(i))}_updateColors(e,t,i){const{geometryOutlineColor:s,cutColor:r,fillColor:n,cutColorMuted:l,fillColorMuted:a,cutProjectionLineColor:c,fillProjectionLineColor:u}=o;if(this._renderNode.cutColor=i?r:l,this._renderNode.fillColor=i?n:a,e){const e=t.toUnitRGBA();this._targetGeometry.color=e,this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e,this._fillProjectionLines.color=e,this._occludedFillProjectionLines.color=e,this._renderNode.borderColor=t}else{this._targetGeometry.color=s.toUnitRGBA();const e=(i?c:l).toUnitRGBA();this._cutProjectionLines.color=e,this._occludedCutProjectionLines.color=e;const t=(i?u:a).toUnitRGBA();this._fillProjectionLines.color=t,this._occludedFillProjectionLines.color=t,this._renderNode.borderColor=s}}_updateLabels(e){const{effectiveDisplayUnits:t,depthExtremaPositions:s,messages:o,unitsMessages:r,result:n,visible:l}=e;if(this._cutVolumeLabel.visible=l,this._fillVolumeLabel.visible=l,this._cutVolumeLabel.geometry=s?{type:"point",point:s.cut}:null,this._fillVolumeLabel.geometry=s?{type:"point",point:s.fill}:null,null==n||null==o||null==r)return this._cutVolumeLabel.text="-",void(this._fillVolumeLabel.text="-");const a=t.volume,c=i(o.labels.cut,{volume:z(r,n.cutVolume,a)}),u=i(o.labels.fill,{volume:z(r,n.fillVolume,a)});this._cutVolumeLabel.text=c,this._fillVolumeLabel.text=u}_updateCutFillVisibility(e){e?this._renderNode.enable():this._renderNode.disable()}_updateCutFillGeometry(){const{renderCoordsHelper:e}=this.view,{targetGeometry:t}=this.analysisViewData,{cut:i,fill:s}=this._extrusionHeights;if(!t?.extent)return;const{center:o}=t.extent,r=w(o.x,o.y,0),n=C();e.toRenderCoords(r,t.spatialReference,n);const l=this._getExtrudedVolumes(t,i,r,n),a=this._getExtrudedVolumes(t,s,r,n);this._renderNode.updateGeometries(l,a,n)}_getExtrudedVolumes(e,t,i,s){const{renderCoordsHelper:o,spatialReference:r,elevationProvider:n}=this.view,l=C(),a=1===o.viewingMode;o.worldUpAtPosition(s,l);const c=S(e,n,o,this._elevationContext),{polygons:u,mapPositions:m,position:d}=c;return u.map(e=>{const s=e.count,n=y(e.mapPositions,e.holeIndices,3),c=n.length,u=6*s,h=V(u+c),p=V(c),g=G(3*u),f=G(3*u);U(d,m,n,e,g,null,f,null,h,p,t,l,a);const v=_(),j=_();if(P(r,i,v,o.spatialReference),j[12]=-v[12],j[13]=-v[13],j[14]=-v[14],D(g,g,j),"stockpile"===this.analysis.measureType)for(let t=0;t<f.length;t+=3)f[t]=l[0],f[t+1]=l[1],f[t+2]=l[2];return new B(g,p,h,f)})}async _updateMessageBundle(){this.loadingMessages=!0;try{this.unitsMessages=await s("esri/core/t9n/Units"),this.messages=await s("esri/views/3d/analysis/VolumeMeasurement/t9n/VolumeMeasurementAnalysis")}finally{this.loadingMessages=!1}}};function z(e,t,i){if(!t||!e)return null;const s=h(t.value,t.unit,i),o=u(s);return c(e,t,s,o)}e([p({constructOnly:!0})],T.prototype,"view",void 0),e([p({constructOnly:!0})],T.prototype,"analysis",void 0),e([p({constructOnly:!0})],T.prototype,"analysisViewData",void 0),e([p()],T.prototype,"unitsMessages",void 0),e([p()],T.prototype,"messages",void 0),e([p()],T.prototype,"loadingMessages",void 0),e([p({readOnly:!0})],T.prototype,"visible",null),e([p()],T.prototype,"updating",null),e([p()],T.prototype,"hasUnsupportedError",null),e([p()],T.prototype,"_extrusionHeights",null),T=e([g("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillVisualization")],T);class I{constructor(e,t,i,s){this.segment=e,this.previous=t,this.next=i,this.isCut=s,this._isOccluded=!1,this._n1=C(),this._n2=C();const o=v(k,j(k,e.endRenderSpace,e.startRenderSpace));v(this._n1,L(this._n1,o,v(W,j(W,t.startRenderSpace,e.startRenderSpace)))),v(this._n2,L(this._n2,o,v(W,j(W,e.startRenderSpace,i.startRenderSpace)))),this._isConvex=l.normalize(x(this._n1,this._n2,o))<0}get isOccluded(){return this._isOccluded}updateOccluded(e){j(k,this.segment.startRenderSpace,e.eye);const t=b(this._n1,k)<0,i=b(this._n2,k)<0,s=this._isOccluded;return this._isOccluded=this._isConvex?t&&i:t||i,this._isOccluded!==s}}const k=C(),W=C();export{T as VolumeMeasurementCutFillVisualization};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{colorVectorEquals as r}from"../../../../core/colorUtils.js";import e from"../../../../core/Handles.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as i,subtract as a,sub as n,cross as h,len as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as d}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as p}from"./Object3DVisualElement.js";import{headingTiltToDirectionUp as g}from"../../support/cameraUtils.js";import{createDirectionUp as u}from"../../support/cameraUtilsInternal.js";import{createPolylineGeometry as w}from"../../webgl-engine/lib/GeometryUtil.js";import{MeasurementArrowMaterial as f}from"../../webgl-engine/materials/MeasurementArrowMaterial.js";class C extends p{constructor(r){super(r),this._arrowWidth=16,this._arrowSubdivisions=128,this._origin=c(),this._originTransform=o(),this._arrowCenter=c(),this._renderOccluded=4,this._geometry=null,this._stripeLength=1,this._stripesEnabled=!0,this._color=_(),this._contrastColor=_(),this.applyProperties(r)}get renderOccluded(){return this._renderOccluded}set renderOccluded(r){r!==this._renderOccluded&&(this._renderOccluded=r,this._arrowMaterial?.setParameters({renderOccluded:r}))}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(r){this._transparentRenderOrder=r,this._arrowMaterial&&this._arrowMaterial.setParameters({testsTransparentRenderOrder:r})}get geometry(){return this._geometry}set geometry(r){this._geometry=r,this._geometryChanged()}get stripeLength(){return this._stripeLength}set stripeLength(r){this._stripeLength=r,this.attached&&this._arrowMaterial.setParameters({stripeLength:this._stripeLength})}get stripesEnabled(){return this._stripesEnabled}set stripesEnabled(r){if(this._stripesEnabled=r,this.attached){const r=this._stripesEnabled?this._contrastColor:this._color;this._arrowMaterial.setParameters({stripeEvenColor:r})}}get color(){return this._color}set color(e){r(e,this._color)||(d(this._color,e),this._updateArrowColor())}get contrastColor(){return this._contrastColor}set contrastColor(e){r(e,this._color)||(d(this._contrastColor,e),this._updateArrowColor())}createExternalResources(){const r=this._color,t=this._contrastColor,o=this._stripesEnabled?t:r;this._arrowMaterial=new f({outlineColor:r,stripeEvenColor:o,stripeOddColor:r,renderOccluded:this.renderOccluded,polygonOffset:!0,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}),this._handles=new e,this._handles.add(s(()=>this.view.state.camera,()=>{this._viewChanged()}))}destroyExternalResources(){this._arrowMaterial=null,this._handles=t(this._handles)}forEachMaterial(r){r(this._arrowMaterial)}createGeometries(r){if(null==this._geometry?.startRenderSpace||null==this._geometry.endRenderSpace)return;const e=this._createArrowGeometry(this._geometry.startRenderSpace,this._geometry.endRenderSpace,this._origin,this._geometry);e.transformation=this._originTransform,r.addGeometry(e),this._viewChanged()}_createArrowGeometry(r,e,t,s){const o=this.view,n=o.renderCoordsHelper,h=[],l=[],c=(r,e)=>{const s=m.get();a(s,r,t),h.push(s),l.push(e)};if("euclidean"===s.type){s.eval(.5,this._arrowCenter);const t=m.get();if(n.worldUpAtPosition(this._arrowCenter,t),y(r,e,t)){const{heading:e,tilt:s}=o.camera,{direction:a}=g(o,r,e,s,b);i(t,a)}c(r,t),c(e,t)}else{s.eval(.5,this._arrowCenter);const r=this._arrowSubdivisions+1&-2;for(let e=0;e<r;++e){const t=e/(r-1),o=m.get(),i=m.get();s.eval(t,o),n.worldUpAtPosition(o,i),c(o,i)}}return w(this._arrowMaterial,h,l)}_geometryChanged(){this.recreateGeometry()}_viewChanged(){if(this.view.ready&&this.attached&&null!=this._geometry){const r=this.view.state.camera.computeScreenPixelSizeAt(this._arrowCenter);this._arrowMaterial.setParameters({width:this._arrowWidth*r})}}_updateArrowColor(){if(!this.attached)return;const r=this._color,e=this._contrastColor,t=this._stripesEnabled?e:r,s=r,o=r;this._arrowMaterial.setParameters({stripeEvenColor:t,outlineColor:s,stripeOddColor:o})}}function y(r,e,t){const s=n(v,e,r),o=h(v,s,t);return 0===l(o)}const v=c(),b=u();export{C as MeasurementArrowVisualElement};
2
+ import{colorVectorEquals as r}from"../../../../core/colorUtils.js";import e from"../../../../core/Handles.js";import{destroyMaybe as t}from"../../../../core/maybe.js";import{watch as s}from"../../../../core/reactiveUtils.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as o,subtract as a,sub as n,cross as h,len as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as d}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{Object3DVisualElement as p}from"./Object3DVisualElement.js";import{headingTiltToDirectionUp as g}from"../../support/cameraUtils.js";import{createDirectionUp as u}from"../../support/cameraUtilsInternal.js";import{createPolylineGeometry as w}from"../../webgl-engine/lib/GeometryUtil.js";import{MeasurementArrowMaterial as f}from"../../webgl-engine/materials/MeasurementArrowMaterial.js";class C extends p{constructor(r){super(r),this._arrowWidth=16,this._arrowSubdivisions=128,this._origin=c(),this._originTransform=i(),this._arrowCenter=c(),this._renderOccluded=4,this._geometry=null,this._stripeLength=1,this._stripesEnabled=!0,this._color=_(),this._contrastColor=_(),this.applyProperties(r)}get renderOccluded(){return this._renderOccluded}set renderOccluded(r){r!==this._renderOccluded&&(this._renderOccluded=r,this._arrowMaterial?.setParameters({renderOccluded:r}))}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(r){this._transparentRenderOrder=r,this._arrowMaterial&&this._arrowMaterial.setParameters({testsTransparentRenderOrder:r})}get geometry(){return this._geometry}set geometry(r){this._geometry=r,this._geometryChanged()}get stripeLength(){return this._stripeLength}set stripeLength(r){this._stripeLength=r,this.attached&&this._arrowMaterial.setParameters({stripeLength:this._stripeLength})}get stripesEnabled(){return this._stripesEnabled}set stripesEnabled(r){if(this._stripesEnabled=r,this.attached){const r=this._stripesEnabled?this._contrastColor:this._color;this._arrowMaterial.setParameters({stripeEvenColor:r})}}get color(){return this._color}set color(e){r(e,this._color)||(d(this._color,e),this._updateArrowColor())}get contrastColor(){return this._contrastColor}set contrastColor(e){r(e,this._color)||(d(this._contrastColor,e),this._updateArrowColor())}createExternalResources(){const r=this._color,t=this._contrastColor,i=this._stripesEnabled?t:r;this._arrowMaterial=new f({outlineColor:r,stripeEvenColor:i,stripeOddColor:r,renderOccluded:this.renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}),this._handles=new e,this._handles.add(s(()=>this.view.state.camera,()=>{this._viewChanged()}))}destroyExternalResources(){this._arrowMaterial=null,this._handles=t(this._handles)}forEachMaterial(r){r(this._arrowMaterial)}createGeometries(r){if(null==this._geometry?.startRenderSpace||null==this._geometry.endRenderSpace)return;const e=this._createArrowGeometry(this._geometry.startRenderSpace,this._geometry.endRenderSpace,this._origin,this._geometry);e.transformation=this._originTransform,r.addGeometry(e),this._viewChanged()}_createArrowGeometry(r,e,t,s){const i=this.view,n=i.renderCoordsHelper,h=[],l=[],c=(r,e)=>{const s=m.get();a(s,r,t),h.push(s),l.push(e)};if("euclidean"===s.type){s.eval(.5,this._arrowCenter);const t=m.get();if(n.worldUpAtPosition(this._arrowCenter,t),y(r,e,t)){const{heading:e,tilt:s}=i.camera,{direction:a}=g(i,r,e,s,b);o(t,a)}c(r,t),c(e,t)}else{s.eval(.5,this._arrowCenter);const r=this._arrowSubdivisions+1&-2;for(let e=0;e<r;++e){const t=e/(r-1),i=m.get(),o=m.get();s.eval(t,i),n.worldUpAtPosition(i,o),c(i,o)}}return w(this._arrowMaterial,h,l)}_geometryChanged(){this.recreateGeometry()}_viewChanged(){if(this.view.ready&&this.attached&&null!=this._geometry){const r=this.view.state.camera.computeScreenPixelSizeAt(this._arrowCenter);this._arrowMaterial.setParameters({width:this._arrowWidth*r})}}_updateArrowColor(){if(!this.attached)return;const r=this._color,e=this._contrastColor,t=this._stripesEnabled?e:r,s=r,i=r;this._arrowMaterial.setParameters({stripeEvenColor:t,outlineColor:s,stripeOddColor:i})}}function y(r,e,t){const s=n(v,e,r),i=h(v,s,t);return 0===l(i)}const v=c(),b=u();export{C as MeasurementArrowVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as r,convertUnit as n}from"../../../core/units.js";import{property as l,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import u from"../../../geometry/HeightModelInfo.js";import{create as c}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as p}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as f,equals as g,isGeographic as _}from"../../../geometry/support/spatialReferenceUtils.js";import y from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as w}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as v}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as S}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as C}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as b}from"./LayerView3D.js";import{addLayerViewToWasm as x,getLyr3DWasm as I,removeLayerViewFromWasm as H}from"./Lyr3DWasm.js";import{LayerElevationProvider as M}from"./i3s/LayerElevationProvider.js";import{ElevationRange as A}from"../support/ElevationRange.js";import{projectToBoundingBox as E}from"../support/extentUtils.js";import{Obb as F}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as T,elementsPerSplatPage as P,packedGaussianSizeInU32 as j,splatPageSizeInU32WithoutHeader as O,gaussiansPerSplatPage as U,splatAtlasTextureWidth as G}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as R}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as V}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as B}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as k}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import D from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as N,isInEffectiveScaleRange as z}from"../../support/layerViewUtils.js";import{TaskPriority as q}from"../../support/Scheduler.js";const W=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D");let $=class extends(b(D)){constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(T),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._tmpSortedTileHandles=new Set,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(q.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=c();return E(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw N("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=x(this).then(e=>{this._wasmLayerId=e,this._renderNode=new k({view:this.view,layerView:this}),this.data=new R(this._renderNode,(e,t)=>this._onSortComplete(e,t)),this.fadeHelper=new V(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new M({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),s(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([s(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([s(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),s(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),s(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return I(this.view)}get usedMemory(){return this._usedMemory}get cachedMemory(){return this._cacheMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return v(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new A(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return z(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc.prims[0],s=i.vertexCount,a=i.atrbs[0].view,r=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==a.type)return W().warnOnce("unexpected meshData.data format"),{memUsageBytes:0,numGaussians:0};l=new Uint32Array(t.data.buffer,n,r/4);const o=this.extractHeader(l),u=Math.ceil(s/U),c=new Uint32Array(s),p=new Array;let m=!1,f=0;const g=async e=>{for(;f<u&&!e.done&&!m;f++){let t=this.data.textureAtlas.requestPage();if(null===t&&(this._freeInvisibleTiles(),t=this.data.textureAtlas.requestPage()),null!==t){p.push(t);const i=s-f*U,a=Math.min(i,U),r=f*U;for(let e=0;e<a;e++)c[e+r]=e+P*t;const n=f*O;this._pageBuffer.set(l.subarray(n,n+a*j)),this._pageBuffer.set(o.packedHeader,O);const h=t*P,d=h%G,u=Math.floor(h/G);this.data.textureAtlas.update(d,u,this._pageBuffer),e.madeProgress()}else m=!0}f<u&&!m&&await this._frameTask.schedule(g)};if(await this._frameTask.schedule(g),m)return W().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};const _=new Float32Array(3*s),y=new Float32Array(s),w=2.048,v=o.tileOrigin.x*w,S=o.tileOrigin.y*w,C=o.tileOrigin.z*w,b=o.invPosScale;let x=null;if(t.desc.obb){const e=t.desc.obb.quaternion;x=new F(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}x||(W().warnOnce("encountered tile without a bounding box"),x=new F);const I=x.centerX,H=x.centerY,M=x.centerZ,E=new A,T=this.view.state.isGlobal,R=T?d(this.view.spatialReference).radius:0;let V=0,L=0,k=0;const D=async e=>{for(;k<s&&!e.done;k++){const t=k*j,{rawX:i,rawY:s,rawZ:a}=this._extractGaussianPosition(l,t),r=this._extractGaussianSphericalScale(l,t),n=i*b+v,o=s*b+S,h=a*b+C;_[V]=n-I,_[V+1]=o-H,_[V+2]=h-M;const d=T?Math.sqrt(n*n+o*o+h*h)-R:h;E.expandElevationRangeValues(d,d),y[k]=r*r,L=Math.max(L,r),V+=3,e.madeProgress()}k<s&&await this._frameTask.schedule(D)};await this._frameTask.schedule(D);const{fullExtent:N}=this.layer;N?.hasZ&&N.zmax&&N.zmin&&(E.minElevation=Math.max(E.minElevation,N.zmin),E.maxElevation=Math.min(E.maxElevation,N.zmax));const z=new B(e.handle,x,c,p,_,y,L,E);return this._memCache.put(`${z.handle}`,z),this._tileHandles.set(e.handle,z),this._cacheMemory+=z.usedMemory,{memUsageBytes:z.usedMemory,numGaussians:s}}_extractGaussianPosition(e,t){const i=e[t+1];return{rawX:16383&i,rawY:i>>>14&16383,rawZ:i>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const i=e[t+2],s=i>>>10&255,a=i>>>18&255,r=i>>>26&63|(3&e[t+3])<<6,n=Math.exp(s/16-10),l=Math.exp(a/16-10),o=Math.exp(r/16-10);return Math.max(n,l,o)}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this._tileHandles.get(e);t&&(0!==t.lifecycleState?(this.fadeHelper.onTileDiscarded(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,t.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(t),this._tileHandles.delete(e)),this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1;let a=!1;for(let r=0;r<i;r++){const i=this._tileHandles.get(e[r]);if(!i)continue;const n=t[r]?this._prepareTileFadeIn(i,s):this._prepareTileFadeOut(i,s);a||=n}a&&(this._currentLyr3dVisibilityChange=s,this.updateGaussians())}_prepareTileFadeIn(e,t){const i=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0),i):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):i}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let r=0;r<e.length;r++){const t=e[r];s.add(t.handle)}let a=this._triggerFadeIns(t,s,i);a=this._triggerFadeOuts(t,i),s.clear(),i.length>0&&this.notifyTileObbsChanged(i),a&&this.updateGaussians()}_triggerFadeIns(e,t,i){let s=!1;for(const[a,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(a))continue;const n=this._tileHandles.get(a);if(!n){this._tileFadeInsAwaitingInitialSort.delete(a);continue}const l=0===n.lifecycleState;2!==n.lifecycleState&&(n.lifecycleState=2,l&&this._popTileFromCache(n),i.push(n),s=!0),this.fadeHelper.fadeTile(n,0),this._tileFadeInsAwaitingInitialSort.delete(a)}return s}_triggerFadeOuts(e,t){let i=!1;for(const[s,a]of this._tileFadeOutsAwaitingInitialSort){if(a>e)continue;const r=this._tileHandles.get(s);if(r){const e=2===r.lifecycleState;this.fadeHelper.fadeTile(r,1),e&&0===r.lifecycleState&&(t.push(r),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_popTileFromCache(e){this._usedMemory+=e.usedMemory,this._cacheMemory-=e.usedMemory,this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedMemory-=e.usedMemory,this._cacheMemory+=e.usedMemory,this._memCache.put(`${e.handle}`,e)}destroy(){H(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._renderNode.destroy(),this.data.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||f(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&g(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=w(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!_(t)&&t.wkid&&-1!==t.wkid&&(i=r(y.units[y[t.wkid]])),i&&(e=new u({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===p(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=S(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,v(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),a=this.reinterpretU32AsFloat(e[t+2]),r=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:a},invPosScale:r}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;return this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++}),new C(this.usedMemory,e,t,this.cachedMemory)}get test(){}};e([l()],$.prototype,"layer",void 0),e([l({readOnly:!0})],$.prototype,"_clippingBox",null),e([l()],$.prototype,"elevationOffset",null),e([l({readOnly:!0})],$.prototype,"visibleAtCurrentScale",null),e([l()],$.prototype,"fullExtentInLocalViewSpatialReference",void 0),$=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],$);const X=$;export{X as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as r,convertUnit as n}from"../../../core/units.js";import{property as l,subclass as o}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as d}from"../../../geometry/ellipsoidUtils.js";import u from"../../../geometry/HeightModelInfo.js";import{create as c}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as p}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as f,equals as g,isGeographic as _}from"../../../geometry/support/spatialReferenceUtils.js";import y from"../../../geometry/support/WKIDUnitConversion.js";import{getHeightModelInfoFromVCS as w}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as v}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as S}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as C}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as b}from"./LayerView3D.js";import{addLayerViewToWasm as x,getLyr3DWasm as I,removeLayerViewFromWasm as H}from"./Lyr3DWasm.js";import{LayerElevationProvider as M}from"./i3s/LayerElevationProvider.js";import{ElevationRange as A}from"../support/ElevationRange.js";import{projectToBoundingBox as T}from"../support/extentUtils.js";import{Obb as E}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as F,elementsPerSplatPage as P,packedGaussianSizeInU32 as j,splatPageSizeInU32WithoutHeader as O,gaussiansPerSplatPage as U,splatAtlasTextureWidth as G}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as R}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as V}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as B}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as k}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import D from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as N,isInEffectiveScaleRange as z}from"../../support/layerViewUtils.js";import{TaskPriority as q}from"../../support/Scheduler.js";const W=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D");let $=class extends(b(D)){constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(F),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._tmpSortedTileHandles=new Set,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(q.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=c();return T(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw N("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=x(this).then(e=>{this._wasmLayerId=e,this._renderNode=new k({view:this.view,layerView:this}),this.data=new R(this._renderNode,(e,t)=>this._onSortComplete(e,t)),this.fadeHelper=new V(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new M({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([s(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),s(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=s(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([s(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([s(()=>this.view.qualitySettings.fadeDuration,e=>{this.fadeHelper.onFadeDurationChanged(e),this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}),s(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),s(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return I(this.view)}get usedMemory(){return this._usedMemory}get cachedMemory(){return this._cacheMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return v(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new A(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return z(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const i=t.desc.prims[0],s=i.vertexCount,a=i.atrbs[0].view,r=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==a.type)return W().warnOnce("unexpected meshData.data format"),{memUsageBytes:0,numGaussians:0};l=new Uint32Array(t.data.buffer,n,r/4);const o=this.extractHeader(l),u=Math.ceil(s/U),c=new Uint32Array(s),p=new Array;let m=!1,f=0;const g=async e=>{for(;f<u&&!e.done&&!m;f++){let t=this.data.textureAtlas.requestPage();if(null===t&&(this._freeInvisibleTiles(),t=this.data.textureAtlas.requestPage()),null!==t){p.push(t);const i=s-f*U,a=Math.min(i,U),r=f*U;for(let e=0;e<a;e++)c[e+r]=e+P*t;const n=f*O;this._pageBuffer.set(l.subarray(n,n+a*j)),this._pageBuffer.set(o.packedHeader,O);const h=t*P,d=h%G,u=Math.floor(h/G);this.data.textureAtlas.update(d,u,this._pageBuffer),e.madeProgress()}else m=!0}f<u&&!m&&await this._frameTask.schedule(g)};if(await this._frameTask.schedule(g),m)return W().warnOnce("ran out of gaussian splat memory"),{memUsageBytes:0,numGaussians:0};const _=new Float32Array(3*s),y=new Float32Array(s),w=2.048,v=o.tileOrigin.x*w,S=o.tileOrigin.y*w,C=o.tileOrigin.z*w,b=o.invPosScale;let x=null;if(t.desc.obb){const e=t.desc.obb.quaternion;x=new E(t.desc.obb.center,t.desc.obb.halfSize,h(...e))}x||(W().warnOnce("encountered tile without a bounding box"),x=new E);const I=x.centerX,H=x.centerY,M=x.centerZ,T=new A,F=this.view.state.isGlobal,R=F?d(this.view.spatialReference).radius:0;let V=0,L=0,k=0;const D=async e=>{for(;k<s&&!e.done;k++){const t=k*j,{rawX:i,rawY:s,rawZ:a}=this._extractGaussianPosition(l,t),r=this._extractGaussianSphericalScale(l,t),n=i*b+v,o=s*b+S,h=a*b+C;_[V]=n-I,_[V+1]=o-H,_[V+2]=h-M;const d=F?Math.sqrt(n*n+o*o+h*h)-R:h;T.expandElevationRangeValues(d,d),y[k]=r*r,L=Math.max(L,r),V+=3,e.madeProgress()}k<s&&await this._frameTask.schedule(D)};await this._frameTask.schedule(D);const{fullExtent:N}=this.layer;N?.hasZ&&N.zmax&&N.zmin&&(T.minElevation=Math.max(T.minElevation,N.zmin),T.maxElevation=Math.min(T.maxElevation,N.zmax));const z=new B(e.handle,x,c,p,_,y,s,L,T);return this._memCache.put(`${z.handle}`,z),this._tileHandles.set(e.handle,z),this._cacheMemory+=z.usedMemory,{memUsageBytes:z.usedMemory,numGaussians:s}}_extractGaussianPosition(e,t){const i=e[t+1];return{rawX:16383&i,rawY:i>>>14&16383,rawZ:i>>>28&15|(1023&e[t+2])<<4}}_extractGaussianSphericalScale(e,t){const i=e[t+2],s=i>>>10&255,a=i>>>18&255,r=i>>>26&63|(3&e[t+3])<<6,n=Math.exp(s/16-10),l=Math.exp(a/16-10),o=Math.exp(r/16-10);return Math.max(n,l,o)}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this._tileHandles.get(e);t&&(0!==t.lifecycleState?(this.fadeHelper.onTileDiscarded(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this._intersectionHandler.removeTile(t),t.pageIds.forEach(e=>this.data.textureAtlas.freePage(e)),this.freeObject(t),this._tileHandles.delete(e)),this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1;let a=!1;for(let r=0;r<i;r++){const i=this._tileHandles.get(e[r]);if(!i)continue;const n=t[r]?this._prepareTileFadeIn(i,s):this._prepareTileFadeOut(i,s);a||=n}a&&(this._currentLyr3dVisibilityChange=s,this.updateGaussians())}_prepareTileFadeIn(e,t){const i=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0),i):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):i}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let r=0;r<e.length;r++){const t=e[r];s.add(t.handle)}let a=this._triggerFadeIns(t,s,i);a=this._triggerFadeOuts(t,i),s.clear(),i.length>0&&this.notifyTileObbsChanged(i),a&&this.updateGaussians()}_triggerFadeIns(e,t,i){let s=!1;for(const[a,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(a))continue;const n=this._tileHandles.get(a);if(!n){this._tileFadeInsAwaitingInitialSort.delete(a);continue}const l=0===n.lifecycleState;2!==n.lifecycleState&&(n.lifecycleState=2,l&&this._popTileFromCache(n),i.push(n),s=!0),this.fadeHelper.fadeTile(n,0),this._tileFadeInsAwaitingInitialSort.delete(a)}return s}_triggerFadeOuts(e,t){let i=!1;for(const[s,a]of this._tileFadeOutsAwaitingInitialSort){if(a>e)continue;const r=this._tileHandles.get(s);if(r){const e=2===r.lifecycleState;this.fadeHelper.fadeTile(r,1),e&&0===r.lifecycleState&&(t.push(r),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_popTileFromCache(e){this._usedMemory+=e.usedMemory,this._cacheMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(`${e.handle}`)}moveTileToCache(e){this._usedMemory-=e.usedMemory,this._cacheMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(`${e.handle}`,e)}destroy(){H(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._renderNode.destroy(),this.data.destroy(),this._memCache.destroy()}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||f(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&g(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=w(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!_(t)&&t.wkid&&-1!==t.wkid&&(i=r(y.units[y[t.wkid]])),i&&(e=new u({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===p(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=n(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=S(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,v(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),a=this.reinterpretU32AsFloat(e[t+2]),r=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:a},invPosScale:r}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;return this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++}),new C(this.usedMemory,e,t,this.cachedMemory)}get test(){}};e([l()],$.prototype,"layer",void 0),e([l({readOnly:!0})],$.prototype,"_clippingBox",null),e([l()],$.prototype,"elevationOffset",null),e([l({readOnly:!0})],$.prototype,"visibleAtCurrentScale",null),e([l()],$.prototype,"fullExtentInLocalViewSpatialReference",void 0),$=e([o("esri.views.3d.layers.GaussianSplatLayerView3D")],$);const X=$;export{X as default};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{loadLyr3DWorkerWASM as s}from"../../../libs/lyr3d/Lyr3DModule.js";let t,n;async function e(s){await l();const t={status:1,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[]};if(s.inputs.length<1)return{result:t,transferList:[]};const e={ptrs:[],sizes:[]};for(const l of s.inputs){const s=n._malloc(l.byteLength);new Uint8Array(n.HEAPU8.buffer,s,l.byteLength).set(new Uint8Array(l)),e.ptrs.push(s),e.sizes.push(l.byteLength)}const i=n.process(s.jobDescJson,s.id,e,s.isMissingResourceCase);t.status=i.status,t.missingInputUrls=i.missingInputUrls.slice();const r=0===i.status&&i.data,o=2===t.status&&t.missingInputUrls.length>0;t.jobDescJson=i.jobDescJson.slice(),t.error=i.error.slice(),r?t.data=i.data.slice():o&&(t.originalInputs=s.inputs.slice());for(let l=0;l<e.ptrs.length;++l)n._free(e.ptrs[l]);const a=[];if(r)a.push(t.data.buffer);else if(o)for(const n of s.inputs)a.push(n);return{result:t,transferList:a}}async function i(s){await l(),n.add_spatial_reference_info(s.sr,s.isGCS,s.toMetersXY,s.toMetersZ)}function r(s){if(!n)return{success:!1,modifications:null};const t=n._malloc(8*s.modifications.length),e=new Float64Array(n.HEAPF64.buffer,t,s.modifications.length);e.set(s.modifications);const i=n.switch_mesh_modification_polygon_vcs(t,s.modifications.length,s.inVCS);let r=null;return i&&(r=e.slice()),n._free(t),{success:i,modifications:r}}function o(){n&&(n.uninitialize_lyr3d_worker_wasm(),n=null)}function l(){return n?Promise.resolve():(t||(t=s().then(s=>{n=s,n.initialize_lyr3d_worker_wasm(),t=null})),t)}function a(){return null!==n}export{i as addSpatialReferenceInfo,o as destroyWasm,l as initialize,a as isInitialized,e as process,r as switchMeshModificationPolygonVCSSync};
2
+ import{loadLyr3DWorkerWASM as s}from"../../../libs/lyr3d/Lyr3DModule.js";let t,n=null;async function e(s){await l();const t={status:1,error:"",jobDescJson:"",data:new Uint8Array(0),missingInputUrls:[]};if(s.inputs.length<1)return{result:t,transferList:[]};const e={ptrs:[],sizes:[]};for(const l of s.inputs){const s=n._malloc(l.byteLength);new Uint8Array(n.HEAPU8.buffer,s,l.byteLength).set(new Uint8Array(l)),e.ptrs.push(s),e.sizes.push(l.byteLength)}const i=n.process(s.jobDescJson,s.id,e,s.isMissingResourceCase);t.status=i.status,t.missingInputUrls=i.missingInputUrls.slice();const r=0===i.status&&i.data,o=2===t.status&&t.missingInputUrls.length>0;t.jobDescJson=i.jobDescJson.slice(),t.error=i.error.slice(),r?t.data=i.data.slice():o&&(t.originalInputs=s.inputs.slice());for(let l=0;l<e.ptrs.length;++l)n._free(e.ptrs[l]);const a=[];if(r)a.push(t.data.buffer);else if(o)for(const n of s.inputs)a.push(n);return{result:t,transferList:a}}async function i(s){await l(),n.add_spatial_reference_info(s.sr,s.isGCS,s.toMetersXY,s.toMetersZ)}function r(s){if(!n)return{success:!1,modifications:null};const t=n._malloc(8*s.modifications.length),e=new Float64Array(n.HEAPF64.buffer,t,s.modifications.length);e.set(s.modifications);const i=n.switch_mesh_modification_polygon_vcs(t,s.modifications.length,s.inVCS);let r=null;return i&&(r=e.slice()),n._free(t),{success:i,modifications:r}}function o(){n&&(n.uninitialize_lyr3d_worker_wasm(),n=null)}function l(){return a()?Promise.resolve():(t||(t=s().then(s=>{n=s,n.initialize_lyr3d_worker_wasm(),t=null})),t)}function a(){return null!==n}export{i as addSpatialReferenceInfo,o as destroyWasm,l as initialize,a as isInitialized,e as process,r as switchMeshModificationPolygonVCSSync};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{clone as t}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as e}from"../../../../core/units.js";import{e as r}from"../../../../chunks/earcut.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as o,invertOrIdentity as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as l,sub as c,cross as m,add as p,normalize as h,transformMat4 as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as u,create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as _,fromBuffer as x,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as w}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as S,getZeroIndexArray as v}from"../../../../geometry/support/Indices.js";import{t as C}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as P,SnappingCandidateEdge as E}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as I}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as A,SampleElevationInfo as U}from"./elevationAlignmentUtils.js";import{extrudePolygon as D}from"./extrudeUtils.js";import{Object3DEdgeState as M,Graphics3DObject3DGraphicLayer as O}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as L}from"./graphicUtils.js";import{geometryAsPolygon as G}from"./polygonUtils.js";import{createMaterial as V}from"../support/edgeUtils.js";import{encodeNaNUInt8 as B}from"../support/symbolColorUtils.js";import{debugFlags as R}from"../../support/debugFlags.js";import{SamplePosition as F}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as T}from"../../support/renderInfoUtils/polygon.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as W}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as k,compressNormal as q}from"../../webgl-engine/lib/Normals.js";import{Object3D as Z}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as J}from"../../webgl-engine/materials/DefaultMaterial.js";const K=["polygon","extent"];class Q extends z{constructor(t,e,r,s){super(t,e,r,s,rt(e)),this.ensureDrapedStatus(!1)}async doLoad(){const t=this.symbolLayer,e=t?.material,r=this.symbolLayer.material?.color?.a,s=this._hasDrivenColorOrOpacity,i=this.needsDrivenTransparentPass||s&&null!=r&&r<1,o=e?.emissive,n=("color"===o?.source?o?.strength:void 0)??0,a=!s&&(null==r||0===r),l=s?f:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:u,diffuse:u,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:i,hasSymbolColors:s,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:t.castShadows,emissiveStrengthFromSymbol:n,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new J(c,this._context),p=new J({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(t){const e=t.graphic;if(!this._validateGeometry(e.geometry,K,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(t.renderingInfo,this._materialColor,!1);B(r,r);const s=this.createElevationContextForGraphic(e);return this._createAs3DShape(e,t.renderingInfo,r,s,e.uid)}layerOpacityChanged(t,e){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),t?.forEach(t=>e(t)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(t,e){return this.updateGraphics3DGraphicElevationInfo(t,e,A)}slicePlaneEnabledChanged(t,e){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),t?.forEach(t=>{const r=e(t);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const t={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(t),this._materials[1]?.setParameters(t),!0}_getExtrusionSize(t){let e;return e=t.size&&this._drivenProperties.size?I(t.size.output,2)??0:this._getSymbolSize(),e/=this._context.renderCoordsHelper.unitInMeters,e}applyRendererDiff(t,e){return this._drivenPropertiesChanged(e)?0:1}async queryForSnapping(r,s,i,o){const n=this._getExtrusionSize(i)*this._context.renderCoordsHelper.unitInMeters/e(s),{objectId:a,target:l}=r,c=t(l);switch(c.z=(c.z??0)+n,r.type){case"edge":{const{start:e,end:s}=r,i=t(e),o=t(s);return i.z=(i.z??0)+n,o.z=(o.z??0)+n,[new E(a,c,1/0,i,o)]}case"vertex":return[new P(a,c,1/0),new E(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(t,e,n,l,c){const m=G(t.geometry);if(null==m)return null;if(0===m.rings.length||!m.rings.some(t=>t.length>0))return this._logGeometryValidationWarnings(m.rings,"rings","ExtrudeSymbol3DLayer"),null;const p=T(m,this._context.elevationProvider,this._context.renderCoordsHelper,l);this._logGeometryCreationWarnings(p,m.rings,"rings","ExtrudeSymbol3DLayer");const h=L(m);if(null==h)return null;const d=new Array,u=new Array,f=_(),y=a(),v=g(),P=1===this._context.renderCoordsHelper.viewingMode;P||this._context.renderCoordsHelper.worldUpAtPosition(null,v),b(m.spatialReference,[h.x,h.y,0],y,this._context.renderCoordsHelper.spatialReference);const E=a();o(E,y);const I=i();s(I,E);const{polygons:U,mapPositions:z,position:B}=p,R=new Map,F=this._materials[0];for(const s of U){const t=s.count;if(this._context.clippingExtent&&(x(s.mapPositions,f),!j(f,this._context.clippingExtent)))continue;const i=r(s.mapPositions,s.holeIndices,3);if(0===i.length)continue;const o=i.length,a=6*t,l=S(a+o),m=S(o),p=w(3*a),h=w(3*a),g=w(3*a),b=w(a),_=this._getExtrusionSize(e);D(B,z,i,s,p,g,h,b,l,m,_,v,P),C(p,p,E);const I=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),A=new mt(p,g,k(h),b),U=X(F,l,l.length-m.length,A,n,I),M=t,O=t,L=2*s.count,G=new pt(M,O,L,o/3);et(U,G,y),R.set(U,G),d.push(U,X(this._materials[1],m,0,A,n,I)),u.push(A.heights)}if(0===d.length)return null;const H=new Z({geometries:d,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});H.transformation=y;const N=V(this.symbolLayer,{opacity:this._getLayerOpacity()}),W=N?new M(this._materials[0],N,this._context.slicePlaneEnabled):null,q=new O(this,H,null,(t,e,r,s,i)=>tt(t,e,r,s,i,u,R),l,W);return q.alignedSampledElevation=p.sampledElevation,q.needsElevationUpdates=A(l.mode),q}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const t=this._materials[0];t&&t.setParameters({cullFace:t.transparent?0:2})}}function X(t,e,r,s,i,o){const{attributeIndices:n,drawIndices:a}=Y(e),l=[["position",new H(s.positions,n,3,!0)],["normalCompressed",new H(s.normals,n,2,!0)]];if(t.parameters.hasSymbolColors){const t=v(n.length);l.push(["symbolColor",new H(i,t,4,!0)])}return new N(t,l,s.elevation,0,o,r,null,a)}function Y(t){const e=new Array,r=new Map,s=new Array;for(let i=0;i<t.length;++i){const o=t[i];let n=r.get(o);null==n&&(n=e.length,e.push(o),r.set(o,n)),s.push(n)}return{attributeIndices:e,drawIndices:s}}const $=g();function tt(t,e,r,s,i,o,c){const m=t.stageObject,p=m.geometries,h=p.length,u="absolute-height"!==e.mode;let g=0;const f=m.transformation,y=n(a(),f);for(let n=0;n<h;n+=2){const t=p[n];if(!W(t))continue;const e=t.getMutableAttribute("position").data,a=o[n/2],h=new F(t.mapPositions),b=e.length/3;let _=!1,x=0;{let t=0;for(let o=0;o<b;o++){$[0]=e[t],$[1]=e[t+1],$[2]=e[t+2],s(h,ot),u&&(x+=ot.sampledElevation),R.ENABLE_OPTIMIZATIONS?(l(st,e[t],e[t+1],e[t+2]),d(st,st,f),i.setAltitude(st,ot.z+a[t/3]),d(st,st,y)):(l(st,h.array[h.offset],h.array[h.offset+1],ot.z+a[t/3]),null!=r&&i.toRenderCoords(st,r,st),d(st,st,y)),e[t]=st[0],e[t+1]=st[1],e[t+2]=st[2];const o=nt/i.unitInMeters;(Math.abs($[0]-e[t])>=o||Math.abs($[1]-e[t+1])>=o||Math.abs($[2]-e[t+2])>=o)&&(_=!0),h.offset+=3,t+=3}}if(_){const e=c.get(t);e&&et(t,e,f),m.geometryVertexAttributeUpdated(p[n],"normalCompressed"),t.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[n],"position"),p[n+1].invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[n+1],"position")}g+=x/b}return g/h}function et(t,e,r){const s=t.getMutableAttribute("position"),i=t.getMutableAttribute("normalCompressed").data,o=s.data,n=t.primitivePositionIndices,{topVertexStart:a,topVertexCount:u,topFaceStart:g,topFaceCount:f}=e,y=g+f,b=a+u,_=at,x=lt,j=ct,w=it,S=st;l(S,0,0,0);const v=(t,e)=>{const s=3*t;l(e,o[s+0],o[s+1],o[s+2]),d(e,e,r)};for(let l=g;l<y;++l){const t=3*l;v(n[t+0],_[0]),v(n[t+1],_[1]),v(n[t+2],_[2]),c(x,_[1],_[0]),c(j,_[2],_[0]),m(w,x,j),p(S,S,w)}h(S,S);for(let l=a;l<b;++l){const t=S[0],e=S[1],r=S[2];q(i,l,t,e,r)}}function rt(t){return 1===(t.material?.color?.a??0)}const st=g(),it=g(),ot=new U,nt=.01,at=[g(),g(),g()],lt=g(),ct=g();class mt{constructor(t,e,r,s){this.positions=t,this.elevation=e,this.normals=r,this.heights=s}}class pt{constructor(t,e,r,s){this.topVertexStart=t,this.topVertexCount=e,this.topFaceStart=r,this.topFaceCount=s}}export{Q as Graphics3DExtrudeSymbolLayer};
2
+ import{clone as e}from"../../../../core/lang.js";import{getMetersPerVerticalUnitForSR as t}from"../../../../core/units.js";import{e as r}from"../../../../chunks/earcut.js";import{normalFromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as o,invertOrIdentity as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as l,sub as c,cross as m,add as p,normalize as h,transformMat4 as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ONES as u,create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as f,ZEROS as y}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{computeTranslationToOriginAndRotation as b}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{create as _,fromBuffer as x,intersectsClippingArea as j}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as w}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as S,getZeroIndexArray as v}from"../../../../geometry/support/Indices.js";import{t as C}from"../../../../chunks/vec3.js";import{SnappingCandidateVertex as P,SnappingCandidateEdge as E}from"../../../../layers/graphics/data/SnappingCandidate.js";import{getDriverAxisSizeValue as I}from"../../../../renderers/support/renderingInfoUtils.js";import{needsElevationUpdates3D as A,SampleElevationInfo as D}from"./elevationAlignmentUtils.js";import{extrudePolygon as U}from"./extrudeUtilsDeprecated.js";import{Object3DEdgeState as M,Graphics3DObject3DGraphicLayer as O}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as z}from"./Graphics3DSymbolLayer.js";import{computeCentroid as L}from"./graphicUtils.js";import{geometryAsPolygon as G}from"./polygonUtils.js";import{createMaterial as V}from"../support/edgeUtils.js";import{encodeNaNUInt8 as B}from"../support/symbolColorUtils.js";import{debugFlags as R}from"../../support/debugFlags.js";import{SamplePosition as F}from"../../support/ElevationProvider.js";import{polygonToRenderInfo as T}from"../../support/renderInfoUtils/polygonDeprecated.js";import{Attribute as H}from"../../webgl-engine/lib/Attribute.js";import{Geometry as N}from"../../webgl-engine/lib/Geometry.js";import{isGeometryWithMapPositions as W}from"../../webgl-engine/lib/GeometryWithMapPositions.js";import{compressNormals as k,compressNormal as q}from"../../webgl-engine/lib/Normals.js";import{Object3D as Z}from"../../webgl-engine/lib/Object3D.js";import{DefaultMaterial as J}from"../../webgl-engine/materials/DefaultMaterial.js";const K=["polygon","extent"];class Q extends z{constructor(e,t,r,s){super(e,t,r,s,re(t)),this.ensureDrapedStatus(!1)}async doLoad(){const e=this.symbolLayer,t=e?.material,r=this.symbolLayer.material?.color?.a,s=this._hasDrivenColorOrOpacity,i=this.needsDrivenTransparentPass||s&&null!=r&&r<1,o=t?.emissive,n=("color"===o?.source?o?.strength:void 0)??0,a=!s&&(null==r||0===r),l=s?f:this._materialColor?.toUnitRGBA()??y,c={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,useIndexing:!0,ambient:u,diffuse:u,externalColor:l,opacity:a?0:1,layerOpacity:this._getLayerOpacity(),drivenOpacity:i,hasSymbolColors:s,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:e.castShadows,emissiveStrengthFromSymbol:n,emissiveSource:1,offsetTransparentBackfaces:!0,normalType:1},m=new J(c,this._context),p=new J({...c,cullFace:2},this._context);this._materials[0]=m,this._materials[1]=p,this._updateTransparentDepedentMaterialParameters()}destroy(){super.destroy(),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,K,this.symbolLayer.type))return null;const r=this._getDrivenUInt8ColorWithNaNSupport(e.renderingInfo,this._materialColor,!1);B(r,r);const s=this.createElevationContextForGraphic(t);return this._createAs3DShape(t,e.renderingInfo,r,s,t.uid)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._materials[0]?.setParameters({layerOpacity:r}),this._materials[1]?.setParameters({layerOpacity:r}),this._updateTransparentDepedentMaterialParameters(),e?.forEach(e=>t(e)?.layerOpacityChanged(r,this._context.isAsync))}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,A)}slicePlaneEnabledChanged(e,t){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),e?.forEach(e=>{const r=t(e);null!=r&&r.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync)}),!0}physicalBasedRenderingChanged(){const e={usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0};return this._materials[0]?.setParameters(e),this._materials[1]?.setParameters(e),!0}_getExtrusionSize(e){let t;return t=e.size&&this._drivenProperties.size?I(e.size.output,2)??0:this._getSymbolSize(),t/=this._context.renderCoordsHelper.unitInMeters,t}applyRendererDiff(e,t){return this._drivenPropertiesChanged(t)?0:1}async queryForSnapping(r,s,i,o){const n=this._getExtrusionSize(i)*this._context.renderCoordsHelper.unitInMeters/t(s),{objectId:a,target:l}=r,c=e(l);switch(c.z=(c.z??0)+n,r.type){case"edge":{const{start:t,end:s}=r,i=e(t),o=e(s);return i.z=(i.z??0)+n,o.z=(o.z??0)+n,[new E(a,c,1/0,i,o)]}case"vertex":return[new P(a,c,1/0),new E(a,l,1/0,l,c)];default:return[]}}_getSymbolSize(){return this.symbolLayer.size??1}_createAs3DShape(e,t,n,l,c){const m=G(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 p=T(m,this._context.elevationProvider,this._context.renderCoordsHelper,l);this._logGeometryCreationWarnings(p,m.rings,"rings","ExtrudeSymbol3DLayer");const h=L(m);if(null==h)return null;const d=new Array,u=new Array,f=_(),y=a(),v=g(),P=1===this._context.renderCoordsHelper.viewingMode;P||this._context.renderCoordsHelper.worldUpAtPosition(null,v),b(m.spatialReference,[h.x,h.y,0],y,this._context.renderCoordsHelper.spatialReference);const E=a();o(E,y);const I=i();s(I,E);const{polygons:D,mapPositions:z,position:B}=p,R=new Map,F=this._materials[0];for(const s of D){const e=s.count;if(this._context.clippingExtent&&(x(s.mapPositions,f),!j(f,this._context.clippingExtent)))continue;const i=r(s.mapPositions,s.holeIndices,3);if(0===i.length)continue;const o=i.length,a=6*e,l=S(a+o),m=S(o),p=w(3*a),h=w(3*a),g=w(3*a),b=w(a),_=this._getExtrusionSize(t);U(B,z,i,s,p,g,h,b,l,m,_,v,P),C(p,p,E);const I=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:c,layerViewUid:this._context.layerViewUid}),A=new me(p,g,k(h),b),D=X(F,l,l.length-m.length,A,n,I),M=e,O=e,L=2*s.count,G=new pe(M,O,L,o/3);te(D,G,y),R.set(D,G),d.push(D,X(this._materials[1],m,0,A,n,I)),u.push(A.heights)}if(0===d.length)return null;const H=new Z({geometries:d,layerViewUid:this._context.layerViewUid,graphicUid:c,isElevationSource:!0});H.transformation=y;const N=V(this.symbolLayer,{opacity:this._getLayerOpacity()}),W=N?new M(this._materials[0],N,this._context.slicePlaneEnabled):null,q=new O(this,H,null,(e,t,r,s,i)=>ee(e,t,r,s,i,u,R),l,W);return q.alignedSampledElevation=p.sampledElevation,q.needsElevationUpdates=A(l.mode),q}get _materialColor(){return this.symbolLayer.material?.color}_updateTransparentDepedentMaterialParameters(){const e=this._materials[0];e&&e.setParameters({cullFace:e.transparent?0:2})}}function X(e,t,r,s,i,o){const{attributeIndices:n,drawIndices:a}=Y(t),l=[["position",new H(s.positions,n,3,!0)],["normalCompressed",new H(s.normals,n,2,!0)]];if(e.parameters.hasSymbolColors){const e=v(n.length);l.push(["symbolColor",new H(i,e,4,!0)])}return new N(e,l,s.elevation,0,o,r,null,a)}function Y(e){const t=new Array,r=new Map,s=new Array;for(let i=0;i<e.length;++i){const o=e[i];let n=r.get(o);null==n&&(n=t.length,t.push(o),r.set(o,n)),s.push(n)}return{attributeIndices:t,drawIndices:s}}const $=g();function ee(e,t,r,s,i,o,c){const m=e.stageObject,p=m.geometries,h=p.length,u="absolute-height"!==t.mode;let g=0;const f=m.transformation,y=n(a(),f);for(let n=0;n<h;n+=2){const e=p[n];if(!W(e))continue;const t=e.getMutableAttribute("position").data,a=o[n/2],h=new F(e.mapPositions),b=t.length/3;let _=!1,x=0;{let e=0;for(let o=0;o<b;o++){$[0]=t[e],$[1]=t[e+1],$[2]=t[e+2],s(h,oe),u&&(x+=oe.sampledElevation),R.ENABLE_OPTIMIZATIONS?(l(se,t[e],t[e+1],t[e+2]),d(se,se,f),i.setAltitude(se,oe.z+a[e/3]),d(se,se,y)):(l(se,h.array[h.offset],h.array[h.offset+1],oe.z+a[e/3]),null!=r&&i.toRenderCoords(se,r,se),d(se,se,y)),t[e]=se[0],t[e+1]=se[1],t[e+2]=se[2];const o=ne/i.unitInMeters;(Math.abs($[0]-t[e])>=o||Math.abs($[1]-t[e+1])>=o||Math.abs($[2]-t[e+2])>=o)&&(_=!0),h.offset+=3,e+=3}}if(_){const t=c.get(e);t&&te(e,t,f),m.geometryVertexAttributeUpdated(p[n],"normalCompressed"),e.invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[n],"position"),p[n+1].invalidateBoundingInfo(),m.geometryVertexAttributeUpdated(p[n+1],"position")}g+=x/b}return g/h}function te(e,t,r){const s=e.getMutableAttribute("position"),i=e.getMutableAttribute("normalCompressed").data,o=s.data,n=e.primitivePositionIndices,{topVertexStart:a,topVertexCount:u,topFaceStart:g,topFaceCount:f}=t,y=g+f,b=a+u,_=ae,x=le,j=ce,w=ie,S=se;l(S,0,0,0);const v=(e,t)=>{const s=3*e;l(t,o[s+0],o[s+1],o[s+2]),d(t,t,r)};for(let l=g;l<y;++l){const e=3*l;v(n[e+0],_[0]),v(n[e+1],_[1]),v(n[e+2],_[2]),c(x,_[1],_[0]),c(j,_[2],_[0]),m(w,x,j),p(S,S,w)}h(S,S);for(let l=a;l<b;++l){const e=S[0],t=S[1],r=S[2];q(i,l,e,t,r)}}function re(e){return 1===(e.material?.color?.a??0)}const se=g(),ie=g(),oe=new D,ne=.01,ae=[g(),g(),g()],le=g(),ce=g();class me{constructor(e,t,r,s){this.positions=e,this.elevation=t,this.normals=r,this.heights=s}}class pe{constructor(e,t,r,s){this.topVertexStart=e,this.topVertexCount=t,this.topFaceStart=r,this.topFaceCount=s}}export{Q as Graphics3DExtrudeSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{e as t}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as i,intersectsClippingArea as s,empty as o,expandWithAABB as n,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c,floatSubArray as p}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as d}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as m}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y,computeSymbolLayerIndex as f}from"./lineUtils.js";import{geometryAsPolygon as v,createIndices3D as b,createColorGeometry as S,PolygonCreationDataBase as x}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as P,getAttributeValue as D,ConvertOptions as O}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as j}from"../support/patternUtils.js";import{createMapSpaceUVCoords as w,createMapSpaceUVCoordsDraped as G}from"../support/uvUtils.js";import{createGeometry as A}from"../../support/engineContent/line.js";import{polygonToRenderInfo as E,polygonToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygon.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as R}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as I}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const F=["polyline","polygon","extent"];class T extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,J(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=U(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;const i=this.symbolLayer.outline;if(q(i)){const t=I(i.pattern);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:f(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:y(i.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&R(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,F,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!P(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=h(T.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=u(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r,i){const s=v(t.geometry);if(!s)return null;const o=E(s,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new k(o,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=c(4*a,!0),n.boundingRect=l(9),w(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._materials[1]&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,s.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const p=new M({geometries:n.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=new m(this,p,null,j,i);return h.alignedSampledElevation=n.renderData.sampledElevation,h.needsElevationUpdates=u(i.mode),h}_createAs3DShapeFill(e,t){const r=t.renderData.polygons;for(const{position:o,mapPositions:n,holeIndices:a,index:l,count:c}of r){if(null!=this._context.clippingExtent&&(i(n,H),!s(H,this._context.clippingExtent)))continue;const r=b(n,a,this._context.elevationProvider.spatialReference);if(0===r.length)continue;const h=this._fastUpdates?.visualVariables.color,u=S({material:this._materials[0],indices:r,mapPositions:n,attributeData:{position:o,color:h?null:t.color,colorFeature:h?D(h,e.color):null,uvMapSpace:this._needsUV?p(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?t.boundingRect:null,olidColor:t.olidColor}});t.outGeometries.push(u)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:r,position:o}of t){if(null!=this._context.clippingExtent&&(i(r,H),!s(H,this._context.clippingExtent)))continue;const t=A(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=v(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=L(i,this._context.overlaySR),n=new W(s,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;return this._needsUV&&(n.uvMapSpace=c(4*a,!0),G(n.uvMapSpace,n.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),n.outBoundingBox=o(),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAsOverlayFill(e,n),this._materials[1]&&this._createAsOverlayOutline(n),this._logGeometryCreationWarnings(n.renderData,i.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length?null:new d(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,r){const o=r.renderData.polygons;for(const{position:a,holeIndices:l,index:c,count:h}of o){const o=i(a,H);if(!s(o,this._context.clippingExtent))continue;const u=t(a,l,3);if(0===u.length)continue;n(r.outBoundingBox,o);const d=this._fastUpdates?.visualVariables.color,m=S({material:this._materials[0],indices:u,attributeData:{position:a,color:d?null:r.color,colorFeature:d?D(d,e.color):null,uvMapSpace:this._needsUV?p(r.uvMapSpace,4*c,4*h):null,olidColor:r.olidColor}});r.outGeometries.push(new V(m,r))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let r=0;r<t.length;++r){const{position:o}=t[r];if(i(o,H),!s(H,this._context.clippingExtent))continue;n(e.outBoundingBox,H);const a=A(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new V(a,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new O({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??r})}}const H=a();class k extends x{constructor(e,t,r,i){super(e,r,i),this.color=t}}class W extends x{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function J(e){return 1===(e.material?.color?.a??0)}export{T as Graphics3DPolygonFillSymbolLayer};
2
+ import has from"../../../../core/has.js";import{pt2px as e}from"../../../../core/screenUtils.js";import{e as t}from"../../../../chunks/earcut.js";import{ZEROS as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromBuffer as i,intersectsClippingArea as s,empty as o,expandWithAABB as n,create as a}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as l}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as c,floatSubArray as p}from"../../../../geometry/support/FloatArray.js";import{elevationModeChangeUpdateType as h,needsElevationUpdates2D as u}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as d}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as m}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as _}from"./Graphics3DSymbolLayer.js";import{mixinColorAndOpacity as g}from"./graphicUtils.js";import{parseCapType as y,computeSymbolLayerIndex as f}from"./lineUtils.js";import{geometryAsPolygon as v,createIndices3D as b,createColorGeometry as S,PolygonCreationDataBase as x}from"./polygonUtils.js";import{initFastSymbolUpdatesState as C,updateFastSymbolUpdatesState as P,getAttributeValue as D,ConvertOptions as O}from"../support/FastSymbolUpdates.js";import{createMaterial as U,uvElevationAligner as j}from"../support/patternUtils.js";import{createMapSpaceUVCoords as w,createMapSpaceUVCoordsDraped as G}from"../support/uvUtils.js";import{createGeometry as A}from"../../support/engineContent/line.js";import{polygonToRenderInfo as E,polygonToRenderInfoDraped as L}from"../../support/renderInfoUtils/polygonDeprecated.js";import{Object3D as M}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as V}from"../../webgl-engine/lib/RenderGeometry.js";import{isScreenSizePerspectiveEnabled as R}from"../../webgl-engine/lib/screenSizePerspectiveUtils.js";import{getStipplePatternForLinePattern as I}from"../../webgl-engine/materials/lineStippleUtils.js";import{PatternMaterial as z}from"../../webgl-engine/materials/PatternMaterial.js";import{RibbonLineMaterial as B}from"../../webgl-engine/materials/RibbonLineMaterial.js";const F=["polyline","polygon","extent"];class T extends _{static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i,J(t)),this._needsUV=!1,this._materials=[]}async doLoad(){this._fastUpdates=C(this._context.renderer,this._vvConvertOptions)}get _materialColor(){return this.symbolLayer.material?.color}get _emissiveStrength(){if(has("enable-feature:emissive-on-none-volumetrics")){const e=this.symbolLayer.material?.emissive;return("color"===e?.source?e?.strength:void 0)??0}return 0}_createMaterials(){if(this._materials.length>0)return;const t=this._materialColor,r=this._getCombinedOpacityAndColor(t);this._materials[0]=U(this.symbolLayer,{color:r,forceTransparentMode:this.needsDrivenTransparentPass,discardInvisibleFragments:!0,hasVertexColors:this._drivenProperties.color||this._drivenProperties.opacity,draped:this.draped,hasSlicePlane:this._context.slicePlaneEnabled,emissiveStrength:this._emissiveStrength,...this._fastUpdates?.materialParameters}),this._needsUV=this._materials[0]instanceof z;const i=this.symbolLayer.outline;if(q(i)){const t=I(i.pattern);this._materials[1]=new B({width:e(i.size),color:this._getOutlineColor(),polygonOffset:3,polygonOffsetIndex:f(this._renderPriority,this._renderPriorityStep),hasSlicePlane:this._context.slicePlaneEnabled,isClosed:!0,stipplePattern:t,cap:y(i.patternCap||"butt"),screenSizePerspective:this._outlineScreenSizePerspective},this.view.state.isGlobal)}}get _outlineScreenSizePerspective(){return!this.draped&&R(this._context.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,F,this.symbolLayer.type))return null;const r=this._getDrivenUInt8Color(e.renderingInfo,this._materialColor,!1),i=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===i.mode),this._createMaterials(),this.draped?this._createAsOverlay(e.renderingInfo,t,r):this._createAs3DShape(e.renderingInfo,t,r,i)}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return 0;if(!P(this._fastUpdates,t,this._vvConvertOptions))return 0;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return 2}layerOpacityChanged(){if(null!=this._materials[0]){const e=this._materials[0].parameters.color,t=this._materialColor,r=this._getCombinedOpacity(t);this._materials[0].setParameters({color:[e[0],e[1],e[2],r],forceTransparentMode:this.needsDrivenTransparentPass})}if(null!=this._materials[1]){const e=this._materials[1].parameters.color;this._materials[1].setParameters({color:[e[0],e[1],e[2],this._getOutlineOpacity()]})}}layerScreenSizePerspectiveChanged(){this._materials[1]?.setParameters({screenSizePerspective:this._outlineScreenSizePerspective})}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,s=h(T.elevationModeChangeTypes,r,i);if(1!==s)return s;const o=u(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>o)}slicePlaneEnabledChanged(){if(this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),this._materials[1]){const e={hasSlicePlane:this._context.slicePlaneEnabled};this._materials[1].setParameters(e)}return!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r,i){const s=v(t.geometry);if(!s)return null;const o=E(s,this._context.elevationProvider,this._context.renderCoordsHelper,i),n=new k(o,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;if(this._needsUV&&(n.uvMapSpace=c(4*a,!0),n.boundingRect=l(9),w(n.uvMapSpace,n.boundingRect,n.renderData.position,this._context.renderCoordsHelper)),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAs3DShapeFill(e,n),this._materials[1]&&this._createAs3DShapeOutline(n),this._logGeometryCreationWarnings(n.renderData,s.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length)return null;const p=new M({geometries:n.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:t.uid}),h=new m(this,p,null,j,i);return h.alignedSampledElevation=n.renderData.sampledElevation,h.needsElevationUpdates=u(i.mode),h}_createAs3DShapeFill(e,t){const r=t.renderData.polygons;for(const{position:o,mapPositions:n,holeIndices:a,index:l,count:c}of r){if(null!=this._context.clippingExtent&&(i(n,H),!s(H,this._context.clippingExtent)))continue;const r=b(n,a,this._context.elevationProvider.spatialReference);if(0===r.length)continue;const h=this._fastUpdates?.visualVariables.color,u=S({material:this._materials[0],indices:r,mapPositions:n,attributeData:{position:o,color:h?null:t.color,colorFeature:h?D(h,e.color):null,uvMapSpace:this._needsUV?p(t.uvMapSpace,4*l,4*c):null,boundingRect:this._needsUV?t.boundingRect:null,olidColor:t.olidColor}});t.outGeometries.push(u)}}_createAs3DShapeOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(const{mapPositions:r,position:o}of t){if(null!=this._context.clippingExtent&&(i(r,H),!s(H,this._context.clippingExtent)))continue;const t=A(this._materials[1],{overlayInfo:null,removeDuplicateStartEnd:!0,mapPositions:r,attributeData:{position:o}},e.olidColor);e.outGeometries.push(t)}}_createAsOverlay(e,t,r){const i=v(t.geometry);if(null==i)return null;this._materials[0].renderPriority=this._renderPriority+this._renderPriorityStep/2,null!=this._materials[1]&&(this._materials[1].renderPriority=this._renderPriority);const s=L(i,this._context.overlaySR),n=new W(s,r,this._context.layerViewUid,t.uid),a=n.renderData.position.length/3;return this._needsUV&&(n.uvMapSpace=c(4*a,!0),G(n.uvMapSpace,n.renderData.position,this._context.overlaySR,this._context.graphicsCoreOwner.view.state.viewingMode)),n.outBoundingBox=o(),n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),this._createAsOverlayFill(e,n),this._materials[1]&&this._createAsOverlayOutline(n),this._logGeometryCreationWarnings(n.renderData,i.rings,"rings","FillSymbol3DLayer"),0===n.outGeometries.length?null:new d(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayFill(e,r){const o=r.renderData.polygons;for(const{position:a,holeIndices:l,index:c,count:h}of o){const o=i(a,H);if(!s(o,this._context.clippingExtent))continue;const u=t(a,l,3);if(0===u.length)continue;n(r.outBoundingBox,o);const d=this._fastUpdates?.visualVariables.color,m=S({material:this._materials[0],indices:u,attributeData:{position:a,color:d?null:r.color,colorFeature:d?D(d,e.color):null,uvMapSpace:this._needsUV?p(r.uvMapSpace,4*c,4*h):null,olidColor:r.olidColor}});r.outGeometries.push(new V(m,r))}}_createAsOverlayOutline(e){if(null==this._materials[1])return;const t=e.renderData.outlines;for(let r=0;r<t.length;++r){const{position:o}=t[r];if(i(o,H),!s(H,this._context.clippingExtent))continue;n(e.outBoundingBox,H);const a=A(this._materials[1],{overlayInfo:{spatialReference:this._context.overlaySR,renderCoordsHelper:this._context.renderCoordsHelper},removeDuplicateStartEnd:!0,attributeData:{position:o}},e.olidColor);e.outGeometries.push(new V(a,e))}}_getOutlineOpacity(){const e=this.symbolLayer?.outline?.color;return(this.draped?1:this._getLayerOpacity())*(null!=e?e.a:0)}_getOutlineColor(){const e=this.symbolLayer?.outline?.color,t=this._getOutlineOpacity();return g(e?.toUnitRGB(),t)}test(){return{...super.test(),createAsOverlay:(e,t,r)=>this._createAsOverlay(e,t,r),createAs3DShape:(e,t,r,i)=>this._createAs3DShape(e,t,r,i)}}get _vvConvertOptions(){return new O({supports:{size:!1,color:!0,rotation:!1,opacity:!1},fallbackColor:this._materialColor?.toUnitRGBA()??r})}}const H=a();class k extends x{constructor(e,t,r,i){super(e,r,i),this.color=t}}class W extends x{constructor(e,t,r,i){super(e,r,i),this.color=t}}function q(e){return null!=e?.size&&e.size>0&&null!=e.color&&(null==e.pattern||"style"!==e.pattern.type||"none"!==e.pattern.style)}function J(e){return 1===(e.material?.color?.a??0)}export{T as Graphics3DPolygonFillSymbolLayer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{getMetersPerUnitForSR as e}from"../../../../core/units.js";import{e as t}from"../../../../chunks/earcut.js";import{set as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as n}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{toRadian as s}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as a,intersectsClippingArea as l,empty as c,expandWithAABB as h,create as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as m,expandPointInPlace as u,create as d}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as g,floatSubArray as y}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as f}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as x,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as w}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as D,createWaterGeometry as S,PolygonCreationDataBase as C}from"./polygonUtils.js";import{polygonToRenderInfo as G,polygonToRenderInfoDraped as j}from"../../support/renderInfoUtils/polygon.js";import{Object3D as P}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as O,WaterMaterial as A}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as E}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const T=["polyline","polygon","extent"];class U extends w{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const e=new O,t=this.symbolLayer.color.toUnitRGBA();t[3]*=this._getLayerOpacity(),e.color=t,e.transparent=t[3]<1||this.needsDrivenTransparentPass,e.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const r=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,o=E[r];e.waveStrength=o.waveStrength,e.waveTextureRepeat=o.textureRepeat,e.waveVelocity=o.waveVelocity,e.flowStrength=o.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.draped=this.draped,e.useIndexing=!0,this._materials[0]=new A(e,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=x(U.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=v(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=D(e.geometry);if(null==i)return null;const o=G(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=o.position.length/3,s=g(2*n);M(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new W(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new P({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new b(this,l,null,f,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=v(t.mode),c}_create3DShapeGeometries(e){const r=e.renderData.polygons,i=e.uvCoords;for(const{count:o,index:n,position:s,mapPositions:c,holeIndices:h}of r){if(null!=this._context.clippingExtent&&(a(c,z),!l(z,this._context.clippingExtent)))continue;const r=t(c,h,3);if(0===r.length)continue;const p=y(i,2*n,2*o),m=S({material:this._materials[0],indices:r,mapPositions:c,attributeData:{position:s,uv0:p}},e.olidColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=D(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=j(t,this._context.overlaySR),i=r.position.length/3,o=g(2*i);M(o,r.position,i,this._context.overlaySR);const n=new F(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=c(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new _(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const r=e.uvCoords,i=e.renderData.polygons;for(const{position:o,holeIndices:n,index:s,count:c}of i){if(a(o,z),!l(z,this._context.clippingExtent))continue;h(e.outBoundingBox,z);const i=t(o,n,3);if(0===i.length)continue;const p=y(r,2*s,2*c),m=S({material:this._materials[0],indices:i,attributeData:{position:o,uv0:p}},e.olidColor);e.outGeometries.push(new L(m,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=o(),r=s(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(t,i,o,s){const a=e(s);m(I);for(let e=0;e<o;e++)r(V,i[3*e],i[3*e+1]),u(I,V);n(I,I,a);const l=I[0]%U.unitSizeOfTexture,c=I[1]%U.unitSizeOfTexture;R[0]=I[0]-l,R[1]=I[1]-c;for(let e=0;e<o;e++)t[2*e]=(i[3*e]*a-R[0])/U.unitSizeOfTexture,t[2*e+1]=(i[3*e+1]*a-R[1])/U.unitSizeOfTexture}const R=o(),I=d(),V=o(),z=p();class W extends C{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class F extends C{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{U as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
2
+ import{getMetersPerUnitForSR as e}from"../../../../core/units.js";import{e as t}from"../../../../chunks/earcut.js";import{set as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as n}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{toRadian as s}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as a,intersectsClippingArea as l,empty as c,expandWithAABB as h,create as p}from"../../../../geometry/support/aaBoundingBox.js";import{empty as m,expandPointInPlace as u,create as d}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as g,floatSubArray as y}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as f}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as x,needsElevationUpdates2D as v}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as _}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as w}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as D,createWaterGeometry as S,PolygonCreationDataBase as C}from"./polygonUtils.js";import{polygonToRenderInfo as G,polygonToRenderInfoDraped as j}from"../../support/renderInfoUtils/polygonDeprecated.js";import{Object3D as P}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as L}from"../../webgl-engine/lib/RenderGeometry.js";import{Parameters as O,WaterMaterial as A}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as E}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const T=["polyline","polygon","extent"];class U extends w{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,T,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const e=new O,t=this.symbolLayer.color.toUnitRGBA();t[3]*=this._getLayerOpacity(),e.color=t,e.transparent=t[3]<1||this.needsDrivenTransparentPass,e.waveDirection=null!=this.symbolLayer.waveDirection?B(this.symbolLayer.waveDirection):i(0,0);const r=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,o=E[r];e.waveStrength=o.waveStrength,e.waveTextureRepeat=o.textureRepeat,e.waveVelocity=o.waveVelocity,e.flowStrength=o.perturbationStrength,e.hasSlicePlane=this._context.slicePlaneEnabled,e.draped=this.draped,e.useIndexing=!0,this._materials[0]=new A(e,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=x(U.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=v(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=D(e.geometry);if(null==i)return null;const o=G(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=o.position.length/3,s=g(2*n);M(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new W(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new P({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new b(this,l,null,f,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=v(t.mode),c}_create3DShapeGeometries(e){const r=e.renderData.polygons,i=e.uvCoords;for(const{count:o,index:n,position:s,mapPositions:c,holeIndices:h}of r){if(null!=this._context.clippingExtent&&(a(c,z),!l(z,this._context.clippingExtent)))continue;const r=t(c,h,3);if(0===r.length)continue;const p=y(i,2*n,2*o),m=S({material:this._materials[0],indices:r,mapPositions:c,attributeData:{position:s,uv0:p}},e.olidColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=D(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=j(t,this._context.overlaySR),i=r.position.length/3,o=g(2*i);M(o,r.position,i,this._context.overlaySR);const n=new F(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=c(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new _(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const r=e.uvCoords,i=e.renderData.polygons;for(const{position:o,holeIndices:n,index:s,count:c}of i){if(a(o,z),!l(z,this._context.clippingExtent))continue;h(e.outBoundingBox,z);const i=t(o,n,3);if(0===i.length)continue;const p=y(r,2*s,2*c),m=S({material:this._materials[0],indices:i,attributeData:{position:o,uv0:p}},e.olidColor);e.outGeometries.push(new L(m,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function B(e){const t=o(),r=s(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(t,i,o,s){const a=e(s);m(I);for(let e=0;e<o;e++)r(V,i[3*e],i[3*e+1]),u(I,V);n(I,I,a);const l=I[0]%U.unitSizeOfTexture,c=I[1]%U.unitSizeOfTexture;R[0]=I[0]-l,R[1]=I[1]-c;for(let e=0;e<o;e++)t[2*e]=(i[3*e]*a-R[0])/U.unitSizeOfTexture,t[2*e+1]=(i[3*e+1]*a-R[1])/U.unitSizeOfTexture}const R=o(),I=d(),V=o(),z=p();class W extends C{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class F extends C{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{U as Graphics3DWaterSymbolLayer,B as headingVectorFromAngle};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{copy as t,normalize as o,set as n,subtract as c,cross as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function l(t,o,n,c,e,s,l,i,u,h,a,g,m){const p=n.length/3;let x=2*c.count;r(t,o,c.index,c.count,n,0,p,e,s,l,i,u,h,x,a,g,m);let L=0,b=2*c.count;x=0;const j=c.pathLengths[0];f(e,s,i,l,L,j,c.count,b,u,x,a),b+=4*j,x+=2*j,L+=j;for(let r=1;r<c.pathLengths.length;++r){const t=c.pathLengths[r];f(e,s,i,l,L,t,c.count,b,u,x,a),b+=4*t,x+=2*t,L+=t}}function r(n,c,e,s,l,r,f,i,u,h,a,g,m,p,x,v,d){t(L,v),u??=[],h??=[],a??=[];const k=x>0?1:-1;let q=3*e,w=0,y=3*w,z=s,A=3*z;for(let t=0;t<s;++t){const t=n[q],e=n[q+1],s=n[q+2];d&&(L[0]=t,L[1]=e,L[2]=s,o(L,L)),i[y+0]=t,i[y+1]=e,i[y+2]=s;const l=c[q+0],r=c[q+1],f=c[q+2];u[y+0]=l,u[y+1]=r,u[y+2]=f,h[y+0]=-k*L[0],h[y+1]=-k*L[1],h[y+2]=-k*L[2],a[w]=0,i[A+0]=t+x*L[0],i[A+1]=e+x*L[1],i[A+2]=s+x*L[2],u[A+0]=l,u[A+1]=r,u[A+2]=f,a[z]=x,y+=3,A+=3,q+=3,w+=1,z+=1}q=3*r,y=0,A=3*p;const B=x<0?j:b,C=x<0?b:j;for(let t=0;t<f;++t)m[y]=l[q+B[0]],m[y+1]=l[q+B[1]],m[y+2]=l[q+B[2]],g[A]=l[q+C[0]]+s,g[A+1]=l[q+C[1]]+s,g[A+2]=l[q+C[2]]+s,y+=3,A+=3,q+=3}function f(t,o,n,c,e,s,l,r,f,a,g){o??=[],n??=[],c??=[];let m=e,p=e+1,x=e+l,L=e+l+1,b=r,j=r+1,v=r+2*s,d=r+2*s+1;g<0&&(m=e+l+1,L=e);let k=3*a;for(let q=0;q<s;++q)q===s-1&&(p=e,g>0?L=e+l:m=e+l),i(t,m,p,x,h),u(t,o,c,n,h,b,m),u(t,o,c,n,h,j,p),u(t,o,c,n,h,v,x),u(t,o,c,n,h,d,L),f[k]=b,f[k+1]=v,f[k+2]=d,f[k+3]=b,f[k+4]=d,f[k+5]=j,k+=6,m++,p++,x++,L++,b+=2,j+=2,v+=2,d+=2}function i(t,s,l,r,f){s*=3,l*=3,r*=3,n(a,t[s++],t[s++],t[s++]),n(g,t[l++],t[l++],t[l++]),n(m,t[r++],t[r++],t[r++]),c(p,g,a),c(x,m,a),e(f,x,p),o(f,f)}function u(t,o,n,c,e,s,l){c[s]=c[l],l*=3,t[s*=3]=t[l],t[s+1]=t[l+1],t[s+2]=t[l+2],o[s]=o[l],o[s+1]=o[l+1],o[s+2]=o[l+2],n[s]=e[0],n[s+1]=e[1],n[s+2]=e[2]}const h=s(),a=s(),g=s(),m=s(),p=s(),x=s(),L=s(),b=[0,2,1],j=[0,1,2];export{l as extrudePolygon};
2
+ import{copy as o,normalize as t,set as e,subtract as n,cross as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as r}from"../../../../geometry/support/DoubleArray.js";import{newIndexArray as s}from"../../../../geometry/support/Indices.js";function c(e,n){const{worldUp:l,height:i,spherical:c,requireElevation:m,requireNormals:p,requireSizes:f}=n,d=e.vertexCount,a=e.outlineSegmentCount,g=3*(2*d+4*a),v=r(g),h=s(6*a+e.polygonIndexCount),b=s(e.polygonIndexCount),{positions:j,mapPositions:C,polygonIndices:q,outline:z}=e;if("tessellated-indices"!==z.output)return null;const S=z.outlineIndices;o(x,l);const w=m?r(g):void 0,A=p?r(g):void 0,D=f?r(g):void 0,E=q.length/3,N=i>0?1:-1;let P=0,U=0,k=d;for(let o=0;o<d;++o){const o=j[P],e=j[P+1],n=j[P+2];c&&(x[0]=o,x[1]=e,x[2]=n,t(x,x));const l=3*U;v[l+0]=o,v[l+1]=e,v[l+2]=n;const r=C[P+0],s=C[P+1],u=C[P+2];null!=w&&(w[l+0]=r,w[l+1]=s,w[l+2]=u),null!=A&&(A[l+0]=-N*x[0],A[l+1]=-N*x[1],A[l+2]=-N*x[2]),null!=D&&(D[U]=0);const m=3*k;v[m+0]=o+i*x[0],v[m+1]=e+i*x[1],v[m+2]=n+i*x[2],null!=w&&(w[m+0]=r,w[m+1]=s,w[m+2]=u),null!=D&&(D[k]=i),P+=3,U+=1,k+=1}let B=2*d,F=0;for(let o=0;o<S.length;++o){const t=S[o],e=t.length-1;e<=1||(u(v,w,D,A,t,e,d,B,h,F,i),B+=4*e,F+=2*e)}let G=0,H=0,J=3*F;const K=i<0?I:y,L=i<0?y:I;for(let o=0;o<E;++o)b[H]=q[G+K[0]],b[H+1]=q[G+K[1]],b[H+2]=q[G+K[2]],h[J]=q[G+L[0]]+d,h[J+1]=q[G+L[1]]+d,h[J+2]=q[G+L[2]]+d,H+=3,J+=3,G+=3;return{vertices:v,indices:h,bottomIndices:b,elevation:w,normals:A,sizes:D}}function u(o,t,e,n,l,i,r,s,c,u,d){t??=[],e??=[],n??=[];let a=s,g=s+1,v=s+2*i,h=s+2*i+1,x=3*u;for(let y=0;y<i;++y){const i=l[y],s=l[y+1],u=i+r,I=s+r;let b=i,j=s,C=u,q=I;d<0&&(b=I,j=s,C=u,q=i),m(o,b,j,C,f),p(o,t,n,e,f,a,b),p(o,t,n,e,f,g,j),p(o,t,n,e,f,v,C),p(o,t,n,e,f,h,q),c[x]=a,c[x+1]=v,c[x+2]=h,c[x+3]=a,c[x+4]=h,c[x+5]=g,x+=6,a+=2,g+=2,v+=2,h+=2}}function m(o,i,r,s,c){i*=3,r*=3,s*=3,e(d,o[i++],o[i++],o[i++]),e(a,o[r++],o[r++],o[r++]),e(g,o[s++],o[s++],o[s++]),n(v,a,d),n(h,g,d),l(c,h,v),t(c,c)}function p(o,t,e,n,l,i,r){n[i]=n[r],r*=3,o[i*=3]=o[r],o[i+1]=o[r+1],o[i+2]=o[r+2],t[i]=t[r],t[i+1]=t[r+1],t[i+2]=t[r+2],e[i]=l[0],e[i+1]=l[1],e[i+2]=l[2]}const f=i(),d=i(),a=i(),g=i(),v=i(),h=i(),x=i(),y=[0,2,1],I=[0,1,2];export{c as extrudePolygon};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import{copy as t,normalize as o,set as n,subtract as c,cross as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";function l(t,o,n,c,e,s,l,i,u,h,a,g,m){const p=n.length/3;let x=2*c.count;r(t,o,c.index,c.count,n,0,p,e,s,l,i,u,h,x,a,g,m);let L=0,b=2*c.count;x=0;const j=c.pathLengths[0];f(e,s,i,l,L,j,c.count,b,u,x,a),b+=4*j,x+=2*j,L+=j;for(let r=1;r<c.pathLengths.length;++r){const t=c.pathLengths[r];f(e,s,i,l,L,t,c.count,b,u,x,a),b+=4*t,x+=2*t,L+=t}}function r(n,c,e,s,l,r,f,i,u,h,a,g,m,p,x,v,d){t(L,v),u??=[],h??=[],a??=[];const k=x>0?1:-1;let q=3*e,w=0,y=3*w,z=s,A=3*z;for(let t=0;t<s;++t){const t=n[q],e=n[q+1],s=n[q+2];d&&(L[0]=t,L[1]=e,L[2]=s,o(L,L)),i[y+0]=t,i[y+1]=e,i[y+2]=s;const l=c[q+0],r=c[q+1],f=c[q+2];u[y+0]=l,u[y+1]=r,u[y+2]=f,h[y+0]=-k*L[0],h[y+1]=-k*L[1],h[y+2]=-k*L[2],a[w]=0,i[A+0]=t+x*L[0],i[A+1]=e+x*L[1],i[A+2]=s+x*L[2],u[A+0]=l,u[A+1]=r,u[A+2]=f,a[z]=x,y+=3,A+=3,q+=3,w+=1,z+=1}q=3*r,y=0,A=3*p;const B=x<0?j:b,C=x<0?b:j;for(let t=0;t<f;++t)m[y]=l[q+B[0]],m[y+1]=l[q+B[1]],m[y+2]=l[q+B[2]],g[A]=l[q+C[0]]+s,g[A+1]=l[q+C[1]]+s,g[A+2]=l[q+C[2]]+s,y+=3,A+=3,q+=3}function f(t,o,n,c,e,s,l,r,f,a,g){o??=[],n??=[],c??=[];let m=e,p=e+1,x=e+l,L=e+l+1,b=r,j=r+1,v=r+2*s,d=r+2*s+1;g<0&&(m=e+l+1,L=e);let k=3*a;for(let q=0;q<s;++q)q===s-1&&(p=e,g>0?L=e+l:m=e+l),i(t,m,p,x,h),u(t,o,c,n,h,b,m),u(t,o,c,n,h,j,p),u(t,o,c,n,h,v,x),u(t,o,c,n,h,d,L),f[k]=b,f[k+1]=v,f[k+2]=d,f[k+3]=b,f[k+4]=d,f[k+5]=j,k+=6,m++,p++,x++,L++,b+=2,j+=2,v+=2,d+=2}function i(t,s,l,r,f){s*=3,l*=3,r*=3,n(a,t[s++],t[s++],t[s++]),n(g,t[l++],t[l++],t[l++]),n(m,t[r++],t[r++],t[r++]),c(p,g,a),c(x,m,a),e(f,x,p),o(f,f)}function u(t,o,n,c,e,s,l){c[s]=c[l],l*=3,t[s*=3]=t[l],t[s+1]=t[l+1],t[s+2]=t[l+2],o[s]=o[l],o[s+1]=o[l+1],o[s+2]=o[l+2],n[s]=e[0],n[s+1]=e[1],n[s+2]=e[2]}const h=s(),a=s(),g=s(),m=s(),p=s(),x=s(),L=s(),b=[0,2,1],j=[0,1,2];export{l as extrudePolygon};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import"../../../../core/has.js";import"../../../../core/Logger.js";import{e as t}from"../../../../chunks/earcut.js";import{loadLibtessF64 as n,isLibtessF64Loaded as e,triangulateIndexedF64 as o}from"../../../../geometry/libtess.js";import{isClockwise as i}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as s,doubleSubArray as r}from"../../../../geometry/support/DoubleArray.js";import{compactMeshIndices as l,newIndexArray as u}from"../../../../geometry/support/Indices.js";import{leastSignificantAxis as c}from"../../../../geometry/support/polygonUtils.js";const h=1e-5,g=100,f={method:"auto",projectionAxis:void 0,outlines:void 0};function d(t,n){const{hasZ:e,ccwRingsAsHoles:o,spatialReference:i}=n,l=n.axis??p(t,e,i),u=t.length,c=new Array(u),h=new Array(u),g=new Array(u),f=t.reduce((t,n)=>t+n.length,0);let d=0,m=0,x=0;const y=s(3*f);let L=0;for(let s=u-1;s>=0;s--){const n=t[s];if(B(n,e)<3)continue;const i=!!o&&a(n,e,l);if(i&&1!==u)c[d++]=n;else{let t=n.length;for(let n=0;n<d;++n)t+=c[n].length;const o={index:L,pathLengths:new Array(d+1),count:t,holeIndices:new Array(d)};o.pathLengths[0]=n.length,n.length>0&&(g[x++]={index:L,count:n.length}),L=i?R(n,n.length-1,-1,y,L,n.length,e):R(n,0,1,y,L,n.length,e);for(let n=0;n<d;++n){const t=c[n];o.holeIndices[n]=L,o.pathLengths[n+1]=t.length,t.length>0&&(g[x++]={index:L,count:t.length}),L=R(t,0,1,y,L,t.length,e)}d=0,o.count>0&&(h[m++]=o)}}h.length=m,g.length=x;return{positions:3*L===y.length?y:r(y,0,3*L),polygons:h,outlines:g}}function p(t,n,e){if(!n)return 2;const o=t.map(t=>{const o=B(t,n);return o<3?2:c(t,o,e)}),i=o[0];return o.every(t=>t===i)?i:2}function a(t,n,e){if(!n)return!i(t);if(t.length<3)return!1;switch(e){case 0:return!i(t,1,2);case 1:return!i(t,0,2);case 2:return!i(t,0,1)}}async function m(){try{await n()}catch(t){}}function x(t,n){const e={...f,...n},{projectionAxis:o}=e,i=null!=o&&2!==o;i&&v(t.positions,o,2);const s=y(t,e);if(i){const n=s.succeeded?s.positions:null;null!=n&&n!==t.positions&&v(n,2,o),v(t.positions,2,o)}return s.succeeded,s}function y(n,e){if("libtess"===e.method||"auto"===e.method&&j(n)>g)return L(n,e);const o=Array();let i=0;for(const l of n.polygons){const s=w(n.positions,l),r=(l.holeIndices??[]).map(t=>t-l.index),u=r.length>0?r:null,c=t(s,u,3),g=t.deviation(s,r,3,c);if("auto"===e.method&&g>h)return L(n,e);for(let t=0;t<c.length;t++)o.push(c[t]+l.index);i=Math.max(i,g)}const{outlineIndexBuffer:s,outlineRingLengths:r}=null!=e.outlines?A(e.outlines,n.positions):{outlineIndexBuffer:void 0,outlineRingLengths:void 0};return{succeeded:!0,positions:n.positions,indices:l(o),outlineIndexBuffer:s,outlineRingLengths:r,vertexCount:n.positions.length/3,method:"earcut",deviation:i}}function L(t,n){if(!e())return C("Libtess not loaded");const i=null!=n.outlines,s=I(t.polygons),{vertices:r,indices:l,outlineIndices:u,outlineRingLengths:c}=o(t.positions,s,3,i);return r.length%3!=0?C("positions length is not multiple of 3"):{succeeded:!0,positions:r,indices:l,outlineIndexBuffer:i?u:void 0,outlineRingLengths:i?c:void 0,vertexCount:r.length/3,method:"libtess"}}function v(t,n,e){for(let o=0;o<t.length;o+=3){const i=t[o+n];t[o+n]=t[o+e],t[o+e]=i}}function A(t,n){const e=u(t.length);let o=0;for(let r=0;r<t.length;r++){const i=t[r],s=i.count;if(s<=0){e[r]=0;continue}const l=3*i.index,u=3*(i.index+s-1),c=s>1&&n[l]===n[u]&&n[l+1]===n[u+1]&&n[l+2]===n[u+2]?s-1:s,h=c>0?c+1:0;e[r]=h,o+=h}const i=u(o);let s=0;for(let r=0;r<t.length;r++){const n=e[r];if(0===n)continue;const o=t[r].index,l=n-1;for(let t=0;t<l;t++)i[s++]=o+t;i[s++]=o}return{outlineIndexBuffer:i,outlineRingLengths:e}}function I(t){const n=t.reduce((t,n)=>t+n.pathLengths.length,0),e=new Array(n);let o=0;for(let i=0;i<t.length;i++){const n=t[i].pathLengths;for(let t=0;t<n.length;t++)e[o++]=n[t]}return e}function j(t){return t.polygons.reduce((t,n)=>{if(null==n.holeIndices)return t;if(0===n.pathLengths.length)return t;let e=0;for(let o=0;o<n.pathLengths.length;o++)e+=n.pathLengths[o];return t+(e-n.pathLengths[0])},0)}function w(t,{index:n,count:e}){return r(t,3*n,3*e)}function R(t,n,e,o,i,s,r){i*=3;for(let l=0;l<s;++l){const s=t[n];o[i++]=s[0],o[i++]=s[1],o[i++]=r&&null!=s[2]?s[2]:0,n+=e}return i/3}function b(t,n){const e=t.length;if(e<2)return!1;const o=t[0],i=t[e-1];return o[0]===i[0]&&o[1]===i[1]&&(!n||o[2]===i[2])}function B(t,n){return b(t,n)?t.length-1:t.length}function C(t){return{succeeded:!1,message:t}}export{p as axisFromRings,a as isCounterClockwise,m as load,d as ringsToOutlinedTessellationInfo,x as tessellate};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{makeHandle as e}from"../../../../core/handleUtils.js";import{Object3DHighlightStateID as t}from"../../webgl-engine/lib/Object3DStateID.js";class i{constructor(e){this._context=e,this._highlights=new Map}get empty(){return 0===this._highlights.size}destroy(){this._highlights=null}add(t,i){const s=new h(t,i),d=this._highlights.get(i);return d?d.add(s):this._highlights.set(i,new Set([s])),this._enableSet(s),e(()=>this._removeSet(s))}_removeSet(e){this._disableSet(e);const{highlightName:t}=e.id,i=this._highlights.get(t);i&&(i.delete(e),0===i.size&&this._highlights.delete(t))}_enableSet(e){e.enabled||(e.enabled=!0,this._context.forEachNode(t=>this._enableSetForNode(e,t)))}_enableSetForNode(e,t){if(!e.enabled)return;const i=e.ids.get(t.id);i&&i.forEach(i=>this._context.addHighlight(t,i,e.id))}_disableSet(e){e.enabled&&(e.enabled=!1,this._context.forEachNode(t=>this._disableSetForNode(e,t)))}_disableSetForNode(e,t){e.enabled||this._context.removeHighlight(t,e.id)}nodeAdded(e){this._forEachSet(t=>this._enableSetForNode(t,e))}nodeRemoved(e){this._forEachSet(t=>this._disableSetForNode(t,e))}removeAll(){this._forEachSet(e=>this._disableSet(e))}_forEachSet(e){this._highlights.forEach(t=>t.forEach(e))}has(e){return this._highlights.has(e)}}class h{constructor(e,i){this.ids=new Map,this.enabled=!1;for(const t of e)null!=t&&this._add(t.nodeId,t.pointId);this.id=new t(i)}_add(e,t){const i=this.ids.get(e);i?i.add(t):this.ids.set(e,new Set([t]))}}export{i as PointCloudHighlights};
2
+ import{makeHandle as e}from"../../../../core/handleUtils.js";import{Object3DHighlightStateID as t}from"../../webgl-engine/lib/Object3DStateID.js";class i{constructor(e){this._context=e,this._highlights=new Map}get empty(){return 0===this._highlights.size}destroy(){this._highlights=null}add(t,i){const s=new h(t,i),d=this._highlights.get(i);return d?d.add(s):this._highlights.set(i,new Set([s])),this._enableSet(s),e(()=>this._removeSet(s))}_removeSet(e){this._disableSet(e);const{highlightName:t}=e.id,i=this._highlights.get(t);i&&(i.delete(e),0===i.size&&this._highlights.delete(t))}_enableSet(e){e.enabled||(e.enabled=!0,this._context.forEachNode(t=>this._enableSetForNode(e,t)))}_enableSetForNode(e,t){if(!e.enabled)return;const i=e.ids.get(t.id);i&&this._context.addHighlights(t,i,e.id)}_disableSet(e){e.enabled&&(e.enabled=!1,this._context.forEachNode(t=>this._disableSetForNode(e,t)))}_disableSetForNode(e,t){e.enabled||this._context.removeHighlight(t,e.id)}nodeAdded(e){this._forEachSet(t=>this._enableSetForNode(t,e))}nodeRemoved(e){this._forEachSet(t=>this._disableSetForNode(t,e))}removeAll(){this._forEachSet(e=>this._disableSet(e))}_forEachSet(e){this._highlights.forEach(t=>t.forEach(e))}has(e){return this._highlights.has(e)}}class h{constructor(e,i){this.ids=new Map,this.enabled=!1;for(const t of e)null!=t&&this._add(t.nodeId,t.pointId);this.id=new t(i)}_add(e,t){const i=this.ids.get(e);i?i.add(t):this.ids.set(e,new Set([t]))}}export{i as PointCloudHighlights};