@arcgis/core 5.2.0-next.160 → 5.2.0-next.162

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 (152) hide show
  1. package/arcgisGlobal.d.ts +1 -0
  2. package/assets/esri/core/workers/RemoteClient.js +1 -1
  3. package/assets/esri/core/workers/chunks/{0a5a9885ee6f5b5f99f0.js → 167b057ad50e6aef54de.js} +1 -1
  4. package/assets/esri/core/workers/chunks/17c6d66b47aa690df0d4.js +1 -0
  5. package/assets/esri/core/workers/chunks/{15bcf7cfe603f2ee1a24.js → 28104681ba161967039f.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{842893e75696428d536f.js → 3b0808ee3c4facfaca3d.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{eebbde81e56d69dc602f.js → 44f90e75c1dc3d726a95.js} +1 -1
  8. package/assets/esri/core/workers/chunks/{77ebacfdf8e57f2e03f1.js → 46c5371c7a627537098c.js} +11 -11
  9. package/assets/esri/core/workers/chunks/5daa9429808ca31279f2.js +1 -0
  10. package/assets/esri/core/workers/chunks/{60737732ce495bbdd0fc.js → 5f4feca26102088ea565.js} +1 -1
  11. package/assets/esri/core/workers/chunks/6da7229433105a69eb3f.js +1 -0
  12. package/assets/esri/core/workers/chunks/83f29a159b8b5197e76a.js +1 -0
  13. package/assets/esri/core/workers/chunks/849879c8aed16315194c.js +1 -0
  14. package/assets/esri/core/workers/chunks/{1d77c8c59b0118c7e77b.js → 85bba551057366cd00ae.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{9401cc22373566e1171e.js → 8a7b02037151767542f1.js} +1 -1
  16. package/assets/esri/core/workers/chunks/{4eae066673484986d4c1.js → 8e4a7027d171fb60e51e.js} +1 -1
  17. package/assets/esri/core/workers/chunks/{32b351b047ce1eb58146.js → 9ce8b9b80da146a5bbf5.js} +1 -1
  18. package/assets/esri/core/workers/chunks/a2fcbc494333376192aa.js +1 -0
  19. package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.js +1 -0
  20. package/assets/esri/core/workers/chunks/{f1df76f098a3cc924832.js → b5df193c93e9c19f9700.js} +1 -1
  21. package/assets/esri/core/workers/chunks/{28b74bc77f7c13080074.js → be97a629e2ae4d13ceb3.js} +1 -1
  22. package/assets/esri/core/workers/chunks/{d33360c4f85203edafff.js → bf4d913e523eae2fda28.js} +1 -1
  23. package/assets/esri/core/workers/chunks/{172cfeb5f415e4662432.js → d7429b58c90e015263ad.js} +1 -1
  24. package/assets/esri/core/workers/chunks/{612104dff305ff062dfa.js → dfc81e66196c402f39b4.js} +2 -2
  25. package/assets/esri/core/workers/chunks/{02f8654852d389583891.js → e04fb83ab2634bc15cc7.js} +1 -1
  26. package/assets/esri/core/workers/chunks/f74ae0eff3f08978e607.js +1 -0
  27. package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -5
  28. package/assets/esri/themes/dark/main.css +1 -1
  29. package/assets/esri/themes/light/main.css +1 -1
  30. package/assets/esri/themes/light/view.css +1 -1
  31. package/chunks/DefaultMaterial.glsl.js +1 -1
  32. package/chunks/RealisticTree.glsl.js +1 -1
  33. package/chunks/RibbonLine.glsl.js +125 -133
  34. package/config.d.ts +62 -34
  35. package/config.js +1 -1
  36. package/core/has.js +1 -1
  37. package/core/mapCollectionUtils.js +1 -1
  38. package/core/workers/Connection.d.ts +58 -89
  39. package/core/workers.d.ts +45 -54
  40. package/geometry/support/Indices.js +1 -1
  41. package/geometry/support/aaBoundingRect.js +1 -1
  42. package/geometry/support/ray.js +1 -1
  43. package/kernel.js +1 -1
  44. package/layers/FeatureLayer.d.ts +7 -5
  45. package/layers/FeatureLayer.js +1 -1
  46. package/layers/GeospatialPDFLayer.js +1 -1
  47. package/layers/MapImageLayer.d.ts +9 -3
  48. package/layers/MapNotesLayer.d.ts +2 -2
  49. package/layers/SubtypeGroupLayer.d.ts +1 -1
  50. package/layers/SubtypeGroupLayer.js +1 -1
  51. package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
  52. package/layers/graphics/sources/FeatureLayerSource.js +1 -1
  53. package/layers/graphics/sources/support/QueryTask.js +1 -1
  54. package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +16 -16
  55. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  56. package/layers/mixins/ArcGISMapService.js +1 -1
  57. package/layers/ogc/ogcFeatureUtils.js +1 -1
  58. package/layers/support/Sublayer.d.ts +29 -15
  59. package/layers/support/Sublayer.js +1 -1
  60. package/layers/support/commonProperties.js +1 -1
  61. package/package.json +2 -2
  62. package/rest/layerSources/DynamicDataLayer.d.ts +4 -2
  63. package/rest/layerSources/DynamicDataLayer.js +1 -1
  64. package/rest/layerSources/DynamicMapLayer.d.ts +1 -1
  65. package/rest/layerSources/DynamicWorkspaceLayer.d.ts +45 -0
  66. package/rest/layerSources/DynamicWorkspaceLayer.js +2 -0
  67. package/rest/layerSources/typeUtils.js +2 -0
  68. package/rest/print.js +1 -1
  69. package/rest/query/operations/queryRelatedRecords.js +1 -1
  70. package/rest/query/operations/queryUtils.js +1 -1
  71. package/rest/support/Query.js +1 -1
  72. package/rest/support/RelationshipQuery.js +1 -1
  73. package/symbols/LineSymbol3D.d.ts +5 -3
  74. package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +6 -0
  75. package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
  76. package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
  77. package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
  78. package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
  79. package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
  80. package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
  81. package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +6 -0
  82. package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
  83. package/views/3d/analysis/LineOfSight/LineOfSightIntersectionResult.js +1 -1
  84. package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
  85. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  86. package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
  87. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  88. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  89. package/views/3d/input/SceneInputManager.js +1 -1
  90. package/views/3d/input/handlers/DragZoom.js +1 -1
  91. package/views/3d/input/handlers/MouseWheelFov.js +1 -1
  92. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  93. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  94. package/views/3d/interactive/manipulators/ResizeManipulator.js +1 -1
  95. package/views/3d/interactive/manipulators/RotateManipulator.js +1 -1
  96. package/views/3d/interactive/manipulators/ShiftManipulator.js +1 -1
  97. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  98. package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
  99. package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
  100. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  101. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  102. package/views/3d/layers/FlowSubView3D.js +1 -1
  103. package/views/3d/layers/I3SMeshView3D.js +1 -1
  104. package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
  105. package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
  106. package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
  107. package/views/3d/layers/graphics/extrudePolygon.js +1 -1
  108. package/views/3d/layers/graphics/tessellationUtils.js +1 -1
  109. package/views/3d/state/controllers/FovController.js +1 -1
  110. package/views/3d/state/controllers/GroundNavigationController.js +1 -1
  111. package/views/3d/state/controllers/momentum/GroundNavigationMomentumController.js +1 -1
  112. package/views/3d/state/utils/OffsetCorrectionController.js +1 -1
  113. package/views/3d/support/elevationUpdateUtils.js +1 -1
  114. package/views/3d/terrain/PatchRenderData.js +1 -1
  115. package/views/3d/terrain/TerrainData.js +1 -1
  116. package/views/3d/terrain/TextureReference.js +1 -1
  117. package/views/3d/terrain/terrainUtils.js +1 -1
  118. package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
  119. package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +3 -3
  120. package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialExternalColor.glsl.js +2 -2
  121. package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +2 -2
  122. package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
  123. package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
  124. package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
  125. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  126. package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
  127. package/views/BreakpointsOwner.d.ts +6 -0
  128. package/views/SceneView.js +1 -1
  129. package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
  130. package/views/interactive/editGeometry/EditGeometry.js +1 -1
  131. package/views/interactive/editGeometry/operations/RotateVertex.js +1 -1
  132. package/views/interactive/editGeometry/operations/ScaleVertex.js +1 -1
  133. package/views/interactive/editGeometry/operations/SetAllVertexPositions.js +1 -1
  134. package/views/interactive/snapping/FeatureSnappingEngine.js +1 -1
  135. package/views/types.d.ts +3 -0
  136. package/views/webgl/ShaderBuilder.js +1 -1
  137. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  138. package/widgets/Search/LocatorSearchSource.d.ts +22 -1
  139. package/widgets/support/SelectionList/GroupLayerItem.d.ts +2 -0
  140. package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
  141. package/widgets/support/SelectionList/ItemBase.d.ts +2 -0
  142. package/widgets/support/SelectionList/ItemBase.js +1 -1
  143. package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
  144. package/widgets/support/SelectionList.js +1 -1
  145. package/assets/esri/core/workers/chunks/3e3e076fa5e8d5d5f33f.js +0 -1
  146. package/assets/esri/core/workers/chunks/510502a4c9a2ba8d3f7b.js +0 -1
  147. package/assets/esri/core/workers/chunks/7d212c415f2709037408.js +0 -1
  148. package/assets/esri/core/workers/chunks/abb9e820d2871fa7acae.js +0 -1
  149. package/assets/esri/core/workers/chunks/ade5fdcd08dcbac74740.js +0 -1
  150. package/assets/esri/core/workers/chunks/b390b9cde2884755e8be.js +0 -1
  151. package/assets/esri/core/workers/chunks/e8bf653376a607f00897.js +0 -1
  152. package/assets/esri/core/workers/chunks/f4a7aa3cdbc0c429c359.js +0 -1
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n}from"../../../../../core/arrayUtils.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a,handlesGroup as o,destroyHandle as s}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as c,removeMaybe as l}from"../../../../../core/maybe.js";import{initial as u,on as d,watch as f,syncAndInitial as p,when as m,sync as h}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as y,subtract as b,lerp as x,set as ee,add as te,scale as ne}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,create as ie}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ae}from"../../../../../core/support/UpdatingHandles.js";import oe from"../../../../../geometry/Point.js";import se from"../../../../../geometry/Polyline.js";import{projectPoint as ce}from"../../../../../geometry/projectionUtils.js";import le from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as ue}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as de}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as fe}from"../../../../../symbols/support/utils.js";import{Manipulator3D as S}from"../../Manipulator3D.js";import{createManipulatorMaterials as C,createSphereGeometryAsOffsets as w,placeAtObject as pe,screenSizeManipulatorSettings as me}from"../../manipulatorUtils.js";import{RenderObject as T}from"../../RenderObject.js";import{SegmentLabels3D as he}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as ge}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as E,screenToRenderPlaneFromEvent as _e,convertToMapCoordinates as ve}from"../dragEventPipeline3D.js";import{orientation as ye}from"../geometryUtils.js";import{canMoveZOperations as D}from"../manipulatorUtils.js";import{Settings as be}from"../settings.js";import{createVisualElements as xe}from"../visualElementUtils.js";import{discRadiusSmall as Se}from"../manipulations/config.js";import{MoveManipulation as O}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Ce}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as k,createEdgeOffsetIntersectionPlane as A,createEdgeOffsetOperation as j,edgeOffsetRotationMatrix as we,screenEdgeLengthSquared as Te,getDistanceInGeometrySR as Ee}from"./edgeOffsetUtils.js";import{createTooltipInfos as De,connectTooltipToManipulatedObject as Oe,getUpdatedTranslateObjectTooltipInfo as ke,getUpdatedEdgeOffsetTooltipInfo as M}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as N}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as Ae}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as P}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as F}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as I,addMapDelta as L,createManipulatorDragEventPipeline as R,dragAtLocation as z,addScreenDelta as je}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as Me}from"../../../../interactive/keybindings.js";import{SnappingContext as B}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as V}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Ne,enterInputModeIfAvailable as H}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Pe}from"../../../../support/GeometryWorkerHandle.js";const U=Symbol(),W=Symbol(),Fe=Symbol(),G=Symbol();let K=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(G)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new i,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new ae,this._recreatingManipulators=!1,this._settings=new be({getTheme:()=>this.view.effectiveTheme}),this.events=new r,this.activeTooltipInfo=null,this._measurementWorker=new Pe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit(`reshape`,{type:`reshape`,object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit(`move`,{type:`move`,object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){let{view:e}=this,t=this._settings.manipulators,n=t.vertex;this.tooltipInfos=De(this._toolOptions,e),this._vertexManipulatorMaterials=C({color:n.color.toUnitRGBA(),outlineColor:n.outlineColor.toUnitRGBA(),focusedOutlineColor:n.focusedOutlineColor.toUnitRGBA(),screenSize:n,renderOccluded:n.renderOccluded});let r=t.edge;this._edgeManipulatorMaterials=C({color:r.color.toUnitRGBA(),outlineColor:r.outlineColor.toUnitRGBA(),screenSize:r,renderOccluded:r.renderOccluded});let i=t.edgeOffset;this._edgeOffsetManipulatorMaterials=C({color:i.color.toUnitRGBA(),focusedColor:i.focusedColor.toUnitRGBA(),renderOccluded:i.renderOccluded,shaded:!1});let a=t.selected;this._selectedManipulatorMaterials=C({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),focusedOutlineColor:a.focusedOutlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded}),this.tooltip=Ne(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{let e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:n,selectedSettings:r})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),n.applyColor(this._edgeOffsetManipulatorMaterials.material),n.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),r.applyColor(this._selectedManipulatorMaterials.material),r.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),r.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(let t of this._manipulatorInfos)t.manipulator.available=e,Y(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:n})=>{e!=null&&(e.visible=t,e.edgeDistance=n?`far`:`default`)},u),Oe(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{t===`input`&&e!==`input`&&this._resetTooltip()}),d(()=>this._operations,`vertex-update`,e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,`change`,e=>{(e.operation===`undo`||e.operation===`redo`)&&this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=c(this._segmentLabels),this.tooltip=c(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return e.type!==`key-down`||e.key!==Me.enterInputMode?!1:this.activeTooltipInfo?.type===`reshape-edge-offset`?this._enterInputModeDuringEdgeOffset(e):H(e,this.tooltip)?(this.tool.endDrag(),!0):!1}removeSelectedVertices(){let e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type===`vertex`);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit(`manipulators-changed`)}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(W),this.removeHandles(G),this._moveManipulation=c(this._moveManipulation),this._objectMoveManipulation=c(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(this._operations==null)return;let t=this.object.elevationInfo;for(let{vertices:n,segments:r,index:i}of this._operations.data.parts){let a=e?.byPartIndex.get(i);for(let e of n){let n=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,n)}for(let e of r)e.type===`line`&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit(`undo`),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),(!this._operations||this._segmentLabels?.context?.editGeometryOperations!==this._operations)&&(this._segmentLabels=c(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){let e=this._toolOptions.labels;this._segmentLabels=new he({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if(t.action===`end`)return t;let n=0,r=[],i=e===1&&this._someVerticesSelected;for(let e of this._manipulatorInfos)e.type===`vertex`&&(!e.manipulator.grabbing&&(!i||e.manipulator.selected)&&r.push(e),n++);if(r.length===n){if(i||this._hideReshapeControls(),this._moveVertices(r,t),this._updateEventState(1),this.destroyed)return t;this.events.emit(`move`,{type:`move`,dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(r,t),this._updateEventState(2),this.destroyed)return t;this.events.emit(`reshape`,{type:`reshape`,object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),a(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],G)}_showReshapeControls(){this.removeHandles(G)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){let t=this._manipulatorInfos.filter(Y).find(t=>t.manipulator===e||t.edgeManipulator===e);t!=null&&(this.removeHandles(W),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],W))}_hideReshapeManipulators(e){return o(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Y(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(U):this.tool.manipulators.forEach(({manipulator:e})=>{let t=e.disableDisplay?.();t&&this.addHandles(t,U)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>t.type===`vertex`&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;let{mapDeltaX:t,mapDeltaY:n,mapDeltaZ:r}=e;if(!t&&!n&&!r)return;let i=[];this._forEachVertex(t=>{let{selected:n,grabbing:r}=t.manipulator;(n&&!r||t===e.info)&&i.push(t)}),this._moveVertices(i,e,1),this.events.emit(`reshape`,{type:`reshape`,object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(this._numGrabbing!==0||this._numDragging!==0))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object}),this.destroyed||this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit(`reshape`,{type:`reshape-start`,object:this.object});break;case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit(`reshape`,{type:`reshape-start`,object:this.object})}}if(this.destroyed)return!1;let n=this._reshapeEventState!==e;return this._reshapeEventState=e,n}_createObjectMoveManipulation(){let{tool:e,view:t,object:n,_operations:r}=this;if(r){if(this._objectMoveManipulation=new Ce({tool:e,view:t,object:n}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,n,i)=>{n.next(e=>this._trackNumDragging(e)).next(t=>(t.action===`start`&&(e=r.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{t.action===`end`&&(this._showReshapeControls(),this._resetTooltip(),e=l(e))}),i.next(()=>this._onDragCancel(!0,()=>e=l(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on(`immediate-click`,e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){let{object:t,tool:n,view:r,_operations:i}=this;if(!i)return;this._moveManipulation=new O({tool:n,view:r,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&D(t.operations,t.elevationInfo),snapToScene:!1,radius:O.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on(`immediate-click`,t=>{!this._moveManipulation.zManipulation.hasManipulator(e)&&!this._manipulatorInfos.some(e=>e.manipulator.selected)&&this.events.emit(`immediate-click`,{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));let a=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(a(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(a(1)),this._moveManipulation.zManipulation.forEachManipulator(a(2)),this._moveManipulation.elevationInfo={mode:`absolute-height`,offset:0};let o=i.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((r,a,o,s,c)=>{let{snappingStep:l,cancelSnapping:u}=V({predicate:e=>!!e.info,snappingManager:n.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:e,pointer:c,excludeFeature:t.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next(e=>(this._onDragCancel(),e)).next(u),o=o.next(e=>this._trackNumDragging(e)).next(e=>{let t=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.manipulatorType===1&&t.length===1?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(I(this.view,e,t.graphic??void 0)).next(...l).next(L()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(e.action===`end`&&this._showReshapeControls(),this._updateTranslateTooltip(r,e),e)),{steps:o,cancel:s}},e,o,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on(`committed`,()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Fe),e&&this.addHandles(Ae({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Fe)},u)])}_createVisualElements(){let{object:e,view:t}=this,n=xe({view:t,object:e,forEachManipulator:e=>{if(!(this.destroyed||this._recreatingManipulators)){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(let t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on(`manipulators-changed`,e)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof N?n.visualElement:null);let r=this._outlineVisualElement;if(r!=null){let t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>r.events,`attachment-origin-changed`,t,{onListenerAdd:t}))}this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){let n=this.view,r=this._operations;if(e.part.vertices.length<=2||!r)return null;let i=r.data.spatialReference,a=this._settings.manipulators.edgeOffset,s=a.size/2,c=s+a.collisionPadding,l=s/c,u=l/2,d=l*Math.sqrt(3)/2,{height:f,offset:p}=a,{material:m,focusedMaterial:h}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){let e=P(m,d,u,u,f,p);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){let e=P(m,-d,u,u,f,-p);this._edgeOffsetManipulatorGeometryOutside=e}let g=[new T(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryInside.instantiate({material:h}),2),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:h}),2)],_=new S({view:n,renderObjects:g,elevationInfo:t.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?t:{mode:`absolute-height`,offset:0},worldOriented:!1,focusMultiplier:1,radius:c,available:this.object.visible,collisionType:{type:`disc`,direction:re(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:J(i)}),v=new S({view:n,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?`move`:`default`,metadata:{deleting:!1},location:J(i)}),y={manipulator:_,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(y,a.minSquaredEdgeLength);let b=()=>this._updateEdgeOffsetManipulator(y);b(),y.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>this._getManipulatorInfoFromHandle(e)?.manipulator.events.on(`location-update`,b)));let x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([y.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),R(_,this._createEdgeOffsetPipeline(y,t,r)),R(v,this._createEdgePipeline(y,t,r)),v.events.on(`immediate-click`,x),_.events.on(`immediate-click`,x),_.events.on(`focus-changed`,()=>this._resetTooltip()),_.events.on(`grab-changed`,({screenPoint:e,action:t})=>{y.grabMapPoint=t===`start`?k(e,this.view,this.object,y):null})],_),this._manipulatorInfos.push(y),this.manipulators.addMany([_,v]),this.events.emit(`manipulators-changed`),y}_autoHideEdgeOffsetManipulator(e,t){let n=e.manipulator,r=e.edgeManipulator,i=()=>{e.visibilityHandle=l(e.visibilityHandle);let i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),c=i!=null&&s!=null&&Te(i.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!n.focused&&!r.focused||c)&&(n.grabbable=!c,r.grabbable=!c,e.visibilityHandle=o([n.disableDisplay(),a(()=>{n.grabbable=!0,r.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([n.events.on(`focus-changed`,i),r.events.on(`focus-changed`,i),a(()=>{l(e.visibilityHandle),r.metadata.deleting=!0,this.manipulators.remove(r)})],n),i()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);let{coordinateHelper:t}=this._operations.data,n=A(this.view,e.manipulator.elevationAlignedLocation,j(t,e.handle,e.manipulator.elevationInfo)),r=this._getManipulatorInfoFromHandle(e.handle.leftVertex),i=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(r==null||i==null)return;let a=r.manipulator.renderLocation,o=i.manipulator.renderLocation,s=n==null?v:we(n,a,o);e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;let c=y(b(Z,a,o))/2;e.edgeManipulator.collisionType={type:`line`,paths:[[[-c,0,0],[c,0,0]]]}}_createEdgePipeline(e,t,n){return(r,i,a,o)=>{if(o===`touch`)this._createEdgeOffsetPipeline(e,t,n)(r,i,a);else if(this.enableMoveObject){let e=this.object.graphic,o=n.data.spatialReference,{elevationAlignedLocation:s}=r;i.next(e=>this._trackNumDragging(e)).next(z(this.view,s)).next(E(this.view,s,t,o,e)).next(je()).next(L()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{e.action===`end`&&(this._showReshapeControls(),this._resetTooltip())}),a.next(()=>this._onDragCancel(!r.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,n){return(r,i,a)=>{let o=this._pendingEdgeOffsetInfo;if(o?.manipulatorInfo===e&&o.mode!==`drag`){a.execute({action:`cancel`});return}this._clearSelection();let{initializeStep:s,cleanup:c}=this._initializeEdgeOffset(e,t,n,a),l=this._applyEdgeOffsetStep(e);i.next(e=>this._trackNumDragging(e)).next(z(this.view,r.elevationAlignedLocation)).next(s).next(_e(this.view)).next(ve(this.view,n.data.spatialReference)).next(L()).next(Ie()).next(e=>this._pendingEdgeOffsetInfo?e:l(e)).next(e=>{e.action===`end`&&!this._pendingEdgeOffsetInfo&&c()}),a.next(()=>{this._exitEdgeOffsetInputMode(),r.metadata.deleting||(c(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,n,r){let{view:i,object:a}=this,s=j(n.data.coordinateHelper,e.handle,t),c=n.createUndoGroup(),u=A(i,e.manipulator.elevationAlignedLocation,s);this._splitEdgesBeforeEdgeOffset(e,s),this._selectEdgeOffsetArrow(e,s);let d,f=()=>{this._cleanEdgeOffsetCollapsedEdges(e,n),d=l(d)},p=this.events.on(`undo`,f);return d=o([this._initializeEdgeOffsetVisualElement(e,a,t,n),c,p,this._connectEdgeOffsetTooltip(e,s,n,()=>{r.execute({action:`cancel`})})]),{initializeStep:e=>s==null||u==null?(f(),null):{...e,operation:s,plane:u},cleanup:f}}_initializeEdgeOffsetVisualElement(e,t,n,r){let i=()=>new se({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:r.data.spatialReference}),a=new N({view:this.view,isDraped:t.isDraped,geometry:i(),elevationInfo:n,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),c=o([f(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{a.color=e.toUnitRGBA(),a.isDraped=t},p),t.on(`committed`,()=>{a.geometry=i()}),s(a)]);return a.attached=!0,c}_applyEdgeOffsetStep(e){return t=>this.destroyed||t.operation==null||!this._operations?t:(this._updateEventState(2),t.signedDistance==null?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit(`reshape`,{type:`reshape`,object:this.object})),this._updateEdgeOffsetTooltip(t)),t)}_cleanEdgeOffsetCollapsedEdges(e,t){let n=e.handle.leftVertex.leftSegment?.leftVertex,r=e.handle.leftVertex,i=e.handle.rightVertex.rightSegment?.rightVertex,a=e.handle.rightVertex,o=t.data.coordinateHelper,s=this.view.pixelSizeAt(o.vectorToDehydratedPoint(r.pos),o.spatialReference),c=[];if(n&&o.distance(n.pos,r.pos)<Le){let e=this._getManipulatorInfoFromHandle(r);e!=null&&c.push(e)}if(o.distance(r.pos,a.pos)<s||i&&o.distance(i.pos,a.pos)<Le){let e=this._getManipulatorInfoFromHandle(a);e!=null&&c.push(e)}c.length&&this._removeVertices(c)}_enterInputModeDuringEdgeOffset(e){let t=this._findActiveEdgeOffsetManipulatorInfo();return t&&H(e,this.tooltip)?t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`drag`},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`hover`},this._connectEdgeOffsetTooltipOnHover(t),!0):!1}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Y).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){let{_operations:t,object:n}=this;if(!t)return;let{elevationInfo:r}=n,i=j(t.data.coordinateHelper,e.handle,r);this._selectEdgeOffsetArrow(e,i),this.addHandles([this._initializeEdgeOffsetVisualElement(e,n,r,t),this._connectEdgeOffsetTooltip(e,i,t,()=>{this.removeHandles(i),this._exitEdgeOffsetInputMode()})],i)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){let t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);t!=null&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){let t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);t!=null&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){let n=e.grabMapPoint??k(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);n&&t.selectArrowFromStartPoint(n)}_connectEdgeOffsetTooltip(e,t,n,r){let i=()=>this.tooltipInfos.edgeOffset.distance.actual,a=i=>{r(),queueMicrotask(()=>{this.view.focus();let r=n.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,Ee(i,e.manipulator.location,t,n)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,n),r.remove()})},s=()=>{let e=i();e==null?r():a(e)};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>s(),h),this.tooltip.on(`discard`,r),this.tooltip.on(`commit`,e=>{e.type===`commit-and-exit`&&s()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,n=!1){let r=this.view,i=this._operations;if(!i)return null;let a=i.data.type,s=i.data.spatialReference;if(e.type===`line`){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(this._vertexManipulatorGeometry==null||this._vertexManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=w(e),this._vertexManipulatorOutlineGeometry=w(t)}if(this._edgeManipulatorGeometry==null||this._edgeManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=w(e),this._edgeManipulatorOutlineGeometry=w(t)}let c=this._vertexManipulatorGeometry,u=this._vertexManipulatorOutlineGeometry,d=[];if(a!==`point`&&a!==`mesh`){d.push(new T(c.instantiate(),Q|4),new T(u.instantiate(),Q|5),new T(u.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),Q|6));{let{material:e,outlineMaterial:t,focusedMaterial:n}=this._selectedManipulatorMaterials;d.push(new T(c.instantiate({material:e}),8),new T(u.instantiate({material:t}),9),new T(u.instantiate({material:n}),10))}}if(this.enableMidpoints){let{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,n=this._edgeManipulatorGeometry,r=this._edgeManipulatorOutlineGeometry,i=$|6,a=$|5;d.push(new T(n.instantiate({material:e}),i),new T(r.instantiate({material:t}),i),new T(n.instantiate(),a),new T(r.instantiate(),a))}let f=e.type===`vertex`,p=new S({view:r,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:a===`point`||a===`mesh`,available:this.object.visible,metadata:{deleting:!1},location:J(s),...me});p.selected=n,this._setTypeSpecificManipulatorSettings(p,e,t);let m=f?{manipulator:p,handle:e,type:`vertex`,selectedIndex:0}:{manipulator:p,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(p),this._updateManipulatorPosition(m),m.type===`edge`){let e=[];for(let t of[m.handle.leftVertex,m.handle.rightVertex]){let n=this._getManipulatorInfoFromHandle(t);n!=null&&e.push(n.manipulator.events.on(`location-update`,()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=o(e),this._manipulatorHandles.add(m.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);let h=R(p,(e,n,a,o)=>{let c=null,{snappingStep:u,cancelSnapping:d}=V({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:t,pointer:o,excludeFeature:this.object.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});a.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>c=l(c)),t)).next(d);let{elevationAlignedLocation:f}=e,p=this.object.graphic??void 0,h=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,i,p):E(r,f,t,s,p);n.next(e=>this._trackNumDragging(e)).next(e=>{if(e.action===`start`&&i&&(c=i.createUndoGroup()),m.type===`edge`){let t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(z(r,f)).next(h).next(I(r,t,p)).next(...u).next(L()).next(e=>{this._perVertexManipulatorDragAction(e),e.action===`end`&&(c=l(c)),this._resetTooltip()})});return this._manipulatorHandles.add([h,p.events.on(`immediate-click`,e=>this._manipulatorClickCallback(e,m)),p.events.on(`select-changed`,()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),p.events.on(`focus-changed`,()=>{this._resetTooltip()})],p),this.events.emit(`manipulators-changed`),m}_screenToSceneMapForVertexDrag(e,t,n){let{view:r}=this,{coordinateHelper:i,spatialReference:a}=t.data,o=null;return t=>{if(t.action===`start`&&(o=i.vectorToPoint(t.snapOrigin)),o==null)return null;let s=r.toMap(t.screenEnd,{exclude:n,excludeLabels:!0});return s==null||(s.z=de(s,r,e),!ce(s,s,a))?null:{...t,mapStart:o,mapEnd:s}}}_trackNumDragging(e){switch(e.action){case`start`:this._numDragging++;break;case`end`:this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit(`move`,{type:`move`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape`,object:this.object})}t?.(),!this.destroyed&&this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,n){let r=this._settings;switch(t.type){case`vertex`:{e.selectable=!0,e.cursor=`move`,e.collisionPriority=2,e.elevationInfo=n;let t=this._operations?.data.type;e.interactive=t!=null&&t!==`point`&&t!==`mesh`;let{size:i,collisionPadding:a}=r.manipulators.vertex;e.radius=i/2+a,e.state=Q;break}case`line`:{e.state=$,e.selectable=!1,e.cursor=`copy`,e.collisionPriority=2;let{size:t,collisionPadding:i}=r.manipulators.edge;e.radius=t/2+i,e.elevationInfo=n.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?n:{mode:`absolute-height`,offset:0};break}}}_watchAndUpdateGrabState(e,t){return e.events.on(`grab-changed`,n=>{this._onGrabStateChanged(e,t,n.action,n.pointerType)})}_onGrabStateChanged(e,t,n,r=`mouse`){if(!this._recreatingManipulators){if(n===`start`)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(W),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(r!==`touch`||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{let{manipulator:t}=e,n=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&n!=null&&n!==`point`&&n!==`mesh`,Y(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(let e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit(`manipulators-changed`))}_removeManipulator(e){e!=null&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),n(this._manipulatorInfos,e),this.events.emit(`manipulators-changed`),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(let t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){let t=this._operations;if(e!=null&&t){if(e.type===`vertex`)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,X),e.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if(e.type===`edge`){let n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(n==null||r==null)return;let i=n.manipulator,a=r.manipulator;if(e.manipulator.elevationInfo?.mode===`on-the-ground`){let n=i.location,r=a.location,o=.5,s=n.x+o*(r.x-n.x),c=n.y+o*(r.y-n.y),l=n.hasZ&&r.hasZ?0:void 0;e.manipulator.location=ue(s,c,l,t.data.spatialReference)}else x(Z,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=Z}}}_splitEdgeManipulator(e,t=.5){let n=this._operations,r=n.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=l(e.locationUpdateHandle);let i=this.object.elevationInfo,a;this.enableEdgeOffset?(this._removeManipulator(e),a=this._createVertexOrEdgeManipulator(r)):(a=e,a.handle=r,a.type=`vertex`,this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,i)),r.leftSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.leftSegment),r.rightSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.rightSegment),this._updateManipulatorPosition(a),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);let o=this._updateEventState(2),s=n.data.coordinateHelper.vectorToArray(a.handle.pos),c=n.data.parts.indexOf(r.part);return this.events.emit(`vertex-add`,{type:`vertex-add`,object:this.object,vertices:[{coordinates:s,componentIndex:c,vertexIndex:r.index}],added:s}),o&&this._updateEventState(0),a}_updateMoveManipulationPosition(){let e=ee(Z,0,0,0),t=0,n=!1,r=null,i=null;for(let a of this._manipulatorInfos)if(a.type===`vertex`){if(!a.manipulator.selected){n=!0;continue}t++,te(e,e,a.manipulator.renderLocation),r==null||a.selectedIndex>r.selectedIndex?(i=r,r=a):(i==null||a.selectedIndex>i.selectedIndex)&&(i=a)}let a=this.object,o=this._operations?.data.geometry;if(t===0){let e=a.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&D(this._operations,a.elevationInfo),this._moveManipulation.angle=ye(o),this._moveManipulation.radius=O.radiusForSymbol(a.graphic?.symbol)}else{let e=a.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&D(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&t!==1;let n=0;if(r!=null){let e=r.handle.pos,t=i==null?r.handle.leftSegment?.leftVertex?r.handle.leftSegment.leftVertex.pos:null:i.handle.pos,a=i==null&&r.handle.rightSegment?.rightVertex?r.handle.rightSegment.rightVertex.pos:null;t&&a?this._moveManipulation.xyAxisManipulation.available=!1:t?n=q(t,e):a&&(n=q(e,a))}this._moveManipulation.angle=n,this._moveManipulation.radius=Se}t!==0&&n?(ne(e,e,1/t),X.spatialReference=this._operations.data.spatialReference,X.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,X),this._moveManipulation.elevationAlignedLocation=X):this._outlineVisualElement!=null&&!this.object.isDraped&&this._outlineVisualElement.attachmentOrigin!=null?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:pe(this._moveManipulation,this.object)}_removeVertices(e){let t=[],n=this._operations;if(!n)return;let r=e.filter(e=>e.type===`vertex`&&n.canRemoveVertex(e.handle.part));if(r.length>0){let e=this._createBeforeVertexRemoveEvent(r);if(this.events.emit(`before-vertex-remove`,e),e.defaultPrevented)return}for(let e of r){let r=e.handle.part;if(n.canRemoveVertex(r)){t.push(e.handle),this._removeManipulator(e),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightSegment));let i=n.removeVertices([e.handle]).removedVertices?.[0].createdSegment;i&&i.type===`line`?this._createVertexOrEdgeManipulator(i):this.enableEdgeOffset&&r.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(r.segments[0]))}}if(t.length>0){let e=t.map(e=>{let t=n.data.parts.indexOf(e.part);return{coordinates:n.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),r=this._updateEventState(2);if(this.destroyed||(this.events.emit(`vertex-remove`,{type:`vertex-remove`,object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)||r&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){let t=this._operations,n=e.map(e=>{let n=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:n,vertexIndex:e.handle.index}}),r=!1;return{type:`before-vertex-remove`,object:this.object,removed:n.map(e=>e.coordinates),vertices:n,get defaultPrevented(){return r},preventDefault(){r=!0}}}_moveVertices(e,t,n=t.action===`start`?0:1){let r=this._operations;if(r&&(e.length>0&&r.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,n),!this._movingManipulatorsHidden))for(let t of e)this._updateManipulatorPosition(t)}_offsetEdge(e,t,n){if(!this._operations)return;let r=t.clone();r.distance=n,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],r),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),t.type===`vertex`&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===F.Right&&this._removeVertices([t])),t.type===`edge`&&e.button===F.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){this._defaultTooltipInfo==null?this._updateTranslateObjectTooltip(e,t):this._resetTooltip()}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ke(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=M(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){let e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&e?.type===`reshape-edge-offset`)return;let t=null;t=this._pendingEdgeOffsetInfo||this._findActiveEdgeOffsetManipulatorInfo()!=null?M(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(e==null||t==null||this.tooltip.mode!==`input`)&&(this.activeTooltipInfo=t)}get _defaultTooltipInfo(){switch(this._operations?.data.type){case`polyline`:case`polygon`:return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case`point`:case`mesh`:return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){let e=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.length===1?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>e.type===`vertex`&&e.manipulator.selected)}_forEachVertex(e){for(let t of this._manipulatorInfos)t.type===`vertex`&&e(t)}get _tooltipsContext(){let{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};e([g()],K.prototype,`_numGrabbing`,void 0),e([g()],K.prototype,`_numDragging`,void 0),e([g()],K.prototype,`_pendingEdgeOffsetInfo`,void 0),e([g()],K.prototype,`_operations`,null),e([g()],K.prototype,`_segmentLabels`,void 0),e([g({constructOnly:!0})],K.prototype,`tool`,void 0),e([g()],K.prototype,`tooltip`,void 0),e([g()],K.prototype,`activeTooltipInfo`,void 0),e([g({readOnly:!0})],K.prototype,`updating`,null),e([g()],K.prototype,`manipulators`,null),e([g()],K.prototype,`view`,null),e([g()],K.prototype,`object`,null),e([g()],K.prototype,`enableZShape`,null),e([g()],K.prototype,`enableDeleteVertices`,null),e([g()],K.prototype,`enableZVertex`,null),e([g()],K.prototype,`autoHideManipulators`,null),e([g()],K.prototype,`enableMoveObject`,null),e([g()],K.prototype,`enableMidpoints`,null),e([g()],K.prototype,`enableEdgeOffset`,null),e([g()],K.prototype,`_toolOptions`,null),e([g()],K.prototype,`_accentColor`,null),e([g()],K.prototype,`_tooltipsContext`,null),K=e([_(`esri.views.3d.interactive.editingTools.reshape.ReshapeOperation`)],K);function Ie(){return e=>{let{operation:t,mapEnd:n}=e;return t==null||n==null?e:{...e,signedDistance:t.signedDistanceToPoint(n)}}}function q(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function J(e){return new oe({x:0,y:0,z:0,spatialReference:e})}function Y(e){return e.type===`edge`&&`edgeManipulator`in e}const X=ue(0,0,void 0,le.WGS84),Z=ie(),Le=1e-6,Q=16,$=32;export{K as ReshapeOperation};
2
+ import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n}from"../../../../../core/arrayUtils.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a,handlesGroup as o,destroyHandle as s}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as c,removeMaybe as l}from"../../../../../core/maybe.js";import{initial as u,on as d,watch as f,syncAndInitial as p,when as m,sync as h}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as y,subtract as b,lerp as x,set as ee,add as te,scale as ne}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,create as ie}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ae}from"../../../../../core/support/UpdatingHandles.js";import oe from"../../../../../geometry/Point.js";import se from"../../../../../geometry/Polyline.js";import{projectPoint as ce}from"../../../../../geometry/projectionUtils.js";import le from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as ue}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as de}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as fe}from"../../../../../symbols/support/utils.js";import{Manipulator3D as S}from"../../Manipulator3D.js";import{createManipulatorMaterials as C,createSphereGeometryAsOffsets as w,placeAtObject as pe,screenSizeManipulatorSettings as me}from"../../manipulatorUtils.js";import{RenderObject as T}from"../../RenderObject.js";import{SegmentLabels3D as he}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as ge}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as E,screenToRenderPlaneFromEvent as _e,convertToMapCoordinates as ve}from"../dragEventPipeline3D.js";import{orientation as ye}from"../geometryUtils.js";import{canMoveZOperations as D}from"../manipulatorUtils.js";import{Settings as be}from"../settings.js";import{createVisualElements as xe}from"../visualElementUtils.js";import{discRadiusSmall as Se}from"../manipulations/config.js";import{MoveManipulation as O}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Ce}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as k,createEdgeOffsetIntersectionPlane as A,createEdgeOffsetOperation as j,edgeOffsetRotationMatrix as we,screenEdgeLengthSquared as Te,getDistanceInGeometrySR as Ee}from"./edgeOffsetUtils.js";import{createTooltipInfos as De,connectTooltipToManipulatedObject as Oe,getUpdatedTranslateObjectTooltipInfo as ke,getUpdatedEdgeOffsetTooltipInfo as M}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as N}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as Ae}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as P}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as F}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as I,addMapDelta as L,createManipulatorDragEventPipeline as R,dragAtLocation as z,addScreenDelta as je}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as Me}from"../../../../interactive/keybindings.js";import{SnappingContext as B}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as V}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Ne,enterInputModeIfAvailable as H}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Pe}from"../../../../support/GeometryWorkerHandle.js";const U=Symbol(),W=Symbol(),Fe=Symbol(),G=Symbol();let K=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(G)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new i,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new ae,this._recreatingManipulators=!1,this._settings=new be({getTheme:()=>this.view.effectiveTheme}),this.events=new r,this.activeTooltipInfo=null,this._measurementWorker=new Pe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit(`reshape`,{type:`reshape`,object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit(`move`,{type:`move`,object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){let{view:e}=this,t=this._settings.manipulators,n=t.vertex;this.tooltipInfos=De(this._toolOptions,e),this._vertexManipulatorMaterials=C({color:n.color.toUnitRGBA(),outlineColor:n.outlineColor.toUnitRGBA(),focusedOutlineColor:n.focusedOutlineColor.toUnitRGBA(),screenSize:n,renderOccluded:n.renderOccluded});let r=t.edge;this._edgeManipulatorMaterials=C({color:r.color.toUnitRGBA(),outlineColor:r.outlineColor.toUnitRGBA(),screenSize:r,renderOccluded:r.renderOccluded});let i=t.edgeOffset;this._edgeOffsetManipulatorMaterials=C({color:i.color.toUnitRGBA(),focusedColor:i.focusedColor.toUnitRGBA(),renderOccluded:i.renderOccluded,shaded:!1});let a=t.selected;this._selectedManipulatorMaterials=C({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),focusedOutlineColor:a.focusedOutlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded}),this.tooltip=Ne(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{let e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:n,selectedSettings:r})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),n.applyColor(this._edgeOffsetManipulatorMaterials.material),n.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),r.applyColor(this._selectedManipulatorMaterials.material),r.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),r.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(let t of this._manipulatorInfos)t.manipulator.available=e,Y(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:n})=>{e!=null&&(e.visible=t,e.edgeDistance=n?`far`:`default`)},u),Oe(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{t===`input`&&e!==`input`&&this._resetTooltip()}),d(()=>this._operations,`vertex-update`,e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,`change`,e=>{(e.operation===`undo`||e.operation===`redo`)&&this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=c(this._segmentLabels),this.tooltip=c(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return e.type!==`key-down`||e.key!==Me.enterInputMode?!1:this.activeTooltipInfo?.type===`reshape-edge-offset`?this._enterInputModeDuringEdgeOffset(e):H(e,this.tooltip)?(this.tool.endDrag(),!0):!1}removeSelectedVertices(){let e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type===`vertex`);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit(`manipulators-changed`)}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(W),this.removeHandles(G),this._moveManipulation=c(this._moveManipulation),this._objectMoveManipulation=c(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(this._operations==null)return;let t=this.object.elevationInfo;for(let{vertices:n,segments:r,index:i}of this._operations.data.parts){let a=e?.byPartIndex.get(i);for(let e of n){let n=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,n)}for(let e of r)e.type===`line`&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit(`undo`),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),(!this._operations||this._segmentLabels?.context?.editGeometryOperations!==this._operations)&&(this._segmentLabels=c(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){let e=this._toolOptions.labels;this._segmentLabels=new he({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if(t.action===`end`)return t;let n=0,r=[],i=e===1&&this._someVerticesSelected;for(let e of this._manipulatorInfos)e.type===`vertex`&&(!e.manipulator.grabbing&&(!i||e.manipulator.selected)&&r.push(e),n++);if(r.length===n){if(i||this._hideReshapeControls(),this._moveVertices(r,t),this._updateEventState(1),this.destroyed)return t;this.events.emit(`move`,{type:`move`,dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(r,t),this._updateEventState(2),this.destroyed)return t;this.events.emit(`reshape`,{type:`reshape`,object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),a(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],G)}_showReshapeControls(){this.removeHandles(G)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){let t=this._manipulatorInfos.filter(Y).find(t=>t.manipulator===e||t.edgeManipulator===e);t!=null&&(this.removeHandles(W),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],W))}_hideReshapeManipulators(e){return o(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Y(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(U):this.tool.manipulators.forEach(({manipulator:e})=>{let t=e.disableDisplay?.();t&&this.addHandles(t,U)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>t.type===`vertex`&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;let{mapDeltaX:t,mapDeltaY:n,mapDeltaZ:r}=e;if(!t&&!n&&!r)return;let i=[];this._forEachVertex(t=>{let{selected:n,grabbing:r}=t.manipulator;(n&&!r||t===e.info)&&i.push(t)}),this._moveVertices(i,e,1),this.events.emit(`reshape`,{type:`reshape`,object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(this._numGrabbing!==0||this._numDragging!==0))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object}),this.destroyed||this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit(`reshape`,{type:`reshape-start`,object:this.object});break;case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit(`reshape`,{type:`reshape-start`,object:this.object})}}if(this.destroyed)return!1;let n=this._reshapeEventState!==e;return this._reshapeEventState=e,n}_createObjectMoveManipulation(){let{tool:e,view:t,object:n,_operations:r}=this;if(r){if(this._objectMoveManipulation=new Ce({tool:e,view:t,object:n}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,n,i)=>{n.next(e=>this._trackNumDragging(e)).next(t=>(t.action===`start`&&(e=r.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{t.action===`end`&&(this._showReshapeControls(),this._resetTooltip(),e=l(e))}),i.next(()=>this._onDragCancel(!0,()=>e=l(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on(`immediate-click`,e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){let{object:t,tool:n,view:r,_operations:i}=this;if(!i)return;this._moveManipulation=new O({tool:n,view:r,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&D(t.operations,t.elevationInfo),snapToScene:!1,radius:O.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on(`immediate-click`,t=>{!this._moveManipulation.zManipulation.hasManipulator(e)&&!this._manipulatorInfos.some(e=>e.manipulator.selected)&&this.events.emit(`immediate-click`,{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));let a=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(a(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(a(1)),this._moveManipulation.zManipulation.forEachManipulator(a(2)),this._moveManipulation.elevationInfo={mode:`absolute-height`,offset:0};let o=i.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((r,a,o,s,c)=>{let{snappingStep:l,cancelSnapping:u}=V({predicate:e=>!!e.info,snappingManager:n.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:e,pointer:c,excludeFeature:t.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next(e=>(this._onDragCancel(),e)).next(u),o=o.next(e=>this._trackNumDragging(e)).next(e=>{let t=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.manipulatorType===1&&t.length===1?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(I(this.view,e,t.graphic??void 0)).next(...l).next(L()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(e.action===`end`&&this._showReshapeControls(),this._updateTranslateTooltip(r,e),e)),{steps:o,cancel:s}},e,o,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on(`committed`,()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Fe),e&&this.addHandles(Ae({view:this.view,geometry:()=>t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Fe)},u)])}_createVisualElements(){let{object:e,view:t}=this,n=xe({view:t,object:e,forEachManipulator:e=>{if(!(this.destroyed||this._recreatingManipulators)){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(let t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on(`manipulators-changed`,e)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof N?n.visualElement:null);let r=this._outlineVisualElement;if(r!=null){let t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>r.events,`attachment-origin-changed`,t,{onListenerAdd:t}))}this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){let n=this.view,r=this._operations;if(e.part.vertices.length<=2||!r)return null;let i=r.data.spatialReference,a=this._settings.manipulators.edgeOffset,s=a.size/2,c=s+a.collisionPadding,l=s/c,u=l/2,d=l*Math.sqrt(3)/2,{height:f,offset:p}=a,{material:m,focusedMaterial:h}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){let e=P(m,d,u,u,f,p);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){let e=P(m,-d,u,u,f,-p);this._edgeOffsetManipulatorGeometryOutside=e}let g=[new T(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryInside.instantiate({material:h}),2),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:h}),2)],_=new S({view:n,renderObjects:g,elevationInfo:t.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?t:{mode:`absolute-height`,offset:0},worldOriented:!1,focusMultiplier:1,radius:c,available:this.object.visible,collisionType:{type:`disc`,direction:re(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:J(i)}),v=new S({view:n,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?`move`:`default`,metadata:{deleting:!1},location:J(i)}),y={manipulator:_,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(y,a.minSquaredEdgeLength);let b=()=>this._updateEdgeOffsetManipulator(y);b(),y.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>this._getManipulatorInfoFromHandle(e)?.manipulator.events.on(`location-update`,b)));let x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([y.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),R(_,this._createEdgeOffsetPipeline(y,t,r)),R(v,this._createEdgePipeline(y,t,r)),v.events.on(`immediate-click`,x),_.events.on(`immediate-click`,x),_.events.on(`focus-changed`,()=>this._resetTooltip()),_.events.on(`grab-changed`,({screenPoint:e,action:t})=>{y.grabMapPoint=t===`start`?k(e,this.view,this.object,y):null})],_),this._manipulatorInfos.push(y),this.manipulators.addMany([_,v]),this.events.emit(`manipulators-changed`),y}_autoHideEdgeOffsetManipulator(e,t){let n=e.manipulator,r=e.edgeManipulator,i=()=>{e.visibilityHandle=l(e.visibilityHandle);let i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),c=i!=null&&s!=null&&Te(i.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!n.focused&&!r.focused||c)&&(n.grabbable=!c,r.grabbable=!c,e.visibilityHandle=o([n.disableDisplay(),a(()=>{n.grabbable=!0,r.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([n.events.on(`focus-changed`,i),r.events.on(`focus-changed`,i),a(()=>{l(e.visibilityHandle),r.metadata.deleting=!0,this.manipulators.remove(r)})],n),i()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);let{coordinateHelper:t}=this._operations.data,n=A(this.view,e.manipulator.elevationAlignedLocation,j(t,e.handle,e.manipulator.elevationInfo)),r=this._getManipulatorInfoFromHandle(e.handle.leftVertex),i=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(r==null||i==null)return;let a=r.manipulator.renderLocation,o=i.manipulator.renderLocation,s=n==null?v:we(n,a,o);e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;let c=y(b(Z,a,o))/2;e.edgeManipulator.collisionType={type:`line`,paths:[[[-c,0,0],[c,0,0]]]}}_createEdgePipeline(e,t,n){return(r,i,a,o)=>{if(o===`touch`)this._createEdgeOffsetPipeline(e,t,n)(r,i,a);else if(this.enableMoveObject){let e=this.object.graphic,o=n.data.spatialReference,{elevationAlignedLocation:s}=r;i.next(e=>this._trackNumDragging(e)).next(z(this.view,s)).next(E(this.view,s,t,o,e)).next(je()).next(L()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{e.action===`end`&&(this._showReshapeControls(),this._resetTooltip())}),a.next(()=>this._onDragCancel(!r.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,n){return(r,i,a)=>{let o=this._pendingEdgeOffsetInfo;if(o?.manipulatorInfo===e&&o.mode!==`drag`){a.execute({action:`cancel`});return}this._clearSelection();let{initializeStep:s,cleanup:c}=this._initializeEdgeOffset(e,t,n,a),l=this._applyEdgeOffsetStep(e);i.next(e=>this._trackNumDragging(e)).next(z(this.view,r.elevationAlignedLocation)).next(s).next(_e(this.view)).next(ve(this.view,n.data.spatialReference)).next(L()).next(Ie()).next(e=>this._pendingEdgeOffsetInfo?e:l(e)).next(e=>{e.action===`end`&&!this._pendingEdgeOffsetInfo&&c()}),a.next(()=>{this._exitEdgeOffsetInputMode(),r.metadata.deleting||(c(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,n,r){let{view:i,object:a}=this,s=j(n.data.coordinateHelper,e.handle,t),c=n.createUndoGroup(),u=A(i,e.manipulator.elevationAlignedLocation,s);this._splitEdgesBeforeEdgeOffset(e,s),this._selectEdgeOffsetArrow(e,s);let d,f=()=>{this._cleanEdgeOffsetCollapsedEdges(e,n),d=l(d)},p=this.events.on(`undo`,f);return d=o([this._initializeEdgeOffsetVisualElement(e,a,t,n),c,p,this._connectEdgeOffsetTooltip(e,s,n,()=>{r.execute({action:`cancel`})})]),{initializeStep:e=>s==null||u==null?(f(),null):{...e,operation:s,plane:u},cleanup:f}}_initializeEdgeOffsetVisualElement(e,t,n,r){let i=()=>new se({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:r.data.spatialReference}),a=new N({view:this.view,isDraped:t.isDraped,geometry:i(),elevationInfo:n,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),c=o([f(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{a.color=e.toUnitRGBA(),a.isDraped=t},p),t.on(`committed`,()=>{a.geometry=i()}),s(a)]);return a.attached=!0,c}_applyEdgeOffsetStep(e){return t=>this.destroyed||t.operation==null||!this._operations?t:(this._updateEventState(2),t.signedDistance==null?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit(`reshape`,{type:`reshape`,object:this.object})),this._updateEdgeOffsetTooltip(t)),t)}_cleanEdgeOffsetCollapsedEdges(e,t){let n=e.handle.leftVertex.leftSegment?.leftVertex,r=e.handle.leftVertex,i=e.handle.rightVertex.rightSegment?.rightVertex,a=e.handle.rightVertex,o=t.data.coordinateHelper,s=this.view.pixelSizeAt(o.vectorToDehydratedPoint(r.pos),o.spatialReference),c=[];if(n&&o.distance(n.pos,r.pos)<Le){let e=this._getManipulatorInfoFromHandle(r);e!=null&&c.push(e)}if(o.distance(r.pos,a.pos)<s||i&&o.distance(i.pos,a.pos)<Le){let e=this._getManipulatorInfoFromHandle(a);e!=null&&c.push(e)}c.length&&this._removeVertices(c)}_enterInputModeDuringEdgeOffset(e){let t=this._findActiveEdgeOffsetManipulatorInfo();return t&&H(e,this.tooltip)?t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`drag`},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`hover`},this._connectEdgeOffsetTooltipOnHover(t),!0):!1}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Y).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){let{_operations:t,object:n}=this;if(!t)return;let{elevationInfo:r}=n,i=j(t.data.coordinateHelper,e.handle,r);this._selectEdgeOffsetArrow(e,i),this.addHandles([this._initializeEdgeOffsetVisualElement(e,n,r,t),this._connectEdgeOffsetTooltip(e,i,t,()=>{this.removeHandles(i),this._exitEdgeOffsetInputMode()})],i)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){let t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);t!=null&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){let t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);t!=null&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){let n=e.grabMapPoint??k(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);n&&t.selectArrowFromStartPoint(n)}_connectEdgeOffsetTooltip(e,t,n,r){let i=()=>this.tooltipInfos.edgeOffset.distance.actual,a=i=>{r(),queueMicrotask(()=>{this.view.focus();let r=n.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,Ee(i,e.manipulator.location,t,n)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,n),r.remove()})},s=()=>{let e=i();e==null?r():a(e)};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>s(),h),this.tooltip.on(`discard`,r),this.tooltip.on(`commit`,e=>{e.type===`commit-and-exit`&&s()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,n=!1){let r=this.view,i=this._operations;if(!i)return null;let a=i.data.type,s=i.data.spatialReference;if(e.type===`line`){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(this._vertexManipulatorGeometry==null||this._vertexManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=w(e),this._vertexManipulatorOutlineGeometry=w(t)}if(this._edgeManipulatorGeometry==null||this._edgeManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=w(e),this._edgeManipulatorOutlineGeometry=w(t)}let c=this._vertexManipulatorGeometry,u=this._vertexManipulatorOutlineGeometry,d=[];if(a!==`point`&&a!==`mesh`){d.push(new T(c.instantiate(),Q|4),new T(u.instantiate(),Q|5),new T(u.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),Q|6));{let{material:e,outlineMaterial:t,focusedMaterial:n}=this._selectedManipulatorMaterials;d.push(new T(c.instantiate({material:e}),8),new T(u.instantiate({material:t}),9),new T(u.instantiate({material:n}),10))}}if(this.enableMidpoints){let{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,n=this._edgeManipulatorGeometry,r=this._edgeManipulatorOutlineGeometry,i=$|6,a=$|5;d.push(new T(n.instantiate({material:e}),i),new T(r.instantiate({material:t}),i),new T(n.instantiate(),a),new T(r.instantiate(),a))}let f=e.type===`vertex`,p=new S({view:r,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:a===`point`||a===`mesh`,available:this.object.visible,metadata:{deleting:!1},location:J(s),...me});p.selected=n,this._setTypeSpecificManipulatorSettings(p,e,t);let m=f?{manipulator:p,handle:e,type:`vertex`,selectedIndex:0}:{manipulator:p,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(p),this._updateManipulatorPosition(m),m.type===`edge`){let e=[];for(let t of[m.handle.leftVertex,m.handle.rightVertex]){let n=this._getManipulatorInfoFromHandle(t);n!=null&&e.push(n.manipulator.events.on(`location-update`,()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=o(e),this._manipulatorHandles.add(m.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);let h=R(p,(e,n,a,o)=>{let c=null,{snappingStep:u,cancelSnapping:d}=V({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:t,pointer:o,excludeFeature:this.object.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});a.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>c=l(c)),t)).next(d);let{elevationAlignedLocation:f}=e,p=this.object.graphic??void 0,h=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,i,p):E(r,f,t,s,p);n.next(e=>this._trackNumDragging(e)).next(e=>{if(e.action===`start`&&i&&(c=i.createUndoGroup()),m.type===`edge`){let t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(z(r,f)).next(h).next(I(r,t,p)).next(...u).next(L()).next(e=>{this._perVertexManipulatorDragAction(e),e.action===`end`&&(c=l(c)),this._resetTooltip()})});return this._manipulatorHandles.add([h,p.events.on(`immediate-click`,e=>this._manipulatorClickCallback(e,m)),p.events.on(`select-changed`,()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),p.events.on(`focus-changed`,()=>{this._resetTooltip()})],p),this.events.emit(`manipulators-changed`),m}_screenToSceneMapForVertexDrag(e,t,n){let{view:r}=this,{coordinateHelper:i,spatialReference:a}=t.data,o=null;return t=>{if(t.action===`start`&&(o=i.vectorToPoint(t.snapOrigin)),o==null)return null;let s=r.toMap(t.screenEnd,{exclude:n,excludeLabels:!0});return s==null||(s.z=de(s,r,e),!ce(s,s,a))?null:{...t,mapStart:o,mapEnd:s}}}_trackNumDragging(e){switch(e.action){case`start`:this._numDragging++;break;case`end`:this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit(`move`,{type:`move`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape`,object:this.object})}t?.(),!this.destroyed&&this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,n){let r=this._settings;switch(t.type){case`vertex`:{e.selectable=!0,e.cursor=`move`,e.collisionPriority=2,e.elevationInfo=n;let t=this._operations?.data.type;e.interactive=t!=null&&t!==`point`&&t!==`mesh`;let{size:i,collisionPadding:a}=r.manipulators.vertex;e.radius=i/2+a,e.state=Q;break}case`line`:{e.state=$,e.selectable=!1,e.cursor=`copy`,e.collisionPriority=2;let{size:t,collisionPadding:i}=r.manipulators.edge;e.radius=t/2+i,e.elevationInfo=n.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?n:{mode:`absolute-height`,offset:0};break}}}_watchAndUpdateGrabState(e,t){return e.events.on(`grab-changed`,n=>{this._onGrabStateChanged(e,t,n.action,n.pointerType)})}_onGrabStateChanged(e,t,n,r=`mouse`){if(!this._recreatingManipulators){if(n===`start`)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(W),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(r!==`touch`||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{let{manipulator:t}=e,n=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&n!=null&&n!==`point`&&n!==`mesh`,Y(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(let e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit(`manipulators-changed`))}_removeManipulator(e){e!=null&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),n(this._manipulatorInfos,e),this.events.emit(`manipulators-changed`),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(let t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){let t=this._operations;if(e!=null&&t){if(e.type===`vertex`)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,X),e.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if(e.type===`edge`){let n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(n==null||r==null)return;let i=n.manipulator,a=r.manipulator;if(e.manipulator.elevationInfo?.mode===`on-the-ground`){let n=i.location,r=a.location,o=.5,s=n.x+o*(r.x-n.x),c=n.y+o*(r.y-n.y),l=n.hasZ&&r.hasZ?0:void 0;e.manipulator.location=ue(s,c,l,t.data.spatialReference)}else x(Z,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=Z}}}_splitEdgeManipulator(e,t=.5){let n=this._operations,r=n.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=l(e.locationUpdateHandle);let i=this.object.elevationInfo,a;this.enableEdgeOffset?(this._removeManipulator(e),a=this._createVertexOrEdgeManipulator(r)):(a=e,a.handle=r,a.type=`vertex`,this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,i)),r.leftSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.leftSegment),r.rightSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.rightSegment),this._updateManipulatorPosition(a),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);let o=this._updateEventState(2),s=n.data.coordinateHelper.vectorToArray(a.handle.pos),c=n.data.parts.indexOf(r.part);return this.events.emit(`vertex-add`,{type:`vertex-add`,object:this.object,vertices:[{coordinates:s,componentIndex:c,vertexIndex:r.index}],added:s}),o&&this._updateEventState(0),a}_updateMoveManipulationPosition(){let e=ee(Z,0,0,0),t=0,n=!1,r=null,i=null;for(let a of this._manipulatorInfos)if(a.type===`vertex`){if(!a.manipulator.selected){n=!0;continue}t++,te(e,e,a.manipulator.renderLocation),r==null||a.selectedIndex>r.selectedIndex?(i=r,r=a):(i==null||a.selectedIndex>i.selectedIndex)&&(i=a)}let a=this.object,o=this._operations?.data.geometry;if(t===0){let e=a.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&D(this._operations,a.elevationInfo),this._moveManipulation.angle=ye(o),this._moveManipulation.radius=O.radiusForSymbol(a.graphic?.symbol)}else{let e=a.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&D(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&t!==1;let n=0;if(r!=null){let e=r.handle.pos,t=i==null?r.handle.leftSegment?.leftVertex?r.handle.leftSegment.leftVertex.pos:null:i.handle.pos,a=i==null&&r.handle.rightSegment?.rightVertex?r.handle.rightSegment.rightVertex.pos:null;t&&a?this._moveManipulation.xyAxisManipulation.available=!1:t?n=q(t,e):a&&(n=q(e,a))}this._moveManipulation.angle=n,this._moveManipulation.radius=Se}t!==0&&n?(ne(e,e,1/t),X.spatialReference=this._operations.data.spatialReference,X.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,X),this._moveManipulation.elevationAlignedLocation=X):this._outlineVisualElement!=null&&!this.object.isDraped&&this._outlineVisualElement.attachmentOrigin!=null?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:pe(this._moveManipulation,this.object)}_removeVertices(e){let t=[],n=this._operations;if(!n)return;let r=e.filter(e=>e.type===`vertex`&&n.canRemoveVertex(e.handle.part));if(r.length>0){let e=this._createBeforeVertexRemoveEvent(r);if(this.events.emit(`before-vertex-remove`,e),e.defaultPrevented)return}for(let e of r){let r=e.handle.part;if(n.canRemoveVertex(r)){t.push(e.handle),this._removeManipulator(e),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightSegment));let i=n.removeVertices([e.handle]).removedVertices?.[0].createdSegment;i&&i.type===`line`?this._createVertexOrEdgeManipulator(i):this.enableEdgeOffset&&r.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(r.segments[0]))}}if(t.length>0){let e=t.map(e=>{let t=n.data.parts.indexOf(e.part);return{coordinates:n.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),r=this._updateEventState(2);if(this.destroyed||(this.events.emit(`vertex-remove`,{type:`vertex-remove`,object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)||r&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){let t=this._operations,n=e.map(e=>{let n=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:n,vertexIndex:e.handle.index}}),r=!1;return{type:`before-vertex-remove`,object:this.object,removed:n.map(e=>e.coordinates),vertices:n,get defaultPrevented(){return r},preventDefault(){r=!0}}}_moveVertices(e,t,n=t.action===`start`?0:1){let r=this._operations;if(r&&(e.length>0&&r.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,n),!this._movingManipulatorsHidden))for(let t of e)this._updateManipulatorPosition(t)}_offsetEdge(e,t,n){if(!this._operations)return;let r=t.clone();r.distance=n,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],r),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),t.type===`vertex`&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===F.Right&&this._removeVertices([t])),t.type===`edge`&&e.button===F.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){this._defaultTooltipInfo==null?this._updateTranslateObjectTooltip(e,t):this._resetTooltip()}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ke(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=M(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){let e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&e?.type===`reshape-edge-offset`)return;let t=null;t=this._pendingEdgeOffsetInfo||this._findActiveEdgeOffsetManipulatorInfo()!=null?M(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(e==null||t==null||this.tooltip.mode!==`input`)&&(this.activeTooltipInfo=t)}get _defaultTooltipInfo(){switch(this._operations?.data.type){case`polyline`:case`polygon`:return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case`point`:case`mesh`:return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){let e=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.length===1?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>e.type===`vertex`&&e.manipulator.selected)}_forEachVertex(e){for(let t of this._manipulatorInfos)t.type===`vertex`&&e(t)}get _tooltipsContext(){let{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};e([g()],K.prototype,`_numGrabbing`,void 0),e([g()],K.prototype,`_numDragging`,void 0),e([g()],K.prototype,`_pendingEdgeOffsetInfo`,void 0),e([g()],K.prototype,`_operations`,null),e([g()],K.prototype,`_segmentLabels`,void 0),e([g({constructOnly:!0})],K.prototype,`tool`,void 0),e([g()],K.prototype,`tooltip`,void 0),e([g()],K.prototype,`activeTooltipInfo`,void 0),e([g({readOnly:!0})],K.prototype,`updating`,null),e([g()],K.prototype,`manipulators`,null),e([g()],K.prototype,`view`,null),e([g()],K.prototype,`object`,null),e([g()],K.prototype,`enableZShape`,null),e([g()],K.prototype,`enableDeleteVertices`,null),e([g()],K.prototype,`enableZVertex`,null),e([g()],K.prototype,`autoHideManipulators`,null),e([g()],K.prototype,`enableMoveObject`,null),e([g()],K.prototype,`enableMidpoints`,null),e([g()],K.prototype,`enableEdgeOffset`,null),e([g()],K.prototype,`_toolOptions`,null),e([g()],K.prototype,`_accentColor`,null),e([g()],K.prototype,`_tooltipsContext`,null),K=e([_(`esri.views.3d.interactive.editingTools.reshape.ReshapeOperation`)],K);function Ie(){return e=>{let{operation:t,mapEnd:n}=e;return t==null||n==null?e:{...e,signedDistance:t.signedDistanceToPoint(n)}}}function q(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function J(e){return new oe({x:0,y:0,z:0,spatialReference:e})}function Y(e){return e.type===`edge`&&`edgeManipulator`in e}const X=ue(0,0,void 0,le.WGS84),Z=ie(),Le=1e-6,Q=16,$=32;export{K as ReshapeOperation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{watch as e,initial as t}from"../../../../core/reactiveUtils.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{resizeHandleCornerWidth as r,resizeHandleEdgeWidth as i,displayFocusMultiplier as a,resizeHandleCornerInputRadius as o,resizeHandleEdgeInputRadius as s}from"../../analysis/Slice/sliceToolConfig.js";import{isDiagonalResizeHandle as c,resizeNormal as l,resizeOutlineOnly as u}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as d}from"../Manipulator3D.js";import{worldScaledManipulatorSettings as f}from"../manipulatorUtils.js";import{RenderObject as p}from"../RenderObject.js";import{createPolylineGeometry as m}from"../../webgl-engine/lib/GeometryUtil.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class g extends d{constructor(n,o){let s=c(o),l=s?r:i,u=l*a,d=i,p={renderOccluded:4,isDecoration:!0},m=new h({...p,width:l},n.state.isGlobal),g=new h({...p,width:u},n.state.isGlobal),v=new h({...p,width:d},n.state.isGlobal);super({view:n,...f,..._({isCorner:s,unfocusedMaterial:m,focusedMaterial:g,outlineMaterial:v})}),this._themeHandle=e(()=>n.effectiveTheme.accentColor,e=>{let t=e.toUnitRGBA();m.setParameters({color:t}),g.setParameters({color:t}),v.setParameters({color:t})},t)}destroy(){this._themeHandle.remove(),super.destroy()}}function _({isCorner:e,unfocusedMaterial:t,focusedMaterial:r,outlineMaterial:i}){let a=e?[n(1,0,0),n(0,0,0),n(0,1,0)]:[n(1,0,0),n(-1,0,0)];return{renderObjects:[new p(m(t,a),1|l),new p(m(r,a),2|l),new p(m(i,a),u)],collisionType:{type:`line`,paths:[a]},radius:e?o:s,state:l}}export{g as ResizeManipulator};
2
+ import{watch as e,initial as t}from"../../../../core/reactiveUtils.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{resizeHandleCornerWidth as r,resizeHandleEdgeWidth as i,displayFocusMultiplier as a,resizeHandleCornerInputRadius as o,resizeHandleEdgeInputRadius as s}from"../../analysis/Slice/sliceToolConfig.js";import{isDiagonalResizeHandle as c,resizeNormal as l,resizeOutlineOnly as u}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as d}from"../Manipulator3D.js";import{worldScaledManipulatorSettings as f}from"../manipulatorUtils.js";import{RenderObject as p}from"../RenderObject.js";import{createPolylineGeometry as m}from"../../webgl-engine/lib/GeometryUtil.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class g extends d{constructor(n,o){let s=c(o),l=s?r:i,u=l*a,d=i,p={renderOccluded:4,isDecoration:!0},m=new h({...p,width:l},n),g=new h({...p,width:u},n),v=new h({...p,width:d},n);super({view:n,...f,..._({isCorner:s,unfocusedMaterial:m,focusedMaterial:g,outlineMaterial:v})}),this._themeHandle=e(()=>n.effectiveTheme.accentColor,e=>{let t=e.toUnitRGBA();m.setParameters({color:t}),g.setParameters({color:t}),v.setParameters({color:t})},t)}destroy(){this._themeHandle.remove(),super.destroy()}}function _({isCorner:e,unfocusedMaterial:t,focusedMaterial:r,outlineMaterial:i}){let a=e?[n(1,0,0),n(0,0,0),n(0,1,0)]:[n(1,0,0),n(-1,0,0)];return{renderObjects:[new p(m(t,a),1|l),new p(m(r,a),2|l),new p(m(i,a),u)],collisionType:{type:`line`,paths:[a]},radius:e?o:s,state:l}}export{g as ResizeManipulator};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{multiplyOpacity as e,getContrast as t}from"../../../../core/colorUtils.js";import{releaseMaybe as n}from"../../../../core/maybe.js";import{watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as a}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as o}from"../Manipulator3D.js";import{rotateManipulatorDefaults as s}from"../manipulatorUtils.js";import{RenderObject as c}from"../RenderObject.js";import{Attribute as l}from"../../webgl-engine/lib/Attribute.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as d}from"../../webgl-engine/lib/GeometryUtil.js";import{Parameters as f,ImageMaterial as p}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as m}from"../../webgl-engine/materials/RibbonLineMaterial.js";class h extends o{constructor(n,a){let o=a(e(n.effectiveTheme.accentColor,.5),t(n.effectiveTheme.accentColor)),c=new f(o.managedTexture,!1);c.renderOccluded=16,c.isDecoration=!0;let l=new p(c),u=s.calloutWidth,d=new m({width:u,renderOccluded:4,isDecoration:!0},n.state.isGlobal);super({view:n,...g({imageMaterial:l,calloutMaterial:d})}),this._textureHandle=o,this._themeHandle=r(()=>n.effectiveTheme.accentColor,n=>{let r=e(n,.5),i=t(n),o=this._textureHandle;this._textureHandle=a(r,i),l.setParameters({managedTexture:this._textureHandle.managedTexture}),o?.release(),d.setParameters({color:n.toUnitRGBA()})},i)}destroy(){this._textureHandle=n(this._textureHandle),this._themeHandle.remove(),super.destroy()}}function g({imageMaterial:e,calloutMaterial:t}){let{focusMultiplier:n,calloutLength:r,discRadius:i}=s,o=i*n,f=(e,t)=>{let n=[0,1,2,2,3,0];return new u(t,[[`position`,new l([r-e,-e,0,r+e,-e,0,r+e,e,0,r-e,e,0],n,3,!0)],[`uv0`,new l([0,0,1,0,1,1,0,1],n,2,!0)]])},p=d(t,[[0,0,0],[r-i,0,0]]),m=d(t,[[0,0,0],[r-o,0,0]]),h=a;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:`disc`,direction:[0,0,1],offset:[r,0,0]},focusMultiplier:n,radius:i,renderObjects:[new c(f(i,e),1|h),new c(p,1|h),new c(f(o,e),2|h),new c(m,2|h)],state:h}}export{h as RotateManipulator};
2
+ import{multiplyOpacity as e,getContrast as t}from"../../../../core/colorUtils.js";import{releaseMaybe as n}from"../../../../core/maybe.js";import{watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as a}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as o}from"../Manipulator3D.js";import{rotateManipulatorDefaults as s}from"../manipulatorUtils.js";import{RenderObject as c}from"../RenderObject.js";import{Attribute as l}from"../../webgl-engine/lib/Attribute.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as d}from"../../webgl-engine/lib/GeometryUtil.js";import{Parameters as f,ImageMaterial as p}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as m}from"../../webgl-engine/materials/RibbonLineMaterial.js";class h extends o{constructor(n,a){let o=a(e(n.effectiveTheme.accentColor,.5),t(n.effectiveTheme.accentColor)),c=new f(o.managedTexture,!1);c.renderOccluded=16,c.isDecoration=!0;let l=new p(c),u=s.calloutWidth,d=new m({width:u,renderOccluded:4,isDecoration:!0},n);super({view:n,...g({imageMaterial:l,calloutMaterial:d})}),this._textureHandle=o,this._themeHandle=r(()=>n.effectiveTheme.accentColor,n=>{let r=e(n,.5),i=t(n),o=this._textureHandle;this._textureHandle=a(r,i),l.setParameters({managedTexture:this._textureHandle.managedTexture}),o?.release(),d.setParameters({color:n.toUnitRGBA()})},i)}destroy(){this._textureHandle=n(this._textureHandle),this._themeHandle.remove(),super.destroy()}}function g({imageMaterial:e,calloutMaterial:t}){let{focusMultiplier:n,calloutLength:r,discRadius:i}=s,o=i*n,f=(e,t)=>{let n=[0,1,2,2,3,0];return new u(t,[[`position`,new l([r-e,-e,0,r+e,-e,0,r+e,e,0,r-e,e,0],n,3,!0)],[`uv0`,new l([0,0,1,0,1,1,0,1],n,2,!0)]])},p=d(t,[[0,0,0],[r-i,0,0]]),m=d(t,[[0,0,0],[r-o,0,0]]),h=a;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:`disc`,direction:[0,0,1],offset:[r,0,0]},focusMultiplier:n,radius:i,renderObjects:[new c(f(i,e),1|h),new c(p,1|h),new c(f(o,e),2|h),new c(m,2|h)],state:h}}export{h as RotateManipulator};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as n,initial as r}from"../../../../core/reactiveUtils.js";import{identity as i,translate as a,scale as o,fromQuat as s,multiply as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{rotationTo as u}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{subtract as d,normalize as f,scale as p,add as m,set as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as v,sm4d as y,sq4d as b}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as x,shiftRestartTipRadius as S,shiftRestartTipLength as C,shiftRestartArrowOutlineWidth as w,shiftRestartArrowLength as T,shiftRestartTubeRadius as E,shiftRestartTubeFocusMultiplier as D,shiftRestartTipFocusMultiplier as O}from"../../analysis/Slice/sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as k,IsShiftEdgeOnScreenFlag as A}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as j}from"../Manipulator3D.js";import{RenderObject as M}from"../RenderObject.js";import{createPolylineGeometry as N,createConeGeometry as P,createPathExtrusionGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as I}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as L}from"../../webgl-engine/materials/RibbonLineMaterial.js";class R extends j{constructor(i,a,o=4){let s=new L({width:1,renderOccluded:o,isDecoration:!0},i.state.isGlobal),c=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),l=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),u=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),d=new I({writeDepth:!1,cullFace:1,renderOccluded:2,isDecoration:!0});super({view:i,...z({offsetMode:a,tubeMaterial:c,tipMaterial:l,capMaterial:u,outlineMaterial:d,calloutMaterial:s})}),this._themeHandle=n(()=>i.effectiveTheme.accentColor,n=>{let r=t(n),i=n.toUnitRGBA(),a=r.toUnitRGBA(),o=e.blendColors(r,n,.4).toUnitRGBA(),f=e.blendColors(r,n,.14).toUnitRGBA();s.setParameters({color:i}),c.setParameters({color:f}),l.setParameters({color:a}),u.setParameters({color:o}),d.setParameters({color:i})},r)}destroy(){this._themeHandle.remove(),super.destroy()}}function z({offsetMode:e,tubeMaterial:t,tipMaterial:n,capMaterial:r,outlineMaterial:i,calloutMaterial:a}){let o=e===0?x:0,s=[_(o,0,-T/2),_(o,0,T/2)],c=H(s),l=B({vertices:s,padding:0,materials:{tube:t,tip:n,cap:r}}),u=B({vertices:s,padding:w,materials:{tube:i,tip:i,cap:i}}),d=N(a,[[o,0,0],[o-x,0,0]]),f=N(a,[[o,0,0],[o-x,0,0]]);return{renderObjects:[...l.normal.map(e=>new M(e,1|k)),...u.normal.map(e=>new M(e,1|k)),new M(d,1|k|A),...l.focused.map(e=>new M(e,2|k)),...u.focused.map(e=>new M(e,2|k)),new M(f,2|k|A)],autoScaleRenderObjects:!1,collisionType:{type:`line`,paths:[c]},collisionPriority:1,radius:S,state:k}}function B({vertices:e,padding:t,materials:n}){let r=r=>{let x=e.slice(),w=d(v.get(),x[0],x[1]);f(w,w);let T=d(v.get(),x[x.length-1],x[x.length-2]);if(f(T,T),t>0){let e=p(g(),T,-t);x[x.length-1]=m(e,e,x[x.length-1]);let n=p(g(),w,-t);x[0]=m(n,n,x[0])}let k=r?O:1,A=C*k,j=S*k,M=i(y.get());if(t>0){let e=A/4,n=h(v.get(),0,e,0),r=1+t/e;a(M,M,n),o(M,M,h(v.get(),r,r,r)),a(M,M,p(n,n,-1/r))}let N=i(l()),F=_(0,1,0),I=s(l(),u(b.get(),F,T));I[12]=x[x.length-1][0],I[13]=x[x.length-1][1],I[14]=x[x.length-1][2],c(I,I,M);let L=n.tube,R=V(E*(r?D:1)+t,x,L);R.transformation=N;let z=[R],B=n.tip,H=P(B,A,j,24,!1,!1,!0);H.transformation=I,z.push(H);let U=n.cap,W=P(U,A,j,24,!1,!0,!1);W.transformation=I,z.push(W);let G=s(l(),u(b.get(),F,w));return G[12]=x[0][0],G[13]=x[0][1],G[14]=x[0][2],c(G,G,M),z.push(H.instantiate({transformation:G})),z.push(W.instantiate({transformation:G})),z};return{normal:r(!1),focused:r(!0)}}function V(e,t,n){let r=[];for(let t=0;t<12;t++){let n=t/12*2*Math.PI;r.push([Math.cos(n)*e,Math.sin(n)*e])}return F(n,r,t,[],[],!1)}function H(e,t){let n=d(g(),e[e.length-1],e[e.length-2]);f(n,n),p(n,n,C),m(n,n,e[e.length-1]);{let t=d(g(),e[0],e[1]);return f(t,t),p(t,t,C),m(t,t,e[0]),[t,...e,n]}}export{R as ShiftManipulator};
2
+ import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as n,initial as r}from"../../../../core/reactiveUtils.js";import{identity as i,translate as a,scale as o,fromQuat as s,multiply as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{rotationTo as u}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{subtract as d,normalize as f,scale as p,add as m,set as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as v,sm4d as y,sq4d as b}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as x,shiftRestartTipRadius as S,shiftRestartTipLength as C,shiftRestartArrowOutlineWidth as w,shiftRestartArrowLength as T,shiftRestartTubeRadius as E,shiftRestartTubeFocusMultiplier as D,shiftRestartTipFocusMultiplier as O}from"../../analysis/Slice/sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as k,IsShiftEdgeOnScreenFlag as A}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as j}from"../Manipulator3D.js";import{RenderObject as M}from"../RenderObject.js";import{createPolylineGeometry as N,createConeGeometry as P,createPathExtrusionGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as I}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as L}from"../../webgl-engine/materials/RibbonLineMaterial.js";class R extends j{constructor(i,a,o=4){let s=new L({width:1,renderOccluded:o,isDecoration:!0},i),c=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),l=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),u=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),d=new I({writeDepth:!1,cullFace:1,renderOccluded:2,isDecoration:!0});super({view:i,...z({offsetMode:a,tubeMaterial:c,tipMaterial:l,capMaterial:u,outlineMaterial:d,calloutMaterial:s})}),this._themeHandle=n(()=>i.effectiveTheme.accentColor,n=>{let r=t(n),i=n.toUnitRGBA(),a=r.toUnitRGBA(),o=e.blendColors(r,n,.4).toUnitRGBA(),f=e.blendColors(r,n,.14).toUnitRGBA();s.setParameters({color:i}),c.setParameters({color:f}),l.setParameters({color:a}),u.setParameters({color:o}),d.setParameters({color:i})},r)}destroy(){this._themeHandle.remove(),super.destroy()}}function z({offsetMode:e,tubeMaterial:t,tipMaterial:n,capMaterial:r,outlineMaterial:i,calloutMaterial:a}){let o=e===0?x:0,s=[_(o,0,-T/2),_(o,0,T/2)],c=H(s),l=B({vertices:s,padding:0,materials:{tube:t,tip:n,cap:r}}),u=B({vertices:s,padding:w,materials:{tube:i,tip:i,cap:i}}),d=N(a,[[o,0,0],[o-x,0,0]]),f=N(a,[[o,0,0],[o-x,0,0]]);return{renderObjects:[...l.normal.map(e=>new M(e,1|k)),...u.normal.map(e=>new M(e,1|k)),new M(d,1|k|A),...l.focused.map(e=>new M(e,2|k)),...u.focused.map(e=>new M(e,2|k)),new M(f,2|k|A)],autoScaleRenderObjects:!1,collisionType:{type:`line`,paths:[c]},collisionPriority:1,radius:S,state:k}}function B({vertices:e,padding:t,materials:n}){let r=r=>{let x=e.slice(),w=d(v.get(),x[0],x[1]);f(w,w);let T=d(v.get(),x[x.length-1],x[x.length-2]);if(f(T,T),t>0){let e=p(g(),T,-t);x[x.length-1]=m(e,e,x[x.length-1]);let n=p(g(),w,-t);x[0]=m(n,n,x[0])}let k=r?O:1,A=C*k,j=S*k,M=i(y.get());if(t>0){let e=A/4,n=h(v.get(),0,e,0),r=1+t/e;a(M,M,n),o(M,M,h(v.get(),r,r,r)),a(M,M,p(n,n,-1/r))}let N=i(l()),F=_(0,1,0),I=s(l(),u(b.get(),F,T));I[12]=x[x.length-1][0],I[13]=x[x.length-1][1],I[14]=x[x.length-1][2],c(I,I,M);let L=n.tube,R=V(E*(r?D:1)+t,x,L);R.transformation=N;let z=[R],B=n.tip,H=P(B,A,j,24,!1,!1,!0);H.transformation=I,z.push(H);let U=n.cap,W=P(U,A,j,24,!1,!0,!1);W.transformation=I,z.push(W);let G=s(l(),u(b.get(),F,w));return G[12]=x[0][0],G[13]=x[0][1],G[14]=x[0][2],c(G,G,M),z.push(H.instantiate({transformation:G})),z.push(W.instantiate({transformation:G})),z};return{normal:r(!1),focused:r(!0)}}function V(e,t,n){let r=[];for(let t=0;t<12;t++){let n=t/12*2*Math.PI;r.push([Math.cos(n)*e,Math.sin(n)*e])}return F(n,r,t,[],[],!1)}function H(e,t){let n=d(g(),e[e.length-1],e[e.length-2]);f(n,n),p(n,n,C),m(n,n,e[e.length-1]);{let t=d(g(),e[0],e[1]);return f(t,t),p(t,t,C),m(t,t,e[0]),[t,...e,n]}}export{R as ShiftManipulator};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{copy as e,subtract as t,exactEquals as n,negate as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as u,getStart as d,getEnd as f,create as p}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as m}from"../../../../geometry/support/frustumPlanes.js";import{fromPoints as h,pointAt as g,create as _}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as y}from"../../../../geometry/support/ray.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{LaserlineVisualElement as x}from"./LaserlineVisualElement.js";import{drapedZ as S}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as C}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";class E extends b{constructor(e){super(e),this._ray=v(),this._isWorldDown=!1,this._start=i(),this._end=a(1,0,0),this._width=1,this._color=c(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=c(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._transparentRenderOrder=0,this._fadedExtensions=N,this._laserline=new x({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:D,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:D,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(n){this._isWorldDown=!0,e(this._start,n),this.view.renderCoordsHelper.worldUpAtPosition(n,this._end),t(this._end,n,this._end),y(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,n(this._start,t)||(e(this._start,t),y(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,n(this._end,t)||(e(this._end,t),y(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){o(e,this._color)||(s(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){o(e,this._innerColor)||(s(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(e==null||this._stippleOffColor==null||!o(e,this._stippleOffColor))&&(this._stippleOffColor=e==null?null:l(e),this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??N,this.recreateGeometry()}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,polygonOffset:this._polygonOffset?3:0,renderOccluded:this._normalizedRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){let t=new T(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let r=this._createGeometry(e);n.push(r),t.addGeometry(r),this._updateVerticesObject3D(t)}_createDrapedResources(){let e=new T(this.materialParameters,this.view.state.isGlobal);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){let t=this._createGeometry(e);return this._updateVerticesDraped(t),new w(t)}_createGeometry(e){let t=this.extensionType===3,n=t?[i(),i(),i(),i()]:[i(),i()];return C(e,n,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===3?this._updateLineSegmentFinite(j):this._updateLineSegmentInfinite(this._extensionType,j)}_updateLineSegmentFinite(e){return h(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){let n=this.view.state.camera;switch(u(this._ray,O),e){case 0:O.c0=-Number.MAX_VALUE;break;case 1:case 2:{let e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,`ground`)??0,n=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&n<t&&r(O.ray.direction,O.ray.direction),this._extensionType===2&&t!=null&&(O.c1=Math.abs(n-t));break}}if(!m(n.frustum,O))return this._updateLineSegmentFinite(t);let i=d(O,k),a=f(O,A);return h(i,a,t)}_updateVertexAttributesObject3D(e,t){let n=e.geometries[0].getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=e[2];e.geometryVertexAttributeUpdated(e.geometries[0],`position`)}_updateVertexAttributesDraped(e,t){let n=e.getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=S;e.invalidateBoundingInfo()}*_lineVertices(e){this.extensionType===3?(yield g(e,-this.fadedExtensions.start,k),yield g(e,0,k),yield g(e,1,k),yield g(e,1+this.fadedExtensions.end,k)):(yield g(e,0,k),yield g(e,1,k))}}function D(e){e.geometries=[]}const O=p(),k=i(),A=i(),j=_(),M=1/3,N={start:M,end:M};export{E as ExtendedLineVisualElement};
2
+ import{copy as e,subtract as t,exactEquals as n,negate as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i,fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as o,copy as s}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as c,clone as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{fromRay as u,getStart as d,getEnd as f,create as p}from"../../../../geometry/support/clipRay.js";import{intersectClipRay as m}from"../../../../geometry/support/frustumPlanes.js";import{fromPoints as h,pointAt as g,create as _}from"../../../../geometry/support/lineSegment.js";import{create as v,fromPoints as y}from"../../../../geometry/support/ray.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{LaserlineVisualElement as x}from"./LaserlineVisualElement.js";import{drapedZ as S}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as C}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as w}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as T}from"../../webgl-engine/materials/RibbonLineMaterial.js";class E extends b{constructor(e){super(e),this._ray=v(),this._isWorldDown=!1,this._start=i(),this._end=a(1,0,0),this._width=1,this._color=c(1,0,1,1),this._polygonOffset=!1,this._writeDepthEnabled=!0,this._innerWidth=0,this._innerColor=c(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._stipplePreferContinuous=!0,this._falloff=0,this._extensionType=0,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=4,this._transparentRenderOrder=0,this._fadedExtensions=N,this._laserline=new x({view:this.view,isDecoration:e.isDecoration}),this.applyProperties(e)}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:D,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:D,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}updateVisibility(e){super.updateVisibility(e),this._laserline.visible=e}onAttachedChange(){this._laserline.attached=this._laserlineAttached}setStartEndFromWorldDownAtLocation(n){this._isWorldDown=!0,e(this._start,n),this.view.renderCoordsHelper.worldUpAtPosition(n,this._end),t(this._end,n,this._end),y(this._start,this._end,this._ray),this._updateGeometry()}get start(){return this._start}set start(t){this._isWorldDown=!1,n(this._start,t)||(e(this._start,t),y(this._start,this._end,this._ray),this._updateGeometry())}get end(){return this._end}set end(t){this._isWorldDown=!1,n(this._end,t)||(e(this._end,t),y(this._start,this._end,this._ray),this._updateGeometry())}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){o(e,this._color)||(s(this._color,e),this._updateMaterial())}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){e!==this._polygonOffset&&(this._polygonOffset=e,this._updateMaterial())}get writeDepthEnabled(){return this._writeDepthEnabled}set writeDepthEnabled(e){this._writeDepthEnabled!==e&&(this._writeDepthEnabled=e,this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){o(e,this._innerColor)||(s(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(e==null||this._stippleOffColor==null||!o(e,this._stippleOffColor))&&(this._stippleOffColor=e==null?null:l(e),this._updateMaterial())}get stipplePreferContinuous(){return this._stipplePreferContinuous}set stipplePreferContinuous(e){e!==this._stipplePreferContinuous&&(this._stipplePreferContinuous=e,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get extensionType(){return this._extensionType}set extensionType(e){e!==this._extensionType&&(this._extensionType=e,this.recreateGeometry())}get _laserlineAttached(){return this._laserlineEnabled&&this._laserlineStyle!=null&&this.attached&&!this.isDraped}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}get fadedExtensions(){return this._fadedExtensions}set fadedExtensions(e){this._fadedExtensions=e??N,this.recreateGeometry()}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:this._stipplePreferContinuous,innerWidth:this._innerWidth,innerColor:this._innerColor,falloff:this._falloff,polygonOffset:this._polygonOffset?3:0,renderOccluded:this._normalizedRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration,writeDepth:this._writeDepthEnabled}}_createObject3DResources(e){let t=new T(this.materialParameters,this.view),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let r=this._createGeometry(e);n.push(r),t.addGeometry(r),this._updateVerticesObject3D(t)}_createDrapedResources(){let e=new T(this.materialParameters,this.view);return{material:e,geometries:[this._createDrapedGeometry(e)]}}_recreateDrapedGeometry(e){e.geometries=[this._createDrapedGeometry(e.material)]}_createDrapedGeometry(e){let t=this._createGeometry(e);return this._updateVerticesDraped(t),new w(t)}_createGeometry(e){let t=this.extensionType===3,n=t?[i(),i(),i(),i()]:[i(),i()];return C(e,n,null,t?[1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0]:null)}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this._lineSegment;this._updateVertexAttributesObject3D(e,t),this._laserline.intersectsLine=t}_updateVerticesDraped(e){this._updateVertexAttributesDraped(e,this._lineSegment)}get _lineSegment(){return this._extensionType===3?this._updateLineSegmentFinite(j):this._updateLineSegmentInfinite(this._extensionType,j)}_updateLineSegmentFinite(e){return h(this._start,this._end,e)}_updateLineSegmentInfinite(e,t){let n=this.view.state.camera;switch(u(this._ray,O),e){case 0:O.c0=-Number.MAX_VALUE;break;case 1:case 2:{let e=this._ray.origin,t=this.view.elevationProvider.getElevation(e[0],e[1],e[2],this.view.renderCoordsHelper.spatialReference,`ground`)??0,n=this.view.renderCoordsHelper.getAltitude(e);this._isWorldDown&&n<t&&r(O.ray.direction,O.ray.direction),this._extensionType===2&&t!=null&&(O.c1=Math.abs(n-t));break}}if(!m(n.frustum,O))return this._updateLineSegmentFinite(t);let i=d(O,k),a=f(O,A);return h(i,a,t)}_updateVertexAttributesObject3D(e,t){let n=e.geometries[0].getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=e[2];e.geometryVertexAttributeUpdated(e.geometries[0],`position`)}_updateVertexAttributesDraped(e,t){let n=e.getMutableAttribute(`position`)?.data;if(!n)return;let r=0;for(let e of this._lineVertices(t))n[r++]=e[0],n[r++]=e[1],n[r++]=S;e.invalidateBoundingInfo()}*_lineVertices(e){this.extensionType===3?(yield g(e,-this.fadedExtensions.start,k),yield g(e,0,k),yield g(e,1,k),yield g(e,1+this.fadedExtensions.end,k)):(yield g(e,0,k),yield g(e,1,k))}}function D(e){e.geometries=[]}const O=p(),k=i(),A=i(),j=_(),M=1/3,N={start:M,end:M};export{E as ExtendedLineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as s}from"./Object3DVisualElement.js";import{lineStripsToParameters as c,createGeometry as l}from"../../support/engineContent/line.js";import{isImagePattern as u}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as d}from"../../webgl-engine/materials/RibbonLineMaterial.js";class f extends s{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=t!=null,this._material=t??new d({width:1,color:o(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,renderOccluded:4,isDecoration:!!e.isDecoration,writeDepth:!0},e.view.state.isGlobal),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){let n=a();this.view.renderCoordsHelper.toRenderCoords(e,n)&&this.setGeometryFromRenderSpacePoint(n,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){let t=this.view.spatialReference,r=a(),i=a(),o=[];n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[2],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[2],e[3],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[3],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),this.geometry=[o]}setGeometryFromFrustum(e){let t=[];e.lines.forEach(e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){let t=[],n=e.origin,r=e.basis1,i=e.basis2,o=.5,s=a(),c=a(),l=a(),u=a();s[0]=n[0]-r[0]*o-i[0]*o,s[1]=n[1]-r[1]*o-i[1]*o,s[2]=n[2]-r[2]*o-i[2]*o,c[0]=n[0]-r[0]*o+i[0]*o,c[1]=n[1]-r[1]*o+i[1]*o,c[2]=n[2]-r[2]*o+i[2]*o,l[0]=n[0]+r[0]*o+i[0]*o,l[1]=n[1]+r[1]*o+i[1]*o,l[2]=n[2]+r[2]*o+i[2]*o,u[0]=n[0]+r[0]*o-i[0]*o,u[1]=n[1]+r[1]*o-i[1]*o,u[2]=n[2]+r[2]*o-i[2]*o,t.push([s[0],s[1],s[2]]),t.push([c[0],c[1],c[2]]),t.push([l[0],l[1],l[2]]),t.push([u[0],u[1],u[2]]),t.push([s[0],s[1],s[2]]),this.geometry=[t]}setGeometryFromSegment(t){if(!t.visible){this.geometry=null;return}let n=t.endRenderSpace;this.transform=e(p,n);let{points:r}=t.createRenderGeometry(n,this.view.renderCoordsHelper);this.geometry=[r]}setGeometryFromSegments(t,n=i){this.transform=e(p,n),this.geometry=t.filter(({visible:e})=>e).map(e=>e.createRenderGeometry(n,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return this._geometry==null?null:this._geometry.map(e=>e.map(e=>r(a(),e,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get transparentRenderOrder(){return this._material.parameters.testsTransparentRenderOrder}set transparentRenderOrder(e){this._material.setParameters({testsTransparentRenderOrder:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){let t=e[3]===1;this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){let{stipplePattern:e}=this._material.parameters;return u(e)?null:e}set stipplePattern(e){this._material!=null&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.polygonOffset}set polygonOffset(e){this._material.setParameters({polygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(let t of c(this.geometry)){let n=l(this._material,t);e.addGeometry(n)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const p=t();export{f as LineVisualElement};
2
+ import{fromTranslation as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{Object3DVisualElement as s}from"./Object3DVisualElement.js";import{lineStripsToParameters as c,createGeometry as l}from"../../support/engineContent/line.js";import{isImagePattern as u}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as d}from"../../webgl-engine/materials/RibbonLineMaterial.js";class f extends s{constructor(e,t){super(e),this._hasExternalMaterial=!1,this._hasExternalMaterial=t!=null,this._material=t??new d({width:1,color:o(1,0,1,1),stipplePreferContinuous:!0,isClosed:!1,falloff:0,innerWidth:1,renderOccluded:4,isDecoration:!!e.isDecoration,writeDepth:!0},e.view),this.applyProperties(e)}setGeometryFromPoint(e,t=1e3){let n=a();this.view.renderCoordsHelper.toRenderCoords(e,n)&&this.setGeometryFromRenderSpacePoint(n,t)}setGeometryFromRenderSpacePoint(e,t=1e3){this.geometry=[[[e[0]-t,e[1],e[2]],[e[0]+t,e[1],e[2]]],[[e[0],e[1]-t,e[2]],[e[0],e[1]+t,e[2]]],[[e[0],e[1],e[2]-t],[e[0],e[1],e[2]+t]]]}setGeometryFromExtent(e){let t=this.view.spatialReference,r=a(),i=a(),o=[];n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[2],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[2],e[3],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[3],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),n(r,e[0],e[1],100),this.view.renderCoordsHelper.toRenderCoords(r,t,i),o.push([i[0],i[1],i[2]]),this.geometry=[o]}setGeometryFromFrustum(e){let t=[];e.lines.forEach(e=>{t.push([e.origin[0],e.origin[1],e.origin[2]]),t.push([e.endpoint[0],e.endpoint[1],e.endpoint[2]])}),this.geometry=[t]}setGeometryFromBoundedPlane(e){let t=[],n=e.origin,r=e.basis1,i=e.basis2,o=.5,s=a(),c=a(),l=a(),u=a();s[0]=n[0]-r[0]*o-i[0]*o,s[1]=n[1]-r[1]*o-i[1]*o,s[2]=n[2]-r[2]*o-i[2]*o,c[0]=n[0]-r[0]*o+i[0]*o,c[1]=n[1]-r[1]*o+i[1]*o,c[2]=n[2]-r[2]*o+i[2]*o,l[0]=n[0]+r[0]*o+i[0]*o,l[1]=n[1]+r[1]*o+i[1]*o,l[2]=n[2]+r[2]*o+i[2]*o,u[0]=n[0]+r[0]*o-i[0]*o,u[1]=n[1]+r[1]*o-i[1]*o,u[2]=n[2]+r[2]*o-i[2]*o,t.push([s[0],s[1],s[2]]),t.push([c[0],c[1],c[2]]),t.push([l[0],l[1],l[2]]),t.push([u[0],u[1],u[2]]),t.push([s[0],s[1],s[2]]),this.geometry=[t]}setGeometryFromSegment(t){if(!t.visible){this.geometry=null;return}let n=t.endRenderSpace;this.transform=e(p,n);let{points:r}=t.createRenderGeometry(n,this.view.renderCoordsHelper);this.geometry=[r]}setGeometryFromSegments(t,n=i){this.transform=e(p,n),this.geometry=t.filter(({visible:e})=>e).map(e=>e.createRenderGeometry(n,this.view.renderCoordsHelper).points)}getTransformedGeometry(){return this._geometry==null?null:this._geometry.map(e=>e.map(e=>r(a(),e,this.transform)))}get renderOccluded(){return this._material.parameters.renderOccluded}set renderOccluded(e){this._material.setParameters({renderOccluded:e})}get transparentRenderOrder(){return this._material.parameters.testsTransparentRenderOrder}set transparentRenderOrder(e){this._material.setParameters({testsTransparentRenderOrder:e})}get geometry(){return this._geometry}set geometry(e){this._geometry=e,this.recreateGeometry()}get width(){return this._material.parameters.width}set width(e){this._material.setParameters({width:e})}get color(){return this._material.parameters.color}set color(e){let t=e[3]===1;this._material.setParameters({color:e,writeDepth:t})}get innerWidth(){return this._material.parameters.innerWidth}set innerWidth(e){this._material.setParameters({innerWidth:e})}get innerColor(){return this._material.parameters.innerColor}set innerColor(e){this._material.setParameters({innerColor:e})}get stipplePattern(){let{stipplePattern:e}=this._material.parameters;return u(e)?null:e}set stipplePattern(e){this._material!=null&&this._material.setParameters({stipplePattern:e})}get stippleOffColor(){return this._material.parameters.stippleOffColor}set stippleOffColor(e){this._material.setParameters({stippleOffColor:e})}get stipplePreferContinuous(){return this._material.parameters.stipplePreferContinuous}set stipplePreferContinuous(e){this._material.setParameters({stipplePreferContinuous:e})}get falloff(){return this._material.parameters.falloff}set falloff(e){this._material.setParameters({falloff:e})}get polygonOffset(){return this._material.parameters.polygonOffset}set polygonOffset(e){this._material.setParameters({polygonOffset:e})}createExternalResources(){}destroyExternalResources(){}createGeometries(e){for(let t of c(this.geometry)){let n=l(this._material,t);e.addGeometry(n)}}forEachMaterial(e){this._hasExternalMaterial||e(this._material)}}const p=t();export{f as LineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{EventEmitter as e}from"../../../../core/Evented.js";import{set as t,add as n,scale as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as s,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as l}from"../../../../geometry/projection/projectBuffer.js";import{expandWithBuffer as u}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationMode as p}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as h}from"./EngineVisualElement.js";import{LaserlineVisualElement as g}from"./LaserlineVisualElement.js";import{ElevationContext as _}from"../../layers/graphics/ElevationContext.js";import{createGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as y,geometryToRenderInfo as b}from"../../support/renderInfoUtils/line.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";class C extends h{constructor(t){super(t),this._attachmentOrigin=f(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=s(1,0,1,1),this._innerWidth=0,this._innerColor=s(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=8,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new g({view:t.view,isDecoration:t.isDecoration}),this.applyProperties(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:w,recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)},forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:w,recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()},forEachMaterial:(e,t)=>t(e.material)}}get _laserlineAttached(){return this.attached&&this.visible&&this._laserlineStyle!=null&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}get geometry(){return this._geometry}set geometry(e){let t=this._isClosed;this._geometry=e,this.recreateGeometry(),t!==this._isClosed&&this._updateMaterial()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){a(e,this._color)||(o(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){a(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(!e||!this._stippleOffColor||!a(e,this._stippleOffColor))&&(this._stippleOffColor=e?c(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;let e=this.object3dResources.resources?.geometries;if(!e||e.length===0)return null;t(E,0,0,0);let i=0;for(let t of e)t.computeAttachmentOrigin(T)&&(n(E,E,T),i++);return i===0?null:(r(E,E,1/i),this.view.renderCoordsHelper.fromRenderCoords(E,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){this.object3dResources.resources?.material.setParameters(this._materialParameters),this.drapedResources.resources?.material.setParameters(this._materialParameters)}get _isClosed(){return this.geometry!=null&&this.geometry.type===`polygon`}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:`round`,polygonOffset:3,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}_recreateGeometry(e,t,n){this._createRenderGeometries(t,n);for(let t of n)e.addGeometry(t);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit(`attachment-origin-changed`)}_createObject3DResources(e){let t=new S(this._materialParameters,this.view.state.isGlobal),n=[];return this._recreateGeometry(e,t,n),{material:t,geometries:n}}_createDrapedResources(){let e=new S(this._materialParameters,this.view.state.isGlobal);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){let{geometry:t,view:n}=this,r=n.groundView.spatialReference;return t==null||r==null?[]:y(t,r).lines.map(({position:t})=>{let i={overlayInfo:{spatialReference:r,renderCoordsHelper:n.renderCoordsHelper},attributeData:{position:t},removeDuplicateStartEnd:this._isClosed};return new x(v(e,i))})}calculateMapBounds(e){if(this.object3dResources.resources==null)return!1;let t=this.view.renderCoordsHelper;for(let n of this.object3dResources.resources.geometries){let r=n.attributes.get(`position`),i=d(r.data.length);l(r.data,t.spatialReference,0,i,this.view.spatialReference,0),u(e,i)}return!0}_createRenderGeometries(e,t){let n=this.geometry;if(n==null)return;let r=b(n,this.view.elevationProvider,this.view.renderCoordsHelper,_.fromElevationInfo(this.elevationInfo??new m({mode:p(n,null)}))),i=[];for(let{position:n,mapPositions:a}of r.lines){let r={mapPositions:a,attributeData:{position:n},removeDuplicateStartEnd:this._isClosed};t.push(v(e,r)),i.push(n)}this._laserline.pathVerticalPlane=i}}function w(e){e.geometries=[]}const T=i(),E=i();export{C as OutlineVisualElement};
2
+ import{EventEmitter as e}from"../../../../core/Evented.js";import{set as t,add as n,scale as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as a,copy as o}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as s,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as l}from"../../../../geometry/projection/projectBuffer.js";import{expandWithBuffer as u}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as d}from"../../../../geometry/support/DoubleArray.js";import{makeDehydratedPoint as f}from"../../../../layers/graphics/dehydratedPoint.js";import{getGeometryEffectiveElevationMode as p}from"../../../../support/elevationInfoUtils.js";import m from"../../../../symbols/support/ElevationInfo.js";import{EngineVisualElement as h}from"./EngineVisualElement.js";import{LaserlineVisualElement as g}from"./LaserlineVisualElement.js";import{ElevationContext as _}from"../../layers/graphics/ElevationContext.js";import{createGeometry as v}from"../../support/engineContent/line.js";import{geometryToRenderInfoDraped as y,geometryToRenderInfo as b}from"../../support/renderInfoUtils/line.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as S}from"../../webgl-engine/materials/RibbonLineMaterial.js";class C extends h{constructor(t){super(t),this._attachmentOrigin=f(0,0,0,null),this._attachmentOriginDirty=!0,this.events=new e,this._geometry=null,this._width=1,this._color=s(1,0,1,1),this._innerWidth=0,this._innerColor=s(1,1,1,1),this._stipplePattern=null,this._stippleOffColor=null,this._falloff=0,this._elevationInfo=null,this._laserlineStyle=null,this._laserlineEnabled=!1,this._renderOccluded=8,this._attachmentOrigin.spatialReference=t.view.spatialReference,this._laserline=new g({view:t.view,isDecoration:t.isDecoration}),this.applyProperties(t),this.attached=t.attached??!0}destroy(){this._laserline.destroy(),super.destroy()}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:w,recreateGeometry:(e,t)=>{e.geometries.length=0,this._recreateGeometry(t,e.material,e.geometries)},forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:w,recreateGeometry:e=>{e.geometries=this._createRenderGeometriesDraped(e.material),this._attachmentOriginChanged()},forEachMaterial:(e,t)=>t(e.material)}}get _laserlineAttached(){return this.attached&&this.visible&&this._laserlineStyle!=null&&!this.isDraped&&this.laserlineEnabled}onAttachedChange(e){this._laserline.attached=this._laserlineAttached,e&&this._attachmentOriginChanged()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}get geometry(){return this._geometry}set geometry(e){let t=this._isClosed;this._geometry=e,this.recreateGeometry(),t!==this._isClosed&&this._updateMaterial()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get color(){return this._color}set color(e){a(e,this._color)||(o(this._color,e),this._updateMaterial())}get innerWidth(){return this._innerWidth}set innerWidth(e){e!==this._innerWidth&&(this._innerWidth=e,this._updateMaterial())}get innerColor(){return this._innerColor}set innerColor(e){a(e,this._innerColor)||(o(this._innerColor,e),this._updateMaterial())}get stipplePattern(){return this._stipplePattern}set stipplePattern(e){let t=e!=null!=(this._stipplePattern!=null);this._stipplePattern=e,t?this.recreate():this._updateMaterial()}get stippleOffColor(){return this._stippleOffColor}set stippleOffColor(e){(!e||!this._stippleOffColor||!a(e,this._stippleOffColor))&&(this._stippleOffColor=e?c(e):null,this._updateMaterial())}get falloff(){return this._falloff}set falloff(e){e!==this._falloff&&(this._falloff=e,this._updateMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get laserlineStyle(){return this._laserlineStyle}set laserlineStyle(e){this._laserlineStyle=e,this._laserline.attached=this._laserlineAttached,e!=null&&(this._laserline.style=e)}get laserlineEnabled(){return this._laserlineEnabled}set laserlineEnabled(e){this._laserlineEnabled!==e&&(this._laserlineEnabled=e,this._laserline.attached=this._laserlineAttached)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get attachmentOrigin(){if(!this._attachmentOriginDirty)return this._attachmentOrigin;let e=this.object3dResources.resources?.geometries;if(!e||e.length===0)return null;t(E,0,0,0);let i=0;for(let t of e)t.computeAttachmentOrigin(T)&&(n(E,E,T),i++);return i===0?null:(r(E,E,1/i),this.view.renderCoordsHelper.fromRenderCoords(E,this._attachmentOrigin),this._attachmentOriginDirty=!1,this._attachmentOrigin)}_updateMaterial(){this.object3dResources.resources?.material.setParameters(this._materialParameters),this.drapedResources.resources?.material.setParameters(this._materialParameters)}get _isClosed(){return this.geometry!=null&&this.geometry.type===`polygon`}get _materialParameters(){return{width:this._width,color:this._color,stippleOffColor:this._stippleOffColor,stipplePattern:this._stipplePattern,stipplePreferContinuous:!1,isClosed:this._isClosed,falloff:this._falloff,innerColor:this._innerColor,innerWidth:this._innerWidth,join:`round`,polygonOffset:3,renderOccluded:this._normalizedRenderOccluded,isDecoration:this.isDecoration}}get _normalizedRenderOccluded(){return this.isDraped&&this._renderOccluded===8?4:this._renderOccluded}_recreateGeometry(e,t,n){this._createRenderGeometries(t,n);for(let t of n)e.addGeometry(t);this._attachmentOriginChanged()}_attachmentOriginChanged(){this._attachmentOriginDirty=!0,this.events.emit(`attachment-origin-changed`)}_createObject3DResources(e){let t=new S(this._materialParameters,this.view),n=[];return this._recreateGeometry(e,t,n),{material:t,geometries:n}}_createDrapedResources(){let e=new S(this._materialParameters,this.view);return{material:e,geometries:this._createRenderGeometriesDraped(e)}}_createRenderGeometriesDraped(e){let{geometry:t,view:n}=this,r=n.groundView.spatialReference;return t==null||r==null?[]:y(t,r).lines.map(({position:t})=>{let i={overlayInfo:{spatialReference:r,renderCoordsHelper:n.renderCoordsHelper},attributeData:{position:t},removeDuplicateStartEnd:this._isClosed};return new x(v(e,i))})}calculateMapBounds(e){if(this.object3dResources.resources==null)return!1;let t=this.view.renderCoordsHelper;for(let n of this.object3dResources.resources.geometries){let r=n.attributes.get(`position`),i=d(r.data.length);l(r.data,t.spatialReference,0,i,this.view.spatialReference,0),u(e,i)}return!0}_createRenderGeometries(e,t){let n=this.geometry;if(n==null)return;let r=b(n,this.view.elevationProvider,this.view.renderCoordsHelper,_.fromElevationInfo(this.elevationInfo??new m({mode:p(n,null)}))),i=[];for(let{position:n,mapPositions:a}of r.lines){let r={mapPositions:a,attributeData:{position:n},removeDuplicateStartEnd:this._isClosed};t.push(v(e,r)),i.push(n)}this._laserline.pathVerticalPlane=i}}function w(e){e.geometries=[]}const T=i(),E=i();export{C as OutlineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{normalize as r,subtract as i,scale as a,set as o,add as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,copy as u,normalize as d,subtract as f,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as g,copy as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{drapedZ as x}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as S}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class T extends b{constructor(e){super(e),this._location=m(),this._direction=h(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=v(1,0,1,1),this._renderOccluded=4,this._transparentRenderOrder=0,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:O,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:k,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){l(this._location,e)||(u(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(u(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){d(this._direction,f(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(_(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){let t=new w(this.materialParameters,this.view.state.isGlobal),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let[r,i]=E(e);t.addGeometry(r),t.addGeometry(i),n.push(r),n.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){let t=new w(this.materialParameters,this.view.state.isGlobal),n=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:n}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){let t=E(e);return this._updateVerticesDraped(t),t.map(e=>new C(e))}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this.view.state.camera;t.projectToScreen(this.location,P),p(A,this.location,this.direction),t.projectToScreen(A,F),r(F,i(F,F,P)),this._updateVertexAttributesObject3D(t,e,0,P,F,1),this._updateVertexAttributesObject3D(t,e,1,P,F,-1)}_updateVertexAttributesObject3D(e,n,r,i,a,o){let s=n.geometries[r],c=s.getMutableAttribute(`position`)?.data;if(!c)return;let{start:l,end:u}=D(a,i,o,this.offset,this.width,this.length);e.unprojectFromScreen(t(l),A),c[0]=A[0],c[1]=A[1],c[2]=A[2],e.unprojectFromScreen(t(u),A),c[3]=A[0],c[4]=A[1],c[5]=A[2],n.geometryVertexAttributeUpdated(s,`position`)}_updateVerticesDraped(e){let{view:{overlayManager:t,state:{contentPixelRatio:n}}}=this,{location:r,width:i,length:a,offset:o}=this,s=I;s.spatialReference=t.spatialReference,s.x=r[0],s.y=r[1];let c=this.view.overlayPixelSizeInMapUnits(s)*n,l=i*c,u=a*c,d=o*c;this._updateVertexAttributesDraped(e[0],l,u,d,-1),this._updateVertexAttributesDraped(e[1],l,u,d,1)}_updateVertexAttributesDraped(e,t,n,r,i){let a=e.getMutableAttribute(`position`)?.data;if(!a)return;let{location:o,direction:s}=this,{start:c,end:l}=D(s,o,i,r,t,n);a[0]=c[0],a[1]=c[1],a[2]=x,a[3]=l[0],a[4]=l[1],a[5]=x,e.invalidateBoundingInfo()}}function E(e){return[S(e,[m(),m()]),S(e,[m(),m()])]}function D(e,t,n,r,i,c){let l=a(j,o(j,e[1]*n,e[0]*-n),r+i/2),u=s(M,s(M,s(M,t,a(M,e,c/2)),l),l);return{start:u,end:s(N,u,a(N,e,-c))}}function O(e){e.geometries.length=0}function k(e){e.pixelRatioHandle.remove(),e.geometries=[]}const A=m(),j=c(),M=c(),N=c(),P=n(),F=n(),I=y(0,0,void 0,null);export{T as ParallelLineVisualElement};
2
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{castScreenPointArray as t,createScreenPointArray as n}from"../../../../core/screenUtils.js";import{normalize as r,subtract as i,scale as a,set as o,add as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as l,copy as u,normalize as d,subtract as f,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as m,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as g,copy as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeDehydratedPoint as y}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as b}from"./EngineVisualElement.js";import{drapedZ as x}from"../../terrain/DrapedZ.js";import{createPolylineGeometry as S}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as C}from"../../webgl-engine/lib/RenderGeometry.js";import{RibbonLineMaterial as w}from"../../webgl-engine/materials/RibbonLineMaterial.js";class T extends b{constructor(e){super(e),this._location=m(),this._direction=h(1,0,0),this._width=1,this._offset=1,this._length=18,this._color=v(1,0,1,1),this._renderOccluded=4,this._transparentRenderOrder=0,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:O,recreateGeometry:(e,t)=>this._recreateObject3DGeometry(e,t),cameraChanged:()=>this._updateGeometry(),forEachMaterial:(e,t)=>t(e.material)}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:k,recreateGeometry:e=>this._recreateDrapedGeometry(e),forEachMaterial:(e,t)=>t(e.material)}}get location(){return this._location}set location(e){l(this._location,e)||(u(this._location,e),this._updateGeometry())}get direction(){return this._direction}set direction(e){l(this._direction,e)||(u(this._direction,e),this._updateGeometry())}setDirectionFromPoints(e,t){d(this._direction,f(this._direction,t,e)),this._updateGeometry()}get width(){return this._width}set width(e){e!==this._width&&(this._width=e,this._updateMaterial())}get offset(){return this._offset}set offset(e){e!==this._offset&&(this._offset=e,this._updateGeometry())}get length(){return this._length}set length(e){e!==this._length&&(this._length=e,this._updateGeometry())}get color(){return this._color}set color(e){g(e,this._color)||(_(this._color,e),this._updateMaterial())}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){e!==this._transparentRenderOrder&&(this._transparentRenderOrder=e,this._updateMaterial())}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateMaterial()}_createObject3DResources(e){let t=new w(this.materialParameters,this.view),n=[];return this._createObject3DGeometry(t,e,n),{material:t,geometries:n}}_recreateObject3DGeometry(e,t){e.geometries.length=0,this._createObject3DGeometry(e.material,t,e.geometries)}_createObject3DGeometry(e,t,n){let[r,i]=E(e);t.addGeometry(r),t.addGeometry(i),n.push(r),n.push(i),this._updateVerticesObject3D(t)}_createDrapedResources(){let t=new w(this.materialParameters,this.view),n=e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry());return{material:t,geometries:this._createDrapedGeometry(t),pixelRatioHandle:n}}_recreateDrapedGeometry(e){e.geometries=this._createDrapedGeometry(e.material)}_createDrapedGeometry(e){let t=E(e);return this._updateVerticesDraped(t),t.map(e=>new C(e))}_updateMaterial(){let{materialParameters:e}=this;this.object3dResources.resources?.material.setParameters(e),this.drapedResources.resources?.material.setParameters(e)}get materialParameters(){return{width:this._width,color:this._color,renderOccluded:this._renderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateGeometry(){if(this.isDraped)this.drapedResources.recreateGeometry();else{let e=this.object3dResources.object;e&&this._updateVerticesObject3D(e)}}_updateVerticesObject3D(e){let t=this.view.state.camera;t.projectToScreen(this.location,P),p(A,this.location,this.direction),t.projectToScreen(A,F),r(F,i(F,F,P)),this._updateVertexAttributesObject3D(t,e,0,P,F,1),this._updateVertexAttributesObject3D(t,e,1,P,F,-1)}_updateVertexAttributesObject3D(e,n,r,i,a,o){let s=n.geometries[r],c=s.getMutableAttribute(`position`)?.data;if(!c)return;let{start:l,end:u}=D(a,i,o,this.offset,this.width,this.length);e.unprojectFromScreen(t(l),A),c[0]=A[0],c[1]=A[1],c[2]=A[2],e.unprojectFromScreen(t(u),A),c[3]=A[0],c[4]=A[1],c[5]=A[2],n.geometryVertexAttributeUpdated(s,`position`)}_updateVerticesDraped(e){let{view:{overlayManager:t,state:{contentPixelRatio:n}}}=this,{location:r,width:i,length:a,offset:o}=this,s=I;s.spatialReference=t.spatialReference,s.x=r[0],s.y=r[1];let c=this.view.overlayPixelSizeInMapUnits(s)*n,l=i*c,u=a*c,d=o*c;this._updateVertexAttributesDraped(e[0],l,u,d,-1),this._updateVertexAttributesDraped(e[1],l,u,d,1)}_updateVertexAttributesDraped(e,t,n,r,i){let a=e.getMutableAttribute(`position`)?.data;if(!a)return;let{location:o,direction:s}=this,{start:c,end:l}=D(s,o,i,r,t,n);a[0]=c[0],a[1]=c[1],a[2]=x,a[3]=l[0],a[4]=l[1],a[5]=x,e.invalidateBoundingInfo()}}function E(e){return[S(e,[m(),m()]),S(e,[m(),m()])]}function D(e,t,n,r,i,c){let l=a(j,o(j,e[1]*n,e[0]*-n),r+i/2),u=s(M,s(M,s(M,t,a(M,e,c/2)),l),l);return{start:u,end:s(N,u,a(N,e,-c))}}function O(e){e.geometries.length=0}function k(e){e.pixelRatioHandle.remove(),e.geometries=[]}const A=m(),j=c(),M=c(),N=c(),P=n(),F=n(),I=y(0,0,void 0,null);export{T as ParallelLineVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i,normalize as a,subtract as o,copy as s,exactEquals as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as f}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as h}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as _}from"../../terrain/DrapedZ.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as b}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as S}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as C}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=p(1,0,0,1),this._outlineColor=p(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:T,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){f(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){f(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){let t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:n}){this._maxSize=Math.min(i(t,e),i(t,n))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,n,t)),s(this._position,t),this.recreateGeometry()}_createObject3DResources(e){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal);return this._createObject3DGeometries(e,t,n),{quadMaterial:t,outlineMaterial:n}}_createObject3DGeometries(e,t,n){if(c(this._up,d)&&c(this._right,d))return;let r=this._createGeometries(t,n);for(let t of r)e.addGeometry(t);this._updateTransformObject3D(e)}_createDrapedResources(){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view.state.isGlobal),r=this._createGeometries(t,n).map(e=>new x(e));return this._setTransformDraped(r),{quadMaterial:t,outlineMaterial:n,geometries:r,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){let{up:n,right:r,corner:i}=this._getVertices(),a=E(n,r,i,e);return t?[a,b(t,[n,i,r])]:[a]}_getVertices(){let e=this._up,t=this._right,n=l(m.get(),e,t);return this.isDraped&&(e=s(m.get(),e),t=s(m.get(),t),e[2]=0,t[2]=0,n[2]=0),{up:e,right:t,corner:n}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;let r=this.view.state.camera,i=this._size*r.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);t(D,this._position),n(D,D,[a,a,a]),e.transformation=D}_setTransformDraped(e){if(e.length===0)return;let{view:{overlayManager:r,state:{contentPixelRatio:i}}}=this,{_position:a,_size:o}=this,c=s(m.get(),a);c[2]=_;let l=O;l.spatialReference=r.spatialReference,l.x=c[0],l.y=c[1];let u=o*(this.view.overlayPixelSizeInMapUnits(l)*i),d=Math.min(this._maxSize,u);t(D,c),n(D,D,[d,d,1]);for(let t of e)t.transformation=D}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function T(e){e.pixelRatioHandle.remove(),e.geometries=[]}function E(e,t,n,r){return new y(r,[[`position`,new v([0,0,0,...t,...e,...n],[0,1,2,1,2,3],3,!0)]])}const D=r(),O=h(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
2
+ import{watch as e}from"../../../../core/reactiveUtils.js";import{fromTranslation as t,scale as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{distance as i,normalize as a,subtract as o,copy as s,exactEquals as c,add as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u,ZEROS as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as f}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as h}from"../../../../layers/graphics/dehydratedPoint.js";import{EngineVisualElement as g}from"./EngineVisualElement.js";import{drapedZ as _}from"../../terrain/DrapedZ.js";import{Attribute as v}from"../../webgl-engine/lib/Attribute.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as b}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderGeometry as x}from"../../webgl-engine/lib/RenderGeometry.js";import{ColorMaterial as S}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as C}from"../../webgl-engine/materials/RibbonLineMaterial.js";class w extends g{constructor(e){super(e),this._maxSize=0,this._position=u(),this._up=u(),this._right=u(),this._renderOccluded=4,this._color=p(1,0,0,1),this._outlineColor=p(0,0,0,1),this._outlineSize=0,this._size=32,this._outlineRenderOccluded=16,this.applyProperties(e)}createObject3DResourceFactory(e){return{view:e,createResources:e=>this._createObject3DResources(e),destroyResources:()=>{},cameraChanged:()=>this._updateTransformObject3D(),forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}createDrapedResourceFactory(e){return{view:e,createResources:()=>this._createDrapedResources(),destroyResources:T,forEachMaterial:(e,t)=>{t(e.outlineMaterial),t(e.quadMaterial)}}}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateQuadMaterial())}get transparentRenderOrder(){return this._transparentRenderOrder}set transparentRenderOrder(e){this._transparentRenderOrder=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get isDecoration(){return this._isDecoration}set isDecoration(e){this._isDecoration=e,this._updateOutlineMaterial(),this._updateQuadMaterial()}get color(){return this._color}set color(e){f(this._color,e),this._updateQuadMaterial()}get outlineColor(){return this._outlineColor}set outlineColor(e){f(this._outlineColor,e),this._updateOutlineMaterial()}get outlineSize(){return this._outlineSize}set outlineSize(e){let t=this._outlineSize===0!=(e===0);this._outlineSize=e,t?this.recreateGeometry():this._updateOutlineMaterial()}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateTransform())}get outlineRenderOccluded(){return this._outlineRenderOccluded}set outlineRenderOccluded(e){this._outlineRenderOccluded=e,this._updateOutlineMaterial()}set geometry({previous:e,center:t,next:n}){this._maxSize=Math.min(i(t,e),i(t,n))/3,a(this._up,o(this._up,e,t)),a(this._right,o(this._right,n,t)),s(this._position,t),this.recreateGeometry()}_createObject3DResources(e){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view);return this._createObject3DGeometries(e,t,n),{quadMaterial:t,outlineMaterial:n}}_createObject3DGeometries(e,t,n){if(c(this._up,d)&&c(this._right,d))return;let r=this._createGeometries(t,n);for(let t of r)e.addGeometry(t);this._updateTransformObject3D(e)}_createDrapedResources(){let t=new S(this._quadMaterialParameters),n=this._outlineSize===0?void 0:new C(this._outlineMaterialParameters,this.view),r=this._createGeometries(t,n).map(e=>new x(e));return this._setTransformDraped(r),{quadMaterial:t,outlineMaterial:n,geometries:r,pixelRatioHandle:e(()=>this.view.state.contentPixelRatio,()=>this.drapedResources.recreateGeometry())}}_createGeometries(e,t){let{up:n,right:r,corner:i}=this._getVertices(),a=E(n,r,i,e);return t?[a,b(t,[n,i,r])]:[a]}_getVertices(){let e=this._up,t=this._right,n=l(m.get(),e,t);return this.isDraped&&(e=s(m.get(),e),t=s(m.get(),t),e[2]=0,t[2]=0,n[2]=0),{up:e,right:t,corner:n}}_updateTransform(){this.isDraped?this.drapedResources.recreateGeometry():this._updateTransformObject3D()}_updateTransformObject3D(e=this.object3dResources.object){if(!e)return;let r=this.view.state.camera,i=this._size*r.computeScreenPixelSizeAt(this._position),a=Math.min(this._maxSize,i);t(D,this._position),n(D,D,[a,a,a]),e.transformation=D}_setTransformDraped(e){if(e.length===0)return;let{view:{overlayManager:r,state:{contentPixelRatio:i}}}=this,{_position:a,_size:o}=this,c=s(m.get(),a);c[2]=_;let l=O;l.spatialReference=r.spatialReference,l.x=c[0],l.y=c[1];let u=o*(this.view.overlayPixelSizeInMapUnits(l)*i),d=Math.min(this._maxSize,u);t(D,c),n(D,D,[d,d,1]);for(let t of e)t.transformation=D}get _quadMaterialParameters(){return{color:this._color,forceTransparentMode:!0,writeDepth:!1,polygonOffset:1,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration,testsTransparentRenderOrder:this._transparentRenderOrder}}_updateQuadMaterial(){this.object3dResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters),this.drapedResources.resources?.quadMaterial.setParameters(this._quadMaterialParameters)}get _outlineMaterialParameters(){return{color:this._outlineColor,width:this._outlineSize,renderOccluded:this._outlineRenderOccluded,testsTransparentRenderOrder:this._transparentRenderOrder,isDecoration:this.isDecoration}}_updateOutlineMaterial(){this.object3dResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters),this.drapedResources.resources?.outlineMaterial?.setParameters(this._outlineMaterialParameters)}}function T(e){e.pixelRatioHandle.remove(),e.geometries=[]}function E(e,t,n,r){return new y(r,[[`position`,new v([0,0,0,...t,...e,...n],[0,1,2,1,2,3],3,!0)]])}const D=r(),O=h(0,0,void 0,null);export{w as RightAngleQuadVisualElement};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as n,abortMaybe as r}from"../../../core/maybe.js";import{debounce as i,throwIfAborted as a,ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c,when as l,whenOnce as ee}from"../../../core/reactiveUtils.js";import{addFrameTask as u}from"../../../core/scheduling.js";import{signal as d}from"../../../core/signal.js";import{Seconds as f,secondsFromMilliseconds as te}from"../../../core/time.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{projectOrLoad as h}from"../../../geometry/projectionUtils.js";import ne from"../../../geometry/SpatialReference.js";import{toExtent as g,fromExtent as _,intersection as re,create as ie,intersects as v}from"../../../geometry/support/aaBoundingRect.js";import{isInEffectiveScaleRange as y}from"../../../geometry/support/scaleUtils.js";import{getInfo as b}from"../../../geometry/support/spatialReferenceUtils.js";import x from"../../../symbols/support/ElevationInfo.js";import S from"./SubView3D.js";import{getFeatureTileId as C}from"./support/FeatureTileDescriptor.js";import{makeScheduleFunction as w}from"./support/makeScheduleFunction.js";import{debugFlags as T}from"../support/debugFlags.js";import{tileFilterDistance as E,scaleThresholdForLoadingAllTiles as D,defaultTransitionDuration as O,transitionDurationFactor as k,seamlessTransitionEnabled as A,densityFactor as j,loadAllTilesDensityFactor as M,averageLoadingTimeSmoothingFactor as N,fadeOutTime as P,fadeInTime as F,minimumTracingResolution as I}from"../support/flow/constants.js";import{isFullExtent as L,wrappedWidth as ae,FlowQuery3D as R}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as z}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as B,createStreamlineGeometry as V}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as H}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as U}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as W}from"../support/flow/StreamlineResources3DShape.js";import{webMercatorWorldExtent as G}from"../terrain/TerrainConst.js";import{descendantsAtLevel as K,tilesAreRelated as q}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as oe}from"../webgl-engine/materials/RibbonLineMaterial.js";import{hasLayerBasedScaleVisibility as se}from"../../support/layerViewUtils.js";import{TaskPriority as ce}from"../../support/Scheduler.js";import{simulationSettingsEqual as le,getPositions as ue,getFlowSimulationSettings as Y}from"../../support/flow/utils.js";let X=class extends S{constructor(e){super(e),this.type=`flow`,this.renderedTiles=null,this.tilesIntersectDataBounds=!0,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=f(0),this._abortController=null,this._loadingState=`ready-to-load`,this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=d(!0),this.emissiveStrength=0,this._materialParametersOverridde=null,this._suspendedOverride=null,this._simulationSettingsOverride=null,this._seamlessTransitionEnabledOverride=null,this._updateTask=null,this._debouncedTileUpdate=i(async e=>{let{allTiles:t}=this.surface,n=this._getTileFilterFunction(),{_dataBounds:r}=this,i=new Set,o=!1;function*s(e){for(let a=0;a<t.length;++a){let s=t.at(a),c=Z(r,s.extent);n(s)&&c&&(i.add(s),o=!0),e.madeProgress(),e.done&&(e=yield)}}await this.frameTask.scheduleGenerator(s,e.signal),a(e.signal),this.tilesIntersectDataBounds=t.length===0||this.loadAllTiles?!0:o,this.renderedTiles=i})}initialize(){let{surface:e,view:t}=this,{resourceController:n}=t;this.workerHandle=new z(w(n)),this.frameTask=n.scheduler.registerTask(ce.FLOW_GENERATOR),this._updateTask=u({update:()=>this._update()}),this.addHandles([s(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>e==null&&t==null||e!=null&&t!=null&&le(e,t)}),this.updatingHandles.add(()=>this.suspended,e=>{e?this._suspend():this._resume()},c),s(()=>{let{elevationInfo:e}=this;return[this._clippingArea,this.visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit,this._effectiveDensity]},()=>this.triggerLoad(),c),l(()=>!this._animationsEnabled,()=>{let{_resources:e,_lastResources:t}=this;e!=null&&(e.startTime=Q),t!=null&&(t.startTime=Q)},c),s(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),l(()=>e.allTilesCreated,()=>this._triggerTilesUpdate(),c),t.enableFeatureTiles(),s(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),s(()=>this._flowRenderer,(e,t)=>{let n=t?.visualVariables??[],r=e?.visualVariables??[];r.length===n.length&&r.every((e,t)=>e.type===n[t].type)||this.clear()}),l(()=>!t.featureTiles?.updating,()=>{this._triggerTilesUpdate()})]),this.suspended&&this._suspend(),this._triggerTilesUpdate()}destroy(){this._updateTask=n(this._updateTask),this.abort(),this.clear(),this.notifyChange(`updating`)}abort(){this._abortController=r(this._abortController),this._tilesUpdateIsWaiting=!1,this.requireLoad=!1}_ensureAbortController(){return this._abortController??=new AbortController,this._abortController}_resume(){this._updateTask.resume(),this._triggerTilesUpdate(),this.triggerLoad()}_suspend(){this._updateTask.pause(),this.abort(),this.clear()}get _animationsEnabled(){return this.view.state.animationsEnabled}get _clippingArea(){let e=h(this.view.clippingArea,this.surface.spatialReference).geometry;return e==null?null:_(e)}get _dataBounds(){let e=this._fullExtentSurfaceSpatialReference;return e==null?null:_(e)}get suspended(){return this._suspendedOverride==null?this.layerView.suspended||this.view.groundView.hasTerrainReplacement:this._suspendedOverride}get _fullExtentSurfaceSpatialReference(){return h(this.layer.fullExtent,this.surface.spatialReference).geometry}get _draped(){return this.elevationInfo.mode===`on-the-ground`}get extent(){if(this.loadAllTiles)return $(this._fullExtentSurfaceSpatialReference);let{spatialReference:e}=this.surface,t=this.renderedTiles;if(e==null||t==null)return null;let n=this.view.terrainLevel;if(n!=null){let e=new Set;t.forEach(t=>{Math.abs(n-t.level)<E&&e.add(t)}),t=e}let r=H(t,this.spatialReferenceInfo);return r==null?null:(re(r,this._clippingArea,r),$(g(r,e)))}get loadAllTiles(){return this.view.scale>(T.FLOW_GLOBAL_SCALE_THRESHOLD??D)}get isDataGlobal(){let{extent:e,spatialReferenceInfo:t}=this;return e!=null&&L(e.xmin,e.xmax,t)}get loadAllTilesLevel(){let{tilingScheme:e}=this.surface;return Math.min(Math.ceil(e.levelAtScale(T.FLOW_GLOBAL_SCALE_THRESHOLD??D)),e.getMaxLod())}get targetTiles(){let e=new Map;if(this.loadAllTiles){let{_dataBounds:t}=this;if(t==null)return e;let n=ie(),r=this.loadAllTilesLevel,i=this.surface.tilingScheme,a=i.rootTilesInExtent(t).values().flatMap(e=>K(e,r));for(let o of a){let[a,s,c]=o;i.getExtent(r,s,c,n),Z(t,n)&&e.set(C(r,s,c),o)}return e}let{renderedTiles:t}=this;for(let n of t??[])e.set(n.key,n.lij);return e}get _featureTilesBounds(){let e=this.view.featureTiles?.filterExtent,t=h(e,this.surface.spatialReference).geometry;return t==null?null:_(t)}get _flowRenderer(){let e=this.layer.renderer;return e?.type===`flow`?e:null}get _materialParameters(){return{...B(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._materialParametersOverridde,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&`screenSizePerspectiveEnabled`in this.layer&&J(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){let{_averageLoadingTime:e}=this;return f(e===0?O:this._averageLoadingTime*k)}get _transitionEnabled(){return this.view.qualitySettings.flow.transitionEnabled}get _seamlessTransitionEnabled(){return this._transitionEnabled?this._seamlessTransitionEnabledOverride==null?A:this._seamlessTransitionEnabledOverride:!1}get _tracingResolution(){let{extent:e}=this;if(!e)return[0,0];let t=ae(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[n,r]=this.view.size,i,a;n<r?(i=n,a=n/t):(i=r*t,a=r);let o=I,s=this.view.qualitySettings.flow.maxTracingResolution,c=Math.max(1,o/Math.min(i,a)),l=c*Math.min(1,s/Math.max(i*c,a*c));return[Math.round(i*l),Math.round(a*l)]}get visible(){let e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(e==null||e.a>0)}get _effectiveDensity(){let{_simulationSettings:e}=this;if(e==null)return 0;let t=e.density*this.view.quality;return e.lineSpacing/Math.sqrt(t)<e.lineCollisionWidth?(e.lineSpacing/e.lineCollisionWidth)**2:t}get elevationInfo(){return(`elevationInfo`in this.layer?this.layer.elevationInfo:void 0)??fe}startPositions(e){if(!this._seamlessTransitionEnabled)return[];let{_flowRenderer:t,_resources:n}=this;return t==null||n==null?[]:ue(n.streamlines,n.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return b(this.surface.spatialReference)}get loadingState(){return this._loadingState}get loadRequirementsMet(){return this.renderedTiles!=null&&(this.renderedTiles.size>0||this.loadAllTiles)&&this.extent!=null}hasWork(){return this.updatingHandles.updating||this.requireLoad||this._loadingState===`before-transition`}get updating(){return this._debugAllowAutoLoading.value&&this.visible&&!(this.destroyed||this.destroying)&&this.hasWork()}get visibleAtCurrentScale(){return!se()||y(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){let{_flowRenderer:e,_simulationSettingsOverride:t}=this;if(e==null)return null;let n=Y(e);return n.segmentLength=n.lineCollisionWidth/2,n.onlyForwardTracing=!1,n.maxNumberOfStreamlines=this.view.qualitySettings.flow.maxTotalNumberOfStreamlines,n.density*=j,this.loadAllTiles&&this.isDataGlobal&&(n.density*=M),t!=null&&(n={...n,...t}),n}getSimulationSettings(e){let{_simulationSettings:t,spatialReferenceInfo:n}=this;if(t==null)return null;let r=this.view.viewingMode===`global`&&n!=null&&L(e.extent.xmin,e.extent.xmax,n);return{...t,wrapAround:r,density:this._effectiveDensity}}get surface(){return this.view.basemapTerrain}doRefresh(){}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this.tilesIntersectDataBounds=!0,this._loadingState=`ready-to-load`}_update(){let e=this._time;this._lastResources?.hasFadedOut(e)&&this._lastResources.detach();let t=this._nextStateForTransition(e);if(!this.requireLoad||this.updatingHandles.updating||t!==`ready-to-load`||!this.loadRequirementsMet){this._loadingState=t,this.tilesIntersectDataBounds||(this.requireLoad=!1);return}this._loadingState=`loading`,this.updatingHandles.consumePromise(o((async()=>{let t=this._time,n=this._seamlessTransitionEnabled&&this._resources!=null?f(e+this._seamlessTransitionWaitingTime):e;await this._load(n);let r=f((this._time-t)/1e3);this._updateAverageLoadingTime(r)})())),this.requireLoad=!1}_updateAverageLoadingTime(e){let t=N;this._averageLoadingTime=f(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){if(!this.suspended&&this._debugAllowAutoLoading.value){if(!this.visible){this.clear();return}this.requireLoad=!0}}get _time(){return te(this.layerView.view.stage.renderer.renderContext.time)}async _load(e){let{extent:t,view:n}=this;if(!this.visible){this.clear();return}if(t==null){this._loadingState=`ready-to-load`;return}this._transitionEnabled||(this._lastResources?.detach(),this._lastResources=null,this._resources?.detach(),this._resources=null);let r=new R(t,this.layerView.timeExtent,this._tracingResolution,n.state.contentPixelRatio,e),i=this._ensureAbortController();try{let t=await this._loadStreamlines(r,i.signal);if(a(i.signal),t!=null){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=t;let n=this._getStartTime(e);this._lastResources!=null&&(this._lastResources.endTime=n),this._resources.startTime=n,this._animationsEnabled||(this._lastResources?.detach(),this._lastResources=null),await t.attach(),this.suspended&&this.clear(),a(i.signal),this._loadingState=this._seamlessTransitionEnabled?`before-transition`:`transitioning`}else this._loadingState=`ready-to-load`}catch{this._loadingState=`ready-to-load`}}async _loadStreamlines(e,t){let n=await this.fetchDataAndGenerateStreamlines(e,t);if(n==null)return null;let{geometries:r,material:i}=await this._createGeometry(e,n,t);return this._draped?new U(e,n,i,r,this.layerView):new W(e,n,i,r,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t,n){let r=new oe(this._materialParameters,this.view.state.isGlobal),i=[],{elevationInfo:o,_draped:s,view:c}=this;function*l(n){for(let a=0;a<t.length;++a)i.push(V(c,e,t[a],o,r,s)),n.madeProgress(),n.done&&(n=yield)}return await this.frameTask.scheduleGenerator(l,n),a(n),{geometries:i,material:r}}_triggerTilesUpdate(){if(this.suspended||this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;let e=this._ensureAbortController();this.updatingHandles.consumePromise(o((async()=>{try{await ee(()=>this.view.stationary),a(e.signal),await this._debouncedTileUpdate(e)}finally{this._tilesUpdateIsWaiting=!1}})()))}_getTileFilterFunction(){let{view:e,_featureTilesBounds:n,loadAllTiles:r}=this;if(r){let{loadAllTilesLevel:e}=this;return t=>t.level===e}let i=e=>e.rendered&&e.visible,{featureTiles:a}=e;if(!a)return i;let o=a.tiles.filter(e=>e.measures.visible);return e=>i(e)&&Z(n,e.extent)&&o.some(({lij:n})=>t(n,e.lij)||q(n,e.lij))}_nextStateForTransition(e){let{_resources:t}=this;if(this._flowRenderer==null||t==null||this._loadingState===`ready-to-load`||this._loadingState===`loading`)return this._loadingState;let n=t.startTime,r=n+P;return e<n?`before-transition`:e<r?`transitioning`:`ready-to-load`}_getStartTime(e){if(!this._animationsEnabled)return Q;let t=this._time;return f(t>e?t:e)}get usedMemory(){return(this._lastResources?.usedMemory??0)+(this._resources?.usedMemory??0)}get test(){}};e([p()],X.prototype,`type`,void 0),e([p()],X.prototype,`renderedTiles`,void 0),e([p()],X.prototype,`_resources`,void 0),e([p()],X.prototype,`_lastResources`,void 0),e([p()],X.prototype,`tilesIntersectDataBounds`,void 0),e([p()],X.prototype,`requireLoad`,void 0),e([p()],X.prototype,`_averageLoadingTime`,void 0),e([p()],X.prototype,`_loadingState`,void 0),e([p()],X.prototype,`emissiveStrength`,void 0),e([p()],X.prototype,`_animationsEnabled`,null),e([p()],X.prototype,`_clippingArea`,null),e([p()],X.prototype,`_dataBounds`,null),e([p()],X.prototype,`suspended`,null),e([p()],X.prototype,`_fullExtentSurfaceSpatialReference`,null),e([p()],X.prototype,`_draped`,null),e([p()],X.prototype,`extent`,null),e([p()],X.prototype,`loadAllTiles`,null),e([p()],X.prototype,`isDataGlobal`,null),e([p()],X.prototype,`loadAllTilesLevel`,null),e([p()],X.prototype,`targetTiles`,null),e([p()],X.prototype,`_featureTilesBounds`,null),e([p()],X.prototype,`_flowRenderer`,null),e([p()],X.prototype,`_materialParameters`,null),e([p()],X.prototype,`_opacity`,null),e([p()],X.prototype,`_seamlessTransitionWaitingTime`,null),e([p()],X.prototype,`_transitionEnabled`,null),e([p()],X.prototype,`_seamlessTransitionEnabled`,null),e([p()],X.prototype,`_tracingResolution`,null),e([p()],X.prototype,`visible`,null),e([p()],X.prototype,`_effectiveDensity`,null),e([p()],X.prototype,`elevationInfo`,null),e([p()],X.prototype,`needsMagnitude`,null),e([p()],X.prototype,`spatialReferenceInfo`,null),e([p()],X.prototype,`loadingState`,null),e([p()],X.prototype,`updating`,null),e([p()],X.prototype,`visibleAtCurrentScale`,null),e([p()],X.prototype,`_materialParametersOverridde`,void 0),e([p()],X.prototype,`_suspendedOverride`,void 0),e([p()],X.prototype,`_simulationSettingsOverride`,void 0),e([p()],X.prototype,`_seamlessTransitionEnabledOverride`,void 0),e([p()],X.prototype,`_simulationSettings`,null),e([p()],X.prototype,`surface`,null),X=e([m(`esri.views.3d.layers.FlowSubView3D`)],X);const de=X,fe=new x({mode:`on-the-ground`});function Z(e,t){return e==null||t==null||v(e,t)}const pe=g(G,ne.WebMercator),Q=f(-F);function $(e){return e!=null&&e.spatialReference.isWebMercator?e?.intersection(pe):e}export{de as default};
2
+ import{__decorate as e}from"tslib";import{equals as t}from"../../../core/arrayUtils.js";import"../../../core/has.js";import{removeMaybe as n,abortMaybe as r}from"../../../core/maybe.js";import{debounce as i,throwIfAborted as a,ignoreAbortErrors as o}from"../../../core/promiseUtils.js";import{watch as s,sync as c,when as l,whenOnce as ee}from"../../../core/reactiveUtils.js";import{addFrameTask as u}from"../../../core/scheduling.js";import{signal as d}from"../../../core/signal.js";import{Seconds as f,secondsFromMilliseconds as te}from"../../../core/time.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{projectOrLoad as h}from"../../../geometry/projectionUtils.js";import ne from"../../../geometry/SpatialReference.js";import{toExtent as g,fromExtent as _,intersection as re,create as ie,intersects as v}from"../../../geometry/support/aaBoundingRect.js";import{isInEffectiveScaleRange as y}from"../../../geometry/support/scaleUtils.js";import{getInfo as b}from"../../../geometry/support/spatialReferenceUtils.js";import x from"../../../symbols/support/ElevationInfo.js";import S from"./SubView3D.js";import{getFeatureTileId as C}from"./support/FeatureTileDescriptor.js";import{makeScheduleFunction as w}from"./support/makeScheduleFunction.js";import{debugFlags as T}from"../support/debugFlags.js";import{tileFilterDistance as E,scaleThresholdForLoadingAllTiles as D,defaultTransitionDuration as O,transitionDurationFactor as k,seamlessTransitionEnabled as A,densityFactor as j,loadAllTilesDensityFactor as M,averageLoadingTimeSmoothingFactor as N,fadeOutTime as P,fadeInTime as F,minimumTracingResolution as I}from"../support/flow/constants.js";import{isFullExtent as L,wrappedWidth as ae,FlowQuery3D as R}from"../support/flow/FlowQuery3D.js";import{FlowWorkerHandle as z}from"../support/flow/FlowWorkerHandle.js";import{materialParametersFromRenderer as B,createStreamlineGeometry as V}from"../support/flow/geometryUtils.js";import{boundingRectOfTiles as H}from"../support/flow/loadUtils.js";import{StreamlineResources3DOverlay as U}from"../support/flow/StreamlineResources3DOverlay.js";import{StreamlineResources3DShape as W}from"../support/flow/StreamlineResources3DShape.js";import{webMercatorWorldExtent as G}from"../terrain/TerrainConst.js";import{descendantsAtLevel as K,tilesAreRelated as q}from"../terrain/tileUtils.js";import{isScreenSizePerspectiveEnabled as J}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{RibbonLineMaterial as oe}from"../webgl-engine/materials/RibbonLineMaterial.js";import{hasLayerBasedScaleVisibility as se}from"../../support/layerViewUtils.js";import{TaskPriority as ce}from"../../support/Scheduler.js";import{simulationSettingsEqual as le,getPositions as ue,getFlowSimulationSettings as Y}from"../../support/flow/utils.js";let X=class extends S{constructor(e){super(e),this.type=`flow`,this.renderedTiles=null,this.tilesIntersectDataBounds=!0,this.requireLoad=!1,this.workerHandle=null,this.frameTask=null,this._averageLoadingTime=f(0),this._abortController=null,this._loadingState=`ready-to-load`,this._tilesUpdateIsWaiting=!1,this._debugAllowAutoLoading=d(!0),this.emissiveStrength=0,this._materialParametersOverridde=null,this._suspendedOverride=null,this._simulationSettingsOverride=null,this._seamlessTransitionEnabledOverride=null,this._updateTask=null,this._debouncedTileUpdate=i(async e=>{let{allTiles:t}=this.surface,n=this._getTileFilterFunction(),{_dataBounds:r}=this,i=new Set,o=!1;function*s(e){for(let a=0;a<t.length;++a){let s=t.at(a),c=Z(r,s.extent);n(s)&&c&&(i.add(s),o=!0),e.madeProgress(),e.done&&(e=yield)}}await this.frameTask.scheduleGenerator(s,e.signal),a(e.signal),this.tilesIntersectDataBounds=t.length===0||this.loadAllTiles?!0:o,this.renderedTiles=i})}initialize(){let{surface:e,view:t}=this,{resourceController:n}=t;this.workerHandle=new z(w(n)),this.frameTask=n.scheduler.registerTask(ce.FLOW_GENERATOR),this._updateTask=u({update:()=>this._update()}),this.addHandles([s(()=>this._simulationSettings,()=>this.triggerLoad(),{sync:!0,equals:(e,t)=>e==null&&t==null||e!=null&&t!=null&&le(e,t)}),this.updatingHandles.add(()=>this.suspended,e=>{e?this._suspend():this._resume()},c),s(()=>{let{elevationInfo:e}=this;return[this._clippingArea,this.visible,this._draped,this.view.state.contentPixelRatio,this.view.viewingMode,e?.mode,e?.offset,e?.unit,this._effectiveDensity]},()=>this.triggerLoad(),c),l(()=>!this._animationsEnabled,()=>{let{_resources:e,_lastResources:t}=this;e!=null&&(e.startTime=Q),t!=null&&(t.startTime=Q)},c),s(()=>this._materialParameters,e=>{this._resources?.setMaterialParameters(e),this._lastResources?.setMaterialParameters(e)}),l(()=>e.allTilesCreated,()=>this._triggerTilesUpdate(),c),t.enableFeatureTiles(),s(()=>[this._dataBounds,this._featureTilesBounds,this.loadAllTiles],()=>this._triggerTilesUpdate()),s(()=>this._flowRenderer,(e,t)=>{let n=t?.visualVariables??[],r=e?.visualVariables??[];r.length===n.length&&r.every((e,t)=>e.type===n[t].type)||this.clear()}),l(()=>!t.featureTiles?.updating,()=>{this._triggerTilesUpdate()})]),this.suspended&&this._suspend(),this._triggerTilesUpdate()}destroy(){this._updateTask=n(this._updateTask),this.abort(),this.clear(),this.notifyChange(`updating`)}abort(){this._abortController=r(this._abortController),this._tilesUpdateIsWaiting=!1,this.requireLoad=!1}_ensureAbortController(){return this._abortController??=new AbortController,this._abortController}_resume(){this._updateTask.resume(),this._triggerTilesUpdate(),this.triggerLoad()}_suspend(){this._updateTask.pause(),this.abort(),this.clear()}get _animationsEnabled(){return this.view.state.animationsEnabled}get _clippingArea(){let e=h(this.view.clippingArea,this.surface.spatialReference).geometry;return e==null?null:_(e)}get _dataBounds(){let e=this._fullExtentSurfaceSpatialReference;return e==null?null:_(e)}get suspended(){return this._suspendedOverride==null?this.layerView.suspended||this.view.groundView.hasTerrainReplacement:this._suspendedOverride}get _fullExtentSurfaceSpatialReference(){return h(this.layer.fullExtent,this.surface.spatialReference).geometry}get _draped(){return this.elevationInfo.mode===`on-the-ground`}get extent(){if(this.loadAllTiles)return $(this._fullExtentSurfaceSpatialReference);let{spatialReference:e}=this.surface,t=this.renderedTiles;if(e==null||t==null)return null;let n=this.view.terrainLevel;if(n!=null){let e=new Set;t.forEach(t=>{Math.abs(n-t.level)<E&&e.add(t)}),t=e}let r=H(t,this.spatialReferenceInfo);return r==null?null:(re(r,this._clippingArea,r),$(g(r,e)))}get loadAllTiles(){return this.view.scale>(T.FLOW_GLOBAL_SCALE_THRESHOLD??D)}get isDataGlobal(){let{extent:e,spatialReferenceInfo:t}=this;return e!=null&&L(e.xmin,e.xmax,t)}get loadAllTilesLevel(){let{tilingScheme:e}=this.surface;return Math.min(Math.ceil(e.levelAtScale(T.FLOW_GLOBAL_SCALE_THRESHOLD??D)),e.getMaxLod())}get targetTiles(){let e=new Map;if(this.loadAllTiles){let{_dataBounds:t}=this;if(t==null)return e;let n=ie(),r=this.loadAllTilesLevel,i=this.surface.tilingScheme,a=i.rootTilesInExtent(t).values().flatMap(e=>K(e,r));for(let o of a){let[a,s,c]=o;i.getExtent(r,s,c,n),Z(t,n)&&e.set(C(r,s,c),o)}return e}let{renderedTiles:t}=this;for(let n of t??[])e.set(n.key,n.lij);return e}get _featureTilesBounds(){let e=this.view.featureTiles?.filterExtent,t=h(e,this.surface.spatialReference).geometry;return t==null?null:_(t)}get _flowRenderer(){let e=this.layer.renderer;return e?.type===`flow`?e:null}get _materialParameters(){return{...B(this._flowRenderer,this.layerView.fullOpacity,this.emissiveStrength),...this._materialParametersOverridde,hasSlicePlane:this.layerView.slicePlaneEnabled,screenSizePerspective:!this._draped&&`screenSizePerspectiveEnabled`in this.layer&&J(this.layer.screenSizePerspectiveEnabled)?this.view.screenSizePerspective.parameters:null}}get _opacity(){return this.layerView.fullOpacity}get _seamlessTransitionWaitingTime(){let{_averageLoadingTime:e}=this;return f(e===0?O:this._averageLoadingTime*k)}get _transitionEnabled(){return this.view.qualitySettings.flow.transitionEnabled}get _seamlessTransitionEnabled(){return this._transitionEnabled?this._seamlessTransitionEnabledOverride==null?A:this._seamlessTransitionEnabledOverride:!1}get _tracingResolution(){let{extent:e}=this;if(!e)return[0,0];let t=ae(e.xmin,e.xmax,this.spatialReferenceInfo?.valid)/(e.ymax-e.ymin),[n,r]=this.view.size,i,a;n<r?(i=n,a=n/t):(i=r*t,a=r);let o=I,s=this.view.qualitySettings.flow.maxTracingResolution,c=Math.max(1,o/Math.min(i,a)),l=c*Math.min(1,s/Math.max(i*c,a*c));return[Math.round(i*l),Math.round(a*l)]}get visible(){let e=this._flowRenderer?.color;return this.visibleAtCurrentScale&&this.layer.effectiveVisible&&this._opacity>0&&(e==null||e.a>0)}get _effectiveDensity(){let{_simulationSettings:e}=this;if(e==null)return 0;let t=e.density*this.view.quality;return e.lineSpacing/Math.sqrt(t)<e.lineCollisionWidth?(e.lineSpacing/e.lineCollisionWidth)**2:t}get elevationInfo(){return(`elevationInfo`in this.layer?this.layer.elevationInfo:void 0)??fe}startPositions(e){if(!this._seamlessTransitionEnabled)return[];let{_flowRenderer:t,_resources:n}=this;return t==null||n==null?[]:ue(n.streamlines,n.query,e,t.flowSpeed)}get needsMagnitude(){return this._flowRenderer?.hasVisualVariables()??!1}get spatialReferenceInfo(){return b(this.surface.spatialReference)}get loadingState(){return this._loadingState}get loadRequirementsMet(){return this.renderedTiles!=null&&(this.renderedTiles.size>0||this.loadAllTiles)&&this.extent!=null}hasWork(){return this.updatingHandles.updating||this.requireLoad||this._loadingState===`before-transition`}get updating(){return this._debugAllowAutoLoading.value&&this.visible&&!(this.destroyed||this.destroying)&&this.hasWork()}get visibleAtCurrentScale(){return!se()||y(this.layer.effectiveScaleRange,this.view.scale)}get _simulationSettings(){let{_flowRenderer:e,_simulationSettingsOverride:t}=this;if(e==null)return null;let n=Y(e);return n.segmentLength=n.lineCollisionWidth/2,n.onlyForwardTracing=!1,n.maxNumberOfStreamlines=this.view.qualitySettings.flow.maxTotalNumberOfStreamlines,n.density*=j,this.loadAllTiles&&this.isDataGlobal&&(n.density*=M),t!=null&&(n={...n,...t}),n}getSimulationSettings(e){let{_simulationSettings:t,spatialReferenceInfo:n}=this;if(t==null)return null;let r=this.view.viewingMode===`global`&&n!=null&&L(e.extent.xmin,e.extent.xmax,n);return{...t,wrapAround:r,density:this._effectiveDensity}}get surface(){return this.view.basemapTerrain}doRefresh(){}clear(){this._resources?.detach(),this._resources=null,this._lastResources?.detach(),this._lastResources=null,this.tilesIntersectDataBounds=!0,this._loadingState=`ready-to-load`}_update(){let e=this._time;this._lastResources?.hasFadedOut(e)&&this._lastResources.detach();let t=this._nextStateForTransition(e);if(!this.requireLoad||this.updatingHandles.updating||t!==`ready-to-load`||!this.loadRequirementsMet){this._loadingState=t,this.tilesIntersectDataBounds||(this.requireLoad=!1);return}this._loadingState=`loading`,this.updatingHandles.consumePromise(o((async()=>{let t=this._time,n=this._seamlessTransitionEnabled&&this._resources!=null?f(e+this._seamlessTransitionWaitingTime):e;await this._load(n);let r=f((this._time-t)/1e3);this._updateAverageLoadingTime(r)})())),this.requireLoad=!1}_updateAverageLoadingTime(e){let t=N;this._averageLoadingTime=f(t*e+(1-t)*this._averageLoadingTime)}triggerLoad(){if(!this.suspended&&this._debugAllowAutoLoading.value){if(!this.visible){this.clear();return}this.requireLoad=!0}}get _time(){return te(this.layerView.view.stage.renderer.renderContext.time)}async _load(e){let{extent:t,view:n}=this;if(!this.visible){this.clear();return}if(t==null){this._loadingState=`ready-to-load`;return}this._transitionEnabled||(this._lastResources?.detach(),this._lastResources=null,this._resources?.detach(),this._resources=null);let r=new R(t,this.layerView.timeExtent,this._tracingResolution,n.state.contentPixelRatio,e),i=this._ensureAbortController();try{let t=await this._loadStreamlines(r,i.signal);if(a(i.signal),t!=null){this._lastResources?.detach(),this._lastResources=this._resources,this._resources=t;let n=this._getStartTime(e);this._lastResources!=null&&(this._lastResources.endTime=n),this._resources.startTime=n,this._animationsEnabled||(this._lastResources?.detach(),this._lastResources=null),await t.attach(),this.suspended&&this.clear(),a(i.signal),this._loadingState=this._seamlessTransitionEnabled?`before-transition`:`transitioning`}else this._loadingState=`ready-to-load`}catch{this._loadingState=`ready-to-load`}}async _loadStreamlines(e,t){let n=await this.fetchDataAndGenerateStreamlines(e,t);if(n==null)return null;let{geometries:r,material:i}=await this._createGeometry(e,n,t);return this._draped?new U(e,n,i,r,this.layerView):new W(e,n,i,r,this.view)}async fetchDataAndGenerateStreamlines(e,t){return null}async _createGeometry(e,t,n){let r=new oe(this._materialParameters,this.view),i=[],{elevationInfo:o,_draped:s,view:c}=this;function*l(n){for(let a=0;a<t.length;++a)i.push(V(c,e,t[a],o,r,s)),n.madeProgress(),n.done&&(n=yield)}return await this.frameTask.scheduleGenerator(l,n),a(n),{geometries:i,material:r}}_triggerTilesUpdate(){if(this.suspended||this._tilesUpdateIsWaiting)return;this._tilesUpdateIsWaiting=!0;let e=this._ensureAbortController();this.updatingHandles.consumePromise(o((async()=>{try{await ee(()=>this.view.stationary),a(e.signal),await this._debouncedTileUpdate(e)}finally{this._tilesUpdateIsWaiting=!1}})()))}_getTileFilterFunction(){let{view:e,_featureTilesBounds:n,loadAllTiles:r}=this;if(r){let{loadAllTilesLevel:e}=this;return t=>t.level===e}let i=e=>e.rendered&&e.visible,{featureTiles:a}=e;if(!a)return i;let o=a.tiles.filter(e=>e.measures.visible);return e=>i(e)&&Z(n,e.extent)&&o.some(({lij:n})=>t(n,e.lij)||q(n,e.lij))}_nextStateForTransition(e){let{_resources:t}=this;if(this._flowRenderer==null||t==null||this._loadingState===`ready-to-load`||this._loadingState===`loading`)return this._loadingState;let n=t.startTime,r=n+P;return e<n?`before-transition`:e<r?`transitioning`:`ready-to-load`}_getStartTime(e){if(!this._animationsEnabled)return Q;let t=this._time;return f(t>e?t:e)}get usedMemory(){return(this._lastResources?.usedMemory??0)+(this._resources?.usedMemory??0)}get test(){}};e([p()],X.prototype,`type`,void 0),e([p()],X.prototype,`renderedTiles`,void 0),e([p()],X.prototype,`_resources`,void 0),e([p()],X.prototype,`_lastResources`,void 0),e([p()],X.prototype,`tilesIntersectDataBounds`,void 0),e([p()],X.prototype,`requireLoad`,void 0),e([p()],X.prototype,`_averageLoadingTime`,void 0),e([p()],X.prototype,`_loadingState`,void 0),e([p()],X.prototype,`emissiveStrength`,void 0),e([p()],X.prototype,`_animationsEnabled`,null),e([p()],X.prototype,`_clippingArea`,null),e([p()],X.prototype,`_dataBounds`,null),e([p()],X.prototype,`suspended`,null),e([p()],X.prototype,`_fullExtentSurfaceSpatialReference`,null),e([p()],X.prototype,`_draped`,null),e([p()],X.prototype,`extent`,null),e([p()],X.prototype,`loadAllTiles`,null),e([p()],X.prototype,`isDataGlobal`,null),e([p()],X.prototype,`loadAllTilesLevel`,null),e([p()],X.prototype,`targetTiles`,null),e([p()],X.prototype,`_featureTilesBounds`,null),e([p()],X.prototype,`_flowRenderer`,null),e([p()],X.prototype,`_materialParameters`,null),e([p()],X.prototype,`_opacity`,null),e([p()],X.prototype,`_seamlessTransitionWaitingTime`,null),e([p()],X.prototype,`_transitionEnabled`,null),e([p()],X.prototype,`_seamlessTransitionEnabled`,null),e([p()],X.prototype,`_tracingResolution`,null),e([p()],X.prototype,`visible`,null),e([p()],X.prototype,`_effectiveDensity`,null),e([p()],X.prototype,`elevationInfo`,null),e([p()],X.prototype,`needsMagnitude`,null),e([p()],X.prototype,`spatialReferenceInfo`,null),e([p()],X.prototype,`loadingState`,null),e([p()],X.prototype,`updating`,null),e([p()],X.prototype,`visibleAtCurrentScale`,null),e([p()],X.prototype,`_materialParametersOverridde`,void 0),e([p()],X.prototype,`_suspendedOverride`,void 0),e([p()],X.prototype,`_simulationSettingsOverride`,void 0),e([p()],X.prototype,`_seamlessTransitionEnabledOverride`,void 0),e([p()],X.prototype,`_simulationSettings`,null),e([p()],X.prototype,`surface`,null),X=e([m(`esri.views.3d.layers.FlowSubView3D`)],X);const de=X,fe=new x({mode:`on-the-ground`});function Z(e,t){return e==null||t==null||v(e,t)}const pe=g(G,ne.WebMercator),Q=f(-F);function $(e){return e!=null&&e.spatialReference.isWebMercator?e?.intersection(pe):e}export{de as default};