@arcgis/core 4.28.0-next.20230818 → 4.28.0-next.20230821

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 (200) hide show
  1. package/arcade/functions/centroid.js +1 -1
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/003744a45b07865f1be9.js +1 -0
  4. package/assets/esri/core/workers/chunks/034accc7cab6c88a3b31.js +1 -0
  5. package/assets/esri/core/workers/chunks/05ab09713d599687afa3.js +1 -0
  6. package/assets/esri/core/workers/chunks/{3724f23b6f5ac8ec2568.js → 12b8fe0374fa9ab4ca09.js} +1 -1
  7. package/assets/esri/core/workers/chunks/16d1a72014074e87ecb9.js +1 -0
  8. package/assets/esri/core/workers/chunks/{e4b6565c16430b28ad93.js → 19857e5420cdf23c5f2e.js} +1 -1
  9. package/assets/esri/core/workers/chunks/{1a804dea42c0fb5e5c07.js → 1bab408eaffd2c18976d.js} +1 -1
  10. package/assets/esri/core/workers/chunks/201365f53509e3f78e17.js +1 -0
  11. package/assets/esri/core/workers/chunks/{2031451b82ff70fb201a.js → 2f48f4a9a0a056ac5e1c.js} +1 -1
  12. package/assets/esri/core/workers/chunks/318b51fdee09c1fd750f.js +1 -0
  13. package/assets/esri/core/workers/chunks/{5b799dc155adeb728c74.js → 3361e3e8385f8de8820c.js} +1 -1
  14. package/assets/esri/core/workers/chunks/3ce1870c28ab6ac3648e.js +1 -0
  15. package/assets/esri/core/workers/chunks/41929e4531787389804b.js +1 -0
  16. package/assets/esri/core/workers/chunks/{55ac725127c5ea9fb942.js → 4e39252f40bc57be9d12.js} +1 -1
  17. package/assets/esri/core/workers/chunks/4e496b03ce24b1206f86.js +1 -0
  18. package/assets/esri/core/workers/chunks/{ee5f17c1790dc07f9d9e.js → 50455c84131b634ca6b4.js} +1 -1
  19. package/assets/esri/core/workers/chunks/54513578f735d274a20e.js +1 -0
  20. package/assets/esri/core/workers/chunks/{d46f8ef92e79d12384c9.js → 587437526ea77f764986.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{ab720e2f0a35138564b2.js → 5ffabd1a90c5b08109aa.js} +1 -1
  22. package/assets/esri/core/workers/chunks/6108d72faf48a592c8ba.js +1 -0
  23. package/assets/esri/core/workers/chunks/6479439afae01f9bb5e6.js +1 -0
  24. package/assets/esri/core/workers/chunks/69306dfc89e877539223.js +1 -0
  25. package/assets/esri/core/workers/chunks/6db4a6f9d25691830829.js +1 -0
  26. package/assets/esri/core/workers/chunks/{61393fd3376ea599a447.js → 76e27cece1559ae815df.js} +1 -1
  27. package/assets/esri/core/workers/chunks/81526909c0fa11639038.js +1 -0
  28. package/assets/esri/core/workers/chunks/873111ddf4813cdd4903.js +1 -0
  29. package/assets/esri/core/workers/chunks/8d4f1170394a8be15da9.js +1 -0
  30. package/assets/esri/core/workers/chunks/8d8bdfda09c24e363f78.js +1 -0
  31. package/assets/esri/core/workers/chunks/9b54b5bdb6367c36f6e9.js +1 -0
  32. package/assets/esri/core/workers/chunks/b2752e038c5fa3c21e49.js +1 -0
  33. package/assets/esri/core/workers/chunks/{dd3b7cfc6f78552249a4.js → b78dc6cbe14e5817b4d9.js} +1 -1
  34. package/assets/esri/core/workers/chunks/{e31d0c7363cbceeb5ac9.js → c35b850fbfcb28133235.js} +1 -1
  35. package/assets/esri/core/workers/chunks/c83e1be4ee64320cf2fe.js +1 -0
  36. package/assets/esri/core/workers/chunks/c88869d2a647c22dc3e6.js +1 -0
  37. package/assets/esri/core/workers/chunks/cb0a5bc6deaa98026bb5.js +1 -0
  38. package/assets/esri/core/workers/chunks/{767467738aeabec14abd.js → d0c4367a197b193e95d4.js} +1 -1
  39. package/assets/esri/core/workers/chunks/{f113141e254505116b82.js → d1cc2c050423595e54e0.js} +1 -1
  40. package/assets/esri/core/workers/chunks/{7f34945036495ad7c3f8.js → d2a8bf2d090b94cb294b.js} +1 -1
  41. package/assets/esri/core/workers/chunks/{08af7f7f1950a59a8e47.js → d6c96a20e9640b433719.js} +4 -4
  42. package/assets/esri/core/workers/chunks/da5453e67d00ff546640.js +1 -0
  43. package/assets/esri/core/workers/chunks/daa79c14150c12d8bc3d.js +1 -0
  44. package/assets/esri/core/workers/chunks/ef03b78659c72de93076.js +1 -0
  45. package/assets/esri/core/workers/chunks/{c3cace5b25b5170228ba.js → f2fe89b6ac6bf6817e71.js} +1 -1
  46. package/assets/esri/core/workers/chunks/f3554627664a419e00fa.js +1 -0
  47. package/assets/esri/themes/base/_core.scss +2 -0
  48. package/assets/esri/themes/base/widgets/_DirectionalPad.scss +76 -0
  49. package/assets/esri/themes/base/widgets/_Editor.scss +65 -4
  50. package/assets/esri/themes/base/widgets/_UtilityNetworkAssociations.scss +97 -39
  51. package/assets/esri/themes/dark/main.css +1 -1
  52. package/assets/esri/themes/light/main.css +1 -1
  53. package/assets/esri/themes/light/view.css +1 -1
  54. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad.json +1 -0
  55. package/assets/esri/widgets/DirectionalPad/t9n/DirectionalPad_en.json +1 -0
  56. package/assets/esri/widgets/Editor/t9n/Editor.json +1 -1
  57. package/assets/esri/widgets/Editor/t9n/Editor_en.json +1 -1
  58. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/butt.png +0 -0
  59. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/round.png +0 -0
  60. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-caps/square.png +0 -0
  61. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash-dot.png +0 -0
  62. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dash.png +0 -0
  63. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/dot.png +0 -0
  64. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot-dot.png +0 -0
  65. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash-dot.png +0 -0
  66. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/long-dash.png +0 -0
  67. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot-dot.png +0 -0
  68. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash-dot.png +0 -0
  69. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dash.png +0 -0
  70. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/short-dot.png +0 -0
  71. package/assets/esri/widgets/UtilityNetworkAssociations/assets/img/line-patterns/solid.png +0 -0
  72. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations.json +1 -1
  73. package/assets/esri/widgets/UtilityNetworkAssociations/t9n/UtilityNetworkAssociations_en.json +1 -1
  74. package/chunks/HighlightBlur.glsl.js +3 -3
  75. package/chunks/HighlightDownsample.glsl.js +24 -6
  76. package/chunks/SSAO.glsl.js +2 -2
  77. package/core/timeUtils.js +1 -1
  78. package/interfaces.d.ts +182 -2
  79. package/intl/date.js +1 -1
  80. package/layers/FeatureLayer.js +1 -1
  81. package/layers/ImageryLayer.js +1 -1
  82. package/layers/ImageryTileLayer.js +1 -1
  83. package/layers/StreamLayer.js +1 -1
  84. package/layers/SubtypeGroupLayer.js +1 -1
  85. package/layers/VoxelWasmPerSceneView.js +1 -1
  86. package/layers/graphics/sources/support/uploads.js +1 -1
  87. package/layers/mixins/ArcGISImageService.js +1 -1
  88. package/layers/mixins/ImageryTileMixin.js +1 -1
  89. package/layers/save/featureLayerUtils.js +1 -1
  90. package/layers/save/imageryUtils.js +1 -1
  91. package/layers/save/streamLayerUtils.js +1 -1
  92. package/libs/maquette-advanced-projector/utils.js +1 -1
  93. package/package.json +1 -1
  94. package/popup/support/FieldInfoFormat.js +1 -1
  95. package/portal/PortalItem.js +1 -1
  96. package/support/revision.js +1 -1
  97. package/views/2d/navigation/MapViewNavigation.js +1 -1
  98. package/views/3d/environment/EnvironmentRenderer.js +1 -1
  99. package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
  100. package/views/3d/layers/i3s/PointRenderer.js +1 -1
  101. package/views/3d/support/LaserLineRenderer.js +1 -1
  102. package/views/3d/terrain/OverlayRenderer.js +1 -1
  103. package/views/3d/terrain/TerrainRenderer.js +1 -1
  104. package/views/3d/terrain/TerrainSurface.js +1 -1
  105. package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
  106. package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
  107. package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
  108. package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
  109. package/views/3d/webgl-engine/effects/highlight/ShadowHighlight.js +1 -1
  110. package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
  111. package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
  112. package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
  113. package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
  114. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  115. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  116. package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
  117. package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
  118. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  119. package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
  120. package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
  121. package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
  122. package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
  123. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  124. package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
  125. package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
  126. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  127. package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
  128. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  129. package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
  130. package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
  131. package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
  132. package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
  133. package/views/3d/webgl-engine/shaders/HighlightDownsample.glsl.js +1 -1
  134. package/views/draw/DrawGraphicTool.js +1 -1
  135. package/views/draw/DrawOperation.js +1 -1
  136. package/views/interactive/sketch/constraints.js +1 -1
  137. package/views/interactive/sketch/normalizedPoint.js +1 -1
  138. package/views/interactive/snapping/SnappingManager.js +1 -1
  139. package/views/interactive/snapping/candidates/IntersectionSnappingCandidate.js +1 -1
  140. package/views/interactive/tooltip/TooltipEditableField.js +1 -1
  141. package/views/interactive/tooltip/TooltipEditableFieldAngle.js +1 -1
  142. package/views/interactive/tooltip/constraintUtils.js +5 -0
  143. package/views/support/angularMeasurementUtils.js +1 -1
  144. package/widgets/Compass/CompassViewModel.js +1 -1
  145. package/widgets/Compass/utils.js +5 -0
  146. package/widgets/DirectionalPad/DirectionalPadViewModel.d.ts +4 -0
  147. package/widgets/DirectionalPad/DirectionalPadViewModel.js +5 -0
  148. package/widgets/DirectionalPad/VisibleElements.js +5 -0
  149. package/widgets/DirectionalPad/constants.js +5 -0
  150. package/widgets/DirectionalPad/css.js +5 -0
  151. package/widgets/DirectionalPad/utils.js +5 -0
  152. package/widgets/DirectionalPad.d.ts +4 -0
  153. package/widgets/DirectionalPad.js +5 -0
  154. package/widgets/Editor/EditorViewModel.js +1 -1
  155. package/widgets/Editor/Upload.js +1 -1
  156. package/widgets/Editor/components/CreateFeaturesPanelContent.js +1 -1
  157. package/widgets/Editor/components/UploadDetails.js +1 -1
  158. package/widgets/Editor/modelUploadUtils.js +1 -1
  159. package/widgets/Editor.js +1 -1
  160. package/widgets/ElevationProfile/support/chartUtils.js +1 -1
  161. package/widgets/ElevationProfile.js +1 -1
  162. package/widgets/Feature/FeatureViewModel.js +1 -1
  163. package/widgets/Feature/support/featureUtils.js +1 -1
  164. package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
  165. package/widgets/FeatureForm/FieldInput.js +1 -1
  166. package/widgets/FeatureForm/FormExpressionsManager.js +1 -1
  167. package/widgets/FeatureForm/InputBase.js +1 -1
  168. package/widgets/FeatureForm.js +1 -1
  169. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsLineSymbolPicker.js +5 -0
  170. package/widgets/UtilityNetworkAssociations/UtilityNetworkAssociationsViewModel.js +1 -1
  171. package/widgets/UtilityNetworkAssociations/VisibleElements.js +5 -0
  172. package/widgets/UtilityNetworkAssociations/VisibleElementsSettingsPane.js +5 -0
  173. package/widgets/UtilityNetworkAssociations.js +1 -1
  174. package/assets/esri/core/workers/chunks/11abbbf97093b55e2417.js +0 -1
  175. package/assets/esri/core/workers/chunks/1b2a081f2c3b97ba7e00.js +0 -1
  176. package/assets/esri/core/workers/chunks/235f333177ed7ea21e01.js +0 -1
  177. package/assets/esri/core/workers/chunks/3725dd14c2da0f47198f.js +0 -1
  178. package/assets/esri/core/workers/chunks/39467e1da18924cfb9b6.js +0 -1
  179. package/assets/esri/core/workers/chunks/42595c4870c673ed451c.js +0 -1
  180. package/assets/esri/core/workers/chunks/481cdd2a4bc40c6fef66.js +0 -1
  181. package/assets/esri/core/workers/chunks/54893132e70c515ea7e3.js +0 -1
  182. package/assets/esri/core/workers/chunks/6509a4198972b323d9b6.js +0 -1
  183. package/assets/esri/core/workers/chunks/68598d2806d4aa3d8acc.js +0 -1
  184. package/assets/esri/core/workers/chunks/718d2e8ea61f3b7b70c5.js +0 -1
  185. package/assets/esri/core/workers/chunks/7bce4b5eec630ef57f1e.js +0 -1
  186. package/assets/esri/core/workers/chunks/81df7304f97d1fc3ba16.js +0 -1
  187. package/assets/esri/core/workers/chunks/8706dc9f852df9b2095d.js +0 -1
  188. package/assets/esri/core/workers/chunks/8ef26aac0fe7feb8c324.js +0 -1
  189. package/assets/esri/core/workers/chunks/91e61da22f258d9e86c5.js +0 -1
  190. package/assets/esri/core/workers/chunks/9f039bf79b34d8fd75ae.js +0 -1
  191. package/assets/esri/core/workers/chunks/a1f3352301472e4b8956.js +0 -1
  192. package/assets/esri/core/workers/chunks/a20fd9e7db37b3c3b041.js +0 -1
  193. package/assets/esri/core/workers/chunks/aa83dce42d64034a0a13.js +0 -1
  194. package/assets/esri/core/workers/chunks/c8c8471b59700914ee9d.js +0 -1
  195. package/assets/esri/core/workers/chunks/cdcf0a5e05283d37b3ac.js +0 -1
  196. package/assets/esri/core/workers/chunks/d4f9106bf2ea5d66d96a.js +0 -1
  197. package/assets/esri/core/workers/chunks/e6bfbc4347fa13db4df2.js +0 -1
  198. package/assets/esri/core/workers/chunks/f1d5487f2d828fb142ba.js +0 -1
  199. package/assets/esri/core/workers/chunks/f97f165d05439e668e05.js +0 -1
  200. package/assets/esri/core/workers/chunks/fe973d8155c22d73a4f9.js +0 -1
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as e}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as a}from"../core/shaderLibrary/shading/Normals.glsl.js";import s from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{isPathGeometry as n}from"../lib/PathGeometry.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as l,PathTechniqueConfiguration as d,PathTechnique as p,PathPassParameters as m}from"./PathTechnique.js";import{intersectAabbInvDir as f}from"./internal/MaterialUtil.js";class b extends o{constructor(e){super(e,new S),this.supportsEdges=!0,this._vertexAttributeLocations=l,this._configuration=new d,this._vertexBufferLayout=b.getVertexBufferLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==i.Color&&e!==i.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?a.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?a.WindingOrder:a.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=null!=t.ssao),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==i.Shadow&&e!==i.ShadowExcludeHighlight&&e!==i.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(r,i,a,s,o,h){const u=r;if(!n(u))return;const c=u.path,l=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:t,factor:r,minSize:i,maxSize:a}=this.parameters.vvSize,s=c.sizeAttributeValue;l[0]*=e(t[0]+s*r[0],i[0],a[0]),l[1]*=e(t[2]+s*r[2],i[2],a[2])}const d=Math.max(l[0],l[1]),p=r.boundingInfo;if(null==p)return void this._intersectTriangles(c,l,s,o,h);const m=t(p.bbMin[0]-d,p.bbMin[1]-d,p.bbMin[2]-d,p.bbMax[0]+d,p.bbMax[1]+d,p.bbMax[2]+d),b=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],g=Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2]),S=[g/b[0],g/b[1],g/b[2]];f(m,s,S,a.tolerance)&&this._intersectTriangles(c,l,s,o,h)}_intersectTriangles(e,t,r,i,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,a)}createBufferWriter(){return new c(this._vertexBufferLayout)}canRender(e,t){switch(t){case i.Shadow:case i.ShadowHighlight:case i.ShadowExcludeHighlight:if(!this.parameters.castShadows)return!1;case i.Color:case i.Alpha:case i.Depth:case i.Normal:case i.Highlight:case i.ObjectAndLayerIdColor:return e===(this.parameters.transparent?h.TRANSPARENT_MATERIAL:h.OPAQUE_MATERIAL)||e===h.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new g(e)}static getVertexBufferLayout(){return r().vec3f(u.POSITION).vec4f(u.PROFILERIGHT).vec4f(u.PROFILEUP).vec4f(u.PROFILEVERTEXANDNORMAL).vec4f(u.FEATUREVALUE)}}class g extends s{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){null!=this.technique&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==i.Color&&this._output!==i.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(p,e)}}class S extends m{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}export{b as PathMaterial,S as PathMaterialParameters};
5
+ import{clamp as e}from"../../../../core/mathUtils.js";import{fromValues as t}from"../../../../geometry/support/aaBoundingBox.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{NormalsDoubleSidedMode as a}from"../core/shaderLibrary/shading/Normals.glsl.js";import s from"../lib/GLMaterial.js";import{Material as o}from"../lib/Material.js";import{isPathGeometry as n}from"../lib/PathGeometry.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{vertexAttributeLocations as l,PathTechniqueConfiguration as d,PathTechnique as p,PathPassParameters as m}from"./PathTechnique.js";import{intersectAabbInvDir as f}from"./internal/MaterialUtil.js";class b extends o{constructor(e){super(e,new S),this.supportsEdges=!0,this._vertexAttributeLocations=l,this._configuration=new d,this._vertexBufferLayout=b.getVertexBufferLayout()}getConfiguration(e,t){return this._configuration.output=e,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasOccludees=this.parameters.hasOccludees,e!==i.Color&&e!==i.Alpha||(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?a.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?a.WindingOrder:a.None,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.receiveAmbientOcclusion=null!=t.ssao),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}isVisibleForOutput(e){return e!==i.Shadow&&e!==i.ShadowExcludeHighlight&&e!==i.ShadowHighlight||this.parameters.castShadows}isVisible(){return super.isVisible()&&this.parameters.opacity>0}intersect(r,i,a,s,o,h){const u=r;if(!n(u))return;const c=u.path,l=[this.parameters.size[0],this.parameters.size[1]];if(this.parameters.vvSize){const{offset:t,factor:r,minSize:i,maxSize:a}=this.parameters.vvSize,s=c.sizeAttributeValue;l[0]*=e(t[0]+s*r[0],i[0],a[0]),l[1]*=e(t[2]+s*r[2],i[2],a[2])}const d=Math.max(l[0],l[1]),p=r.boundingInfo;if(null==p)return void this._intersectTriangles(c,l,s,o,h);const m=t(p.bbMin[0]-d,p.bbMin[1]-d,p.bbMin[2]-d,p.bbMax[0]+d,p.bbMax[1]+d,p.bbMax[2]+d),b=[o[0]-s[0],o[1]-s[1],o[2]-s[2]],g=Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2]),S=[g/b[0],g/b[1],g/b[2]];f(m,s,S,a.tolerance)&&this._intersectTriangles(c,l,s,o,h)}_intersectTriangles(e,t,r,i,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(r,i,a)}createBufferWriter(){return new c(this._vertexBufferLayout)}produces(e,t){switch(t){case i.Shadow:case i.ShadowHighlight:case i.ShadowExcludeHighlight:if(!this.parameters.castShadows)return!1;case i.Color:case i.Alpha:case i.Depth:case i.Normal:case i.Highlight:case i.ObjectAndLayerIdColor:return e===(this.parameters.transparent?h.TRANSPARENT_MATERIAL:h.OPAQUE_MATERIAL)||e===h.DRAPED_MATERIAL;default:return!1}}createGLMaterial(e){return new g(e)}static getVertexBufferLayout(){return r().vec3f(u.POSITION).vec4f(u.PROFILERIGHT).vec4f(u.PROFILEUP).vec4f(u.PROFILEVERTEXANDNORMAL).vec4f(u.FEATUREVALUE)}}class g extends s{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}_updateShadowState(e){null!=this.technique&&e.shadowMap.enabled===this.technique.configuration.receiveShadows||this._material.setParameters({receiveShadows:e.shadowMap.enabled})}beginSlot(e){return this._output!==i.Color&&this._output!==i.Alpha||(this._updateShadowState(e),this._updateOccludeeState(e)),this.ensureTechnique(p,e)}}class S extends m{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.receiveShadows=!1,this.castShadows=!0,this.hasSlicePlane=!1,this.transparent=!1,this.hasOccludees=!1}}export{b as PathMaterial,S as PathMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{f as t}from"../../../../chunks/vec4f64.js";import{BufferViewMat3f as e,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as a}from"../lib/basicInterfaces.js";import o from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{assert as l}from"../lib/Util.js";import{VertexAttribute as u}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{Style as p}from"./PatternStyle.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{writeDefaultAttribute as d,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as _,PatternTechniqueConfiguration as A,PatternTechnique as T}from"../shaders/PatternTechnique.js";class b extends f{constructor(t){super(t,new P),this.supportsEdges=!0,this._vertexAttributeLocations=_,this._configuration=new A}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<n,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}canRender(t,e){if(e===s.Color||e===s.Alpha||e===s.Highlight||e===s.Depth&&this.parameters.writeLinearDepth){if(t===h.DRAPED_MATERIAL)return!0;if(e===s.Highlight)return t===h.OPAQUE_MATERIAL;return t===(this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return!1}createGLMaterial(t){return new E(t)}createBufferWriter(){const t=i().vec3f(u.POSITION).vec4f(u.UVMAPSPACE);return this.parameters.draped||t.mat3f(u.BOUNDINGRECT),this.parameters.vvColor?t.f32(u.COLORFEATUREATTRIBUTE):t.vec4u8(u.COLOR),new O(t)}}class E extends o{_updateParameters(t){return this.ensureTechnique(T,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:t.hasOccludees})}beginSlot(t){return this._output!==s.Color&&this._output!==s.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class O extends c{write(t,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const h=s.vertexAttributes.get(n),c=s.indices.get(n);if(h&&c)switch(n){case u.UVMAPSPACE:{l(4===h.size);const t=a.getField(n,r);t&&g(c,h.data,t,o);break}case u.BOUNDINGRECT:{l(9===h.size);const r=a.getField(n,e);r&&this.writeBoundingRect(c,h.data,t,r,o);break}default:d(n,h,c,t,i,a,o)}}}writeBoundingRect(t,e,r,i,s){const a=r,o=i.typedBuffer,n=i.typedBufferStride,h=t.length;s*=n;for(let l=0;l<h;++l){const r=9*t[l],i=e[r],h=e[r+1],u=e[r+2];o[s]=a[0]*i+a[4]*h+a[8]*u+a[12],o[s+1]=a[1]*i+a[5]*h+a[9]*u+a[13],o[s+2]=a[2]*i+a[6]*h+a[10]*u+a[14];for(let t=3;t<9;++t)o[s+t]=e[r+t];s+=n}}}class P extends m{constructor(){super(...arguments),this.color=t(1,1,1,1),this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=a.None,this.hasOccludees=!1,this.style=p.Cross,this.patternSpacing=10,this.lineWidth=1,this.draped=!0}}export{P as Parameters,b as PatternMaterial};
5
+ import{f as t}from"../../../../chunks/vec4f64.js";import{BufferViewMat3f as e,BufferViewVec4f as r}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as i}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as s}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as a}from"../lib/basicInterfaces.js";import o from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as n}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{assert as u}from"../lib/Util.js";import{VertexAttribute as l}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{Style as p}from"./PatternStyle.js";import{TriangleMaterial as f}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{writeDefaultAttribute as d,writeBufferVec4 as g}from"./internal/bufferWriterUtils.js";import{vertexAttributeLocations as _,PatternTechniqueConfiguration as A,PatternTechnique as T}from"../shaders/PatternTechnique.js";class b extends f{constructor(t){super(t,new P),this.supportsEdges=!0,this._vertexAttributeLocations=_,this._configuration=new A}getConfiguration(t,e){return this._configuration.output=t,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.style=this.parameters.style,this._configuration.patternSpacing=this.parameters.patternSpacing,this._configuration.lineWidth=this.parameters.lineWidth,this._configuration.draped=this.parameters.draped,this._configuration.transparencyPassType=e.transparencyPassType,this._configuration.enableOffset=e.camera.relativeElevation<n,this._configuration.multipassEnabled=e.multipassEnabled,this._configuration.cullAboveGround=e.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration}produces(t,e){if(e===s.Color||e===s.Alpha||e===s.Highlight||e===s.Depth&&this.parameters.writeLinearDepth){if(t===h.DRAPED_MATERIAL)return!0;if(e===s.Highlight)return t===h.OPAQUE_MATERIAL;return t===(this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return!1}createGLMaterial(t){return new E(t)}createBufferWriter(){const t=i().vec3f(l.POSITION).vec4f(l.UVMAPSPACE);return this.parameters.draped||t.mat3f(l.BOUNDINGRECT),this.parameters.vvColor?t.f32(l.COLORFEATUREATTRIBUTE):t.vec4u8(l.COLOR),new O(t)}}class E extends o{_updateParameters(t){return this.ensureTechnique(T,t)}_updateOccludeeState(t){t.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:t.hasOccludees})}beginSlot(t){return this._output!==s.Color&&this._output!==s.Alpha||this._updateOccludeeState(t),this._updateParameters(t)}}class O extends c{write(t,i,s,a,o){for(const n of this.vertexBufferLayout.fields.keys()){const h=s.vertexAttributes.get(n),c=s.indices.get(n);if(h&&c)switch(n){case l.UVMAPSPACE:{u(4===h.size);const t=a.getField(n,r);t&&g(c,h.data,t,o);break}case l.BOUNDINGRECT:{u(9===h.size);const r=a.getField(n,e);r&&this.writeBoundingRect(c,h.data,t,r,o);break}default:d(n,h,c,t,i,a,o)}}}writeBoundingRect(t,e,r,i,s){const a=r,o=i.typedBuffer,n=i.typedBufferStride,h=t.length;s*=n;for(let u=0;u<h;++u){const r=9*t[u],i=e[r],h=e[r+1],l=e[r+2];o[s]=a[0]*i+a[4]*h+a[8]*l+a[12],o[s+1]=a[1]*i+a[5]*h+a[9]*l+a[13],o[s+2]=a[2]*i+a[6]*h+a[10]*l+a[14];for(let t=3;t<9;++t)o[s+t]=e[r+t];s+=n}}}class P extends m{constructor(){super(...arguments),this.color=t(1,1,1,1),this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=a.None,this.hasOccludees=!1,this.style=p.Cross,this.patternSpacing=10,this.lineWidth=1,this.draped=!0}}export{P as Parameters,b as PatternMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as i}from"../../../../chunks/vec2.js";import{s,g as a,d as n,b as o,e as l,i as c,l as u,h,m as p}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{O as f}from"../../../../chunks/vec4f64.js";import{PlaneIndex as T}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as d,fromPoints as A,closestLineSegmentPoint as E}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as R,signedDistance as I,normal as g}from"../../../../geometry/support/plane.js";import{newLayout as S}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import b from"../lib/GLMaterial.js";import{Material as P,RenderOccludedFlag as L}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{VertexAttribute as y}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as j}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as D}from"../shaders/LineMarkerTechniqueConfiguration.js";import{R as U}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as x,RibbonLineTechnique as F}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as w,CapType as J}from"../shaders/RibbonLineTechniqueConfiguration.js";var M;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(M||(M={}));class B extends P{constructor(e){super(e,new G),this._configuration=new w,this._vertexAttributeLocations=x}isClosed(e,t){return Z(this.parameters,e,t)}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==O.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&W(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===L.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,i,s,a,n){if(!i.options.selectionMode)return;const o=e.vertexAttributes.get(y.POSITION).data,l=e.vertexAttributes.get(y.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const u=s[0],h=s[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let T=0;T<o.length-5;T+=3){const e=o[T],r=o[T+1],i=u-e,s=h-r,a=o[T+3]-e,n=o[T+4]-r,l=t((a*i+n*s)/(a*a+n*n),0,1),c=a*l-i,p=n*l-s,_=c*c+p*p;_<m&&(m=_,f=T/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,_,v){if(!m.options.selectionMode||!r.visible)return;if(!C(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const S=r.vertexAttributes,O=S.get(y.POSITION).data;let b=this.parameters.width;if(this.parameters.vvSize){const e=S.get(y.SIZEFEATUREATTRIBUTE).data[0];b*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else S.has(y.SIZE)&&(b*=S.get(y.SIZE).data[0]);const P=m.camera,L=K;i(L,m.point);const N=b*P.pixelRatio/2+4*P.pixelRatio;s(le[0],L[0]-N,L[1]+N,0),s(le[1],L[0]+N,L[1]+N,0),s(le[2],L[0]+N,L[1]-N,0),s(le[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(le[e],ce[e]))return;R(P.eye,ce[0],ce[1],ue),R(P.eye,ce[1],ce[2],he),R(P.eye,ce[2],ce[3],pe),R(P.eye,ce[3],ce[0],me);let j=Number.MAX_VALUE,D=0;const U=V(this.parameters,S,r.indices)?O.length-2:O.length-5;for(let e=0;e<U;e+=3){X[0]=O[e]+p[12],X[1]=O[e+1]+p[13],X[2]=O[e+2]+p[14];const t=(e+3)%O.length;if(Y[0]=O[t]+p[12],Y[1]=O[t+1]+p[13],Y[2]=O[t+2]+p[14],I(ue,X)<0&&I(ue,Y)<0||I(he,X)<0&&I(he,Y)<0||I(pe,X)<0&&I(pe,Y)<0||I(me,X)<0&&I(me,Y)<0)continue;if(P.projectToRenderScreen(X,$),P.projectToRenderScreen(Y,ee),$[2]<0&&ee[2]>0){a(q,X,Y);const e=P.frustum,t=-I(e[T.NEAR],X)/n(q,g(e[T.NEAR]));o(q,q,t),l(X,X,q),P.projectToRenderScreen(X,$)}else if($[2]>0&&ee[2]<0){a(q,Y,X);const e=P.frustum,t=-I(e[T.NEAR],Y)/n(q,g(e[T.NEAR]));o(q,q,t),l(Y,Y,q),P.projectToRenderScreen(Y,ee)}else if($[2]<0&&ee[2]<0)continue;$[2]=0,ee[2]=0;const r=d(A($,ee,ie),L);r<j&&(j=r,c(te,X),c(re,Y),D=e/3)}const x=m.rayBegin,F=m.rayEnd;if(j<N*N){let e=Number.MAX_VALUE;if(E(A(te,re,ie),A(x,F,se),Q)){a(Q,Q,x);const t=u(Q);o(Q,Q,1/t),e=t/h(x,F)}v(e,Q,D,!1)}}get _layout(){const e=S().vec3f(y.POSITION).f32(y.SUBDIVISIONFACTOR).vec2f(y.UV0).vec3f(y.AUXPOS1).vec3f(y.AUXPOS2);return this.parameters.vvSize?e.f32(y.SIZEFEATUREATTRIBUTE):e.f32(y.SIZE),this.parameters.vvColor?e.f32(y.COLORFEATUREATTRIBUTE):e.vec4f(y.COLOR),this.parameters.vvOpacity&&e.f32(y.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(y.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new H(this._layout,this.parameters)}canRender(e,t){if(t===O.Color||t===O.Alpha||t===O.Highlight||t===O.Depth||t===O.ObjectAndLayerIdColor){if(e===N.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===L.OccludeAndTransparentStencil)return e===N.OPAQUE_MATERIAL||e===N.OCCLUDER_MATERIAL||e===N.TRANSPARENT_OCCLUDER_MATERIAL;if(t===O.Color||t===O.Alpha){return e===(this.parameters.writeDepth?N.TRANSPARENT_MATERIAL:N.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===N.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new z(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class z extends b{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==O.Color&&this._output!==O.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(F,e)}}class G extends j{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=J.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class H{constructor(e,t){this._parameters=t,this.numJoinSubdivisions=0,this.vertexBufferLayout=e;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=U+r}}_isClosed(e){return V(this._parameters,e.vertexAttributes,e.indices)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.indices.get(y.POSITION).length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,a){const n=ae,o=ne,l=oe,u=r.vertexAttributes.get(y.POSITION).data,m=r.indices&&r.indices.get(y.POSITION),f=r.vertexAttributes.get(y.DISTANCETOSTART)?.data;m&&m.length!==2*(u.length/3-1)&&console.warn("RibbonLineMaterial does not support indices");let T=1,_=0;this._parameters.vvSize?_=r.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.SIZE)&&(T=r.vertexAttributes.get(y.SIZE).data[0]);let d=[1,1,1,1],A=0;this._parameters.vvColor?A=r.vertexAttributes.get(y.COLORFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.COLOR)&&(d=r.vertexAttributes.get(y.COLOR).data);const E=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null;let v=0;this._parameters.vvOpacity&&(v=r.vertexAttributes.get(y.OPACITYFEATUREATTRIBUTE).data[0]);const R=u.length/3,I=new Float32Array(i.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(i.buffer):null,S=this.vertexBufferLayout.stride/4;let O=a*S;const b=O;let P=0;const L=f?(e,t,r)=>P=f[r]:(e,t,r)=>P+=h(e,t),N=has("enable-feature:objectAndLayerId-rendering"),C=(e,t,r,i,s,a,n)=>{if(I[O++]=t[0],I[O++]=t[1],I[O++]=t[2],I[O++]=i,I[O++]=n,I[O++]=s,I[O++]=e[0],I[O++]=e[1],I[O++]=e[2],I[O++]=r[0],I[O++]=r[1],I[O++]=r[2],I[O++]=this._parameters.vvSize?_:T,this._parameters.vvColor)I[O++]=A;else{const e=Math.min(4*a,d.length-4);I[O++]=d[e],I[O++]=d[e+1],I[O++]=d[e+2],I[O++]=d[e+3]}this._parameters.vvOpacity&&(I[O++]=v),N&&(null!=E&&(g[4*O]=E[0],g[4*O+1]=E[1],g[4*O+2]=E[2],g[4*O+3]=E[3]),O++)};O+=S,s(o,u[0],u[1],u[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=u.length-3;s(n,u[t],u[t+1],u[t+2]),e&&p(n,n,e)}else s(l,u[3],u[4],u[5]),e&&p(l,l,e),C(o,o,l,1,M.LEFT_CAP_START,0,0),C(o,o,l,1,M.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const D=j?0:1,U=j?R:R-1;for(let h=D;h<U;h++){const t=(h+1)%R*3;s(l,u[t],u[t+1],u[t+2]),e&&p(l,l,e),L(n,o,h),C(n,o,l,0,M.LEFT_JOIN_END,h,P),C(n,o,l,0,M.RIGHT_JOIN_END,h,P);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);C(n,o,l,t,M.LEFT_JOIN_END,h,P),C(n,o,l,t,M.RIGHT_JOIN_END,h,P)}C(n,o,l,1,M.LEFT_JOIN_START,h,P),C(n,o,l,1,M.RIGHT_JOIN_START,h,P),c(n,o),c(o,l)}j?(s(l,u[3],u[4],u[5]),e&&p(l,l,e),P=L(n,o,U),C(n,o,l,0,M.LEFT_JOIN_END,D,P),C(n,o,l,0,M.RIGHT_JOIN_END,D,P)):(P=L(n,o,U),C(n,o,o,0,M.LEFT_CAP_END,U,P),C(n,o,o,0,M.RIGHT_CAP_END,U,P)),k(I,b+S,I,b,S);O=k(I,O-S,I,O,S),this._parameters.wireframe&&this._addWireframeVertices(i,b,O,S)}_addWireframeVertices(e,t,r,i){const s=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=k(a,e,s,n,i);for(let l=0;l<a.length-1;l+=2*i)o(l),o(l+2*i),o(l+1*i),o(l+2*i),o(l+1*i),o(l+3*i)}}function k(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function V(e,t,r){return Z(e,t.get(y.POSITION).data,r?r.get(y.POSITION):null)}function Z(e,t,r){return!!e.isClosed&&(r?r.length>2:t.length>6)}function W(e){return e.anchor===D.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const X=m(),Y=m(),q=m(),Q=m(),K=m(),$=r(),ee=r(),te=m(),re=m(),ie=_(),se=_(),ae=m(),ne=m(),oe=m(),le=[r(),r(),r(),r()],ce=[m(),m(),m(),m()],ue=v(),he=v(),pe=v(),me=v();export{G as Parameters,B as RibbonLineMaterial};
5
+ import has from"../../../../core/has.js";import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{j as s}from"../../../../chunks/vec2.js";import{s as i,g as a,d as n,b as o,e as l,i as c,l as u,h,m as p}from"../../../../chunks/vec3.js";import{c as m}from"../../../../chunks/vec3f64.js";import{O as f}from"../../../../chunks/vec4f64.js";import{PlaneIndex as T}from"../../../../geometry/support/frustum.js";import{create as _,distance2 as d,fromPoints as A,closestLineSegmentPoint as E}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as R,signedDistance as I,normal as g}from"../../../../geometry/support/plane.js";import{newLayout as S}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as O}from"../core/shaderLibrary/ShaderOutput.js";import b from"../lib/GLMaterial.js";import{Material as P,RenderOccludedFlag as L}from"../lib/Material.js";import{RenderSlot as N}from"../lib/RenderSlot.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{VertexAttribute as y}from"../lib/VertexAttribute.js";import{VisualVariablePassParameters as j}from"./VisualVariablePassParameters.js";import{LineMarkerAnchor as D}from"../shaders/LineMarkerTechniqueConfiguration.js";import{R as U}from"../../../../chunks/RibbonLine.glsl.js";import{vertexAttributeLocations as x,RibbonLineTechnique as F}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as w,CapType as J}from"../shaders/RibbonLineTechniqueConfiguration.js";var M;!function(e){e[e.LEFT_JOIN_START=-2]="LEFT_JOIN_START",e[e.LEFT_JOIN_END=-1]="LEFT_JOIN_END",e[e.LEFT_CAP_START=-4]="LEFT_CAP_START",e[e.LEFT_CAP_END=-5]="LEFT_CAP_END",e[e.RIGHT_JOIN_START=2]="RIGHT_JOIN_START",e[e.RIGHT_JOIN_END=1]="RIGHT_JOIN_END",e[e.RIGHT_CAP_START=4]="RIGHT_CAP_START",e[e.RIGHT_CAP_END=5]="RIGHT_CAP_END"}(M||(M={}));class B extends P{constructor(e){super(e,new G),this._configuration=new w,this._vertexAttributeLocations=x}isClosed(e,t){return Z(this.parameters,e,t)}getConfiguration(e,t){this._configuration.output=e,this._configuration.draped=t.slot===N.DRAPED_MATERIAL;const r=null!=this.parameters.stipplePattern&&e!==O.Highlight;return this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&W(this.parameters.markerParameters),this._configuration.hasPolygonOffset=this.parameters.hasPolygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.vvOpacity=!!this.parameters.vvOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.occluder=this.parameters.renderOccluded===L.OccludeAndTransparentStencil,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.wireframe=this.parameters.wireframe,this._configuration}intersectDraped(e,r,s,i,a,n){if(!s.options.selectionMode)return;const o=e.vertexAttributes.get(y.POSITION).data,l=e.vertexAttributes.get(y.SIZE);let c=this.parameters.width;if(this.parameters.vvSize){const r=e.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0];c*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else l&&(c*=l.data[0]);const u=i[0],h=i[1],p=(c/2+4)*e.screenToWorldRatio;let m=Number.MAX_VALUE,f=0;for(let T=0;T<o.length-5;T+=3){const e=o[T],r=o[T+1],s=u-e,i=h-r,a=o[T+3]-e,n=o[T+4]-r,l=t((a*s+n*i)/(a*a+n*n),0,1),c=a*l-s,p=n*l-i,_=c*c+p*p;_<m&&(m=_,f=T/3)}m<p*p&&a(n.dist,n.normal,f,!1)}intersect(r,p,m,f,_,v){if(!m.options.selectionMode||!r.visible)return;if(!C(p))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const S=r.vertexAttributes,O=S.get(y.POSITION).data;let b=this.parameters.width;if(this.parameters.vvSize){const e=S.get(y.SIZEFEATUREATTRIBUTE).data[0];b*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else S.has(y.SIZE)&&(b*=S.get(y.SIZE).data[0]);const P=m.camera,L=K;s(L,m.point);const N=b*P.pixelRatio/2+4*P.pixelRatio;i(le[0],L[0]-N,L[1]+N,0),i(le[1],L[0]+N,L[1]+N,0),i(le[2],L[0]+N,L[1]-N,0),i(le[3],L[0]-N,L[1]-N,0);for(let e=0;e<4;e++)if(!P.unprojectFromRenderScreen(le[e],ce[e]))return;R(P.eye,ce[0],ce[1],ue),R(P.eye,ce[1],ce[2],he),R(P.eye,ce[2],ce[3],pe),R(P.eye,ce[3],ce[0],me);let j=Number.MAX_VALUE,D=0;const U=V(this.parameters,S,r.indices)?O.length-2:O.length-5;for(let e=0;e<U;e+=3){X[0]=O[e]+p[12],X[1]=O[e+1]+p[13],X[2]=O[e+2]+p[14];const t=(e+3)%O.length;if(Y[0]=O[t]+p[12],Y[1]=O[t+1]+p[13],Y[2]=O[t+2]+p[14],I(ue,X)<0&&I(ue,Y)<0||I(he,X)<0&&I(he,Y)<0||I(pe,X)<0&&I(pe,Y)<0||I(me,X)<0&&I(me,Y)<0)continue;if(P.projectToRenderScreen(X,$),P.projectToRenderScreen(Y,ee),$[2]<0&&ee[2]>0){a(q,X,Y);const e=P.frustum,t=-I(e[T.NEAR],X)/n(q,g(e[T.NEAR]));o(q,q,t),l(X,X,q),P.projectToRenderScreen(X,$)}else if($[2]>0&&ee[2]<0){a(q,Y,X);const e=P.frustum,t=-I(e[T.NEAR],Y)/n(q,g(e[T.NEAR]));o(q,q,t),l(Y,Y,q),P.projectToRenderScreen(Y,ee)}else if($[2]<0&&ee[2]<0)continue;$[2]=0,ee[2]=0;const r=d(A($,ee,se),L);r<j&&(j=r,c(te,X),c(re,Y),D=e/3)}const x=m.rayBegin,F=m.rayEnd;if(j<N*N){let e=Number.MAX_VALUE;if(E(A(te,re,se),A(x,F,ie),Q)){a(Q,Q,x);const t=u(Q);o(Q,Q,1/t),e=t/h(x,F)}v(e,Q,D,!1)}}get _layout(){const e=S().vec3f(y.POSITION).f32(y.SUBDIVISIONFACTOR).vec2f(y.UV0).vec3f(y.AUXPOS1).vec3f(y.AUXPOS2);return this.parameters.vvSize?e.f32(y.SIZEFEATUREATTRIBUTE):e.f32(y.SIZE),this.parameters.vvColor?e.f32(y.COLORFEATUREATTRIBUTE):e.vec4f(y.COLOR),this.parameters.vvOpacity&&e.f32(y.OPACITYFEATUREATTRIBUTE),has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(y.OBJECTANDLAYERIDCOLOR),e}createBufferWriter(){return new H(this._layout,this.parameters)}produces(e,t){if(t===O.Color||t===O.Alpha||t===O.Highlight||t===O.Depth||t===O.ObjectAndLayerIdColor){if(e===N.DRAPED_MATERIAL)return!0;if(this.parameters.renderOccluded===L.OccludeAndTransparentStencil)return e===N.OPAQUE_MATERIAL||e===N.OCCLUDER_MATERIAL||e===N.TRANSPARENT_OCCLUDER_MATERIAL;if(t===O.Color||t===O.Alpha){return e===(this.parameters.writeDepth?N.TRANSPARENT_MATERIAL:N.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL)}return e===N.OPAQUE_MATERIAL}return!1}createGLMaterial(e){return new z(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}}class z extends b{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextureRepository.release(this._stipplePattern),this._stipplePattern=null}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){this._output!==O.Color&&this._output!==O.Alpha||this._updateOccludeeState(e);const t=this._material.parameters.stipplePattern;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextureRepository.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.ensureTechnique(F,e)}}class G extends j{constructor(){super(...arguments),this.width=0,this.color=f,this.join="miter",this.cap=J.BUTT,this.miterLimit=5,this.writeDepth=!0,this.hasPolygonOffset=!1,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.hasOccludees=!1,this.wireframe=!1}}class H{constructor(e,t){this._parameters=t,this.numJoinSubdivisions=0,this.vertexBufferLayout=e;const r=t.stipplePattern?1:0;switch(this._parameters.join){case"miter":case"bevel":this.numJoinSubdivisions=r;break;case"round":this.numJoinSubdivisions=U+r}}_isClosed(e){return V(this._parameters,e.vertexAttributes,e.indices)}allocate(e){return this.vertexBufferLayout.createBuffer(e)}elementCount(e){const t=2,r=e.indices.get(y.POSITION).length/2+1,s=this._isClosed(e);let i=s?2:2*t;return i+=((s?r:r-1)-(s?0:1))*(2*this.numJoinSubdivisions+4),i+=2,this._parameters.wireframe&&(i=2+4*(i-2)),i}write(e,t,r,s,a){const n=ae,o=ne,l=oe,u=r.vertexAttributes.get(y.POSITION).data,m=r.indices&&r.indices.get(y.POSITION),f=r.vertexAttributes.get(y.DISTANCETOSTART)?.data;m&&m.length!==2*(u.length/3-1)&&console.warn("RibbonLineMaterial does not support indices");let T=1,_=0;this._parameters.vvSize?_=r.vertexAttributes.get(y.SIZEFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.SIZE)&&(T=r.vertexAttributes.get(y.SIZE).data[0]);let d=[1,1,1,1],A=0;this._parameters.vvColor?A=r.vertexAttributes.get(y.COLORFEATUREATTRIBUTE).data[0]:r.vertexAttributes.has(y.COLOR)&&(d=r.vertexAttributes.get(y.COLOR).data);const E=has("enable-feature:objectAndLayerId-rendering")?r.objectAndLayerIdColor:null;let v=0;this._parameters.vvOpacity&&(v=r.vertexAttributes.get(y.OPACITYFEATUREATTRIBUTE).data[0]);const R=u.length/3,I=new Float32Array(s.buffer),g=has("enable-feature:objectAndLayerId-rendering")?new Uint8Array(s.buffer):null,S=this.vertexBufferLayout.stride/4;let O=a*S;const b=O;let P=0;const L=f?(e,t,r)=>P=f[r]:(e,t,r)=>P+=h(e,t),N=has("enable-feature:objectAndLayerId-rendering"),C=(e,t,r,s,i,a,n)=>{if(I[O++]=t[0],I[O++]=t[1],I[O++]=t[2],I[O++]=s,I[O++]=n,I[O++]=i,I[O++]=e[0],I[O++]=e[1],I[O++]=e[2],I[O++]=r[0],I[O++]=r[1],I[O++]=r[2],I[O++]=this._parameters.vvSize?_:T,this._parameters.vvColor)I[O++]=A;else{const e=Math.min(4*a,d.length-4);I[O++]=d[e],I[O++]=d[e+1],I[O++]=d[e+2],I[O++]=d[e+3]}this._parameters.vvOpacity&&(I[O++]=v),N&&(null!=E&&(g[4*O]=E[0],g[4*O+1]=E[1],g[4*O+2]=E[2],g[4*O+3]=E[3]),O++)};O+=S,i(o,u[0],u[1],u[2]),e&&p(o,o,e);const j=this._isClosed(r);if(j){const t=u.length-3;i(n,u[t],u[t+1],u[t+2]),e&&p(n,n,e)}else i(l,u[3],u[4],u[5]),e&&p(l,l,e),C(o,o,l,1,M.LEFT_CAP_START,0,0),C(o,o,l,1,M.RIGHT_CAP_START,0,0),c(n,o),c(o,l);const D=j?0:1,U=j?R:R-1;for(let h=D;h<U;h++){const t=(h+1)%R*3;i(l,u[t],u[t+1],u[t+2]),e&&p(l,l,e),L(n,o,h),C(n,o,l,0,M.LEFT_JOIN_END,h,P),C(n,o,l,0,M.RIGHT_JOIN_END,h,P);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);C(n,o,l,t,M.LEFT_JOIN_END,h,P),C(n,o,l,t,M.RIGHT_JOIN_END,h,P)}C(n,o,l,1,M.LEFT_JOIN_START,h,P),C(n,o,l,1,M.RIGHT_JOIN_START,h,P),c(n,o),c(o,l)}j?(i(l,u[3],u[4],u[5]),e&&p(l,l,e),P=L(n,o,U),C(n,o,l,0,M.LEFT_JOIN_END,D,P),C(n,o,l,0,M.RIGHT_JOIN_END,D,P)):(P=L(n,o,U),C(n,o,o,0,M.LEFT_CAP_END,U,P),C(n,o,o,0,M.RIGHT_CAP_END,U,P)),k(I,b+S,I,b,S);O=k(I,O-S,I,O,S),this._parameters.wireframe&&this._addWireframeVertices(s,b,O,S)}_addWireframeVertices(e,t,r,s){const i=new Float32Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Float32Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,r-t);let n=0;const o=e=>n=k(a,e,i,n,s);for(let l=0;l<a.length-1;l+=2*s)o(l),o(l+2*s),o(l+1*s),o(l+2*s),o(l+1*s),o(l+3*s)}}function k(e,t,r,s,i){for(let a=0;a<i;a++)r[s++]=e[t++];return s}function V(e,t,r){return Z(e,t.get(y.POSITION).data,r?r.get(y.POSITION):null)}function Z(e,t,r){return!!e.isClosed&&(r?r.length>2:t.length>6)}function W(e){return e.anchor===D.Tip&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}const X=m(),Y=m(),q=m(),Q=m(),K=m(),$=r(),ee=r(),te=m(),re=m(),se=_(),ie=_(),ae=m(),ne=m(),oe=m(),le=[r(),r(),r(),r()],ce=[m(),m(),m(),m()],ue=v(),he=v(),pe=v(),me=v();export{G as Parameters,B as RibbonLineMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{n as e,s as t,b as r,e as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as b}from"../lib/Util.js";import{VertexAttribute as E}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as S,writePosition as g}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as A}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as T,vertexAttributeLocations as _,ShadedColorMaterialTechnique as F}from"../shaders/ShadedColorMaterialTechnique.js";class v extends f{constructor(e){super(e,new O),this.supportsEdges=!0,this._configuration=new T,this._vertexAttributeLocations=_}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u){if(this.parameters.screenSizeEnabled){const s=e.vertexAttributes.get(E.OFFSET),h={applyToVertex:(e,n,o,c)=>{const l=t(R,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),u=t(w,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,R);return o(e,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(t))}};A(e,a,c,l,h,u)}else A(e,a,c,l,void 0,u)}canRender(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new j(e)}createBufferWriter(){return new x(this.parameters.screenSizeEnabled)}}class j extends p{beginSlot(e){return this.ensureTechnique(F,e)}}class O extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class x{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(E.POSITION).vec3f(E.NORMAL);this.screenSizeEnabled&&t.vec3f(E.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.indices.get(E.POSITION).length}write(e,t,r,i,s){if(S(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.vertexAttributes.has(E.OFFSET))throw new Error(`${E.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.vertexAttributes.get(E.OFFSET),a=r.indices.get(E.OFFSET);b(3===e.size);const n=i.getField(E.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+E.OFFSET);g(a,e.data,t,n,s)}}}}const R=s(),w=s();export{v as ShadedColorMaterial,O as ShadedColorMaterialParameters};
5
+ import{n as e,s as t,b as r,e as i}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{center as n,scale as o}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{newLayout as l}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as u}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as h}from"../lib/basicInterfaces.js";import p from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{RenderSlot as d}from"../lib/RenderSlot.js";import{assert as b}from"../lib/Util.js";import{VertexAttribute as E}from"../lib/VertexAttribute.js";import{writeDefaultAttributes as S,writePosition as g}from"./internal/bufferWriterUtils.js";import{intersectTriangleGeometry as A}from"./internal/MaterialUtil.js";import{ShadedColorMaterialTechniqueConfiguration as T,vertexAttributeLocations as _,ShadedColorMaterialTechnique as F}from"../shaders/ShadedColorMaterialTechnique.js";class v extends f{constructor(e){super(e,new O),this.supportsEdges=!0,this._configuration=new T,this._vertexAttributeLocations=_}getConfiguration(e,t){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}intersect(e,s,a,c,l,u){if(this.parameters.screenSizeEnabled){const s=e.vertexAttributes.get(E.OFFSET),h={applyToVertex:(e,n,o,c)=>{const l=t(w,s.data[3*c],s.data[3*c+1],s.data[3*c+2]),u=t(z,e,n,o);return r(l,l,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(l)),i(u,u,l),[u[0],u[1],u[2]]},applyToAabb:e=>{const t=n(e,w);return o(e,this.parameters.screenSizeScale*a.camera.computeRenderPixelSizeAt(t))}};A(e,a,c,l,h,u)}else A(e,a,c,l,void 0,u)}produces(e,t){if(t===u.Highlight)return e===d.OPAQUE_MATERIAL;if(t===u.Color||t===u.Alpha||t===u.ObjectAndLayerIdColor){let t=d.OPAQUE_MATERIAL;return this.parameters.transparent&&(t=this.parameters.writeDepth?d.TRANSPARENT_MATERIAL:d.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===t||e===d.DRAPED_MATERIAL}return!1}createGLMaterial(e){return new j(e)}createBufferWriter(){return new x(this.parameters.screenSizeEnabled)}}class j extends p{beginSlot(e){return this.ensureTechnique(F,e)}}class O extends m{constructor(){super(...arguments),this.color=a(1,1,1,1),this.shadingTint=a(0,0,0,.25),this.shadingDirection=e(s(),[.5,-.5,-.5]),this.screenSizeScale=14,this.transparent=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=h.None,this.screenSizeEnabled=!1,this.shadingEnabled=!0}}class x{constructor(e){this.screenSizeEnabled=e;const t=l().vec3f(E.POSITION).vec3f(E.NORMAL);this.screenSizeEnabled&&t.vec3f(E.OFFSET),this.vertexBufferLayout=t}elementCount(e){return e.indices.get(E.POSITION).length}write(e,t,r,i,s){if(S(r,this.vertexBufferLayout,e,t,i,s),this.screenSizeEnabled){if(!r.vertexAttributes.has(E.OFFSET))throw new Error(`${E.OFFSET} vertex attribute required for screenSizeEnabled ShadedColorMaterial`);{const e=r.vertexAttributes.get(E.OFFSET),a=r.indices.get(E.OFFSET);b(3===e.size);const n=i.getField(E.OFFSET,c);if(!n)throw new Error("unable to acquire view for "+E.OFFSET);g(a,e.data,t,n,s)}}}}const w=s(),z=s();export{v as ShadedColorMaterial,O as ShadedColorMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{ShaderTechniqueConfiguration as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import t from"../lib/GLMaterial.js";import{RenderOccludedFlag as i}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as n}from"./DefaultBufferWriter.js";import{PositionUVLayout as s}from"./DefaultLayouts.js";import{TriangleMaterial as a}from"./TriangleMaterial.js";import{SlicePlaneMaterialTechnique as u,SlicePlaneMaterialPassParameters as c}from"../shaders/SlicePlaneMaterialTechnique.js";class l extends a{constructor(r){super(r,new m),this._configuration=new e}createBufferWriter(){return new n(s)}canRender(e,t){return t===r.Color&&e===o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL}createGLMaterial(r){return new f(r)}getConfiguration(){return this._configuration}}class f extends t{constructor(r){super(r),this.ensureTechnique(u,null)}beginSlot(){return this.technique}}class m extends c{constructor(){super(...arguments),this.renderOccluded=i.Occlude,this.isDecoration=!1}}export{m as Parameters,l as SlicePlaneMaterial};
5
+ import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";import{ShaderTechniqueConfiguration as e}from"../core/shaderTechnique/ShaderTechniqueConfiguration.js";import t from"../lib/GLMaterial.js";import{RenderOccludedFlag as i}from"../lib/Material.js";import{RenderSlot as o}from"../lib/RenderSlot.js";import{DefaultBufferWriter as s}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{SlicePlaneMaterialTechnique as a,SlicePlaneMaterialPassParameters as c}from"../shaders/SlicePlaneMaterialTechnique.js";class l extends u{constructor(r){super(r,new m),this._configuration=new e}createBufferWriter(){return new s(n)}produces(e,t){return t===r.Color&&e===o.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL}createGLMaterial(r){return new f(r)}getConfiguration(){return this._configuration}}class f extends t{constructor(r){super(r),this.ensureTechnique(a,null)}beginSlot(){return this.technique}}class m extends c{constructor(){super(...arguments),this.renderOccluded=i.Occlude,this.isDecoration=!1}}export{m as Parameters,l as SlicePlaneMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import has from"../../../../core/has.js";import{secondsFromMilliseconds as e}from"../../../../core/time.js";import{f as t}from"../../../../chunks/vec2f64.js";import{c as r}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{AnimationTimer as s}from"../lib/AnimationTimer.js";import{MaterialParameters as n}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{PositionUVLayoutObjectAndLayerId as m,PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as l}from"./TriangleMaterial.js";import{WaterGLMaterial as f}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as u}from"./WaterTechnique.js";class d extends l{constructor(e){super(e,new A),this._configuration=new u,this.animation=new s}getConfiguration(e,t){return this._configuration.output=e,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasScreenSpaceReflections=this.parameters.hasScreenSpaceReflections,this._configuration.hasCloudsReflections=this.parameters.hasCloudsReflections,this._configuration.isDraped=this.parameters.isDraped,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}update(t){const r=Math.min(t.camera.relativeElevation,t.camera.distance);this.animation.enabled=Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*r<R;const a=this.animation.advance(t);return this.setParameters({timeElapsed:e(this.animation.time)*this.parameters.animationSpeed},!1),this.animation.enabled&&a}canRender(e,t){switch(t){case i.Normal:return e===h.DRAPED_WATER;case i.Color:if(this.parameters.isDraped)return e===h.DRAPED_MATERIAL;break;case i.Alpha:break;case i.Highlight:case i.ObjectAndLayerIdColor:return e===h.OPAQUE_MATERIAL||e===h.DRAPED_MATERIAL;default:return!1}let r=h.OPAQUE_MATERIAL;return this.parameters.transparent&&(r=this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===r}createGLMaterial(e){return new f(e)}createBufferWriter(){return new c(has("enable-feature:objectAndLayerId-rendering")?m:p)}}class A extends n{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=t(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=a(0,0,0,0),this.transparent=!0,this.writeDepth=!0,this.hasSlicePlane=!1,this.isDraped=!1,this.receiveShadows=!0,this.hasScreenSpaceReflections=!1,this.hasCloudsReflections=!1,this.origin=r(),this.modelTransformation=null}}const R=35e3;export{d as WaterMaterial,A as WaterMaterialParameters};
5
+ import has from"../../../../core/has.js";import{secondsFromMilliseconds as e}from"../../../../core/time.js";import{f as t}from"../../../../chunks/vec2f64.js";import{c as r}from"../../../../chunks/vec3f64.js";import{f as a}from"../../../../chunks/vec4f64.js";import{ShaderOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{AnimationTimer as s}from"../lib/AnimationTimer.js";import{MaterialParameters as n}from"../lib/Material.js";import{OITPolygonOffsetLimit as o}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as h}from"../lib/RenderSlot.js";import{DefaultBufferWriter as c}from"./DefaultBufferWriter.js";import{PositionUVLayoutObjectAndLayerId as m,PositionUVLayout as p}from"./DefaultLayouts.js";import{TriangleMaterial as l}from"./TriangleMaterial.js";import{WaterGLMaterial as u}from"./WaterGLMaterial.js";import{WaterTechniqueConfiguration as f}from"./WaterTechnique.js";class d extends l{constructor(e){super(e,new A),this._configuration=new f,this.animation=new s}getConfiguration(e,t){return this._configuration.output=e,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.receiveShadows=this.parameters.receiveShadows,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.hasScreenSpaceReflections=this.parameters.hasScreenSpaceReflections,this._configuration.hasCloudsReflections=this.parameters.hasCloudsReflections,this._configuration.isDraped=this.parameters.isDraped,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<o,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}update(t){const r=Math.min(t.camera.relativeElevation,t.camera.distance);this.animation.enabled=Math.sqrt(this.parameters.waveTextureRepeat/this.parameters.waveStrength)*r<g;const a=this.animation.advance(t);return this.setParameters({timeElapsed:e(this.animation.time)*this.parameters.animationSpeed},!1),this.animation.enabled&&a}produces(e,t){switch(t){case i.Normal:return e===h.DRAPED_WATER;case i.Color:if(this.parameters.isDraped)return e===h.DRAPED_MATERIAL;break;case i.Alpha:break;case i.Highlight:case i.ObjectAndLayerIdColor:return e===h.OPAQUE_MATERIAL||e===h.DRAPED_MATERIAL;default:return!1}let r=h.OPAQUE_MATERIAL;return this.parameters.transparent&&(r=this.parameters.writeDepth?h.TRANSPARENT_MATERIAL:h.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL),e===r}createGLMaterial(e){return new u(e)}createBufferWriter(){return new c(has("enable-feature:objectAndLayerId-rendering")?m:p)}}class A extends n{constructor(){super(...arguments),this.waveStrength=.06,this.waveTextureRepeat=32,this.waveDirection=t(1,0),this.waveVelocity=.05,this.flowStrength=.015,this.flowOffset=-.5,this.animationSpeed=.35,this.timeElapsed=0,this.color=a(0,0,0,0),this.transparent=!0,this.writeDepth=!0,this.hasSlicePlane=!1,this.isDraped=!1,this.receiveShadows=!0,this.hasScreenSpaceReflections=!1,this.hasCloudsReflections=!1,this.origin=r(),this.modelTransformation=null}}const g=35e3;export{d as WaterMaterial,A as WaterMaterialParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import{someMap as s}from"../../../../../core/MapUtils.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as a}from"../../../../../core/maybe.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import n from"../../../../../core/PooledArray.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{m as h,a as c,t as f}from"../../../../../chunks/mat4.js";import{c as d}from"../../../../../chunks/mat4f64.js";import{glLayout as m}from"../../../support/buffer/glUtil.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as p}from"../../effects/RenderPlugin.js";import{GLMaterials as y}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as _}from"../../lib/Material.js";import{DirtyState as b}from"../../lib/ModelDirtyTypes.js";import{assert as v,setMatrixTranslation3 as w}from"../../lib/Util.js";import{DrawParameters as O}from"../DrawParameters.js";import{WaterMaterial as C}from"../WaterMaterial.js";import{BufferRange as B,mergeAdjacentRanges as E}from"./BufferRange.js";import{Instance as H}from"./Instance.js";import{PerBufferData as A,hasVao as D}from"./PerBufferData.js";import{PerOriginData as M}from"./PerOriginData.js";import{VaoCache as j}from"./VaoCache.js";let x=class extends p{constructor(e){super(e),this._vaoCache=null,this._glMaterials=null,this._bufferWriter=null,this._dataByOrigin=new Map,this._hasHighlights=!1,this._hasOccludees=!1,this.renderSlots=[]}dispose(){this._glMaterials=a(this._glMaterials),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache=a(this._vaoCache)}initializeRenderContext(e,t){this._glMaterials=new y(this.material,t??e.materialRepository),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=new j(e.renderContext.rctx,this.material.vertexAttributeLocations,m(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get isEmpty(){return 0===this._dataByOrigin.size}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this.material instanceof C}get isDecoration(){return this.material.isDecoration}get rendersOccluded(){return!this.isEmpty&&this.material.renderOccluded!==_.Occlude}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.memoryUsage),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((t=>e(t.geometry)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){if(null===this._bufferWriter)return;const t=this._bufferWriter,r=t.vertexBufferLayout.stride/4;for(const s of e){const e=s.renderGeometry,i=this._dataByOrigin.get(e.localOrigin.id),a=i?.findBuffer(e.id);if(null==a)return;const o=a.instances.get(e.id);if(s.updateType&(b.GEOMETRY|b.TRANSFORMATION)){const s=k(t.elementCount(o.geometry.geometry)*r),i=t.vertexBufferLayout.createView(s.buffer);this._writeGeometry(e,i,0),a.vao.vertexBuffers.geometry.setSubData(s,o.from*r,0,o.numElements*r)}s.updateType&(b.HIGHLIGHT|b.OCCLUDEE|b.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new o;for(const s of e){const e=s.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new S(e.vec3),r.set(e.id,null,t)),t.changes.push(s)}for(const s of t){const e=s.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),i=t?.findBuffer(s.id);if(null==i)continue;let a=r.get(e.id,i);null==a&&(a=new S(e.vec3),r.set(e.id,i,a)),a.changes.push(s)}return r}_addAndRemoveGeometries(e,r){if(null===this._bufferWriter||null===this._vaoCache)return;const{_bufferWriter:s,_dataByOrigin:i}=this,a=s.vertexBufferLayout.stride/4,o=this._computeDeltas(e,r);o.forEach(((e,r)=>{const n=e.get(null),l=null!=n?n.changes:[];o.delete(r,null);let u=i.get(r);if(e.forEach(((e,n)=>{if(o.delete(r,n),null==n)return void v(!1,"No VAO for removed geometries");if(n.instances.size===e.changes.length)return this._vaoCache.deleteVao(n.vao),t(u.buffers,n),void(0===u.buffers.length&&0===l.length&&i.delete(r));const h=n.numElements,c=n.vao.byteSize/4,f=l.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),d=e.changes.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),m=Math.min((h+f-d)*a,U),g=m>c;m>T&&m<c/2?(e.changes.forEach((({id:e})=>n.deleteInstance(e))),n.instances.forEach((({geometry:e})=>l.push(e))),this._vaoCache.deleteVao(n.vao),t(u.buffers,n)):g?this._applyAndRebuild(n,l,e):this._applyRemoves(n,e)})),l.length>0)for(null==u&&(u=new M(n.origin),i.set(r,u)),u.buffers.forEach((e=>this._applyAdds(e,l)));l.length>0;)u.buffers.push(this._applyAndRebuild(new A,l,null))}))}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.drawCommandsDirty&&(e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,s(e.instances,(t=>(e.updateDrawState(t),e.hasHiddenInstances&&e.hasHighlights&&e.hasOccludees))),e.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)),this._hasHighlights=this._hasHighlights||e.hasHighlights,this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(null!=r)for(const d of r.changes)e.deleteInstance(d.id);const s=this._bufferWriter,i=s.vertexBufferLayout.stride,a=i/4,o=Math.floor(U/a);let n=e.numElements;for(;t.length>0;){const r=t.pop(),i=s.elementCount(r.geometry);if(n+i>o&&n>0){t.push(r);break}n+=i;const a=new H(r,0,0);v(null==e.instances.get(r.id)),e.addInstance(r.id,a)}const l=n*a,u=k(l),h=s.vertexBufferLayout.createView(u.buffer);let c=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,h,c);const i=c;c+=s.elementCount(t.geometry.geometry),e.updateInstance(r,i,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(F(l)),e.vao.vertexBuffers.geometry.setSubData(u,0,0,c*a),e.holes.clear();const f=e.holes.pushNew();return f.from=c,f.to=Math.floor(e.vao.byteSize/i),e.updateDrawCommands(i),e}_applyRemoves(e,t){if(0===t.changes.length||null===this._bufferWriter)return;for(const o of t.changes){const t=o.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const s=G.back();if(s){if(s.to===r.from){s.to=r.to;continue}if(s.from===r.to){s.from=r.from;continue}}const i=G.pushNew();i.from=r.from,i.to=r.to}E(G);const r=this._bufferWriter.vertexBufferLayout.stride/4,s=G.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,i=k(s);i.fill(0,0,s);const a=e.vao.vertexBuffers.geometry;G.forAll((e=>a.setSubData(i,e.from*r,0,e.numElements*r))),e.holes.pushArray(G.data,G.length),G.forAll(((e,t)=>G.data[t]=null)),G.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null===this._bufferWriter)return;if(!D(e))return void this._applyAndRebuild(e,t,null);const s=this._bufferWriter,i=s.vertexBufferLayout.stride/4,a=e.numElements,o=t.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),n=Math.min((a+o)*i,U),l=4*n;if(e.vao.byteSize<F(U-T)&&l>e.vao.byteSize)return void this._applyAndRebuild(e,t,null);E(e.holes);const u=new Array;for(const r of t){const t=s.elementCount(r.geometry),i=R(e.holes,t);u.push(i)}const h=e.vao.vertexBuffers.geometry;let c=0,f=0,d=0;const m=k(n),g=s.vertexBufferLayout.createView(m.buffer);t.forEach(((t,r)=>{const a=u[r];if(null==a)return;if(!(d===a)){const e=d-f;e>0&&h.setSubData(m,f*i,0,e*i),f=a,c=0}const o=s.elementCount(t.geometry);this._writeGeometry(t,g,c),c+=o,d=a+o;const n=new H(t,a,a+o);v(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}));const p=d-f;p>0&&h.setSubData(m,f*i,0,p*i),r(t,((e,t)=>null==u[t]))}_writeGeometry(e,t,r){if(null===this._bufferWriter)return;const s=e.localOrigin.vec3;w(I,-s[0],-s[1],-s[2]);const i=h(W,I,e.transformation);c(L,i),f(L,L),this._bufferWriter.write(i,L,e.geometry,t,r)}updateAnimation(e){return this.material.update(e)}canRender(e,t){return this.material.canRender(e,t)}prepareTechnique(e){const{output:t,bindParameters:r}=e;if(!this.canRender(r.slot,t))return null;const s=t===g.Highlight||t===g.ShadowHighlight;if(s&&!this._hasHighlights)return null;const i=t===g.ShadowExcludeHighlight,a=!(s||i);for(const o of this._dataByOrigin.values())for(const n of o.buffers){if(s&&!n.hasHighlights)continue;const o=(s?n.drawCommandsHighlight:i&&n.needsMultipleCommands()?n.drawCommandsShadowHighlightRest:n.drawCommandsDefault)||null,l=a&&n.drawCommandsOccludees||null;if(o?.length||l?.length){const s=this._glMaterials.load(e.rctx,r.slot,t),i=null!=s?s.beginSlot(r):null;if(null!=i)return i}}return null}render(e,t){const{output:r,bindParameters:s}=e,i=r===g.Highlight||r===g.ShadowHighlight,a=r===g.ShadowExcludeHighlight,o=!(i||a),n=e.rctx;n.appleAmdDriverHelper?.resetIndicesType(),n.bindTechnique(t,this.material.parameters,s);for(const l of this._dataByOrigin.values())for(const e of l.buffers){if(i&&!e.hasHighlights)continue;const r=(i?e.drawCommandsHighlight:a&&e.needsMultipleCommands()?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,u=o&&e.drawCommandsOccludees||null;if(r?.length||u?.length){t.program.bindDraw(new O(l.origin),s,this.material.parameters),t.ensureAttributeLocations(e.vao),n.bindVAO(e.vao),r?.length&&(t.bindPipelineState(n,s.slot,!1),r.forAll((e=>n.drawArrays(t.primitiveType,e.first,e.count)))),u?.length&&(t.bindPipelineState(n,s.slot,!0),u.forAll((e=>n.drawArrays(t.primitiveType,e.first,e.count))))}}}get test(){return{material:this.material,glMaterials:this._glMaterials,dataByOrigin:this._dataByOrigin}}};e([l({constructOnly:!0})],x.prototype,"material",void 0),x=e([u("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],x);class S{constructor(e){this.origin=e,this.changes=new Array}}function R(e,t){let r;if(!e.some((e=>!(e.numElements<t)&&(r=e,!0))))return null;const s=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),s}const I=d(),W=d(),L=d(),G=new n({allocator:e=>e||new B,deallocator:null}),T=65536,V=4*T,z=1024,P=16777216,U=P/4;let N=new Float32Array(T);function k(e){return N.length<e&&(N=new Float32Array(e)),N}function F(e){const t=4*e;return t<=z?z:t<V?i(t):Math.max(Math.min(Math.ceil(1.5*t/V)*V,P),t)}export{x as MergedRenderer};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t,filterInPlace as r}from"../../../../../core/arrayUtils.js";import{someMap as s}from"../../../../../core/MapUtils.js";import{nextHighestPowerOfTwo as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as a}from"../../../../../core/maybe.js";import{NestedMap as o}from"../../../../../core/NestedMap.js";import n from"../../../../../core/PooledArray.js";import{property as l}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/has.js";import{subclass as u}from"../../../../../core/accessorSupport/decorators/subclass.js";import{m as h,a as c,t as f}from"../../../../../chunks/mat4.js";import{c as d}from"../../../../../chunks/mat4f64.js";import{glLayout as m}from"../../../support/buffer/glUtil.js";import{ShaderOutput as g}from"../../core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as p}from"../../effects/RenderPlugin.js";import{GLMaterials as y}from"../../lib/GLMaterials.js";import{RenderOccludedFlag as _}from"../../lib/Material.js";import{DirtyState as b}from"../../lib/ModelDirtyTypes.js";import{assert as v,setMatrixTranslation3 as w}from"../../lib/Util.js";import{DrawParameters as O}from"../DrawParameters.js";import{WaterMaterial as C}from"../WaterMaterial.js";import{BufferRange as B,mergeAdjacentRanges as E}from"./BufferRange.js";import{Instance as H}from"./Instance.js";import{PerBufferData as A,hasVao as D}from"./PerBufferData.js";import{PerOriginData as M}from"./PerOriginData.js";import{VaoCache as j}from"./VaoCache.js";let x=class extends p{constructor(e){super(e),this._vaoCache=null,this._glMaterials=null,this._bufferWriter=null,this._dataByOrigin=new Map,this._hasHighlights=!1,this._hasOccludees=!1,this.renderSlots=[]}dispose(){this._glMaterials=a(this._glMaterials),this._dataByOrigin.forEach((e=>e.dispose())),this._dataByOrigin.clear(),this._vaoCache=a(this._vaoCache)}initializeRenderContext(e,t){this._glMaterials=new y(this.material,t??e.materialRepository),this._bufferWriter=this.material.createBufferWriter(),this._vaoCache=new j(e.renderContext.rctx,this.material.vertexAttributeLocations,m(this._bufferWriter.vertexBufferLayout))}uninitializeRenderContext(){}get isEmpty(){return 0===this._dataByOrigin.size}get hasHighlights(){return this._hasHighlights}get hasOccludees(){return this._hasOccludees}get hasWater(){return!this.isEmpty&&this.material instanceof C}get isDecoration(){return this.material.isDecoration}get rendersOccluded(){return!this.isEmpty&&this.material.renderOccluded!==_.Occlude}get numGeometries(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.instances.size),0))),e}get usedMemory(){let e=0;return this._dataByOrigin.forEach((t=>e+=t.buffers.reduce(((e,t)=>e+t.vao.memoryUsage),0))),e}forEachGeometry(e){this._dataByOrigin.forEach((t=>t.buffers.forEach((t=>t.instances.forEach((t=>e(t.geometry)))))))}modify(e){this._updateGeometries(e.updates),this._addAndRemoveGeometries(e.adds,e.removes),this._updateDrawCommands()}_updateGeometries(e){if(null===this._bufferWriter)return;const t=this._bufferWriter,r=t.vertexBufferLayout.stride/4;for(const s of e){const e=s.renderGeometry,i=this._dataByOrigin.get(e.localOrigin.id),a=i?.findBuffer(e.id);if(null==a)return;const o=a.instances.get(e.id);if(s.updateType&(b.GEOMETRY|b.TRANSFORMATION)){const s=k(t.elementCount(o.geometry.geometry)*r),i=t.vertexBufferLayout.createView(s.buffer);this._writeGeometry(e,i,0),a.vao.vertexBuffers.geometry.setSubData(s,o.from*r,0,o.numElements*r)}s.updateType&(b.HIGHLIGHT|b.OCCLUDEE|b.VISIBILITY)&&(a.drawCommandsDirty=!0)}}_computeDeltas(e,t){const r=new o;for(const s of e){const e=s.localOrigin;if(null==e)continue;let t=r.get(e.id,null);null==t&&(t=new S(e.vec3),r.set(e.id,null,t)),t.changes.push(s)}for(const s of t){const e=s.localOrigin;if(null==e)continue;const t=this._dataByOrigin.get(e.id),i=t?.findBuffer(s.id);if(null==i)continue;let a=r.get(e.id,i);null==a&&(a=new S(e.vec3),r.set(e.id,i,a)),a.changes.push(s)}return r}_addAndRemoveGeometries(e,r){if(null===this._bufferWriter||null===this._vaoCache)return;const{_bufferWriter:s,_dataByOrigin:i}=this,a=s.vertexBufferLayout.stride/4,o=this._computeDeltas(e,r);o.forEach(((e,r)=>{const n=e.get(null),l=null!=n?n.changes:[];o.delete(r,null);let u=i.get(r);if(e.forEach(((e,n)=>{if(o.delete(r,n),null==n)return void v(!1,"No VAO for removed geometries");if(n.instances.size===e.changes.length)return this._vaoCache.deleteVao(n.vao),t(u.buffers,n),void(0===u.buffers.length&&0===l.length&&i.delete(r));const h=n.numElements,c=n.vao.byteSize/4,f=l.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),d=e.changes.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),m=Math.min((h+f-d)*a,U),g=m>c;m>T&&m<c/2?(e.changes.forEach((({id:e})=>n.deleteInstance(e))),n.instances.forEach((({geometry:e})=>l.push(e))),this._vaoCache.deleteVao(n.vao),t(u.buffers,n)):g?this._applyAndRebuild(n,l,e):this._applyRemoves(n,e)})),l.length>0)for(null==u&&(u=new M(n.origin),i.set(r,u)),u.buffers.forEach((e=>this._applyAdds(e,l)));l.length>0;)u.buffers.push(this._applyAndRebuild(new A,l,null))}))}_updateDrawCommands(){this._hasHighlights=!1,this._hasOccludees=!1,this._dataByOrigin.forEach((e=>{e.buffers.forEach((e=>{e.drawCommandsDirty&&(e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,s(e.instances,(t=>(e.updateDrawState(t),e.hasHiddenInstances&&e.hasHighlights&&e.hasOccludees))),e.updateDrawCommands(this._bufferWriter.vertexBufferLayout.stride)),this._hasHighlights=this._hasHighlights||e.hasHighlights,this._hasOccludees=this._hasOccludees||e.hasOccludees}))}))}_applyAndRebuild(e,t,r){if(null!=r)for(const d of r.changes)e.deleteInstance(d.id);const s=this._bufferWriter,i=s.vertexBufferLayout.stride,a=i/4,o=Math.floor(U/a);let n=e.numElements;for(;t.length>0;){const r=t.pop(),i=s.elementCount(r.geometry);if(n+i>o&&n>0){t.push(r);break}n+=i;const a=new H(r,0,0);v(null==e.instances.get(r.id)),e.addInstance(r.id,a)}const l=n*a,u=k(l),h=s.vertexBufferLayout.createView(u.buffer);let c=0;e.hasHiddenInstances=!1,e.hasHighlights=!1,e.hasOccludees=!1,e.instances.forEach(((t,r)=>{this._writeGeometry(t.geometry,h,c);const i=c;c+=s.elementCount(t.geometry.geometry),e.updateInstance(r,i,c),e.updateDrawState(t)})),this._vaoCache.deleteVao(e.vao),e.vao=this._vaoCache.newVao(F(l)),e.vao.vertexBuffers.geometry.setSubData(u,0,0,c*a),e.holes.clear();const f=e.holes.pushNew();return f.from=c,f.to=Math.floor(e.vao.byteSize/i),e.updateDrawCommands(i),e}_applyRemoves(e,t){if(0===t.changes.length||null===this._bufferWriter)return;for(const o of t.changes){const t=o.id,r=e.instances.get(t);if(!r)continue;e.deleteInstance(t);const s=G.back();if(s){if(s.to===r.from){s.to=r.to;continue}if(s.from===r.to){s.from=r.from;continue}}const i=G.pushNew();i.from=r.from,i.to=r.to}E(G);const r=this._bufferWriter.vertexBufferLayout.stride/4,s=G.reduce(((e,t)=>Math.max(e,t.numElements)),0)*r,i=k(s);i.fill(0,0,s);const a=e.vao.vertexBuffers.geometry;G.forAll((e=>a.setSubData(i,e.from*r,0,e.numElements*r))),e.holes.pushArray(G.data,G.length),G.forAll(((e,t)=>G.data[t]=null)),G.clear(),e.drawCommandsDirty=!0}_applyAdds(e,t){if(0===t.length||null===this._bufferWriter)return;if(!D(e))return void this._applyAndRebuild(e,t,null);const s=this._bufferWriter,i=s.vertexBufferLayout.stride/4,a=e.numElements,o=t.reduce(((e,t)=>e+s.elementCount(t.geometry)),0),n=Math.min((a+o)*i,U),l=4*n;if(e.vao.byteSize<F(U-T)&&l>e.vao.byteSize)return void this._applyAndRebuild(e,t,null);E(e.holes);const u=new Array;for(const r of t){const t=s.elementCount(r.geometry),i=R(e.holes,t);u.push(i)}const h=e.vao.vertexBuffers.geometry;let c=0,f=0,d=0;const m=k(n),g=s.vertexBufferLayout.createView(m.buffer);t.forEach(((t,r)=>{const a=u[r];if(null==a)return;if(!(d===a)){const e=d-f;e>0&&h.setSubData(m,f*i,0,e*i),f=a,c=0}const o=s.elementCount(t.geometry);this._writeGeometry(t,g,c),c+=o,d=a+o;const n=new H(t,a,a+o);v(null==e.instances.get(t.id)),e.addInstance(t.id,n),e.drawCommandsDirty=!0}));const p=d-f;p>0&&h.setSubData(m,f*i,0,p*i),r(t,((e,t)=>null==u[t]))}_writeGeometry(e,t,r){if(null===this._bufferWriter)return;const s=e.localOrigin.vec3;w(I,-s[0],-s[1],-s[2]);const i=h(W,I,e.transformation);c(L,i),f(L,L),this._bufferWriter.write(i,L,e.geometry,t,r)}updateAnimation(e){return this.material.update(e)}produces(e,t){return this.material.produces(e,t)}prepareTechnique(e){const{output:t,bindParameters:r}=e;if(!this.produces(r.slot,t))return null;const s=t===g.Highlight||t===g.ShadowHighlight;if(s&&!this._hasHighlights)return null;const i=t===g.ShadowExcludeHighlight,a=!(s||i);for(const o of this._dataByOrigin.values())for(const n of o.buffers){if(s&&!n.hasHighlights)continue;const o=(s?n.drawCommandsHighlight:i&&n.needsMultipleCommands()?n.drawCommandsShadowHighlightRest:n.drawCommandsDefault)||null,l=a&&n.drawCommandsOccludees||null;if(o?.length||l?.length){const s=this._glMaterials.load(e.rctx,r.slot,t),i=null!=s?s.beginSlot(r):null;if(null!=i)return i}}return null}render(e,t){const{output:r,bindParameters:s}=e,i=r===g.Highlight||r===g.ShadowHighlight,a=r===g.ShadowExcludeHighlight,o=!(i||a),n=e.rctx;n.appleAmdDriverHelper?.resetIndicesType(),n.bindTechnique(t,this.material.parameters,s);for(const l of this._dataByOrigin.values())for(const e of l.buffers){if(i&&!e.hasHighlights)continue;const r=(i?e.drawCommandsHighlight:a&&e.needsMultipleCommands()?e.drawCommandsShadowHighlightRest:e.drawCommandsDefault)||null,u=o&&e.drawCommandsOccludees||null;if(r?.length||u?.length){t.program.bindDraw(new O(l.origin),s,this.material.parameters),t.ensureAttributeLocations(e.vao),n.bindVAO(e.vao),r?.length&&(t.bindPipelineState(n,s.slot,!1),r.forAll((e=>n.drawArrays(t.primitiveType,e.first,e.count)))),u?.length&&(t.bindPipelineState(n,s.slot,!0),u.forAll((e=>n.drawArrays(t.primitiveType,e.first,e.count))))}}}get test(){return{material:this.material,glMaterials:this._glMaterials,dataByOrigin:this._dataByOrigin}}};e([l({constructOnly:!0})],x.prototype,"material",void 0),x=e([u("esri.views.3d.webgl-engine.materials.renderers.MergedRenderer")],x);class S{constructor(e){this.origin=e,this.changes=new Array}}function R(e,t){let r;if(!e.some((e=>!(e.numElements<t)&&(r=e,!0))))return null;const s=r.from;return r.from+=t,r.from>=r.to&&e.removeUnordered(r),s}const I=d(),W=d(),L=d(),G=new n({allocator:e=>e||new B,deallocator:null}),T=65536,V=4*T,z=1024,P=16777216,U=P/4;let N=new Float32Array(T);function k(e){return N.length<e&&(N=new Float32Array(e)),N}function F(e){const t=4*e;return t<=z?z:t<V?i(t):Math.max(Math.min(Math.ceil(1.5*t/V)*V,P),t)}export{x as MergedRenderer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../chunks/vec2f64.js";import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/Float2DrawUniform.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DDrawUniform.js";export{H as HighlightDownsampleDrawParameters,b as build}from"../../../../chunks/HighlightDownsample.glsl.js";
5
+ import"../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../core/shaderModules/interfaces.js";import"../core/shaderModules/ShaderBuilder.js";import"../core/shaderModules/Texture2DDrawUniform.js";export{G as GRID_CELL_PIXEL_SIZE,H as HighlightDownsampleDrawParameters,b as build}from"../../../../chunks/HighlightDownsample.glsl.js";
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import i from"../../core/Evented.js";import{makeHandle as o}from"../../core/handleUtils.js";import{destroyMaybe as r}from"../../core/maybe.js";import{createLength as l,zeroMeters as n,zeroDegrees as a,zeroSquareMeters as s}from"../../core/quantityUtils.js";import{watch as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as u}from"../../core/unitUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import y from"../../layers/GraphicsLayer.js";import{getConvertedElevation as m}from"../../support/elevationInfoUtils.js";import{createSquare as g,createRectangle as v,createCircle as f,createEllipse as _,createPolygon as w,createPolyline as O,createMultipoint as G}from"./support/createUtils.js";import{getDrawHelpMessage as T}from"./support/helpMessageUtils.js";import{createViewAlignedCoordinateSystem as x}from"./support/surfaceCoordinateSystems.js";import{InteractiveToolBase as V}from"../interactive/InteractiveToolBase.js";import b from"../interactive/sketch/SketchLabelOptions.js";import S from"../interactive/sketch/SketchTooltipOptions.js";import{DrawPointTooltipInfo as I,DrawPolylineTooltipInfo as j,DrawPolygonTooltipInfo as U,DrawMeshTooltipInfo as M,DrawRectangleTooltipInfo as k,DrawCircleTooltipInfo as C}from"../interactive/tooltip/DrawTooltipInfos.js";import{Tooltip as z}from"../interactive/tooltip/Tooltip.js";import{orientationBetweenPoints as D}from"../support/angularMeasurementUtils.js";import{autoAreaByElevationMode as E}from"../support/automaticAreaMeasurementUtils.js";import{autoDirectDistanceByElevationModeBetweenPoints as P,autoLengthByElevationMode as H,autoHorizontalDistanceByElevationModeBetweenPoints as A}from"../support/automaticLengthMeasurementUtils.js";import{autorun as R}from"../../core/accessorSupport/trackingUtils.js";class L{constructor(){this.regularVertices=null,this.activeVertex=null,this.full=null,this.outline=null,this.circle=null,this.rectangle=null}}let Z=class extends(i.EventedMixin(V)){constructor(e){super(e),this._graphic=null,this._createOperationGeometry=null,this.defaultZ=0,this.geometryType=null,this.hasZ=!0,this.labelOptions=new b,this.geometryToPlace=null,this.mode=null,this.snappingManager=null,this.snapToScene=!1,this.tooltip=null,this.tooltipOptions=new S}initialize(){this.internalGraphicsLayer=new y({listMode:"hide",internal:!0}),this.view.map.layers.add(this.internalGraphicsLayer),this.drawOperation=this.makeDrawOperation();const e=this.tooltipOptions,t=this.view.type;this.tooltipInfos={point:new I({tooltipOptions:e,viewType:t}),polyline:new j({tooltipOptions:e,viewType:t}),polygon:new U({tooltipOptions:e,viewType:t}),mesh:new M({tooltipOptions:e,viewType:t}),rectangle:new k({tooltipOptions:e}),circle:new C({tooltipOptions:e})},this.addHandles([this.drawOperation.on("vertex-add",(e=>this.onVertexAdd(e))),this.drawOperation.on("vertex-remove",(e=>this.onVertexRemove(e))),this.drawOperation.on("vertex-update",(e=>this.onVertexUpdate(e))),this.drawOperation.on("cursor-update",(e=>this.onCursorUpdate(e))),this.drawOperation.on("complete",(e=>this.onComplete(e))),p((()=>this.tooltipOptions.enabled),(e=>{this.tooltip=e?new z({view:this.view,info:this._tooltipInfo}):r(this.tooltip)}),c),R((()=>this._updateTooltipInfo()))]),this.finishToolCreation()}destroy(){this.drawOperation=r(this.drawOperation),this.tooltip=r(this.tooltip),this._destroyAllVisualisations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=r(this.internalGraphicsLayer),this._set("view",null)}get _defaultElevation(){return l(this.defaultZ,"meters")}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(e){this._set("centered",e),this._updateGraphic()}set enabled(e){this.drawOperation.interactive=e,this._set("enabled",e)}set forceUniformSize(e){this._set("forceUniformSize",e),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(e){this._set("graphicSymbol",e),null!=this._graphic&&(this._graphic.symbol=e)}get updating(){return this.drawOperation?.updating??!1}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(e){const t=this._tooltipInfo;if("key-down"===e.type&&"Tab"===e.key&&t&&this.tooltipOptions.inputEnabled)return t.mode="input",void e.stopPropagation();this.drawOperation.onInputEvent(e)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}_destroyAllVisualisations(){this.removeHandles(q.outline),this.removeHandles(q.regularVertices),this.removeHandles(q.activeVertex),this.removeHandles(N)}_createOrUpdateGraphic(e){if(null!=this._graphic)return this.updateGraphicGeometry(this._graphic,e),this._graphic;const i=this._graphic=new t({...this.graphicProperties,symbol:this.graphicSymbol});return this.updateGraphicGeometry(i,e),this.internalGraphicsLayer.add(i),this.addHandles(this.initializeGraphic(i)),this.notifyChange("graphic"),this.addHandles(o((()=>{this.internalGraphicsLayer.remove(i),r(i),this._graphic===i&&(this._graphic=null)})),N),i}updateGraphicGeometry(e,t){e.geometry=t}_getCreateOperationGeometry(e={operationComplete:!1}){const{drawOperation:t}=this;if(null==t||0===t.numVertices)return null;const{coordinateHelper:i,view:o}=t,r=t.stagedVertex,l=t.committedVertices,n=l.slice(),a=null!=r;a&&n.push(i.pointToArray(r));const s=a?i.pointToArray(r):l.splice(-1)[0],p=n.length,c=o.spatialReference,u="3d"===o.type&&"global"===o.viewingMode,h=new L;switch(this.geometryType){case"point":case"mesh":h.regularVertices=l,h.activeVertex=s,h.full=i.arrayToPoint(n[0]);break;case"multipoint":h.regularVertices=l,h.activeVertex=s,p>0&&(h.full=G(n,c));break;case"polyline":h.regularVertices=l,h.activeVertex=s,p>0&&(h.full=O([n],c,u));break;case"polygon":h.regularVertices=l,h.activeVertex=s,p>0&&(h.full=w([n],c,u,!0));break;case"circle":if(p>0){const t=x(o,n[0]);if(1===p&&e.operationComplete){const e=n[0],i=t.makeMapPoint(e[0]+F*o.resolution,e[1]);h.circle=f([e,i],t,!0),h.full=null!=h.circle?h.circle.geometry:null}else 2===p&&(this.forceUniformSize?(h.circle=f(n,t,this.centered),h.full=null!=h.circle?h.circle.geometry:null):(h.rectangle=_(n,t,this.centered),h.full=h.rectangle.geometry))}break;case"rectangle":if(p>0){const t=x(o,n[0]);if(1===p&&e.operationComplete){const e=n[0],i=t.makeMapPoint(e[0]+F*o.resolution,e[1]);h.rectangle=g([e,i],t,!0),h.full=h.rectangle.geometry}else 2===p&&(h.rectangle=this.forceUniformSize?g(n,t,this.centered):v(n,t,this.centered),h.full=h.rectangle.geometry)}break;default:return null}switch(this.geometryType){case"point":case"multipoint":break;case"polyline":h.outline=p>1?O([n],c,u):null;break;case"polygon":h.outline=p>1?w([n],c,u):null;break;case"circle":case"rectangle":h.outline="polygon"===h.full?.type?w(h.full.rings,c,u):null}return h}initializeGraphic(e){return o()}onComplete(e){this._updateGraphic();let t=null;if(this.drawOperation.isCompleted){const e=this._getCreateOperationGeometry({operationComplete:!0});null!=e&&(t=this._createOrUpdateGraphic(e.full).clone())}this._createOperationGeometry=null,this.emit("complete",{graphic:t,...e})}onCursorUpdate(e){this._updateGraphic(),this.emit("cursor-update",e)}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}onVertexAdd(e){this._updateGraphic(),this.emit("vertex-add",e)}onVertexRemove(e){this._updateGraphic(),this.emit("vertex-remove",e)}onVertexUpdate(e){this._updateGraphic(),this.emit("vertex-update",e)}_updateGraphic(){const e=this._getCreateOperationGeometry();this._createOperationGeometry=e,null!=e?(null!=e.outline?this.addHandles(this.onOutlineChanged(e.outline),q.outline):this.removeHandles(q.outline),null!=e.regularVertices?this.addHandles(this.onRegularVerticesChanged(e.regularVertices),q.regularVertices):this.removeHandles(q.regularVertices),null!=e.activeVertex?this.addHandles(this.onActiveVertexChanged(e.activeVertex),q.activeVertex):this.removeHandles(q.activeVertex),null!=e.full?this._createOrUpdateGraphic(e.full):this.removeHandles(N)):this._destroyAllVisualisations()}get _tooltipInfo(){const{drawOperation:e,graphic:t,view:i}=this;if(!e)return null;const o=this.tooltipInfos;if("2d"===i.type&&0===this.defaultZ)return null;const r=t?.geometry?.type;switch(this.geometryType){case"point":return"point"===r?o.point:null;case"polyline":return"polyline"===r?o.polyline:null;case"polygon":return"polygon"===r?o.polygon:null;case"rectangle":return"polygon"===r?o.rectangle:null;case"circle":return"polygon"===r?o.circle:null;case"mesh":return"mesh"===r?o.mesh:null;default:return null}}_updateTooltipInfo(){const{_tooltipInfo:e,tooltip:t}=this;if(e&&t){switch(e.type){case"draw-point":this._updateDrawPointTooltipInfo(e);break;case"draw-polyline":this._updateDrawPolylineTooltipInfo(e);break;case"draw-polygon":this._updateDrawPolygonTooltipInfo(e);break;case"draw-rectangle":this._updateDrawRectangleTooltipInfo(e);break;case"draw-circle":this._updateDrawCircleTooltipInfo(e);break;case"draw-mesh":this.updateDrawMeshTooltipInfo(e)}t.info=e}}_updateDrawPointTooltipInfo(e){e.tooltipOptions=this.tooltipOptions,e.viewType=this.view.type,e.helpMessage=T("point",this.graphic?.geometry),this.updateElevation(e.elevation)}_updateDrawPolylineTooltipInfo(e){const t=this._createOperationGeometry,i=null!=t?t.full:null;if("polyline"!==i?.type)return;const o=i.getPoint(0,i.paths[0].length-2),r=this.drawOperation.stagedVertex;e.distance.actual=(o&&r?P(o,r,this._elevationMode):null)??n,e.orientation.actual=(o&&r?D(o,r):null)??a,e.tooltipOptions=this.tooltipOptions,e.totalLength=H(i,this._elevationMode)??n,e.viewType=this.view.type,e.helpMessage=T("polyline",i),this.updateElevation(e.elevation)}_updateDrawPolygonTooltipInfo(e){const t=this._createOperationGeometry,i=null!=t?t.full:null;if("polygon"!==i?.type)return;const o=i.getPoint(0,i.rings[0].length-2),r=this.drawOperation.stagedVertex;e.distance.actual=(o&&r?P(o,r,this._elevationMode):null)??n,e.orientation.actual=(o&&r?D(o,r):null)??a,e.tooltipOptions=this.tooltipOptions,e.area=E(i,this._elevationMode)??s,e.viewType=this.view.type,e.helpMessage=T("polygon",i),this.updateElevation(e.elevation)}updateDrawMeshTooltipInfo(e){}_updateDrawRectangleTooltipInfo(e){e.tooltipOptions=this.tooltipOptions,e.xSize=this._xSize??n,e.ySize=this._ySize??n,e.area=this._fullGeometryArea??s}_updateDrawCircleTooltipInfo(e){const{forceUniformSize:t}=this;e.tooltipOptions=this.tooltipOptions,e.radius=t?this._circleRadius??n:null,e.xSize=t?null:this._xSize??n,e.ySize=t?null:this._ySize??n,e.area=this._fullGeometryArea??s}get _circleRadius(){const e=this._createOperationGeometry;return null!=e&&null!=e.circle&&null!=e.circle.center&&null!=e.circle.edge?A(e.circle.center,e.circle.edge,this._elevationMode):null}get _xSize(){const e=this._createOperationGeometry?.rectangle?.midpoints;return null!=e?A(e.left,e.right,this._elevationMode):null}get _ySize(){const e=this._createOperationGeometry?.rectangle?.midpoints;return null!=e?A(e.top,e.bottom,this._elevationMode):null}get _fullGeometryArea(){const e=this._createOperationGeometry?.full;return"polygon"!==e?.type?null:E(e,this._elevationMode)}updateElevation(e){e.mode=this.drawOperation.elevationInfo.mode,e.actual=this._vertexTooltipElevation}get _vertexTooltipElevation(){const{tooltipOptions:e,view:t,drawOperation:i}=this;if(null==i)return this._defaultElevation;const o=i.stagedVertex??i.lastVertex;if(null==o||"2d"===t.type)return this._defaultElevation;const r={mode:e.elevation.mode,offset:0},n=(m(t,o,i.elevationInfo,r)??0)*u(o.spatialReference);return l(n,"meters")}get _elevationMode(){return this.drawOperation.isDraped?"on-the-ground":"absolute-height"}};e([h()],Z.prototype,"_createOperationGeometry",void 0),e([h()],Z.prototype,"_defaultElevation",null),e([h({value:!0})],Z.prototype,"centered",null),e([h({nonNullable:!0})],Z.prototype,"defaultZ",void 0),e([h()],Z.prototype,"drawOperation",void 0),e([h({value:!0})],Z.prototype,"enabled",null),e([h({value:!0})],Z.prototype,"forceUniformSize",null),e([h({constructOnly:!0})],Z.prototype,"geometryType",void 0),e([h()],Z.prototype,"graphic",null),e([h({constructOnly:!0})],Z.prototype,"graphicProperties",void 0),e([h()],Z.prototype,"graphicSymbol",null),e([h({constructOnly:!0})],Z.prototype,"hasZ",void 0),e([h({constructOnly:!0,type:b})],Z.prototype,"labelOptions",void 0),e([h({constructOnly:!0})],Z.prototype,"geometryToPlace",void 0),e([h({constructOnly:!0})],Z.prototype,"mode",void 0),e([h()],Z.prototype,"snappingManager",void 0),e([h()],Z.prototype,"snapToScene",void 0),e([h()],Z.prototype,"tooltip",void 0),e([h()],Z.prototype,"tooltipInfos",void 0),e([h({constructOnly:!0,type:S})],Z.prototype,"tooltipOptions",void 0),e([h({readOnly:!0})],Z.prototype,"type",void 0),e([h({readOnly:!0})],Z.prototype,"updating",null),e([h({constructOnly:!0,nonNullable:!0})],Z.prototype,"view",void 0),e([h()],Z.prototype,"_tooltipInfo",null),e([h()],Z.prototype,"_circleRadius",null),e([h()],Z.prototype,"_xSize",null),e([h()],Z.prototype,"_ySize",null),e([h()],Z.prototype,"_fullGeometryArea",null),e([h()],Z.prototype,"_vertexTooltipElevation",null),e([h()],Z.prototype,"_elevationMode",null),Z=e([d("esri.views.draw.DrawGraphicTool")],Z);const N="create-operation-graphic",q={outline:"outline-visual",regularVertices:"regular-vertices-visual",activeVertex:"active-vertex-visual"};function B(e){switch(e){case"point":case"polyline":case"polygon":case"multipoint":return e;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const F=48;export{L as CreateOperationGeometry,Z as DrawGraphicTool,B as geometryTypeToDrawOperationGeometryType};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../Graphic.js";import o from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import{destroyMaybe as r}from"../../core/maybe.js";import{createLength as n,zeroMeters as l,zeroSquareMeters as a,zeroDegrees as s}from"../../core/quantityUtils.js";import{watch as p,syncAndInitial as c}from"../../core/reactiveUtils.js";import{getMetersPerVerticalUnitForSR as u}from"../../core/unitUtils.js";import{property as h}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import"../../core/arrayUtils.js";import"../../core/has.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import m from"../../layers/GraphicsLayer.js";import{getConvertedElevation as y}from"../../support/elevationInfoUtils.js";import{createSquare as g,createRectangle as v,createCircle as f,createEllipse as _,createPolygon as w,createPolyline as O,createMultipoint as G}from"./support/createUtils.js";import{getDrawHelpMessage as T}from"./support/helpMessageUtils.js";import{createViewAlignedCoordinateSystem as x}from"./support/surfaceCoordinateSystems.js";import{InteractiveToolBase as V}from"../interactive/InteractiveToolBase.js";import b from"../interactive/sketch/SketchLabelOptions.js";import S from"../interactive/sketch/SketchTooltipOptions.js";import{intersectAll as I,getDistanceConstraint as j,getOrientationConstraint as U}from"../interactive/tooltip/constraintUtils.js";import{DrawPointTooltipInfo as k,DrawPolylineTooltipInfo as C,DrawPolygonTooltipInfo as M,DrawMeshTooltipInfo as P,DrawRectangleTooltipInfo as z,DrawCircleTooltipInfo as D}from"../interactive/tooltip/DrawTooltipInfos.js";import{Tooltip as E}from"../interactive/tooltip/Tooltip.js";import{orientationBetweenPoints as H}from"../support/angularMeasurementUtils.js";import{autoAreaByElevationMode as A}from"../support/automaticAreaMeasurementUtils.js";import{autoLengthByElevationMode as R,autoDirectDistanceByElevationModeBetweenPoints as L,autoHorizontalDistanceByElevationModeBetweenPoints as Z}from"../support/automaticLengthMeasurementUtils.js";import{autorun as N}from"../../core/accessorSupport/trackingUtils.js";class q{constructor(){this.regularVertices=null,this.activeVertex=null,this.full=null,this.outline=null,this.circle=null,this.rectangle=null}}let B=class extends(o.EventedMixin(V)){constructor(e){super(e),this._graphic=null,this._createOperationGeometry=null,this.defaultZ=0,this.geometryType=null,this.hasZ=!0,this.labelOptions=new b,this.geometryToPlace=null,this.mode=null,this.snappingManager=null,this.snapToScene=!1,this.tooltip=null,this.tooltipOptions=new S}initialize(){this.internalGraphicsLayer=new m({listMode:"hide",internal:!0}),this.view.map.layers.add(this.internalGraphicsLayer),this.drawOperation=this.makeDrawOperation();const e=this.tooltipOptions,t=this.view.type;this.tooltipInfos={point:new k({tooltipOptions:e,viewType:t}),polyline:new C({tooltipOptions:e,viewType:t}),polygon:new M({tooltipOptions:e,viewType:t}),mesh:new P({tooltipOptions:e,viewType:t}),rectangle:new z({tooltipOptions:e}),circle:new D({tooltipOptions:e})},this.addHandles([this.drawOperation.on("vertex-add",(e=>this.onVertexAdd(e))),this.drawOperation.on("vertex-remove",(e=>this.onVertexRemove(e))),this.drawOperation.on("vertex-update",(e=>this.onVertexUpdate(e))),this.drawOperation.on("cursor-update",(e=>this.onCursorUpdate(e))),this.drawOperation.on("complete",(e=>this.onComplete(e))),p((()=>this.tooltipOptions.enabled),(e=>{this.tooltip=e?new E({view:this.view,info:this._tooltipInfo}):r(this.tooltip)}),c),N((()=>this._updateTooltipInfo()))]),this.finishToolCreation()}destroy(){this.drawOperation=r(this.drawOperation),this.tooltip=r(this.tooltip),this._destroyAllVisualisations(),this.view.map.remove(this.internalGraphicsLayer),this.internalGraphicsLayer=r(this.internalGraphicsLayer),this._set("view",null)}get _defaultElevation(){return n(this.defaultZ,"meters")}get canRedo(){return this.drawOperation.canRedo}get canUndo(){return this.drawOperation.canUndo}set centered(e){this._set("centered",e),this._updateGraphic()}set enabled(e){this.drawOperation.interactive=e,this._set("enabled",e)}set forceUniformSize(e){this._set("forceUniformSize",e),this._updateGraphic()}get graphic(){return this._graphic}set graphicSymbol(e){this._set("graphicSymbol",e),null!=this._graphic&&(this._graphic.symbol=e)}get updating(){return this.drawOperation?.updating??!1}completeCreateOperation(){this.drawOperation.complete()}onInputEvent(e){const t=this._tooltipInfo;if("key-down"===e.type&&"Tab"===e.key&&t&&this.tooltipOptions.inputEnabled)return t.mode="input",void e.stopPropagation();this.drawOperation.onInputEvent(e)}redo(){this.drawOperation.redo()}reset(){}undo(){this.drawOperation.undo()}_destroyAllVisualisations(){this.removeHandles(J.outline),this.removeHandles(J.regularVertices),this.removeHandles(J.activeVertex),this.removeHandles(F)}_createOrUpdateGraphic(e){if(null!=this._graphic)return this.updateGraphicGeometry(this._graphic,e),this._graphic;const o=this._graphic=new t({...this.graphicProperties,symbol:this.graphicSymbol});return this.updateGraphicGeometry(o,e),this.internalGraphicsLayer.add(o),this.addHandles(this.initializeGraphic(o)),this.notifyChange("graphic"),this.addHandles(i((()=>{this.internalGraphicsLayer.remove(o),r(o),this._graphic===o&&(this._graphic=null)})),F),o}updateGraphicGeometry(e,t){e.geometry=t}_getCreateOperationGeometry(e={operationComplete:!1}){const{drawOperation:t}=this;if(null==t||0===t.numVertices)return null;const{coordinateHelper:o,view:i}=t,r=t.stagedVertex,n=t.committedVertices,l=n.slice(),a=null!=r;a&&l.push(o.pointToArray(r));const s=a?o.pointToArray(r):n.splice(-1)[0],p=l.length,c=i.spatialReference,u="3d"===i.type&&"global"===i.viewingMode,h=new q;switch(this.geometryType){case"point":case"mesh":h.regularVertices=n,h.activeVertex=s,h.full=o.arrayToPoint(l[0]);break;case"multipoint":h.regularVertices=n,h.activeVertex=s,p>0&&(h.full=G(l,c));break;case"polyline":h.regularVertices=n,h.activeVertex=s,p>0&&(h.full=O([l],c,u));break;case"polygon":h.regularVertices=n,h.activeVertex=s,p>0&&(h.full=w([l],c,u,!0));break;case"circle":if(p>0){const t=x(i,l[0]);if(1===p&&e.operationComplete){const e=l[0],o=t.makeMapPoint(e[0]+Q*i.resolution,e[1]);h.circle=f([e,o],t,!0),h.full=null!=h.circle?h.circle.geometry:null}else 2===p&&(this.forceUniformSize?(h.circle=f(l,t,this.centered),h.full=null!=h.circle?h.circle.geometry:null):(h.rectangle=_(l,t,this.centered),h.full=h.rectangle.geometry))}break;case"rectangle":if(p>0){const t=x(i,l[0]);if(1===p&&e.operationComplete){const e=l[0],o=t.makeMapPoint(e[0]+Q*i.resolution,e[1]);h.rectangle=g([e,o],t,!0),h.full=h.rectangle.geometry}else 2===p&&(h.rectangle=this.forceUniformSize?g(l,t,this.centered):v(l,t,this.centered),h.full=h.rectangle.geometry)}break;default:return null}switch(this.geometryType){case"point":case"multipoint":break;case"polyline":h.outline=p>1?O([l],c,u):null;break;case"polygon":h.outline=p>1?w([l],c,u):null;break;case"circle":case"rectangle":h.outline="polygon"===h.full?.type?w(h.full.rings,c,u):null}return h}initializeGraphic(e){return i()}onComplete(e){this._updateGraphic();let t=null;if(this.drawOperation.isCompleted){const e=this._getCreateOperationGeometry({operationComplete:!0});null!=e&&(t=this._createOrUpdateGraphic(e.full).clone())}this._createOperationGeometry=null,this.emit("complete",{graphic:t,...e})}onCursorUpdate(e){this._updateGraphic(),this.emit("cursor-update",e)}onDeactivate(){this.drawOperation.isCompleted||this.drawOperation.cancel()}onVertexAdd(e){this._updateGraphic(),this.emit("vertex-add",e)}onVertexRemove(e){this._updateGraphic(),this.emit("vertex-remove",e)}onVertexUpdate(e){this._updateGraphic(),this.emit("vertex-update",e)}_updateGraphic(){const e=this._getCreateOperationGeometry();this._createOperationGeometry=e,null!=e?(null!=e.outline?this.addHandles(this.onOutlineChanged(e.outline),J.outline):this.removeHandles(J.outline),null!=e.regularVertices?this.addHandles(this.onRegularVerticesChanged(e.regularVertices),J.regularVertices):this.removeHandles(J.regularVertices),null!=e.activeVertex?this.addHandles(this.onActiveVertexChanged(e.activeVertex),J.activeVertex):this.removeHandles(J.activeVertex),null!=e.full?this._createOrUpdateGraphic(e.full):this.removeHandles(F)):this._destroyAllVisualisations()}get _tooltipInfo(){const{drawOperation:e,graphic:t,view:o}=this;if(!e)return null;const i=this.tooltipInfos,r=t?.geometry?.type;switch(this.geometryType){case"point":return"2d"===o.type&&0===this.defaultZ?null:"point"===r?i.point:null;case"polyline":return"polyline"===r?i.polyline:null;case"polygon":return"polygon"===r?i.polygon:null;case"rectangle":return"polygon"===r?i.rectangle:null;case"circle":return"polygon"===r?i.circle:null;case"mesh":return"mesh"===r?i.mesh:null;default:return null}}_updateTooltipInfo(){const{_tooltipInfo:e,tooltip:t}=this;if(e&&t){switch(e.type){case"draw-point":this._updateDrawPointTooltipInfo(e);break;case"draw-polyline":this._updateDrawPolylineTooltipInfo(e);break;case"draw-polygon":this._updateDrawPolygonTooltipInfo(e);break;case"draw-rectangle":this._updateDrawRectangleTooltipInfo(e);break;case"draw-circle":this._updateDrawCircleTooltipInfo(e);break;case"draw-mesh":this.updateDrawMeshTooltipInfo(e)}t.info=e}}_updateDrawPointTooltipInfo(e){e.tooltipOptions=this.tooltipOptions,e.viewType=this.view.type,e.helpMessage=T("point",this.graphic?.geometry),this.updateElevation(e.elevation)}_updateDrawPolylineTooltipInfo(e){const t=this._createOperationGeometry,o=null!=t?t.full:null;if("polyline"!==o?.type)return;const{tooltipOptions:i,view:r}=this,n=o.getPoint(0,o.paths[0].length-2);this._updatePolylineOrPolygonCommon(e,n),e.tooltipOptions=i,e.totalLength=R(o,this._elevationMode)??l,e.viewType=r.type,e.helpMessage=T("polyline",o),this.updateElevation(e.elevation)}_updateDrawPolygonTooltipInfo(e){const t=this._createOperationGeometry,o=null!=t?t.full:null;if("polygon"!==o?.type)return;const{tooltipOptions:i,view:r}=this,n=o.getPoint(0,o.rings[0].length-3);this._updatePolylineOrPolygonCommon(e,n),e.tooltipOptions=i,e.area=A(o,this._elevationMode)??a,e.viewType=r.type,e.helpMessage=T("polygon",o),this.updateElevation(e.elevation)}_updatePolylineOrPolygonCommon(e,t){const{view:o,drawOperation:i}=this,{elevationInfo:r,stagedVertex:n}=i;if(!t||!n)return e.distance.actual=l,e.orientation.actual=s,void(i.constraint=void 0);const a=L(t,n,this._elevationMode);e.distance.actual=a??l,e.orientation.actual=H(t,n)??s,i.constraint=I([j(t,e.distance.committed,o,r),U(t,e.orientation.committed,o,r)])}updateDrawMeshTooltipInfo(e){}_updateDrawRectangleTooltipInfo(e){e.tooltipOptions=this.tooltipOptions,e.xSize=this._xSize??l,e.ySize=this._ySize??l,e.area=this._fullGeometryArea??a}_updateDrawCircleTooltipInfo(e){const{forceUniformSize:t}=this;e.tooltipOptions=this.tooltipOptions,e.radius=t?this._circleRadius??l:null,e.xSize=t?null:this._xSize??l,e.ySize=t?null:this._ySize??l,e.area=this._fullGeometryArea??a}get _circleRadius(){const e=this._createOperationGeometry;return null!=e&&null!=e.circle&&null!=e.circle.center&&null!=e.circle.edge?Z(e.circle.center,e.circle.edge,this._elevationMode):null}get _xSize(){const e=this._createOperationGeometry?.rectangle?.midpoints;return null!=e?Z(e.left,e.right,this._elevationMode):null}get _ySize(){const e=this._createOperationGeometry?.rectangle?.midpoints;return null!=e?Z(e.top,e.bottom,this._elevationMode):null}get _fullGeometryArea(){const e=this._createOperationGeometry?.full;return"polygon"!==e?.type?null:A(e,this._elevationMode)}updateElevation(e){e.mode=this.drawOperation.elevationInfo.mode,e.actual=this._vertexTooltipElevation}get _vertexTooltipElevation(){const{tooltipOptions:e,view:t,drawOperation:o}=this;if(null==o)return this._defaultElevation;const i=o.stagedVertex??o.lastVertex;if(null==i||"2d"===t.type)return this._defaultElevation;const r={mode:e.elevation.mode,offset:0},l=(y(t,i,o.elevationInfo,r)??0)*u(i.spatialReference);return n(l,"meters")}get _elevationMode(){return this.drawOperation.isDraped?"on-the-ground":"absolute-height"}};e([h()],B.prototype,"_createOperationGeometry",void 0),e([h()],B.prototype,"_defaultElevation",null),e([h({value:!0})],B.prototype,"centered",null),e([h({nonNullable:!0})],B.prototype,"defaultZ",void 0),e([h()],B.prototype,"drawOperation",void 0),e([h({value:!0})],B.prototype,"enabled",null),e([h({value:!0})],B.prototype,"forceUniformSize",null),e([h({constructOnly:!0})],B.prototype,"geometryType",void 0),e([h()],B.prototype,"graphic",null),e([h({constructOnly:!0})],B.prototype,"graphicProperties",void 0),e([h()],B.prototype,"graphicSymbol",null),e([h({constructOnly:!0})],B.prototype,"hasZ",void 0),e([h({constructOnly:!0,type:b})],B.prototype,"labelOptions",void 0),e([h({constructOnly:!0})],B.prototype,"geometryToPlace",void 0),e([h({constructOnly:!0})],B.prototype,"mode",void 0),e([h()],B.prototype,"snappingManager",void 0),e([h()],B.prototype,"snapToScene",void 0),e([h()],B.prototype,"tooltip",void 0),e([h()],B.prototype,"tooltipInfos",void 0),e([h({constructOnly:!0,type:S})],B.prototype,"tooltipOptions",void 0),e([h({readOnly:!0})],B.prototype,"type",void 0),e([h({readOnly:!0})],B.prototype,"updating",null),e([h({constructOnly:!0,nonNullable:!0})],B.prototype,"view",void 0),e([h()],B.prototype,"_tooltipInfo",null),e([h()],B.prototype,"_circleRadius",null),e([h()],B.prototype,"_xSize",null),e([h()],B.prototype,"_ySize",null),e([h()],B.prototype,"_fullGeometryArea",null),e([h()],B.prototype,"_vertexTooltipElevation",null),e([h()],B.prototype,"_elevationMode",null),B=e([d("esri.views.draw.DrawGraphicTool")],B);const F="create-operation-graphic",J={outline:"outline-visual",regularVertices:"regular-vertices-visual",activeVertex:"active-vertex-visual"};function K(e){switch(e){case"point":case"polyline":case"polygon":case"multipoint":return e;case"circle":case"rectangle":return"segment";case"mesh":return"point"}}const Q=48;export{q as CreateOperationGeometry,B as DrawGraphicTool,K as geometryTypeToDrawOperationGeometryType};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import i from"../../core/Evented.js";import{clone as n}from"../../core/lang.js";import{destroyMaybe as r,equalsMaybe as o}from"../../core/maybe.js";import{ignoreAbortErrors as s}from"../../core/promiseUtils.js";import{watch as a,syncAndInitial as p}from"../../core/reactiveUtils.js";import{createScreenPoint as c}from"../../core/screenUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{diff as h}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{pointEquals as u}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as m}from"../../support/elevationInfoUtils.js";import{ViewingMode as v}from"../ViewingMode.js";import{defaultDrawingMode as y}from"./DrawingMode.js";import{DrawManipulator as _}from"./DrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as V,Component as w}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as O}from"../interactive/editGeometry/EditGeometryOperations.js";import T from"../interactive/sketch/SketchLabelOptions.js";import b from"../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as M}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as P}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as D}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as C}from"../interactive/snapping/snappingUtils.js";let I=class extends(i.EventedMixin(t)){constructor(e){super(e),this._createOperationCompleted=!1,this._pointerDownStates=new Set,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new g,this.isDraped=!0,this.labelOptions=new T,this.tooltipOptions=new b,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.lastVertex=null,null==e.elevationInfo&&(this.elevationInfo=m(!!e.hasZ))}initialize(){const{geometryType:e,view:t}=this,i=t.spatialReference,n="viewingMode"in t.state?t.state.viewingMode:v.Local,r="segment"===e||"multipoint"===e?"polyline":e;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new O(new V(r,this.coordinateHelper)),this._snappingOperation=new D({view:t,constrainResult:e=>null==e?e:this._getEffectiveDrawSurface()?.constrainZ(e)}),this.addHandles([a((()=>this.stagedVertex),(e=>{null!=e&&this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(e)}],operation:"apply",type:"vertex-update"})}),{sync:!0,equals:(e,t)=>o(e,t,u)}),a((()=>this.view.viewpoint),((e,t)=>{e&&t&&h(e,t)&&this._onViewpointChange()}))]),this._activeComponent=new w(i,n),this._editGeometryOperations.data.components.push(this._activeComponent);const c=this.segmentLabels;null!=c&&(c.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles([a((()=>this.labelOptions.enabled),(e=>{c.visible=e}),p),this.on("cursor-update",(()=>{const e=this.stagedVertex;c.stagedVertex=null!=e?this.coordinateHelper.pointToVector(e):null}))])),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],(e=>{const t=e.vertices.map((e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)}))),i=t.map((e=>e.coordinates));switch(e.type){case"vertex-add":this.emit(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this.emit(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this.emit(e.type,{...e,removed:i,vertices:t})}const n=this._activeComponent.getLastVertex(),r=null!=n?this.coordinateHelper.vectorToDehydratedPoint(n.pos):null;null!=r&&null!=this.lastVertex&&u(this.lastVertex,r)||(this.lastVertex=r)})));const l=this._manipulator=new _({grabbableForEvent:e=>"click"!==this.drawingMode||"touch"===e.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size});this.manipulators.add(l),l.grabbable="point"!==e,this.addHandles([this._createManipulatorDragPipeline(l),l.events.on("immediate-click",(e=>this._onImmediateClick(e))),l.events.on("immediate-double-click",(e=>this._onImmediateDoubleClick(e))),a((()=>({cursor:this.cursor,loading:this.loading})),(({cursor:e,loading:t})=>{l.cursor=t?"progress":e}),p)]),C(this,(()=>{const e=this.view.inputManager.latestPointerType??"mouse",t=this._getSnappingContext(e);null!=this.snappingManager&&this._updatingHandles.addPromise(s(this._snappingOperation.resnap(this.snappingManager,t)))}))}destroy(){r(this.segmentLabels),r(this._snappingOperation),this._editGeometryOperations=r(this._editGeometryOperations),this._updatingHandles.destroy()}get _snappingEnabled(){return null!=this.snappingManager&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const e=this._getEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map((e=>this.coordinateHelper.vectorToArray(e.pos)))}set drawingMode(e){this._set("drawingMode",e??y)}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return null!=this.stagedVertex?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get snappingOptions(){return null!=this.snappingManager?this.snappingManager.options:null}get stagedVertex(){return this._snappingOperation.stagedPoint}set stagedVertex(e){this._snappingOperation.stagedPoint=n(e)}get updating(){return this._updatingHandles.updating}get vertices(){const e=this.committedVertices;return null!=this.stagedVertex&&e.push(this.coordinateHelper.pointToArray(this.stagedVertex)),e}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingOperation.abort(),null!=this.stagedVertex){const{stagedVertex:e}=this;this.stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e))}}complete(e){const t=e&&e.aborted||!1;this._snappingOperation.abort(),null!=this.snappingManager&&this.snappingManager.doneSnapping(),"segment"===this.geometryType||"point"===this.geometryType?this.commitStagedVertex():this.stagedVertex=null;const i="multipoint"===this.geometryType&&0===this.numVertices||"polyline"===this.geometryType&&this.numVertices<2||"polygon"===this.geometryType&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||t)&&this.emit("complete",{vertices:this.vertices.map(((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e}))),aborted:t,type:"complete"})}onInputEvent(e){switch(e.type){case"pointer-down":this._pointerDownStates.add(e.pointerId);break;case"pointer-up":this._pointerDownStates.delete(e.pointerId)}switch(e.type){case"pointer-move":return this._onPointerMove(e);case"hold":return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(e){const t=this._activeComponent;if("polygon"===this.geometryType&&t.vertices.length>2){if(this._vertexWithinPointerDistance(t.vertices[0].pos,e))return 0;if(this._vertexWithinPointerDistance(t.vertices[t.vertices.length-1].pos,e))return t.vertices.length-1}return null}_createManipulatorDragPipeline(e){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(e);case"freehand":return this._createManipulatorDragPipelineFreehand(e);case"hybrid":return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return f(e,((e,t,i,n)=>{const r="touch"===n&&this._snappingEnabled;if(this.isCompleted||!r)return;const{snappingStep:o,cancelSnapping:s}=P({predicate:()=>r,snappingManager:this.snappingManager,snappingContext:new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:n,visualizer:this.snappingVisualizer}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});i=i.next((e=>(r&&null!=this.snappingManager&&this.snappingManager.doneSnapping(),e))).next(s),t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(this.stagedVertex=e.mapStart,("segment"===this.geometryType||r&&0===this.numVertices)&&this.commitStagedVertex()),e))).next(S(this.view,this.elevationInfo)).next(...o).next((e=>(r&&(this.stagedVertex=e.mapEnd,"end"===e.action&&this.commitStagedVertex()),e))).next((e=>("end"===e.action&&("segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),e)))}))}_createManipulatorDragPipelineFreehand(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(null==this.stagedVertex&&(this.stagedVertex=e.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return e}))}))}_createManipulatorDragPipelineHybrid(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(null==this.stagedVertex&&(this.stagedVertex=e.mapStart),this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return e}))}))}get _drawAtFixedElevation(){return("segment"===this.geometryType||"polygon"===this.geometryType)&&this.numCommittedVertices>0}_getEffectiveDrawSurface(){if(null==this.elevationDrawSurface)return this.drawSurface;if(!this.coordinateHelper.hasZ())return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let e=this.defaultZ,t=!1;return null!=this.elevationInfo&&"absolute-height"===this.elevationInfo.mode&&(t=!0),null!=this.snapToSceneEnabled&&(t=this.snapToSceneEnabled),null!=this.elevationInfo&&"on-the-ground"===this.elevationInfo.mode&&(t=!1),this._drawAtFixedElevation&&(e=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),t=!1),t?this.drawSurface:(this.elevationDrawSurface.defaultZ=e,this.elevationDrawSurface)}_mapToScreen(e){return this._getEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===e.pointerType&&this._snappingEnabled&&(this.stagedVertex=e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if("mouse"===e.pointerType&&2===e.button||this._manipulator.dragging)return;const t=this._activeComponent;if(null!=this._closeOnClickVertexIndex(e.screenPoint))return e.stopPropagation(),void this.complete();const i=this._screenToMap(e.screenPoint);if(null!=i)switch(this.drawingMode){case"freehand":"point"===this.geometryType&&(null!=this.stagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),this.complete());break;case"click":case"hybrid":this._snappingOperation.abort(),null!=this.stagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),("point"===this.geometryType||"segment"===this.geometryType&&2===t.vertices.length||"segment"===this.geometryType&&"hybrid"===this.drawingMode&&1===t.vertices.length)&&this.complete()}e.stopPropagation()}_onImmediateDoubleClick(e){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),e.stopPropagation())}_onPointerMove(e){const t=c(e.x,e.y);this._stagedScreenPoint=t,this._stagedPointerType=e.pointerType;const i=this._snappingOperation,n=this._manipulator;n.dragging||this._pointerDownStates.has(e.pointerId)||n.grabbing||!n.interactive?i.abort():(e.stopPropagation(),this._updateStagedVertexOnPointerMove(t,e.pointerType))}_onViewpointChange(){const e=this._manipulator;this._stagedScreenPoint&&!e.dragging&&!e.grabbing&&e.interactive?this._updateStagedVertexOnPointerMove(this._stagedScreenPoint,this._stagedPointerType??"mouse"):this._snappingOperation.abort()}_updateStagedVertexOnPointerMove(e,t){const i=this._snappingOperation,n=this._closeOnClickVertexIndex(e);if(null!=n)return this._closeOnVertex(n),void i.abort();const r=this._screenToMap(e),o=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(null==r)return this.cursor=null,void i.abort();this.cursor="crosshair";const a=this.snappingManager;if(null==a)return this.stagedVertex=r,void i.abort();const p=this._getSnappingContext(t);this._updatingHandles.addPromise(s(i.snap({point:r,scenePoint:o},a,p)))}_closeOnVertex(e){this.stagedVertex=null;const t={componentIndex:0,vertexIndex:e,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[e].pos)};this.emit("cursor-update",{updated:null,vertices:[t],operation:"apply",type:"vertex-update"})}_screenToMap(e){return this._getEffectiveDrawSurface()?.screenToMap(e)}_screenToMapDragEventStep(){let e=null;return t=>{if("start"===t.action&&(e=this._screenToMap(t.screenStart)),null==e)return null;const i=this._screenToMap(t.screenEnd);return null!=i?{...t,mapStart:e,mapEnd:i}:null}}_vertexWithinPointerDistance(e,t){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return null!=n&&E(n,t,i)}_getSnappingContext(e){const t=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new M({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,visualizer:this.snappingVisualizer,selfSnappingZ:null!=t?{value:t,elevationInfo:this.elevationInfo}:null})}};function E(e,t,i){const n=e.x-t.x,r=e.y-t.y;return n*n+r*r<=i}e([l()],I.prototype,"_snappingEnabled",null),e([l()],I.prototype,"defaultZ",void 0),e([l()],I.prototype,"isDraped",void 0),e([l({value:y})],I.prototype,"drawingMode",null),e([l({constructOnly:!0})],I.prototype,"elevationDrawSurface",void 0),e([l({constructOnly:!0})],I.prototype,"elevationInfo",void 0),e([l({constructOnly:!0,type:T})],I.prototype,"labelOptions",void 0),e([l({constructOnly:!0,type:b})],I.prototype,"tooltipOptions",void 0),e([l({constructOnly:!0})],I.prototype,"geometryType",void 0),e([l({constructOnly:!0})],I.prototype,"hasM",void 0),e([l({constructOnly:!0})],I.prototype,"hasZ",void 0),e([l()],I.prototype,"cursor",void 0),e([l()],I.prototype,"loading",void 0),e([l({constructOnly:!0})],I.prototype,"manipulators",void 0),e([l({constructOnly:!0})],I.prototype,"drawSurface",void 0),e([l({constructOnly:!0})],I.prototype,"segmentLabels",void 0),e([l({constructOnly:!0})],I.prototype,"snappingManager",void 0),e([l({constructOnly:!0})],I.prototype,"snappingVisualizer",void 0),e([l()],I.prototype,"snapToSceneEnabled",void 0),e([l()],I.prototype,"_snappingOperation",void 0),e([l()],I.prototype,"stagedVertex",null),e([l()],I.prototype,"lastVertex",void 0),e([l()],I.prototype,"updating",null),e([l({constructOnly:!0})],I.prototype,"view",void 0),I=e([d("esri.views.draw.DrawOperation")],I);export{I as DrawOperation};
5
+ import{_ as e}from"../../chunks/tslib.es6.js";import t from"../../core/Accessor.js";import i from"../../core/Evented.js";import{clone as n}from"../../core/lang.js";import{destroyMaybe as o,equalsMaybe as r}from"../../core/maybe.js";import{ignoreAbortErrors as s}from"../../core/promiseUtils.js";import{watch as a,syncAndInitial as p}from"../../core/reactiveUtils.js";import{createScreenPoint as c}from"../../core/screenUtils.js";import{property as l}from"../../core/accessorSupport/decorators/property.js";import"../../core/accessorSupport/ensureType.js";import{subclass as d}from"../../core/accessorSupport/decorators/subclass.js";import{diff as h}from"../../core/accessorSupport/diffUtils.js";import{UpdatingHandles as g}from"../../core/support/UpdatingHandles.js";import{pointEquals as m}from"../../layers/graphics/dehydratedFeatureComparison.js";import{getEffectiveElevationInfo as u}from"../../support/elevationInfoUtils.js";import{ViewingMode as v}from"../ViewingMode.js";import{defaultDrawingMode as y}from"./DrawingMode.js";import{DrawManipulator as _}from"./DrawManipulator.js";import{createCoordinateHelper as x}from"../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f,sceneSnappingAtLocation as S}from"../interactive/dragEventPipeline.js";import{EditGeometry as w,Component as V}from"../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as O}from"../interactive/editGeometry/EditGeometryOperations.js";import{fromPoint as T,toDehydratedPoint as b}from"../interactive/sketch/normalizedPoint.js";import M from"../interactive/sketch/SketchLabelOptions.js";import P from"../interactive/sketch/SketchTooltipOptions.js";import{SnappingContext as D}from"../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as C}from"../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as I}from"../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as E}from"../interactive/snapping/snappingUtils.js";let H=class extends(i.EventedMixin(t)){constructor(e){super(e),this._createOperationCompleted=!1,this._pointerDownStates=new Set,this._stagedScreenPoint=null,this._stagedPointerType=null,this._updatingHandles=new g,this.constraint=void 0,this.isDraped=!0,this.labelOptions=new M,this.tooltipOptions=new P,this.cursor=null,this.loading=!1,this.snapToSceneEnabled=null,this.lastVertex=null,null==e.elevationInfo&&(this.elevationInfo=u(!!e.hasZ))}initialize(){const{geometryType:e,view:t}=this,i=t.spatialReference,n="viewingMode"in t.state?t.state.viewingMode:v.Local,o="segment"===e||"multipoint"===e?"polyline":e;this.coordinateHelper=x(this.hasZ,this.hasM,i),this._editGeometryOperations=new O(new w(o,this.coordinateHelper)),this._snappingOperation=new I({view:t,constrainResult:e=>e?this._getEffectiveDrawSurface()?.constrainZ(e):void 0}),this.addHandles([a((()=>this.stagedVertex),(e=>{null!=e&&this.emit("cursor-update",{updated:null,vertices:[{componentIndex:0,vertexIndex:this._activeComponent.vertices.length,coordinates:this.coordinateHelper.pointToArray(e)}],operation:"apply",type:"vertex-update"})}),{sync:!0,equals:(e,t)=>r(e,t,m)}),a((()=>this.view.viewpoint),((e,t)=>{e&&t&&h(e,t)&&this._onViewpointChange()}))]),this._activeComponent=new V(i,n),this._editGeometryOperations.data.components.push(this._activeComponent);const c=this.segmentLabels;null!=c&&(c.context={view:t,editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,labelOptions:this.labelOptions},this.addHandles([a((()=>this.labelOptions.enabled),(e=>{c.visible=e}),p),this.on("cursor-update",(()=>{const e=this.stagedVertex;c.stagedVertex=null!=e?this.coordinateHelper.pointToVector(e):null}))])),this.addHandles(this._editGeometryOperations.on(["vertex-add","vertex-update","vertex-remove"],(e=>{const t=e.vertices.map((e=>({componentIndex:0,vertexIndex:e.index,coordinates:this.coordinateHelper.vectorToArray(e.pos)}))),i=t.map((e=>e.coordinates));switch(e.type){case"vertex-add":this.emit(e.type,{...e,added:i,vertices:t});break;case"vertex-update":this.emit(e.type,{...e,updated:i,vertices:t});break;case"vertex-remove":this.emit(e.type,{...e,removed:i,vertices:t})}const n=this._activeComponent.getLastVertex(),o=null!=n?this.coordinateHelper.vectorToDehydratedPoint(n.pos):null;null!=o&&null!=this.lastVertex&&m(this.lastVertex,o)||(this.lastVertex=o)})));const l=this._manipulator=new _({grabbableForEvent:e=>"click"!==this.drawingMode||"touch"===e.pointerType&&this._snappingEnabled&&1===this._pointerDownStates.size});this.manipulators.add(l),l.grabbable="point"!==e,this.addHandles([this._createManipulatorDragPipeline(l),l.events.on("immediate-click",(e=>this._onImmediateClick(e))),l.events.on("immediate-double-click",(e=>this._onImmediateDoubleClick(e))),a((()=>({cursor:this.cursor,loading:this.loading})),(({cursor:e,loading:t})=>{l.cursor=t?"progress":e}),p)]),E(this,(()=>{const e=this.view.inputManager.latestPointerType??"mouse",t=this._getSnappingContext(e);null!=this.snappingManager&&this._updatingHandles.addPromise(s(this._snappingOperation.resnap(this.snappingManager,t)))}))}destroy(){o(this.segmentLabels),o(this._snappingOperation),this._editGeometryOperations=o(this._editGeometryOperations),this._updatingHandles.destroy()}get _snappingEnabled(){return null!=this.snappingManager&&this.snappingManager.options.effectiveEnabled}get _requiresScenePoint(){const e=this._getEffectiveDrawSurface();return"3d"===this.view.type&&this.drawSurface!==e}get canRedo(){return this._editGeometryOperations.canRedo}get canUndo(){return this._editGeometryOperations.canUndo}get committedVertices(){return this._activeComponent.vertices.map((e=>this.coordinateHelper.vectorToArray(e.pos)))}set drawingMode(e){this._set("drawingMode",e??y)}get interactive(){return this._manipulator.interactive}set interactive(e){this._manipulator.interactive=e}get isCompleted(){return this._createOperationCompleted}get numCommittedVertices(){return this._activeComponent.vertices.length}get numVertices(){return null!=this.stagedVertex?this._activeComponent.vertices.length+1:this._activeComponent.vertices.length}get snappingOptions(){return null!=this.snappingManager?this.snappingManager.options:null}get stagedVertex(){const e=this._snappingOperation.stagedPoint,{constraint:t,elevationInfo:i,view:n}=this;if(!e||!t)return e;const o=T(e,n,i),r=o?t.closestTo(o):void 0;return r?b(r,e.spatialReference):e}set stagedVertex(e){this._snappingOperation.stagedPoint=n(e)}get updating(){return this._updatingHandles.updating}get vertices(){const e=this.committedVertices;return null!=this.stagedVertex&&e.push(this.coordinateHelper.pointToArray(this.stagedVertex)),e}cancel(){this.complete({aborted:!0})}commitStagedVertex(){if(this._snappingOperation.abort(),null!=this.stagedVertex){const{stagedVertex:e}=this;this.stagedVertex=null,this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(e))}}complete(e){const t=e&&e.aborted||!1;this._snappingOperation.abort(),null!=this.snappingManager&&this.snappingManager.doneSnapping(),"segment"===this.geometryType||"point"===this.geometryType?this.commitStagedVertex():this.stagedVertex=null;const i="multipoint"===this.geometryType&&0===this.numVertices||"polyline"===this.geometryType&&this.numVertices<2||"polygon"===this.geometryType&&this.numVertices<3;this._createOperationCompleted=!i,(this.isCompleted||t)&&this.emit("complete",{vertices:this.vertices.map(((e,t)=>({componentIndex:0,vertexIndex:t,coordinates:e}))),aborted:t,type:"complete"})}onInputEvent(e){switch(e.type){case"pointer-down":this._pointerDownStates.add(e.pointerId);break;case"pointer-up":this._pointerDownStates.delete(e.pointerId)}switch(e.type){case"pointer-move":return this._onPointerMove(e);case"hold":return this._onHold(e)}}redo(){this._editGeometryOperations.redo()}undo(){null!=this.snappingManager&&this.snappingManager.doneSnapping(),this._editGeometryOperations.undo()}_closeOnClickVertexIndex(e){const t=this._activeComponent;if("polygon"===this.geometryType&&t.vertices.length>2){if(this._vertexWithinPointerDistance(t.vertices[0].pos,e))return 0;if(this._vertexWithinPointerDistance(t.vertices[t.vertices.length-1].pos,e))return t.vertices.length-1}return null}_createManipulatorDragPipeline(e){switch(this.drawingMode){case"click":return this._createManipulatorDragPipelineClick(e);case"freehand":return this._createManipulatorDragPipelineFreehand(e);case"hybrid":return this._createManipulatorDragPipelineHybrid(e)}}_createManipulatorDragPipelineClick(e){return f(e,((e,t,i,n)=>{const o="touch"===n&&this._snappingEnabled;if(this.isCompleted||!o)return;const{snappingStep:r,cancelSnapping:s}=C({predicate:()=>o,snappingManager:this.snappingManager,snappingContext:new D({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:n,visualizer:this.snappingVisualizer}),updatingHandles:this._updatingHandles,useZ:!this._requiresScenePoint});i=i.next((e=>(o&&null!=this.snappingManager&&this.snappingManager.doneSnapping(),e))).next(s),t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(this.stagedVertex=e.mapStart,("segment"===this.geometryType||o&&0===this.numVertices)&&this.commitStagedVertex()),e))).next(S(this.view,this.elevationInfo)).next(...r).next((e=>(o&&(this.stagedVertex=e.mapEnd,"end"===e.action&&this.commitStagedVertex()),e))).next((e=>("end"===e.action&&("segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()),e)))}))}_createManipulatorDragPipelineFreehand(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(null==this.stagedVertex&&(this.stagedVertex=e.mapStart),"segment"===this.geometryType&&this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":this.complete()}return e}))}))}_createManipulatorDragPipelineHybrid(e){return f(e,((e,t)=>{this.isCompleted||t.next(this._screenToMapDragEventStep()).next((e=>("start"===e.action&&(null==this.stagedVertex&&(this.stagedVertex=e.mapStart),this.commitStagedVertex()),e))).next((e=>{switch(e.action){case"start":case"update":this.stagedVertex=e.mapEnd,"polygon"!==this.geometryType&&"polyline"!==this.geometryType||this.commitStagedVertex();break;case"end":"segment"!==this.geometryType&&"point"!==this.geometryType||this.complete()}return e}))}))}get _drawAtFixedElevation(){return("segment"===this.geometryType||"polygon"===this.geometryType)&&this.numCommittedVertices>0}_getEffectiveDrawSurface(){if(null==this.elevationDrawSurface)return this.drawSurface;if(!this.coordinateHelper.hasZ())return this.elevationDrawSurface.defaultZ=null,this.elevationDrawSurface;let e=this.defaultZ,t=!1;return null!=this.elevationInfo&&"absolute-height"===this.elevationInfo.mode&&(t=!0),null!=this.snapToSceneEnabled&&(t=this.snapToSceneEnabled),null!=this.elevationInfo&&"on-the-ground"===this.elevationInfo.mode&&(t=!1),this._drawAtFixedElevation&&(e=this.coordinateHelper.getZ(this._activeComponent.vertices[0].pos),t=!1),t?this.drawSurface:(this.elevationDrawSurface.defaultZ=e,this.elevationDrawSurface)}_mapToScreen(e){return this._getEffectiveDrawSurface()?.mapToScreen(e)}_onHold(e){this._snappingOperation.abort(),"click"===this.drawingMode&&"touch"===e.pointerType&&this._snappingEnabled&&(this.stagedVertex=e.mapPoint),e.stopPropagation()}_onImmediateClick(e){if("mouse"===e.pointerType&&2===e.button||this._manipulator.dragging)return;const t=this._activeComponent;if(null!=this._closeOnClickVertexIndex(e.screenPoint))return e.stopPropagation(),void this.complete();const i=this._screenToMap(e.screenPoint);if(null!=i)switch(this.drawingMode){case"freehand":"point"===this.geometryType&&(null!=this.stagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),this.complete());break;case"click":case"hybrid":this._snappingOperation.abort(),null!=this.stagedVertex?this.commitStagedVertex():this._editGeometryOperations.appendVertex(this.coordinateHelper.pointToVector(i)),("point"===this.geometryType||"segment"===this.geometryType&&2===t.vertices.length||"segment"===this.geometryType&&"hybrid"===this.drawingMode&&1===t.vertices.length)&&this.complete()}e.stopPropagation()}_onImmediateDoubleClick(e){this._manipulator.dragging||"point"===this.geometryType||(this.complete(),e.stopPropagation())}_onPointerMove(e){const t=c(e.x,e.y);this._stagedScreenPoint=t,this._stagedPointerType=e.pointerType;const i=this._snappingOperation,n=this._manipulator;n.dragging||this._pointerDownStates.has(e.pointerId)||n.grabbing||!n.interactive?i.abort():(e.stopPropagation(),this._updateStagedVertexOnPointerMove(t,e.pointerType))}_onViewpointChange(){const e=this._manipulator;this._stagedScreenPoint&&!e.dragging&&!e.grabbing&&e.interactive?this._updateStagedVertexOnPointerMove(this._stagedScreenPoint,this._stagedPointerType??"mouse"):this._snappingOperation.abort()}_updateStagedVertexOnPointerMove(e,t){const i=this._snappingOperation,n=this._closeOnClickVertexIndex(e);if(null!=n)return this._closeOnVertex(n),void i.abort();const o=this._screenToMap(e),r=this._requiresScenePoint?this.drawSurface?.screenToMap(e):null;if(null==o)return this.cursor=null,void i.abort();this.cursor="crosshair";const a=this.snappingManager;if(null==a)return this.stagedVertex=o,void i.abort();const p=this._getSnappingContext(t);this._updatingHandles.addPromise(s(i.snap({point:o,scenePoint:r},a,p)))}_closeOnVertex(e){this.stagedVertex=null;const t={componentIndex:0,vertexIndex:e,coordinates:this.coordinateHelper.vectorToArray(this._activeComponent.vertices[e].pos)};this.emit("cursor-update",{updated:null,vertices:[t],operation:"apply",type:"vertex-update"})}_screenToMap(e){return this._getEffectiveDrawSurface()?.screenToMap(e)}_screenToMapDragEventStep(){let e=null;return t=>{if("start"===t.action&&(e=this._screenToMap(t.screenStart)),null==e)return null;const i=this._screenToMap(t.screenEnd);return null!=i?{...t,mapStart:e,mapEnd:i}:null}}_vertexWithinPointerDistance(e,t){const i=25,n=this._mapToScreen(this.coordinateHelper.vectorToDehydratedPoint(e));return null!=n&&j(n,t,i)}_getSnappingContext(e){const t=this._drawAtFixedElevation?this.elevationDrawSurface?.defaultZ:null;return new D({editGeometryOperations:this._editGeometryOperations,elevationInfo:this.elevationInfo,pointer:e,visualizer:this.snappingVisualizer,selfSnappingZ:null!=t?{value:t,elevationInfo:this.elevationInfo}:null})}};function j(e,t,i){const n=e.x-t.x,o=e.y-t.y;return n*n+o*o<=i}e([l()],H.prototype,"_snappingOperation",void 0),e([l()],H.prototype,"_snappingEnabled",null),e([l()],H.prototype,"constraint",void 0),e([l()],H.prototype,"defaultZ",void 0),e([l()],H.prototype,"isDraped",void 0),e([l({value:y})],H.prototype,"drawingMode",null),e([l({constructOnly:!0})],H.prototype,"elevationDrawSurface",void 0),e([l({constructOnly:!0})],H.prototype,"elevationInfo",void 0),e([l({constructOnly:!0,type:M})],H.prototype,"labelOptions",void 0),e([l({constructOnly:!0,type:P})],H.prototype,"tooltipOptions",void 0),e([l({constructOnly:!0})],H.prototype,"geometryType",void 0),e([l({constructOnly:!0})],H.prototype,"hasM",void 0),e([l({constructOnly:!0})],H.prototype,"hasZ",void 0),e([l()],H.prototype,"cursor",void 0),e([l()],H.prototype,"loading",void 0),e([l({constructOnly:!0})],H.prototype,"manipulators",void 0),e([l({constructOnly:!0})],H.prototype,"drawSurface",void 0),e([l({constructOnly:!0})],H.prototype,"segmentLabels",void 0),e([l({constructOnly:!0})],H.prototype,"snappingManager",void 0),e([l({constructOnly:!0})],H.prototype,"snappingVisualizer",void 0),e([l()],H.prototype,"snapToSceneEnabled",void 0),e([l()],H.prototype,"stagedVertex",null),e([l()],H.prototype,"lastVertex",void 0),e([l()],H.prototype,"updating",null),e([l({constructOnly:!0})],H.prototype,"view",void 0),H=e([d("esri.views.draw.DrawOperation")],H);export{H as DrawOperation};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{g as t,c as s}from"../../../chunks/vec2.js";import{a as e}from"../../../chunks/vec2f64.js";import{k as n}from"../../../chunks/vec3.js";import{f as r}from"../../../chunks/vec3f64.js";import{clone as i,fromVec3 as o,fromValues as c}from"./normalizedPoint.js";import{projectPointToLineLike as u,projectPointToVerticalCylinder as a,projectPointToVerticalPlane as l,VerticalPlaneType as h,epsilon as p,intersectLineAndPoint as f,intersectVerticalCylinderAndPoint as d,intersectVerticalPlaneAndPoint as k,intersectLineLike as L,intersectLineLikeAndVerticalCylinder as m,intersectVerticalPlaneAndLineLike as y,intersectVerticalPlaneAndVerticalCylinder as q,intersectVerticalPlane as x}from"../../support/geometry3dUtils.js";import{LineType as T}from"../../support/geometry2dUtils.js";class g{intersect(t){return O(this,t)}}class j extends g{constructor(t){super(),this.point=t}equals(t){return z(t)&&n(this.point,t.point)}closestTo(){return i(this.point)}}class P extends g{constructor(t,s,e){super(),this.start=t,this.end=s,this.type=e,this.lineLike={start:this.start,end:this.end,type:this.type}}equals(t){return F(t)&&this.type===t.type&&n(this.start,t.start)&&n(this.end,t.end)}closestTo(t){const s=u(t,this.lineLike);return o(s)}}class Z extends P{constructor(t,s){super(t,s,T.LINE)}}class E extends g{constructor(t,s,e){super(),this.intersection=t,this.first=s,this.second=e}equals(t){return t instanceof E&&this.first.equals(t.first)&&this.second.equals(t.second)}closestTo(){return i(this.intersection)}}class v extends g{constructor(t,s,e){super(),this.basePoint=t,this.first=s,this.second=e}equals(t){return t instanceof v&&this.first.equals(t.first)&&this.second.equals(t.second)}closestTo(t){const s=this.basePoint;return c(s[0],s[1],t[2])}}class w extends g{constructor(t,s){super(),this.center=t,this.radius=s}equals(t){return H(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const s=a(t,this.center,this.radius);return o(s)}}class A extends g{constructor(t,s,e){super(),this.start=t,this.end=s,this.type=e,this.planeLike={start:t,end:s,type:e}}equals(t){return _(t)&&this.type===t.type&&n(this.start,t.start)&&n(this.end,t.end)}closestTo(t){return o(l(t,this.planeLike))}closestEndTo(e){const{start:n,end:r}=this;return Math.sign(t(s(C,r,n),s(D,e,n)))>0?r:n}}class I extends A{constructor(t,s){super(t,s,h.HALF_PLANE)}}class N extends A{constructor(t,s){super(t,s,h.PLANE)}}class b extends g{constructor(t,s,e){super(),this.start=t,this.end=s,this.getZ=e,this.planeLike={start:t,end:s,type:h.PLANE}}equals(t){return B(t)&&n(this.start,t.start)&&n(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return G(this,t)}addIfOnTheGround(t,s){for(const e of s){const s=this.getZ(e[0],e[1],e[2])??0;Math.abs(e[2]-s)<p&&(e[2]=s,t.push(e))}}}function G(t,s){const e=l(s,t.planeLike);return e[2]=t.getZ(s[0],s[1],s[2])??J,o(e)}function O(t,s){let e=[];if(z(t)){const{point:n}=t;F(s)?e=f(s.lineLike,n):H(s)?e=d(s.center,s.radius,n):_(s)?e=k(s.planeLike,n):B(s)&&(e=M(s,t))}else if(F(t)){const{lineLike:n}=t;z(s)?e=f(n,s.point):F(s)?e=L(n,s.lineLike):H(s)?e=m(n,s.center,s.radius):_(s)?e=y(s.planeLike,n):B(s)&&(e=M(s,t))}else if(H(t)){const{center:n,radius:r}=t;if(F(s))e=m(s.lineLike,n,r);else if(z(s))e=d(n,r,s.point);else{if(_(s))return q(s.planeLike,n,r).map((e=>new v(e,t,s)));B(s)&&(e=M(s,t))}}else if(_(t)){const{planeLike:n}=t;if(_(s))return x(n,s.planeLike).map((e=>new v(e,t,s)));if(z(s))e=k(n,s.point);else if(F(s))e=y(n,s.lineLike);else{if(H(s))return q(n,s.center,s.radius).map((e=>new v(e,t,s)));B(s)&&(e=M(s,t))}}else B(t)&&(e=M(t,s));return U(e,t,s)}function M(t,s){const{planeLike:e,getZ:n}=t,i=[];if(z(s))t.addIfOnTheGround(i,k(e,s.point));else if(F(s))t.addIfOnTheGround(i,y(e,s.lineLike));else if(H(s))for(const[o,c]of q(e,s.center,s.radius)){const t=n(o,c,0);null!=t&&i.push(r(o,c,t))}else if(_(s)||B(s))for(const[o,c]of x(e,s.planeLike)){const t=n(o,c,0)??J;i.push(r(o,c,t))}return i}function U(t,s,e){return t.map((t=>new E(o(t),s,e)))}function z(t){return t instanceof j}function F(t){return t instanceof P}function H(t){return t instanceof w}function _(t){return t instanceof A}function B(t){return t instanceof b}const C=e(),D=e(),J=0;export{g as Constraint,b as DrapedLineConstraint,E as IntersectionConstraint,Z as LineConstraint,P as LineLikeConstraint,j as PointConstraint,w as VerticalCylinderConstraint,I as VerticalHalfPlaneConstraint,v as VerticalLineIntersectionConstraint,N as VerticalPlaneConstraint,A as VerticalPlaneLikeConstraint};
5
+ import{equals as t}from"../../../core/arrayUtils.js";import{g as s,c as e}from"../../../chunks/vec2.js";import{a as n}from"../../../chunks/vec2f64.js";import{k as r,a as i}from"../../../chunks/vec3.js";import{f as o}from"../../../chunks/vec3f64.js";import{clone as c,fromVec3 as u,fromValues as a}from"./normalizedPoint.js";import{projectPointToLineLike as f,projectPointToVerticalCylinder as h,projectPointToVerticalPlane as l,VerticalPlaneType as p,epsilon as d,intersectLineAndPoint as k,intersectVerticalCylinderAndPoint as L,intersectVerticalPlaneAndPoint as m,intersectLineLike as y,intersectLineLikeAndVerticalCylinder as T,intersectVerticalPlaneAndLineLike as g,intersectVerticalPlaneAndVerticalCylinder as x,intersectVerticalPlane as q}from"../../support/geometry3dUtils.js";import{LineType as P}from"../../support/geometry2dUtils.js";class j{intersect(t){return U(this,t)}closestPoints(t){return[this.closestTo(t)]}}class Z extends j{constructor(t){super(),this.point=t}equals(t){return this===t||D(t)&&r(this.point,t.point)}closestTo(){return c(this.point)}}class E extends j{constructor(t,s,e){super(),this.start=t,this.end=s,this.type=e,this.lineLike={start:this.start,end:this.end,type:this.type}}equals(t){return this===t||J(t)&&this.type===t.type&&r(this.start,t.start)&&r(this.end,t.end)}closestTo(t){const s=f(t,this.lineLike);return u(s)}}class v extends E{constructor(t,s){super(t,s,P.LINE)}}class A extends j{constructor(t){super(),this.constraints=t}equals(s){return this===s||C(s)&&t(this.constraints,s.constraints,((t,s)=>t.equals(s)))}closestTo(t){let s,e=1/0;for(const n of this.constraints){const r=n.closestTo(t),o=i(t,r);o<e&&(e=o,s=r)}return s?c(s):t}closestPoints(t){return this.constraints.flatMap((s=>s===this?[]:s.closestPoints(t)))}}class I extends j{constructor(t,s,e){super(),this.basePoint=t,this.first=s,this.second=e}equals(t){return this===t||B(t)&&this.first.equals(t.first)&&this.second.equals(t.second)}closestTo(t){const s=this.basePoint;return a(s[0],s[1],t[2])}}class N extends j{constructor(t,s){super(),this.center=t,this.radius=s}equals(t){return this===t||K(t)&&this.center[0]===t.center[0]&&this.center[1]===t.center[1]&&this.radius===t.radius}closestTo(t){const s=h(t,this.center,this.radius);return u(s)}}class b extends j{constructor(t,s,e){super(),this.start=t,this.end=s,this.type=e,this.planeLike={start:t,end:s,type:e}}equals(t){return this===t||Q(t)&&this.type===t.type&&r(this.start,t.start)&&r(this.end,t.end)}closestTo(t){return u(l(t,this.planeLike))}closestEndTo(t){const{start:n,end:r}=this;return Math.sign(s(e(S,r,n),e(V,t,n)))>0?r:n}}class w extends b{constructor(t,s){super(t,s,p.HALF_PLANE)}}class G extends b{constructor(t,s){super(t,s,p.PLANE)}}class M extends j{constructor(t,s,e){super(),this.start=t,this.end=s,this.getZ=e,this.planeLike={start:t,end:s,type:p.PLANE}}equals(t){return this===t||R(t)&&r(this.start,t.start)&&r(this.end,t.end)&&this.getZ===t.getZ}closestTo(t){return O(this,t)}addIfOnTheGround(t,s){for(const e of s){const s=this.getZ(e[0],e[1],e[2])??0;Math.abs(e[2]-s)<d&&(e[2]=s,t.push(e))}}}function O(t,s){const e=l(s,t.planeLike);return e[2]=t.getZ(s[0],s[1],s[2])??W,u(e)}function U(t,s){if(C(t)){const e=[];for(const n of t.constraints){const t=n.intersect(s);t&&e.push(t)}return _(e)}if(C(s))return U(s,t);if(D(t)){const{point:e}=t;if(J(s))return H(k(s.lineLike,e));if(K(s))return H(L(s.center,s.radius,e));if(Q(s))return H(m(s.planeLike,e));if(R(s))return H(z(s,t))}else if(J(t)){const{lineLike:e}=t;if(D(s))return H(k(e,s.point));if(J(s))return H(y(e,s.lineLike));if(K(s))return H(T(e,s.center,s.radius));if(Q(s))return H(g(s.planeLike,e));if(R(s))return H(z(s,t))}else if(K(t)){const{center:e,radius:n}=t;if(J(s))return H(T(s.lineLike,e,n));if(D(s))return H(L(e,n,s.point));if(Q(s))return F(x(s.planeLike,e,n),t,s);if(R(s))return H(z(s,t))}else if(Q(t)){const{planeLike:e}=t;if(Q(s))return F(q(e,s.planeLike),t,s);if(D(s))return H(m(e,s.point));if(J(s))return H(g(e,s.lineLike));if(K(s)){return F(x(e,s.center,s.radius),t,s)}if(R(s))return H(z(s,t))}else if(R(t))return H(z(t,s))}function z(t,s){const{planeLike:e,getZ:n}=t,r=[];if(D(s))t.addIfOnTheGround(r,m(e,s.point));else if(J(s))t.addIfOnTheGround(r,g(e,s.lineLike));else if(K(s))for(const[i,c]of x(e,s.center,s.radius)){const t=n(i,c,0);null!=t&&r.push(o(i,c,t))}else if(Q(s)||R(s))for(const[i,c]of q(e,s.planeLike)){const t=n(i,c,0)??W;r.push(o(i,c,t))}return r}function F(t,s,e){return _(t.map((t=>new I(t,s,e))))}function H(t){return _(t.map((t=>new Z(u(t)))))}function _(t){if(0!==t.length)return 1===t.length?t[0]:new A(t)}function B(t){return t instanceof I}function C(t){return t instanceof A}function D(t){return t instanceof Z}function J(t){return t instanceof E}function K(t){return t instanceof N}function Q(t){return t instanceof b}function R(t){return t instanceof M}const S=n(),V=n(),W=0;export{j as Constraint,M as DrapedLineConstraint,v as LineConstraint,E as LineLikeConstraint,Z as PointConstraint,A as SetConstraint,N as VerticalCylinderConstraint,w as VerticalHalfPlaneConstraint,I as VerticalLineConstraint,G as VerticalPlaneConstraint,b as VerticalPlaneLikeConstraint};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{f as n,a as r}from"../../../chunks/vec3f64.js";import{makeDehydratedPoint as t}from"../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as o,absoluteHeightElevationInfo as e}from"../../../support/elevationInfoUtils.js";function u(r,t,o){return n(r,t,o)}function i(n){return n}function f(r,t,o){return i(n(r,t,o))}function l(n){return r(n)}function c(n,r,{coordinateHelper:t,elevationInfo:o}){return n?s(t.vectorToDehydratedPoint(n,p),r,o):null}function s(r,t,u){if(null==r)return null;if(null==t)return i(n(r.x,r.y,r.z??0));if("2d"===t.type)return i(n(r.x,r.y,0));const f=o(t,r,u,e)??0;return i(n(r.x,r.y,f))}function a(n,r){return t(n[0],n[1],n[2],r)}const p=t(0,0,0,null);export{l as clone,u as create,c as fromAnyMapPoint,s as fromPoint,f as fromValues,i as fromVec3,a as toDehydratedPoint};
5
+ import{f as n,a as r}from"../../../chunks/vec3f64.js";import{makeDehydratedPoint as t}from"../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as o,absoluteHeightElevationInfo as e}from"../../../support/elevationInfoUtils.js";function u(r,t,o){return n(r,t,o)}function i(n){return n}function f(n){return r(n)}function c(r,t,o){return i(n(r,t,o))}function l(n){return r(n)}function s(n,r,{coordinateHelper:t,elevationInfo:o}){return n?a(t.vectorToDehydratedPoint(n,d),r,o):null}function a(r,t,u){if(null==r)return null;if(null==t)return i(n(r.x,r.y,r.z??0));if("2d"===t.type)return i(n(r.x,r.y,0));const f=o(t,r,u,e)??0;return i(n(r.x,r.y,f))}function p(n,r){return t(n[0],n[1],n[2],r)}const d=t(0,0,0,null);export{l as clone,u as create,s as fromAnyMapPoint,a as fromPoint,c as fromValues,i as fromVec3,p as toDehydratedPoint,f as toWritableVec3};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import n from"../../../core/Evented.js";import{isAborted as i}from"../../../core/promiseUtils.js";import{watch as s,sync as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{project as c,initializeProjection as d}from"../../../geometry/projection.js";import{absoluteHeightElevationInfo as h}from"../../../support/elevationInfoUtils.js";import{fromPoint as l}from"../sketch/normalizedPoint.js";import{defaults as u}from"./Settings.js";import{SnappingDomain as f}from"./SnappingDomain.js";import{defaultSnappingEnginesFactory as _}from"./snappingFactory.js";import g from"./SnappingOptions.js";import{snappingPointToSnappingOutput as m}from"./snappingPointUtils.js";import{sortCandidatesInPlace as S,squaredScreenDistance as v}from"./snappingUtils.js";import{IntersectionSnappingCandidate as y}from"./candidates/IntersectionSnappingCandidate.js";import{vectorToScreenPoint as C}from"../support/viewUtils.js";let P=class extends(n.EventedMixin(e)){constructor(t){super(t),this.options=new g,this.snappingEnginesFactory=_,this._engines=[],this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=T.MAIN}initialize(){this.addHandles([s((()=>{const{effectiveFeatureEnabled:t,effectiveSelfEnabled:e,touchSensitivityMultiplier:n,distance:i}=this.options;return{effectiveFeatureEnabled:t,effectiveSelfEnabled:e,touchSensitivityMultiplier:n,distance:i}}),(()=>{this.doneSnapping(),this.emit("changed")}),r),s((()=>this.options),(t=>{for(const e of this._engines)e.options=t}),r),s((()=>({viewReady:this.view.ready,viewSpatialReference:this.view.spatialReference,snappingEnginesFactory:this.snappingEnginesFactory})),(({viewReady:t,snappingEnginesFactory:e})=>this._recreateEngines(t,e)),a)])}destroy(){this._destroyEngines()}get updating(){return this._engines.some((t=>t.updating))}_recreateEngines(t,e){if(this._destroyEngines(),!t)return;const{view:n,options:i}=this;this._engines=e(n,i)}_destroyEngines(){for(const t of this._engines)t.destroy();this._engines=[]}get _squaredMouseProximityTreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:t,touchSensitivityMultiplier:e}=this.options,n=t*e;return n*n}get _squaredSatisfiesConstraintThreshold(){return u.satisfiesConstraintScreenThreshold*u.satisfiesConstraintScreenThreshold}snap(t){return E(t)?this._snapMultiPoint(t):this._snapSinglePoint(t)}update(t){const{point:e,context:n}=t;this._removeVisualization();const i=this._currentMainCandidate;if(null==i)return e;const s=this._selectUpdateInput(t);if(null==s)return e;const{spatialReference:r}=n,a=c(s,r);if(null==a)return e;const{view:o}=this,{elevationInfo:p,visualizer:d}=n,h=[],u=l(a,o,p),f=i.constraint.closestTo(u);if(!this._arePointsWithinScreenThreshold(u,f,n))return this._resetSnappingState(),e;i.targetPoint=f,h.push(...i.hints);for(const c of this._currentOtherActiveCandidates)c.targetPoint=f,h.push(...c.hints);return null!=d&&this.addHandles(d.draw(h,{spatialReference:r,elevationInfo:I(n),view:o,selfSnappingZ:n.selfSnappingZ}),w),m(f,o,{z:e.z,m:e.m,spatialReference:e.spatialReference,elevationInfo:p})}doneSnapping(){this._removeVisualization(),this._resetSnappingState()}_selectUpdateInput({point:t,scenePoint:e}){switch(this._currentSnappedType){case T.MAIN:return t;case T.SCENE:return e}}_resetSnappingState(){this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=T.MAIN}_removeVisualization(){this.removeHandles(w)}async _snapSinglePoint({point:t,context:e,signal:n}){const{view:i}=this,{elevationInfo:s}=e,r=l(t,i,s),a=await this._fetchCandidates(r,f.ALL,e,n);return this._createSnapResult(r,T.MAIN,a,i,e,{z:t.z,m:t.m,spatialReference:t.spatialReference,elevationInfo:s},n)}async _snapMultiPoint({point:t,scenePoint:e,context:n,signal:i}){const{view:s}=this,{coordinateHelper:r,elevationInfo:a,spatialReference:o}=n;await d(e.spatialReference,o);const p=c(e,o),h=l(p,s,a),u=await this._fetchCandidates(h,f.FEATURE,n,i);if(u.length>0){const t=await this._fetchCandidates(h,f.SELF,n,i);return this._createSnapResult(h,T.SCENE,[...u,...t],s,n,{z:p.z,m:p.m,spatialReference:p.spatialReference,elevationInfo:a},i)}const _=l(t,s,a),g=await this._fetchCandidates(_,f.SELF,n,i);return this._createSnapResult(_,T.MAIN,g,s,n,{z:r.hasZ()&&t.hasZ?t.z??0:void 0,m:r.hasM()&&t.hasM?t.m??0:void 0,spatialReference:t.spatialReference,elevationInfo:a},i)}async _fetchCandidates(t,e,n,i){return(await Promise.all(this._engines.map((s=>s.fetchCandidates(t,e,n,i))))).flat()}_createSnapResult(t,e,n,s,r,a,o){return{get valid(){return!i(o)},apply:()=>{const{spatialReference:i}=r,{snappedPoint:o,hints:p}=this._processCandidates(t,e,n,r);return this._removeVisualization(),null!=r.visualizer&&this.addHandles(r.visualizer.draw(p,{spatialReference:i,elevationInfo:h,view:s,selfSnappingZ:r.selfSnappingZ}),w),m(o,s,a)}}}_processCandidates(t,e,n,i){if(n.length<1)return this.doneSnapping(),{snappedPoint:t,hints:[]};this._currentSnappedType!==e&&this._resetSnappingState(),S(t,n);const s=this._currentMainCandidate;if(null!=s){const r=this._findOldConstraintInNewCandidates(s,n);if(r>=0){if(!(n[r]instanceof y))return this._intersectWithOtherCandidates(r,n,t,e,i);if(this._arePointsWithinScreenThreshold(t,s.targetPoint,i))return this._updateSnappingCandidate(s,e,n,i)}}return this._intersectWithOtherCandidates(0,n,t,e,i)}_findOldConstraintInNewCandidates(t,e){return t instanceof y?this._findOldCandidateIndex(e,t.first)>=0&&this._findOldCandidateIndex(e,t.second)>=0?0:-1:this._findOldCandidateIndex(e,t)}_intersectWithOtherCandidates(t,e,n,i,s){const{coordinateHelper:r}=s,a=e[t],o=[];for(let p=0;p<e.length;++p){if(p===t)continue;const i=e[p];for(const t of a.constraint.intersect(i.constraint)){const e=t.closestTo(a.targetPoint);o.push([new y(e,a,i,i.isDraped),this._squaredScreenDistance(n,e,r)])}}return o.length>0&&(o.sort(((t,e)=>t[1]-e[1])),o[0][1]<this._squaredPointProximityThreshold(s.pointer))?this._updateSnappingCandidate(o[0][0],i,e,s):this._updateSnappingCandidate(a,i,e,s)}_updateSnappingCandidate(t,e,n,i){this.doneSnapping(),this._currentMainCandidate=t,this._currentSnappedType=e;const s=this._currentMainCandidate.targetPoint,r=[];r.push(...t.hints);for(const a of n){if(t instanceof y){if(a.constraint.equals(t.first.constraint)||a.constraint.equals(t.second.constraint))continue}else if(a.constraint.equals(t.constraint))continue;const e=a.constraint.closestTo(s);this._squaredScreenDistance(e,s,i.coordinateHelper)<this._squaredSatisfiesConstraintThreshold&&(a.targetPoint=s,this._currentOtherActiveCandidates.push(a),r.push(...a.hints))}return{snappedPoint:s,hints:r}}_squaredPointProximityThreshold(t){return"touch"===t?this._squaredTouchProximityThreshold:this._squaredMouseProximityTreshold}_arePointsWithinScreenThreshold(t,e,n){return this._squaredScreenDistance(t,e,n.coordinateHelper)<this._squaredPointProximityThreshold(n.pointer)}_squaredScreenDistance(t,e,n){return v(this._toScreen(t,n),this._toScreen(e,n))}_toScreen(t,e){return C(t,e.spatialReference,h,this.view)}_findOldCandidateIndex(t,e){let n=-1;for(let i=0;i<t.length;++i)if(e.constraint.equals(t[i].constraint)){n=i;break}return n}get test(){return{visualizationsActive:this.hasHandles(w),engines:this._engines}}};var T;t([o({constructOnly:!0})],P.prototype,"view",void 0),t([o()],P.prototype,"options",void 0),t([o({readOnly:!0})],P.prototype,"updating",null),t([o()],P.prototype,"snappingEnginesFactory",void 0),t([o()],P.prototype,"_engines",void 0),t([o()],P.prototype,"_squaredMouseProximityTreshold",null),t([o()],P.prototype,"_squaredTouchProximityThreshold",null),t([o()],P.prototype,"_squaredSatisfiesConstraintThreshold",null),P=t([p("esri.views.interactive.snapping.SnappingManager")],P),function(t){t[t.MAIN=0]="MAIN",t[t.SCENE=1]="SCENE"}(T||(T={}));const w="visualization-handle";function E(t){return null!=t.scenePoint}function I({coordinateHelper:t,elevationInfo:e}){return t.hasZ()?h:e}export{P as SnappingManager};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import e from"../../../core/Accessor.js";import n from"../../../core/Evented.js";import{isAborted as i}from"../../../core/promiseUtils.js";import{watch as s,sync as r,syncAndInitial as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as p}from"../../../core/accessorSupport/decorators/subclass.js";import{project as c,initializeProjection as d}from"../../../geometry/projection.js";import{absoluteHeightElevationInfo as h}from"../../../support/elevationInfoUtils.js";import{fromPoint as l}from"../sketch/normalizedPoint.js";import{defaults as u}from"./Settings.js";import{SnappingDomain as f}from"./SnappingDomain.js";import{defaultSnappingEnginesFactory as _}from"./snappingFactory.js";import g from"./SnappingOptions.js";import{snappingPointToSnappingOutput as m}from"./snappingPointUtils.js";import{sortCandidatesInPlace as S,squaredScreenDistance as v}from"./snappingUtils.js";import{IntersectionSnappingCandidate as y}from"./candidates/IntersectionSnappingCandidate.js";import{vectorToScreenPoint as C}from"../support/viewUtils.js";let P=class extends(n.EventedMixin(e)){constructor(t){super(t),this.options=new g,this.snappingEnginesFactory=_,this._engines=[],this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=T.MAIN}initialize(){this.addHandles([s((()=>{const{effectiveFeatureEnabled:t,effectiveSelfEnabled:e,touchSensitivityMultiplier:n,distance:i}=this.options;return{effectiveFeatureEnabled:t,effectiveSelfEnabled:e,touchSensitivityMultiplier:n,distance:i}}),(()=>{this.doneSnapping(),this.emit("changed")}),r),s((()=>this.options),(t=>{for(const e of this._engines)e.options=t}),r),s((()=>({viewReady:this.view.ready,viewSpatialReference:this.view.spatialReference,snappingEnginesFactory:this.snappingEnginesFactory})),(({viewReady:t,snappingEnginesFactory:e})=>this._recreateEngines(t,e)),a)])}destroy(){this._destroyEngines()}get updating(){return this._engines.some((t=>t.updating))}_recreateEngines(t,e){if(this._destroyEngines(),!t)return;const{view:n,options:i}=this;this._engines=e(n,i)}_destroyEngines(){for(const t of this._engines)t.destroy();this._engines=[]}get _squaredMouseProximityTreshold(){return this.options.distance*this.options.distance}get _squaredTouchProximityThreshold(){const{distance:t,touchSensitivityMultiplier:e}=this.options,n=t*e;return n*n}get _squaredSatisfiesConstraintThreshold(){return u.satisfiesConstraintScreenThreshold*u.satisfiesConstraintScreenThreshold}snap(t){return E(t)?this._snapMultiPoint(t):this._snapSinglePoint(t)}update(t){const{point:e,context:n}=t;this._removeVisualization();const i=this._currentMainCandidate;if(null==i)return e;const s=this._selectUpdateInput(t);if(null==s)return e;const{spatialReference:r}=n,a=c(s,r);if(null==a)return e;const{view:o}=this,{elevationInfo:p,visualizer:d}=n,h=[],u=l(a,o,p),f=i.constraint.closestTo(u);if(!this._arePointsWithinScreenThreshold(u,f,n))return this._resetSnappingState(),e;i.targetPoint=f,h.push(...i.hints);for(const c of this._currentOtherActiveCandidates)c.targetPoint=f,h.push(...c.hints);return null!=d&&this.addHandles(d.draw(h,{spatialReference:r,elevationInfo:I(n),view:o,selfSnappingZ:n.selfSnappingZ}),w),m(f,o,{z:e.z,m:e.m,spatialReference:e.spatialReference,elevationInfo:p})}doneSnapping(){this._removeVisualization(),this._resetSnappingState()}_selectUpdateInput({point:t,scenePoint:e}){switch(this._currentSnappedType){case T.MAIN:return t;case T.SCENE:return e}}_resetSnappingState(){this._currentMainCandidate=null,this._currentOtherActiveCandidates=[],this._currentSnappedType=T.MAIN}_removeVisualization(){this.removeHandles(w)}async _snapSinglePoint({point:t,context:e,signal:n}){const{view:i}=this,{elevationInfo:s}=e,r=l(t,i,s),a=await this._fetchCandidates(r,f.ALL,e,n);return this._createSnapResult(r,T.MAIN,a,i,e,{z:t.z,m:t.m,spatialReference:t.spatialReference,elevationInfo:s},n)}async _snapMultiPoint({point:t,scenePoint:e,context:n,signal:i}){const{view:s}=this,{coordinateHelper:r,elevationInfo:a,spatialReference:o}=n;await d(e.spatialReference,o);const p=c(e,o),h=l(p,s,a),u=await this._fetchCandidates(h,f.FEATURE,n,i);if(u.length>0){const t=await this._fetchCandidates(h,f.SELF,n,i);return this._createSnapResult(h,T.SCENE,[...u,...t],s,n,{z:p.z,m:p.m,spatialReference:p.spatialReference,elevationInfo:a},i)}const _=l(t,s,a),g=await this._fetchCandidates(_,f.SELF,n,i);return this._createSnapResult(_,T.MAIN,g,s,n,{z:r.hasZ()&&t.hasZ?t.z??0:void 0,m:r.hasM()&&t.hasM?t.m??0:void 0,spatialReference:t.spatialReference,elevationInfo:a},i)}async _fetchCandidates(t,e,n,i){return(await Promise.all(this._engines.map((s=>s.fetchCandidates(t,e,n,i))))).flat()}_createSnapResult(t,e,n,s,r,a,o){return{get valid(){return!i(o)},apply:()=>{const{spatialReference:i}=r,{snappedPoint:o,hints:p}=this._processCandidates(t,e,n,r);return this._removeVisualization(),null!=r.visualizer&&this.addHandles(r.visualizer.draw(p,{spatialReference:i,elevationInfo:h,view:s,selfSnappingZ:r.selfSnappingZ}),w),m(o,s,a)}}}_processCandidates(t,e,n,i){if(n.length<1)return this.doneSnapping(),{snappedPoint:t,hints:[]};this._currentSnappedType!==e&&this._resetSnappingState(),S(t,n);const s=this._currentMainCandidate;if(null!=s){const r=this._findOldConstraintInNewCandidates(s,n);if(r>=0){if(!(n[r]instanceof y))return this._intersectWithOtherCandidates(r,n,t,e,i);if(this._arePointsWithinScreenThreshold(t,s.targetPoint,i))return this._updateSnappingCandidate(s,e,n,i)}}return this._intersectWithOtherCandidates(0,n,t,e,i)}_findOldConstraintInNewCandidates(t,e){return t instanceof y?this._findOldCandidateIndex(e,t.first)>=0&&this._findOldCandidateIndex(e,t.second)>=0?0:-1:this._findOldCandidateIndex(e,t)}_intersectWithOtherCandidates(t,e,n,i,s){const{coordinateHelper:r}=s,a=e[t],o=[];for(let p=0;p<e.length;++p){if(p===t)continue;const i=e[p],s=a.constraint.intersect(i.constraint);if(s)for(const t of s.closestPoints(a.targetPoint))o.push([new y(t,a,i,i.isDraped),this._squaredScreenDistance(n,t,r)])}return o.length>0&&(o.sort(((t,e)=>t[1]-e[1])),o[0][1]<this._squaredPointProximityThreshold(s.pointer))?this._updateSnappingCandidate(o[0][0],i,e,s):this._updateSnappingCandidate(a,i,e,s)}_updateSnappingCandidate(t,e,n,i){this.doneSnapping(),this._currentMainCandidate=t,this._currentSnappedType=e;const s=this._currentMainCandidate.targetPoint,r=[];r.push(...t.hints);for(const a of n){if(t instanceof y){if(a.constraint.equals(t.first.constraint)||a.constraint.equals(t.second.constraint))continue}else if(a.constraint.equals(t.constraint))continue;const e=a.constraint.closestTo(s);this._squaredScreenDistance(e,s,i.coordinateHelper)<this._squaredSatisfiesConstraintThreshold&&(a.targetPoint=s,this._currentOtherActiveCandidates.push(a),r.push(...a.hints))}return{snappedPoint:s,hints:r}}_squaredPointProximityThreshold(t){return"touch"===t?this._squaredTouchProximityThreshold:this._squaredMouseProximityTreshold}_arePointsWithinScreenThreshold(t,e,n){return this._squaredScreenDistance(t,e,n.coordinateHelper)<this._squaredPointProximityThreshold(n.pointer)}_squaredScreenDistance(t,e,n){return v(this._toScreen(t,n),this._toScreen(e,n))}_toScreen(t,e){return C(t,e.spatialReference,h,this.view)}_findOldCandidateIndex(t,e){let n=-1;for(let i=0;i<t.length;++i)if(e.constraint.equals(t[i].constraint)){n=i;break}return n}get test(){return{visualizationsActive:this.hasHandles(w),engines:this._engines}}};var T;t([o({constructOnly:!0})],P.prototype,"view",void 0),t([o()],P.prototype,"options",void 0),t([o({readOnly:!0})],P.prototype,"updating",null),t([o()],P.prototype,"snappingEnginesFactory",void 0),t([o()],P.prototype,"_engines",void 0),t([o()],P.prototype,"_squaredMouseProximityTreshold",null),t([o()],P.prototype,"_squaredTouchProximityThreshold",null),t([o()],P.prototype,"_squaredSatisfiesConstraintThreshold",null),P=t([p("esri.views.interactive.snapping.SnappingManager")],P),function(t){t[t.MAIN=0]="MAIN",t[t.SCENE=1]="SCENE"}(T||(T={}));const w="visualization-handle";function E(t){return null!=t.scenePoint}function I({coordinateHelper:t,elevationInfo:e}){return t.hasZ()?h:e}export{P as SnappingManager};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{IntersectionConstraint as t}from"../../sketch/constraints.js";import{SnappingDomain as i}from"../SnappingDomain.js";import{SnappingCandidate as s}from"./SnappingCandidate.js";import{IntersectionSnappingHint as n}from"../hints/IntersectionSnappingHint.js";class r extends s{constructor(s,n,r,o){super(s,new t(s,n.constraint,r.constraint),o,i.ALL),this.first=n,this.second=r}get hints(){return this.first.targetPoint=this.targetPoint,this.second.targetPoint=this.targetPoint,[...this.first.hints,...this.second.hints,new n(this.targetPoint,this.isDraped,this.domain)]}}export{r as IntersectionSnappingCandidate};
5
+ import{PointConstraint as t}from"../../sketch/constraints.js";import{SnappingDomain as i}from"../SnappingDomain.js";import{SnappingCandidate as s}from"./SnappingCandidate.js";import{IntersectionSnappingHint as n}from"../hints/IntersectionSnappingHint.js";class r extends s{constructor(s,n,r,o){super(s,new t(s),o,i.ALL),this.first=n,this.second=r}get hints(){return this.first.targetPoint=this.targetPoint,this.second.targetPoint=this.targetPoint,[...this.first.hints,...this.second.hints,new n(this.targetPoint,this.isDraped,this.domain)]}}export{r as IntersectionSnappingCandidate};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as t}from"../../../chunks/tslib.es6.js";import{convertUnit as e}from"../../../core/unitUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{TOOLTIP_KEYS as n}from"../keybindings.js";import{BASE as s}from"./css.js";import l from"../../../widgets/Widget.js";import{loadCalciteComponents as u}from"../../../widgets/support/componentsUtils.js";import"../../../widgets/support/widgetUtils.js";import{tsx as a}from"../../../widgets/support/jsxFactory.js";const c=`${s}-editable-field`,r={base:c,locked:`${c}--locked`,title:`${c}__title`,titleContent:`${c}__title__content`,value:`${c}__value`,valueContent:`${c}__value__content`,input:`${c}__input`};let p=class extends l{constructor(){super(...arguments),this.suffix="",this._input=null,this._afterInputCreate=t=>{this._input=t},this._selectText=()=>{requestAnimationFrame((()=>{this._input?.selectText()}))},this._onKeyDown=t=>{t.key===n.discard&&this._discard()},this._onInputKeyDown=t=>{t.key===n.commit&&this._commit()},this._onInput=t=>{this.valueInfo.inputValue=t.target.value},this._onLockClick=()=>{this.valueInfo.locked?this._unlock():this._lock()}}loadDependencies(){return u({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js")})}render(){const{mode:t,valueInfo:e}=this,o="input"===t,{locked:i}=e;return a("div",{class:this.classes({[r.base]:!0,[r.locked]:i})},a("div",{key:"title",class:r.title},a("div",{key:"title-content",class:r.titleContent},this.title,i&&!o?a("calcite-icon",{key:"icon",icon:"lock",scale:"s"}):null)),a("div",{key:"value",class:r.value},o?this._renderInput():a("span",{key:"formatted-value"},this._feedbackValue)))}get _initialValue(){const{actual:t}=this.valueInfo;return null!=t?e(t.value,t.unit,this.inputUnit):null}get _feedbackValue(){const{actual:t,committed:e}=this.valueInfo;return null!=e?this.format(e):null!=t?this.format(t):""}get _displayValue(){const{valueInfo:t,_initialValue:e}=this,{inputValue:o,committed:i}=t;return o??this._toString(i?.value??e)}get _lockEnabled(){return this.valueInfo.dirty&&!this._unlockEnabled}get _unlockEnabled(){return this.valueInfo.locked}_renderInput(){const{locked:t}=this.valueInfo,e=this._displayValue;return a("div",{key:"input-container",class:r.valueContent,onkeydown:this._onKeyDown},a("calcite-input",{class:r.input,numberButtonType:"none",scale:"s",suffixText:this.suffix,type:"text",value:e,afterCreate:this._afterInputCreate,onCalciteInputInput:this._onInput,onkeydown:this._onInputKeyDown,onfocus:this._selectText}),a("calcite-button",{appearance:"transparent",disabled:t?!this._unlockEnabled:!this._lockEnabled,iconStart:t?"lock":"unlock",kind:"neutral",scale:"s",onclick:this._onLockClick}))}_commit(){const{_input:t,valueInfo:e}=this;t&&(e.locked&&""===e.inputValue?this._unlock():this._lock(),this.onCommit(t))}_discard(){const{_input:t,valueInfo:e}=this;t&&(e.inputValue=null,this.onDiscard(t))}_lock(){const{valueInfo:t}=this,e=this._parse(t.inputValue);null!=e&&(t.committed=this.createQuantity(e),t.inputValue=null)}_unlock(){const{valueInfo:t}=this;t.committed=null,t.inputValue=null}_parse(t){if(null==t)return null;const e=parseFloat(t);return isNaN(e)||!isFinite(e)?null:e}_toString(t){return null!=t?t.toFixed(3):"0"}};t([o()],p.prototype,"format",void 0),t([o()],p.prototype,"inputUnit",void 0),t([o()],p.prototype,"mode",void 0),t([o()],p.prototype,"onCommit",void 0),t([o()],p.prototype,"onDiscard",void 0),t([o()],p.prototype,"suffix",void 0),t([o()],p.prototype,"title",void 0),t([o()],p.prototype,"valueInfo",void 0),t([o()],p.prototype,"_initialValue",null),t([o()],p.prototype,"_feedbackValue",null),t([o()],p.prototype,"_input",void 0),t([o()],p.prototype,"_displayValue",null),t([o()],p.prototype,"_lockEnabled",null),t([o()],p.prototype,"_unlockEnabled",null),p=t([i("esri.views.interactive.tooltip.TooltipEditableField")],p);export{p as TooltipEditableField};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{toUnit as e}from"../../../core/quantityUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{TOOLTIP_KEYS as n}from"../keybindings.js";import{BASE as s}from"./css.js";import l from"../../../widgets/Widget.js";import{loadCalciteComponents as u}from"../../../widgets/support/componentsUtils.js";import"../../../widgets/support/widgetUtils.js";import{tsx as a}from"../../../widgets/support/jsxFactory.js";const r=`${s}-editable-field`,c={base:r,locked:`${r}--locked`,title:`${r}__title`,titleContent:`${r}__title__content`,value:`${r}__value`,valueContent:`${r}__value__content`,input:`${r}__input`};let p=class extends l{constructor(){super(...arguments),this.suffix="",this._input=null,this._afterInputCreate=t=>{this._input=t},this._selectText=()=>{requestAnimationFrame((()=>{this._input?.selectText()}))},this._onKeyDown=t=>{t.key===n.discard&&this._discard()},this._onInputKeyDown=t=>{t.key===n.commit&&this._commit()},this._onInput=t=>{this.valueInfo.inputValue=t.target.value},this._onLockClick=()=>{this.valueInfo.locked?this._unlock():this._lock()}}loadDependencies(){return u({button:()=>import("@esri/calcite-components/dist/components/calcite-button.js"),icon:()=>import("@esri/calcite-components/dist/components/calcite-icon.js"),input:()=>import("@esri/calcite-components/dist/components/calcite-input.js")})}render(){const{mode:t,valueInfo:e}=this,o="input"===t,{locked:i}=e;return a("div",{class:this.classes({[c.base]:!0,[c.locked]:i})},a("div",{key:"title",class:c.title},a("div",{key:"title-content",class:c.titleContent},this.title,i&&!o?a("calcite-icon",{key:"icon",icon:"lock",scale:"s"}):null)),a("div",{key:"value",class:c.value},o?this._renderInput():a("span",{key:"formatted-value"},this._feedbackValue)))}get _initialValue(){const{actual:t}=this.valueInfo;return null!=t?this.toInputUnits(t).value:null}get _feedbackValue(){const{actual:t,committed:e}=this.valueInfo;return null!=e?this.format(e):null!=t?this.format(t):""}get _displayValue(){const{valueInfo:t,_initialValue:e}=this,{inputValue:o,committed:i}=t;return o??this._toString(i?.value??e)}get _lockEnabled(){return this.valueInfo.dirty&&!this._unlockEnabled}get _unlockEnabled(){return this.valueInfo.locked}toInputUnits(t){return e(t,this.inputUnit)}_renderInput(){const{locked:t}=this.valueInfo,e=this._displayValue;return a("div",{key:"input-container",class:c.valueContent,onkeydown:this._onKeyDown},a("calcite-input",{class:c.input,numberButtonType:"none",scale:"s",suffixText:this.suffix,type:"text",value:e,afterCreate:this._afterInputCreate,onCalciteInputInput:this._onInput,onkeydown:this._onInputKeyDown,onfocus:this._selectText}),a("calcite-button",{appearance:"transparent",disabled:t?!this._unlockEnabled:!this._lockEnabled,iconStart:t?"lock":"unlock",kind:"neutral",scale:"s",onclick:this._onLockClick}))}_commit(){const{_input:t,valueInfo:e}=this;t&&(e.locked&&""===e.inputValue?this._unlock():this._lock(),this.onCommit(t))}_discard(){const{_input:t,valueInfo:e}=this;t&&(e.inputValue=null,this.onDiscard(t))}_lock(){const{valueInfo:t}=this,e=this._parse(t.inputValue);null!=e&&(t.committed=this.createQuantity(e),t.inputValue=null)}_unlock(){const{valueInfo:t}=this;t.committed=null,t.inputValue=null}_parse(t){if(null==t)return null;const e=parseFloat(t);return isNaN(e)||!isFinite(e)?null:e}_toString(t){return null!=t?t.toFixed(3):"0"}};t([o()],p.prototype,"format",void 0),t([o()],p.prototype,"inputUnit",void 0),t([o()],p.prototype,"mode",void 0),t([o()],p.prototype,"onCommit",void 0),t([o()],p.prototype,"onDiscard",void 0),t([o()],p.prototype,"suffix",void 0),t([o()],p.prototype,"title",void 0),t([o()],p.prototype,"valueInfo",void 0),t([o()],p.prototype,"_initialValue",null),t([o()],p.prototype,"_feedbackValue",null),t([o()],p.prototype,"_input",void 0),t([o()],p.prototype,"_displayValue",null),t([o()],p.prototype,"_lockEnabled",null),t([o()],p.prototype,"_unlockEnabled",null),p=t([i("esri.views.interactive.tooltip.TooltipEditableField")],p);export{p as TooltipEditableField};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.28/esri/copyright.txt for details.
4
4
  */
5
- import{_ as o}from"../../../chunks/tslib.es6.js";import{createAngle as r}from"../../../core/quantityUtils.js";import{property as t}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as e}from"../../../core/accessorSupport/decorators/subclass.js";import{TooltipEditableField as s}from"./TooltipEditableField.js";let i=class extends s{constructor(o){super(o)}createQuantity(o){return r(o,this.inputUnit,this.rotationType)}};o([t()],i.prototype,"rotationType",void 0),i=o([e("esri.views.interactive.tooltip.TooltipEditableFieldAngle")],i);export{i as TooltipEditableFieldAngle};
5
+ import{_ as t}from"../../../chunks/tslib.es6.js";import{createAngle as o,toUnit as r,convertRotationType as e}from"../../../core/quantityUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{TooltipEditableField as p}from"./TooltipEditableField.js";let a=class extends p{constructor(t){super(t)}createQuantity(t){return o(t,this.inputUnit,this.rotationType)}toInputUnits(t){const{inputUnit:s,rotationType:i}=this,p=r(t,s),a=e(p.value,p.rotationType,i);return o(a,s,i)}};t([s()],a.prototype,"rotationType",void 0),a=t([i("esri.views.interactive.tooltip.TooltipEditableFieldAngle")],a);export{a as TooltipEditableFieldAngle};