@arcgis/core 5.2.0-next.140 → 5.2.0-next.142

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 (95) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{498d6dfd3bb0d3490548.js → 14a3808427deaaa85bf2.js} +1 -1
  3. package/assets/esri/core/workers/chunks/25e6013e2c095629b236.js +1 -0
  4. package/assets/esri/core/workers/chunks/347bf269c2b1583d2dca.js +1 -0
  5. package/assets/esri/core/workers/chunks/{5e90c1b49f2b7e21d05a.js → 55766692b578e60dd70e.js} +22 -22
  6. package/assets/esri/core/workers/chunks/{40fb1910f780e78c128c.js → 8b54589f173259c1ba55.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{61ad8306ab79aca79505.js → 8ba32d3a0df4a206ef1c.js} +1 -1
  8. package/assets/esri/core/workers/chunks/d4926545193414cf2f16.js +1 -0
  9. package/assets/esri/core/workers/chunks/e32b96c08cb272a59851.js +1 -0
  10. package/assets/esri/core/workers/chunks/{4310c8d2b40ae69c3681.js → fccbb902fe08448f91de.js} +1 -1
  11. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ar.json +1 -1
  12. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bg.json +1 -1
  13. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.bs.json +1 -1
  14. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ca.json +1 -1
  15. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.cs.json +1 -1
  16. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.da.json +1 -1
  17. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.de.json +1 -1
  18. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.el.json +1 -1
  19. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.es.json +1 -1
  20. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.et.json +1 -1
  21. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fi.json +1 -1
  22. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.fr.json +1 -1
  23. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.he.json +1 -1
  24. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hr.json +1 -1
  25. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.hu.json +1 -1
  26. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.id.json +1 -1
  27. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.it.json +1 -1
  28. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ja.json +1 -1
  29. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ko.json +1 -1
  30. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lt.json +1 -1
  31. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.lv.json +1 -1
  32. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.nl.json +1 -1
  33. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.no.json +1 -1
  34. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pl.json +1 -1
  35. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-BR.json +1 -1
  36. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.pt-PT.json +1 -1
  37. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ro.json +1 -1
  38. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.ru.json +1 -1
  39. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sk.json +1 -1
  40. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sl.json +1 -1
  41. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sr.json +1 -1
  42. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.sv.json +1 -1
  43. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.th.json +1 -1
  44. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.tr.json +1 -1
  45. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.uk.json +1 -1
  46. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.vi.json +1 -1
  47. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-CN.json +1 -1
  48. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-HK.json +1 -1
  49. package/assets/esri/widgets/BatchAttributeForm/t9n/messages.zh-TW.json +1 -1
  50. package/chunks/RibbonLine.glsl.js +9 -11
  51. package/config.js +1 -1
  52. package/kernel.js +1 -1
  53. package/layers/GeospatialPDFLayer.d.ts +2 -5
  54. package/layers/GeospatialPDFLayer.js +1 -1
  55. package/layers/ParquetLayer.d.ts +8 -1
  56. package/layers/ParquetLayer.js +1 -1
  57. package/layers/geospatialPDF/renderExtentUtils.js +1 -1
  58. package/package.json +2 -2
  59. package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
  60. package/views/2d/analysis/AreaMeasurementAnalysisView2D.d.ts +2 -0
  61. package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
  62. package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
  63. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.d.ts +2 -0
  64. package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
  65. package/views/2d/engine/webgl/shaderGraph/techniques/shaders/LineShader.js +1 -1
  66. package/views/3d/analysis/LineOfSight/LineOfSightItemManipulatedObject3D.js +1 -1
  67. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  68. package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
  69. package/views/3d/analysis/Viewshed/ViewshedPlacementController.js +1 -1
  70. package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
  71. package/views/3d/analysis/Viewshed/placementUtils.js +1 -1
  72. package/views/3d/interactive/SnappingVisualizer3D.js +1 -1
  73. package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
  74. package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
  75. package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
  76. package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
  77. package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +3 -3
  78. package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +23 -9
  79. package/views/DOMContainer.d.ts +1 -0
  80. package/views/draw/support/PluginContext.js +1 -1
  81. package/views/draw/support/managers/TooltipManager.js +1 -1
  82. package/views/interactive/snapping/SnappingVisualizer.js +1 -1
  83. package/views/interactive/tooltip/infos/DynamicTooltipInfo.js +1 -1
  84. package/views/layers/FeatureLikeLayerView.d.ts +1 -0
  85. package/views/layers/GraphicsLayerView.d.ts +1 -0
  86. package/views/layers/ImageryLayerView.d.ts +1 -0
  87. package/widgets/BatchAttributeForm.js +1 -1
  88. package/widgets/Directions.js +1 -1
  89. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  90. package/widgets/OrientedImageryViewer/types.d.ts +20 -0
  91. package/widgets/OrientedImageryViewer.d.ts +9 -1
  92. package/assets/esri/core/workers/chunks/1f3148cebee1961249a4.js +0 -1
  93. package/assets/esri/core/workers/chunks/6c5738012ba8b69bc596.js +0 -1
  94. package/assets/esri/core/workers/chunks/ae2181805d8ba130babc.js +0 -1
  95. package/assets/esri/core/workers/chunks/d6d5a9e73ee43d6066d3.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"../../../../analysis/Viewshed.js";import n from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as r,throwIfAborted as i,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as o,sync as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getConvertedElevation as d,absoluteHeightElevationInfo as f}from"../../../../support/elevationInfoUtils.js";import p from"../../../../symbols/support/ElevationInfo.js";import{createDrawTool as m,getFeatureReference as h}from"./placementUtils.js";import{detachToolFromView as g}from"./toolLifecycleUtils.js";import _ from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as y}from"./viewshedToolUtils.js";import{vectorToRender as b}from"../../interactive/support/viewUtils.js";import{DrawManipulator3D as x}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as S}from"../../../input/InputManager.js";import{sketchKeys as C}from"../../../interactive/keybindings.js";import{bindViewToolOptions as w}from"../../../interactive/options/bindViewToolOptions.js";import T from"../../../interactive/options/InteractiveToolOptions.js";const E=Symbol(`hiddenManipulatorHandle`);let D=class extends n{constructor(e){super(e),this.placementMode=`multiple`,this.observerPlacementElevationInfo=null,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._toolOptions=new T,this._observerScenePoint=u(),this._targetScenePoint=u(),this._mapPointVector=u(),this.creationState=null}initialize(){this.addHandles([w(this._toolOptions,()=>this.view.options),o(()=>[this._drawTool?.tooltipManager,this.creationState],([e,t])=>{e&&(e.enabled=t===`placing-observer`)}),o(()=>[this._drawTool?.activeTooltipInfo,this.creationState],([e,t])=>{e&&(e.elevationModeContext=t===`placing-observer`?this._elevationModeContext:null)}),this.view.on(`key-down`,e=>this._handleKeyDown(e),S.DEFAULT),o(()=>{let{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:e!=null&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{e!=null&&!t&&this.analysis.viewsheds.add(e)},s)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get _elevationModeContext(){let e=this;return{get mode(){return e._observerDrawToolElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(this.creationState!==`placing-observer`||!t||!n||!r||e===this._observerDrawToolElevationInfo.mode)return;let i=this.observerPlacementElevationInfo?.clone()??new p;i.mode=e;let a=r.clone();t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked||(a.z=d(this.view,r,this._observerDrawToolElevationInfo,i)),t.defaultZ=a.z,this.observerPlacementElevationInfo=i,this._setDrawToolElevationInfo(i),n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a,this._onObserverMapPointPreview(a)}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(r()),i(t);let{resolve:n,reject:o,promise:s}=Promise.withResolvers(),c=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new _({abortHandle:c,reject:o,resolve:n}),this.placementMode=e,this.observerPlacementElevationInfo=t?.elevationInfo,this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),s}cancelPlaceOperation(){(this.creationState!=null||this._placeOperation!=null)&&(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return this.creationState!=null&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){this.creationState!=null&&(C.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):C.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){if(this._removeStaged()&&this.placementMode===`multiple`){this.callbacks.setSelectedViewshed(null),this._startObserverPlacement();return}this._destroyDrawTool(),this._abortCreation()}_removeStaged(){let{stagedViewshed:e}=this;return this.stagedViewshed=null,e?(this.analysis.viewsheds.remove(e),!0):!1}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,n,r){let i=new t({observer:e,elevationInfo:this.observerPlacementElevationInfo,feature:r});this.analysis.viewsheds.add(i),this.stagedViewshed=i,this.creationState=`placing-target`,this._updateStagedViewshed(n),this.callbacks.setSelectedViewshed(null)}_onCancel(e){let t=this._removeStaged();if(this.creationState===`placing-observer`){if(t&&this.placementMode===`multiple`){this.callbacks.setSelectedViewshed(null),this._startObserverPlacement();return}this._destroyDrawTool(e),this._abortCreation();return}if(!t){this._destroyDrawTool(e),this._abortCreation();return}if(this.creationState=`placing-observer`,this.callbacks.setSelectedViewshed(null),this.placementMode===`multiple`){this._startPointPlacement();return}this._destroyDrawTool(e),this._abortCreation()}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);let t=this.stagedViewshed;return t?.valid?(this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),!0):!1}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){let t=this._placeOperation;this._placeOperation=null,this.observerPlacementElevationInfo=null,e(t)}_startObserverPlacement(){this.creationState=`placing-observer`,this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);let{drawTool:e,renderer:t}=m({analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,toolOptions:this._toolOptions,elevationInfo:this._observerDrawToolElevationInfo,getSnapToSceneEnabled:()=>this._snapToSceneEnabled,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>this.creationState===`placing-observer`});this._drawTool=e,this._renderer=t;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,t)=>this._onObserverMapPointComplete(e,t),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(t){this._destroyDrawTool(e),this._rejectPlaceOperation(t instanceof Error?t:Error(String(t)))}}_onComplete(e){this._removeStaged(),this._finishPlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t){let{intersector:n,snappingManager:r,view:i}=this,a=e.clone(),o=this._toScenePoint(e,this._targetScenePoint,this._observerDrawToolElevationInfo),s=h({intersector:n,snappingManager:r,screenPoint:t,view:i});this._renderer?.updatePlacementLocation(o),this._handleObserverPlacementComplete(a,o,s),this._setDrawToolElevationInfo(f)}_onTargetMapPointComplete(e){let t=this._toScenePoint(e,this._targetScenePoint);return this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t)?(this.placementMode===`multiple`&&(this.creationState=`placing-observer`,this._setDrawToolElevationInfo(this._observerDrawToolElevationInfo),this._onObserverMapPointPreview(e)),!0):!1}_onObserverMapPointPreview(e){let t=e.clone(),n=this._toScenePoint(t,this._observerScenePoint,this._observerDrawToolElevationInfo);this._renderer?.updatePlacementLocation(n)}_onTargetMapPointPreview(e){let t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_setDrawToolElevationInfo(e){let t=this._drawTool;t&&(t.elevationInfo=e)}get _observerDrawToolElevationInfo(){return this.observerPlacementElevationInfo??f}get _snapToSceneEnabled(){let e=this.observerPlacementElevationInfo?.mode;return this.creationState!==`placing-observer`||e==null||e===`absolute-height`?null:!1}_onManipulatorCountChange(e){e.removeHandles(E);let t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof x&&t.push(e.disableDisplay())}),e.addHandles(t,E)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&g(this.view,e)}_toScenePoint(e,t,n=f){let{x:r,y:i,z:a,spatialReference:o}=e,s=this._mapPointVector;return s[0]=r,s[1]=i,s[2]=a??0,b(s,o,n,this.view,t)}_updateStagedViewshed(e){let t=this.stagedViewshed;if(!t)return;let n=this.callbacks.findViewshedComputedData(t);if(!n)return;let{heading:r,tilt:i,farDistance:a}=y(this.view,n,e);t.farDistance=a,t.tilt=i,t.heading=r}get test(){}};e([c({constructOnly:!0})],D.prototype,`analysis`,void 0),e([c({constructOnly:!0})],D.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],D.prototype,`intersector`,void 0),e([c({constructOnly:!0})],D.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],D.prototype,`view`,void 0),e([c({constructOnly:!0})],D.prototype,`callbacks`,void 0),e([c()],D.prototype,`placementMode`,void 0),e([c()],D.prototype,`observerPlacementElevationInfo`,void 0),e([c()],D.prototype,`stagedViewshed`,void 0),e([c()],D.prototype,`_placeOperation`,void 0),e([c()],D.prototype,`_drawTool`,void 0),e([c()],D.prototype,`_renderer`,void 0),e([c()],D.prototype,`_toolOptions`,void 0),e([c()],D.prototype,`updating`,null),e([c()],D.prototype,`active`,null),e([c()],D.prototype,`creationState`,void 0),e([c()],D.prototype,`_elevationModeContext`,null),D=e([l(`esri.views.3d.analysis.Viewshed.ViewshedPlacementController`)],D);export{D as ViewshedPlacementController};
2
+ import{__decorate as e}from"tslib";import t from"../../../../analysis/Viewshed.js";import n from"../../../../core/Accessor.js";import"../../../../core/has.js";import{createAbortError as r,throwIfAborted as i,onAbort as a}from"../../../../core/promiseUtils.js";import{watch as o,sync as s}from"../../../../core/reactiveUtils.js";import{property as c,subclass as l}from"../../../../core/accessorSupport/decorators.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getConvertedElevation as d,absoluteHeightElevationInfo as f}from"../../../../support/elevationInfoUtils.js";import p from"../../../../symbols/support/ElevationInfo.js";import{createDrawTool as m,getFeatureReference as h}from"./placementUtils.js";import{detachToolFromView as g}from"./toolLifecycleUtils.js";import _ from"./ViewshedPlacementOperation.js";import{createViewshedPlacementRootPluginConfiguration as v}from"./ViewshedPlacementRootPlugin.js";import{computeParametersFromTargetPoint as y}from"./viewshedToolUtils.js";import{vectorToRender as b}from"../../interactive/support/viewUtils.js";import{DrawManipulator3D as x}from"../../../draw/DrawManipulator3D.js";import{ViewEventPriorities as S}from"../../../input/InputManager.js";import{sketchKeys as C}from"../../../interactive/keybindings.js";import{bindViewToolOptions as w}from"../../../interactive/options/bindViewToolOptions.js";import T from"../../../interactive/options/InteractiveToolOptions.js";const E=Symbol(`hiddenManipulatorHandle`);let D=class extends n{constructor(e){super(e),this.placementMode=`multiple`,this.observerPlacementElevationInfo=null,this.stagedViewshed=null,this._placeOperation=null,this._drawTool=null,this._renderer=null,this._toolOptions=new T,this._observerScenePoint=u(),this._targetScenePoint=u(),this._mapPointVector=u(),this.creationState=null}initialize(){this.addHandles([w(this._toolOptions,()=>this.view.options),o(()=>[this._drawTool?.tooltipManager,this.creationState],([e,t])=>{e&&(e.enabled=t===`placing-observer`)}),o(()=>[this._drawTool?.activeTooltipInfo,this.creationState],([e,t])=>{e&&(e.elevationModeContext=t===`placing-observer`?this._elevationModeContext:null)}),this.view.on(`key-down`,e=>this._handleKeyDown(e),S.DEFAULT),o(()=>{let{stagedViewshed:e}=this;return{stagedViewshed:e,stagedViewshedInAnalysis:e!=null&&this.analysis.viewsheds.includes(e)}},({stagedViewshed:e,stagedViewshedInAnalysis:t})=>{e!=null&&!t&&this.analysis.viewsheds.add(e)},s)])}destroy(){this._cancelPlacementOperation()}get updating(){return!!this._drawTool?.updating}get active(){return!!this._drawTool?.active}get _elevationModeContext(){let e=this;return{get mode(){return e._observerDrawToolElevationInfo.mode},get disabled(){return!e._drawTool?.interactiveHandleManager?.focusedHandle?.outputMapPosition},onChange:e=>this.setElevationMode(e)}}setElevationMode(e){let t=this._drawTool,n=t?.interactiveHandleManager?.focusedHandle,r=n?.outputMapPosition;if(this.creationState!==`placing-observer`||!t||!n||!r||e===this._observerDrawToolElevationInfo.mode)return;let i=this.observerPlacementElevationInfo?.clone()??new p;i.mode=e;let a=r.clone();t.activeTooltipInfo?.getConstraintFieldByName(n,`elevation`)?.locked||(a.z=d(this.view,r,this._observerDrawToolElevationInfo,i)),t.defaultZ=a.z,this.observerPlacementElevationInfo=i,t.elevationInfo=i,n.inputMapPosition=a.clone(),n.selectedSnappingResult=null,n.outputMapPosition=a}startPlaceOperation(e,t){this._removeStaged(),this.creationState=null,this._rejectPlaceOperation(r()),i(t);let{resolve:n,reject:o,promise:s}=Promise.withResolvers(),c=a(t,()=>this._cancelPlacementOperation());return this._placeOperation=new _({abortHandle:c,reject:o,resolve:n}),this.placementMode=e,this.observerPlacementElevationInfo=t?.elevationInfo,this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),s}cancelPlaceOperation(){(this.creationState!=null||this._placeOperation!=null)&&(this._cancelPlacementOperation(),this.callbacks.cancelTool())}_handleDeleteDuringCreation(){return this.creationState!=null&&(this._destroyDrawTool(),this._removeStaged(),this.callbacks.setSelectedViewshed(null),this._startObserverPlacement(),!0)}_handleKeyDown(e){this.creationState!=null&&(C.cancel===e.key?(this._handleCancelDuringCreation(),e.stopPropagation(),e.preventDefault()):C.delete.includes(e.key)&&(this._handleDeleteDuringCreation(),e.stopPropagation(),e.preventDefault()))}_handleCancelDuringCreation(){if(this._removeStaged()&&this.placementMode===`multiple`){this.callbacks.setSelectedViewshed(null),this._startObserverPlacement();return}this._destroyDrawTool(),this._abortCreation()}_removeStaged(){let{stagedViewshed:e}=this;return this.stagedViewshed=null,e?(this.analysis.viewsheds.remove(e),!0):!1}_cancelPlacementOperation(){this._destroyDrawTool(),this._removeStaged(),this.creationState=null,this._finishPlaceOperation()}_abortCreation(){this.callbacks.cancelTool(),this.creationState=null,this._finishPlaceOperation()}_handleObserverPlacementComplete(e,n,r){let i=new t({observer:e,elevationInfo:this.observerPlacementElevationInfo,feature:r});this.analysis.viewsheds.add(i),this.stagedViewshed=i,this.creationState=`placing-target`,this._updateStagedViewshed(n),this.callbacks.setSelectedViewshed(null)}_onCancel(e){let t=this._removeStaged();if(this.creationState===`placing-observer`){if(t&&this.placementMode===`multiple`){this.callbacks.setSelectedViewshed(null),this._startObserverPlacement();return}this._destroyDrawTool(e),this._abortCreation();return}if(!t){this._destroyDrawTool(e),this._abortCreation();return}if(this.creationState=`placing-observer`,this.callbacks.setSelectedViewshed(null),this.placementMode===`multiple`){this._startPointPlacement();return}this._destroyDrawTool(e),this._abortCreation()}_handleTargetPlacementComplete(e){this._updateStagedViewshed(e);let t=this.stagedViewshed;return t?.valid?(this._placeOperation?.markPlacedViewshed(),this.stagedViewshed=null,this.callbacks.setSelectedViewshed(t),!0):!1}_finishPlaceOperation(){this._clearPlaceOperationAndRun(e=>e?.finish())}_rejectPlaceOperation(e){this._clearPlaceOperationAndRun(t=>t?.reject(e))}_clearPlaceOperationAndRun(e){let t=this._placeOperation;this._placeOperation=null,this.observerPlacementElevationInfo=null,e(t)}_startObserverPlacement(){this.creationState=`placing-observer`,this._startPointPlacement()}_startPointPlacement(){this._drawTool&&this._destroyDrawTool(this._drawTool);let{drawTool:e,renderer:t}=m({analysisViewData:this.analysisViewData,snappingManager:this.snappingManager,view:this.view,toolOptions:this._toolOptions,elevationInfo:this._observerDrawToolElevationInfo,onCancel:e=>this._onCancel(e),onComplete:e=>this._onComplete(e),onManipulatorCountChange:e=>this._onManipulatorCountChange(e),isPlacingObserver:()=>this.creationState===`placing-observer`});this._drawTool=e,this._renderer=t;try{this.view.addAndActivateTool(e),e.begin([v({mode:this.placementMode,onObserverComplete:(e,t)=>this._onObserverMapPointComplete(e,t),onTargetComplete:e=>this._onTargetMapPointComplete(e),onObserverPreview:e=>this._onObserverMapPointPreview(e),onTargetPreview:e=>this._onTargetMapPointPreview(e)})])}catch(t){this._destroyDrawTool(e),this._rejectPlaceOperation(t instanceof Error?t:Error(String(t)))}}_onComplete(e){this._removeStaged(),this._finishPlaceOperation(),this._destroyDrawTool(e),this.creationState=null}_onObserverMapPointComplete(e,t){let{intersector:n,snappingManager:r,view:i}=this,a=e.clone(),o=this._toScenePoint(e,this._targetScenePoint,this._observerDrawToolElevationInfo),s=h({intersector:n,snappingManager:r,screenPoint:t,view:i});this._renderer?.updatePlacementLocation(o),this._handleObserverPlacementComplete(a,o,s),this._setDrawToolElevationInfo(f)}_onTargetMapPointComplete(e){let t=this._toScenePoint(e,this._targetScenePoint);return this._renderer?.updatePlacementLocation(t),this._handleTargetPlacementComplete(t)?(this.placementMode===`multiple`&&(this.creationState=`placing-observer`,this._setDrawToolElevationInfo(this._observerDrawToolElevationInfo),this._onObserverMapPointPreview(e)),!0):!1}_onObserverMapPointPreview(e){let t=e.clone(),n=this._toScenePoint(t,this._observerScenePoint,this._observerDrawToolElevationInfo);this._renderer?.updatePlacementLocation(n)}_onTargetMapPointPreview(e){let t=this._toScenePoint(e,this._targetScenePoint);this._renderer?.updatePlacementLocation(t),this._updateStagedViewshed(t)}_setDrawToolElevationInfo(e){let t=this._drawTool;t&&(t.elevationInfo=e)}get _observerDrawToolElevationInfo(){return this.observerPlacementElevationInfo??f}_onManipulatorCountChange(e){e.removeHandles(E);let t=[];e.manipulators.forEach(({manipulator:e})=>{e instanceof x&&t.push(e.disableDisplay())}),e.addHandles(t,E)}_destroyDrawTool(e=this._drawTool){this._drawTool=null,this._renderer=null,e&&g(this.view,e)}_toScenePoint(e,t,n=f){let{x:r,y:i,z:a,spatialReference:o}=e,s=this._mapPointVector;return s[0]=r,s[1]=i,s[2]=a??0,b(s,o,n,this.view,t)}_updateStagedViewshed(e){let t=this.stagedViewshed;if(!t)return;let n=this.callbacks.findViewshedComputedData(t);if(!n)return;let{heading:r,tilt:i,farDistance:a}=y(this.view,n,e);t.farDistance=a,t.tilt=i,t.heading=r}get test(){}};e([c({constructOnly:!0})],D.prototype,`analysis`,void 0),e([c({constructOnly:!0})],D.prototype,`analysisViewData`,void 0),e([c({constructOnly:!0})],D.prototype,`intersector`,void 0),e([c({constructOnly:!0})],D.prototype,`snappingManager`,void 0),e([c({constructOnly:!0})],D.prototype,`view`,void 0),e([c({constructOnly:!0})],D.prototype,`callbacks`,void 0),e([c()],D.prototype,`placementMode`,void 0),e([c()],D.prototype,`observerPlacementElevationInfo`,void 0),e([c()],D.prototype,`stagedViewshed`,void 0),e([c()],D.prototype,`_placeOperation`,void 0),e([c()],D.prototype,`_drawTool`,void 0),e([c()],D.prototype,`_renderer`,void 0),e([c()],D.prototype,`_toolOptions`,void 0),e([c()],D.prototype,`updating`,null),e([c()],D.prototype,`active`,null),e([c()],D.prototype,`creationState`,void 0),e([c()],D.prototype,`_elevationModeContext`,null),D=e([l(`esri.views.3d.analysis.Viewshed.ViewshedPlacementController`)],D);export{D as ViewshedPlacementController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var o;const s=Symbol(`viewshed-placement-point-plugin-marker`);let c=class extends a{static{o=s}constructor(e){super(e),this[o]=!0,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol(`viewshed-placement-point-vertex`)}start(e){super.start(e);let{positionOfLastUserInput:t,session:n}=e,r=this._getInitialMapPoint(t);r&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&(n.appendOrReplacePoint(this._vertexId,r),this.outputMapPosition=r.clone()),this._ensureInteractiveHandle(e,r)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(e,r){this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?r:void 0}),this.addHandles(t(()=>{let e=this._interactiveHandle;return{outputMapPosition:e?.outputMapPosition,screenPosition:e?.screenPosition}},({outputMapPosition:e,screenPosition:t})=>{this.outputMapPosition=e?.clone(),this.screenPosition=t,e&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,e)},n),this._ownHandlesKey))}_getInitialMapPoint(e){return this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??e:this.inputMapPosition??e}};e([r({constructOnly:!0})],c.prototype,`step`,void 0),e([r()],c.prototype,`defaultCaptureMode`,void 0),e([r()],c.prototype,`inputMapPosition`,void 0),e([r()],c.prototype,`outputMapPosition`,void 0),e([r()],c.prototype,`screenPosition`,void 0),e([r()],c.prototype,`hasCommittedPoint`,void 0),e([r()],c.prototype,`_interactiveHandle`,void 0),c=e([i(`esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin`)],c);function l(e){return{uniqueId:Symbol(`viewshed-${e}-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new c({step:e})}}export{c as ViewshedPlacementPointPlugin,l as createViewshedPlacementPointPluginConfiguration};
2
+ import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var o;const s=Symbol(`viewshed-placement-point-plugin-marker`);let c=class extends a{static{o=s}constructor(e){super(e),this[o]=!0,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol(`viewshed-placement-point-vertex`)}start(e){super.start(e);let{positionOfLastUserInput:t,session:n}=e,r=this._getInitialMapPoint(t);r&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&(n.appendOrReplacePoint(this._vertexId,r),this.outputMapPosition=r.clone()),this._ensureInteractiveHandle(e,r)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(e,r){if(this._interactiveHandle)return;let{defaultCaptureMode:i}=this;this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:i,inputMapPosition:i===`grabbable-object`?r:void 0},{disableDefaultXYFields:this.step===`target`}),this.addHandles(t(()=>{let e=this._interactiveHandle;return{outputMapPosition:e?.outputMapPosition,screenPosition:e?.screenPosition}},({outputMapPosition:e,screenPosition:t})=>{this.outputMapPosition=e?.clone(),this.screenPosition=t,e&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,e)},n),this._ownHandlesKey)}_getInitialMapPoint(e){return this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??e:this.inputMapPosition??e}};e([r({constructOnly:!0})],c.prototype,`step`,void 0),e([r()],c.prototype,`defaultCaptureMode`,void 0),e([r()],c.prototype,`inputMapPosition`,void 0),e([r()],c.prototype,`outputMapPosition`,void 0),e([r()],c.prototype,`screenPosition`,void 0),e([r()],c.prototype,`hasCommittedPoint`,void 0),e([r()],c.prototype,`_interactiveHandle`,void 0),c=e([i(`esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin`)],c);function l(e){return{uniqueId:Symbol(`viewshed-${e}-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new c({step:e})}}export{c as ViewshedPlacementPointPlugin,l as createViewshedPlacementPointPluginConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n,sync as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as o}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as c}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as l}from"../../../draw/DrawTool.js";function u(a){let{analysisViewData:s,snappingManager:c,view:u,toolOptions:d,elevationInfo:f,getSnapToSceneEnabled:p,onCancel:m,onComplete:h,onManipulatorCountChange:g,isPlacingObserver:_}=a,v=new o({view:u,isPlacingObserver:_}),y=new l({elevationInfo:f,enableVertexVisuals:!1,hasZ:!0,renderer:v,toolOptions:d,snappingManager:c,view:u});return y.addHandles([e(v),y.on(`cancel`,()=>m(y)),y.on(`complete`,()=>h(y)),t(()=>[y.surfaceManager,p()],([e,t])=>{e&&(e.snapToSceneEnabled=t)},n),t(()=>y.manipulators.length,()=>g(y),r),t(()=>s.visible,e=>v.analysisVisible=e,i)]),{drawTool:y,renderer:v}}function d({intersector:e,snappingManager:t,screenPoint:n,view:r}){let i=t.getMainFeatureCandidate();return i?p(i):n?f(n,r,e):null}function f(e,t,n){t.sceneIntersectionHelper.intersectToolIntersectorScreen(a(e.x,e.y),n);let r=n.results.min;return s(r)?c(r,t):null}function p(e){let t={id:e.layer.id,objectIdField:`objectIdField`in e.layer?e.layer.objectIdField:void 0};return{attributes:{[t.objectIdField??`ObjectId`]:e.objectId},layer:t,objectId:e.objectId,uid:null}}export{u as createDrawTool,d as getFeatureReference};
2
+ import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as t,syncAndInitial as n,sync as r,initial as i}from"../../../../core/reactiveUtils.js";import{createScreenPointArray as a}from"../../../../core/screenUtils.js";import{ViewshedDrawToolRenderer as o}from"./ViewshedDrawToolRenderer.js";import{isValidIntersectorResult as s}from"../../webgl-engine/lib/IntersectorResult.js";import{toGraphic as c}from"../../webgl-engine/lib/intersectorUtilsConversions.js";import{DrawTool as l}from"../../../draw/DrawTool.js";function u(a){let{analysisViewData:s,snappingManager:c,view:u,toolOptions:d,elevationInfo:f,onCancel:p,onComplete:m,onManipulatorCountChange:h,isPlacingObserver:g}=a,_=new o({view:u,isPlacingObserver:g}),v=new l({elevationInfo:f,enableVertexVisuals:!1,hasZ:!0,renderer:_,toolOptions:d,snappingManager:c,view:u});return v.addHandles([e(_),v.on(`cancel`,()=>p(v)),v.on(`complete`,()=>m(v)),t(()=>v.mostDownstreamPlugin,()=>v.defaultZ=0,n),t(()=>v.manipulators.length,()=>h(v),r),t(()=>s.visible,e=>_.analysisVisible=e,i)]),{drawTool:v,renderer:_}}function d({intersector:e,snappingManager:t,screenPoint:n,view:r}){let i=t.getMainFeatureCandidate();return i?p(i):n?f(n,r,e):null}function f(e,t,n){t.sceneIntersectionHelper.intersectToolIntersectorScreen(a(e.x,e.y),n);let r=n.results.min;return s(r)?c(r,t):null}function p(e){let t={id:e.layer.id,objectIdField:`objectIdField`in e.layer?e.layer.objectIdField:void 0};return{attributes:{[t.objectIdField??`ObjectId`]:e.objectId},layer:t,objectId:e.objectId,uid:null}}export{u as createDrawTool,d as getFeatureReference};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{multiplyOpacity as e}from"../../../core/colorUtils.js";import{destroyHandle as t,makeHandle as n}from"../../../core/handleUtils.js";import{lerp 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{projectVectorToVector as a}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as o,absoluteHeightElevationInfo as s}from"../../../support/elevationInfoUtils.js";import{vectorToRender as c}from"./support/viewUtils.js";import{ExtendedLineVisualElement as l}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as u}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as f}from"./visualElements/RightAngleQuadVisualElement.js";import{createDehydratedPoint as p,isTarget as m,withSelfSnappingZ as h}from"../../interactive/sketch/normalizedPoint.js";import{defaults as g}from"../../interactive/snapping/Settings.js";import{SnappingVisualizer as _}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as v}from"../../interactive/snapping/hints/LineSnappingHint.js";class y extends _{sortUniqueHints(e){return e.sort((e,t)=>(t instanceof v?t.length:0)-(e instanceof v?e.length:0))}visualizeIntersectionPoint(e,n){let{spatialReference:r,view:i}=n,a=b(n);return t(new d({view:i,primitive:`circle`,geometry:p(e.intersectionPoint,r),elevationInfo:e.isDraped?o:s,size:20,outlineSize:2,color:a.intersectionPointColor,outlineColor:a.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,n){let{view:r,spatialReference:i}=n,a=b(n),o=x(e.point,e.domain,n);return t(new d({view:r,primitive:`circle`,geometry:p(o,i),elevationInfo:S(e),size:20,outlineSize:2,color:a.pointColor,outlineColor:a.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,n){let{view:r,spatialReference:i}=n,a=b(n),o=x(e.lineStart,e.domain,n),s=x(e.lineEnd,e.domain,n);return t(C(e.type,o,s,i,S(e),r,a,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeCurve(e,t){return n()}visualizeParallelSign(e,n){let{view:i,spatialReference:a}=n,o=b(n),{isDraped:s}=e,c=S(e),l=x(e.lineStart,e.domain,n),d=x(e.lineEnd,e.domain,n),f=w(l,a,c,i,s),p=w(d,a,c,i,s),m=r(p,f,p,.5),h=new u({view:i,attached:!1,offset:g.parallelLineHintOffset,length:g.parallelLineHintLength,width:g.parallelLineHintWidth,color:o.parallelSignColor,location:m,renderOccluded:s?4:16,isDraped:s,renderGroup:3,isDecoration:!0});return h.setDirectionFromPoints(f,m),h.attached=!0,t(h)}visualizeRightAngleQuad(e,n){let{view:r,spatialReference:i}=n,a=b(n),o=S(e),{isDraped:s}=e,c=x(e.previousVertex,e.domain,n),l=x(e.centerVertex,e.domain,n),u=x(e.nextVertex,e.domain,n),d=w(c,i,o,r,s),p=w(l,i,o,r,s),m=w(u,i,o,r,s);return t(new f({view:r,attached:!0,color:s?a.rightAngleColorDraped:a.rightAngleColor,renderOccluded:s?4:2,outlineRenderOccluded:s?4:16,outlineColor:a.rightAngleOutlineColor,outlineSize:g.rightAngleHintOutlineSize,size:g.rightAngleHintSize,isDraped:s,geometry:{previous:d,center:p,next:m},renderGroup:3,isDecoration:!0}))}}function b(t){let{effectiveTheme:n}=t.view,r=n.accentColor.toUnitRGBA(),i=[0,0,0,0];return{intersectionPointColor:i,intersectionPointOutlineColor:r,pointColor:i,pointOutlineColor:r,lineColor:r,lineOutlineColor:void 0,parallelSignColor:r,rightAngleColor:r,rightAngleColorDraped:e(n.accentColor,.5).toUnitRGBA(),rightAngleOutlineColor:r}}function x(e,t,{selfSnappingZ:n,view:r,spatialReference:i}){return t&2&&m(e)&&n!=null?h(e,n,r,i):e}function S(e){return e.isDraped?o:s}function C(e,t,n,r,i,a,o,s=!1,c=!0,u=!0){let d=w(t,r,i,a,s),f=w(n,r,i,a,s),p=new l({view:a,extensionType:3,start:d,end:f,isDraped:s,color:o.lineColor,renderOccluded:s?4:16,renderGroup:3,isDecoration:!0});switch(e){case 0:p.width=g.lineHintWidthTarget,p.fadedExtensions={start:0,end:g.lineHintFadedExtensions};break;case 2:p.width=g.lineHintWidthReference,p.fadedExtensions={start:0,end:0};break;case 1:p.width=g.lineHintWidthReference,p.fadedExtensions={start:c?g.lineHintFadedExtensions:0,end:u?g.lineHintFadedExtensions:0}}return p.attached=!0,p}function w(e,t,n,r,o){let s=i();if(o){let n=r.overlayManager.spatialReference;a(e,t,s,n)}else c(e,t,n,r,s);return s}export{y as SnappingVisualizer3D};
2
+ import{multiplyOpacity as e}from"../../../core/colorUtils.js";import{destroyHandle as t,makeHandle as n}from"../../../core/handleUtils.js";import{lerp 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{projectVectorToVector as a}from"../../../geometry/projection/projectVectorToVector.js";import{onTheGroundElevationInfo as o,absoluteHeightElevationInfo as s}from"../../../support/elevationInfoUtils.js";import{vectorToRender as c}from"./support/viewUtils.js";import{ExtendedLineVisualElement as l}from"./visualElements/ExtendedLineVisualElement.js";import{ParallelLineVisualElement as u}from"./visualElements/ParallelLineVisualElement.js";import{PointVisualElement as d}from"./visualElements/PointVisualElement.js";import{RightAngleQuadVisualElement as f}from"./visualElements/RightAngleQuadVisualElement.js";import{createDehydratedPoint as p,isTarget as m,withSelfSnappingZ as h}from"../../interactive/sketch/normalizedPoint.js";import{defaults as g}from"../../interactive/snapping/Settings.js";import{SnappingVisualizer as _}from"../../interactive/snapping/SnappingVisualizer.js";import{LineSnappingHint as v}from"../../interactive/snapping/hints/LineSnappingHint.js";class y extends _{sortUniqueHints(e){return e.sort((e,t)=>(t instanceof v?t.length:0)-(e instanceof v?e.length:0))}visualizeIntersectionPoint(e,n){let{spatialReference:r,view:i}=n,a=b(n);return t(new d({view:i,primitive:`circle`,geometry:p(e.intersectionPoint,r),elevationInfo:e.isDraped?o:s,size:20,outlineSize:2,color:a.intersectionPointColor,outlineColor:a.intersectionPointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizePoint(e,n){let{view:r,spatialReference:i}=n,a=b(n),o=x(e.point,e.domain,n);return t(new d({view:r,primitive:`circle`,geometry:p(o,i),elevationInfo:S(e),size:20,outlineSize:2,color:a.pointColor,outlineColor:a.pointOutlineColor,pixelSnappingEnabled:!1,isDecoration:!0,attached:!0}))}visualizeLine(e,n,r){let{view:i,spatialReference:a}=n,o=b(n),s=x(e.lineStart,e.domain,n),c=x(e.lineEnd,e.domain,n);return t(C(e.type,s,c,a,S(e),i,o,r,e.isDraped,e.fadeLeft,e.fadeRight))}visualizeCurve(e,t){return n()}visualizeParallelSign(e,n,i){let{view:a,spatialReference:o}=n,s=b(n),{isDraped:c}=e,l=S(e),d=x(e.lineStart,e.domain,n),f=x(e.lineEnd,e.domain,n),p=w(d,o,l,a,c),m=w(f,o,l,a,c),h=r(m,p,m,.5),_=new u({view:a,attached:!1,offset:g.parallelLineHintOffset,length:g.parallelLineHintLength,width:g.parallelLineHintWidth,color:s.parallelSignColor,location:h,renderOccluded:c?4:16,transparentRenderOrder:i,isDraped:c,renderGroup:3,isDecoration:!0});return _.setDirectionFromPoints(p,h),_.attached=!0,t(_)}visualizeRightAngleQuad(e,n,r){let{view:i,spatialReference:a}=n,o=b(n),s=S(e),{isDraped:c}=e,l=x(e.previousVertex,e.domain,n),u=x(e.centerVertex,e.domain,n),d=x(e.nextVertex,e.domain,n),p=w(l,a,s,i,c),m=w(u,a,s,i,c),h=w(d,a,s,i,c);return t(new f({view:i,attached:!0,color:c?o.rightAngleColorDraped:o.rightAngleColor,renderOccluded:c?4:2,outlineRenderOccluded:c?4:16,outlineColor:o.rightAngleOutlineColor,outlineSize:g.rightAngleHintOutlineSize,size:g.rightAngleHintSize,transparentRenderOrder:r,isDraped:c,geometry:{previous:p,center:m,next:h},renderGroup:3,isDecoration:!0}))}}function b(t){let{effectiveTheme:n}=t.view,r=n.accentColor.toUnitRGBA(),i=[0,0,0,0];return{intersectionPointColor:i,intersectionPointOutlineColor:r,pointColor:i,pointOutlineColor:r,lineColor:r,lineOutlineColor:void 0,parallelSignColor:r,rightAngleColor:r,rightAngleColorDraped:e(n.accentColor,.5).toUnitRGBA(),rightAngleOutlineColor:r}}function x(e,t,{selfSnappingZ:n,view:r,spatialReference:i}){return t&2&&m(e)&&n!=null?h(e,n,r,i):e}function S(e){return e.isDraped?o:s}function C(e,t,n,r,i,a,o,s,c=!1,u=!0,d=!0){let f=w(t,r,i,a,c),p=w(n,r,i,a,c),m=new l({view:a,extensionType:3,start:f,end:p,isDraped:c,color:o.lineColor,renderOccluded:c?4:16,transparentRenderOrder:s,renderGroup:3,isDecoration:!0});switch(e){case 0:m.width=g.lineHintWidthTarget,m.fadedExtensions={start:0,end:g.lineHintFadedExtensions};break;case 2:m.width=g.lineHintWidthReference,m.fadedExtensions={start:0,end:0};break;case 1:m.width=g.lineHintWidthReference,m.fadedExtensions={start:u?g.lineHintFadedExtensions:0,end:d?g.lineHintFadedExtensions:0}}return m.attached=!0,m}function w(e,t,n,r,o){let s=i();if(o){let n=r.overlayManager.spatialReference;a(e,t,s,n)}else c(e,t,n,r,s);return s}export{y as SnappingVisualizer3D};
@@ -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._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 _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,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.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};
@@ -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.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 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,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.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};
@@ -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._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,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.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};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as n,removeMaybe as r,destroyMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as o,whenOnce as s,initial as c}from"../../../core/reactiveUtils.js";import{isUint32Array as l}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as u,convertUnit as d}from"../../../core/units.js";import{property as f,subclass as p}from"../../../core/accessorSupport/decorators.js";import{fromValues as m}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import g from"../../../geometry/HeightModelInfo.js";import{create as _}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as v}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as y,isWebMercator as b,equals as x,isGeographic as S}from"../../../geometry/support/spatialReferenceUtils.js";import C from"../../../geometry/support/WKIDUnitConversion.js";import{validateEntity3D as w,makeCacheKey as T,getHeightModelInfoFromVCS as E}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as D}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as O}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as k}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as A}from"./LayerView3D.js";import{addLayerViewToWasm as j,getLyr3DWasm as M,removeLayerViewFromWasm as N}from"./Lyr3DWasm.js";import{LayerElevationProvider as P}from"./i3s/LayerElevationProvider.js";import{ElevationRange as F}from"../support/ElevationRange.js";import{projectToBoundingBox as I}from"../support/extentUtils.js";import{Obb as L}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as R,gaussiansPerPage as z,packedGaussianSizeInU32 as B,splatAtlasTextureWidth as V}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as H}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as U}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as W}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as G}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatDepthRenderer as K}from"../webgl-engine/lib/GaussianSplatDepthRenderer.js";import{GaussianSplatRenderer as q}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as J}from"../webgl-engine/lib/GaussianSplatShadows.js";import Y from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as X,isInEffectiveScaleRange as Z}from"../../support/layerViewUtils.js";import{TaskPriority as ee}from"../../support/Scheduler.js";var Q;const te=()=>t.getLogger(`esri.views.3d.layers.GaussianSplatLayerView3D`),ne=(()=>{let e=new Int16Array(256);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/255));return e})();let $=class extends A(Y){static{Q=this}static{this.createRenderableBatchSize=64}static{this.uploadBatchPageCount=16}constructor(e){super(e),this.type=`gaussian-splat-3d`,this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(R*Q.uploadBatchPageCount),this._tmpTilesWithChangedVisibility=[],this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this.skipHeightModelInfoValidation=!0,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);let t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(ee.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;let e=_();return I(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){let{view:e}=this;this.addHandles([o(()=>e.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())})]),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;let{signal:t}=this._initializationController;if(await s(()=>e?.defaultsFromMap.heightModelInfoReady,t),a(t),!this._canProjectWithoutEngine())throw X(`layer`,this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await j(this,t),a(t),this._renderer=new q({view:e,layerView:this}),this.data=new H(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new J({view:e,layerView:this}),this.fadeHelper=new U(this),this._prepassDepthRenderer=new K({view:e,layerView:this});let n=new W(this);this._intersectionHandler=n,e.sceneIntersectionHelper.addIntersectionHandler(n),this._elevationProvider=new P({view:e,layerElevationSource:this,intersectionHandler:n}),e.elevationProvider.register(2,this._elevationProvider),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),o(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),c)]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),c),this.addHandles([o(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},c),o(()=>this.maximumGaussianCount,e=>this._wasm?.setMaximumGaussianSplatCount(Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians)),c)]),this._initializationController=null}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return M(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return D(this.layer.elevationInfo)}get elevationRange(){let e=this.fullExtent;return e?.zmin&&e?.zmax?new F(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return Z(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){let e=this._wasm;return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating}updatingFlagChanged(){this.notifyChange(`updating`)}async createRenderable(e){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy`);let{entity3d:t}=e;if(!w(t))throw Error(`entity3D not valid`);let n=t.desc.geometry.prims[t.validPrimitiveIndices[0]].atrbs[0],r=t.assets[n.assetId];if(!r)throw Error(`entity3D not valid`);let i=r.count;if(i===0)return te().warnOnce(`encountered tile with zero Gaussians`),()=>({memUsageBytes:0,numGaussians:0});let a=null;if(r.dataType===`U32`&&l(r.data))a=r.data;else throw Error(`unexpected GaussianSplat Entity3D asset.data format`);let o=this.extractHeader(a),s=2.048,c=o.tileOrigin.x*s,u=o.tileOrigin.y*s,d=o.tileOrigin.z*s,f=t.desc,p=f.obb.quaternion,g=new L(f.obb.center,f.obb.halfSize,m(...p)),_=this.view.state.isGlobal,v=_?h(this.view.spatialReference).radius:0,y={handle:e.handle,bufferView:a,totalGaussians:i,packedHeader:o.packedHeader,tileOrigin:{x:c,y:u,z:d},invPosScale:o.invPosScale,obb:g,origin:{x:g.centerX,y:g.centerY,z:g.centerZ},isGlobal:_,ellipsoidRadius:v};this._renderablesBeingCreated.add(e.handle);let b;try{b=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(y,e),this._createRenderableAbortController.signal)}catch(t){throw this._renderablesBeingCreated.delete(e.handle),t}return this._renderablesBeingCreated.delete(e.handle),()=>b}*_createRenderableTask(e,t){let{handle:n,bufferView:r,totalGaussians:i,packedHeader:a,tileOrigin:o,invPosScale:s,obb:c,origin:l,isGlobal:u,ellipsoidRadius:d}=e,f=o.x,p=o.y,m=o.z,h=l.x,g=l.y,_=l.z,v=new Float32Array(i*3),y=new Uint32Array(i),b=new Uint32Array(i),x=[],S=Math.ceil(i/z),C=1/0,w=-1/0,T=1/0,E=-1/0,D=0,O=-1,k=0,A=0;for(let e=0;e<i;e++){let n=e*B,i=r[n],a=r[n+1],o=r[n+2],c=r[n+3],l=a&16383,d=a>>>14&16383,x=a>>>28&15|(o&1023)<<4,S=c>>>24,j=ne[S],M=(o>>>10&255)+j,N=(o>>>18&255)+j,P=(o>>>26&63|(c&3)<<6)+j,F=M>0?M:0,I=N>0?N:0,L=P>0?P:0,R=F|I<<8|L<<16,z=Math.max(F,I,L),V=l*s+f,H=d*s+p,U=x*s+m;if(v[D]=V-h,v[D+1]=H-g,v[D+2]=U-_,u){let e=V*V+H*H+U*U;T=Math.min(T,e),E=Math.max(E,e)}else C=Math.min(C,U),w=Math.max(w,U);y[e]=i,b[e]=R,z>O&&(O=z),S>k&&(k=S),D+=3,A++,A===Q.createRenderableBatchSize&&(A=0,t.madeProgress()&&(t=yield))}A>0&&t.madeProgress()&&(t=yield),u&&(C=Math.sqrt(T)-d,w=Math.sqrt(E)-d);let j=this._extractGaussianSplatMbsRadiusSquared(O),{fullExtent:M}=this.layer;M?.hasZ&&M.zmax&&M.zmin&&(C=Math.max(C,M.zmin),w=Math.min(w,M.zmax));let N=new F(C,w),P=this.data.textureAtlas,I=this.data.headerTexture;try{for(let e=0;e<S;e+=Q.uploadBatchPageCount){let n=Math.min(S,e+Q.uploadBatchPageCount);for(let t=e;t<n;t++){let e=P.allocatePage();if(e===null&&(this._freeInvisibleTiles(),e=P.allocatePage()),e===null)throw Error(`ran out of gaussian splat memory`);x.push(e)}for(let t=e;t<n;){let e=x[t],o=t+1;for(;o<n&&x[o]===x[o-1]+1;)o++;let s=o-t,c=i-t*z,l=Math.min(c,s*z),u=t*R,d=l*B;this._pageBuffer.set(r.subarray(u,u+d));let f=e*z,p=f%V,m=Math.floor(f/V);P.update(p,m,this._pageBuffer,s),I.update(e,a,s),t=o}t.madeProgress()&&(t=yield)}}catch(e){throw P.freePages(x),e}let L=new G(n,c,x,v,y,b,i,j,k/255,N);return this._tileHandles.set(n,L),this._cacheTileMemory+=L.usedMemory,this._memCache.put(`${L.handle}`,L),{memUsageBytes:L.usedMemory,numGaussians:i}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*9}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);let t=this.data?.textureAtlas,n=!1,r=this._tileHandles.get(e);r&&(r.lifecycleState===0?this._cacheTileMemory-=r.usedMemory:(n=!0,this.fadeHelper.onTileDiscarded(r),this._usedTileMemory-=r.usedMemory,this._intersectionHandler.removeTile(r)),t&&r.pageIds.forEach(e=>t.freePage(e)),this.freeObject(r),this._tileHandles.delete(e)),n&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(let{obb:n}of e)if(!t(n))break})}setRenderableVisibility(e,t,n){let r=this._currentLyr3dVisibilityChange+1,i=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(r,i);let a=!1;for(let o=0;o<n;o++){let n=this._tileHandles.get(e[o]);if(!n)continue;let s=t[o]?this._prepareTileFadeIn(n,r,i):this._prepareTileFadeOut(n,r);a||=s}a?(this._currentLyr3dVisibilityChange=r,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(r)}_prepareTileFadeIn(e,t,n){let r=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return e.lifecycleState===2?(this.fadeHelper.fadeTile(e,0,n),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)===t?r:(e.lifecycleState===0&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0)}_prepareTileFadeOut(e,t){let n=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return n&&e.lifecycleState===1&&(this.moveTileToCache(e),e.lifecycleState=0),e.lifecycleState===2?this._tileFadeOutsAwaitingInitialSort.get(e.handle)===t?n:(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):n}_onSortComplete(e,t){let n=this._tmpTilesWithChangedVisibility;n.length=0;let r=this._tmpSortedTileHandles;r.clear();for(let t=0;t<e.length;t++){let n=e[t];r.add(n.handle)}this._triggerFadeIns(t,r,n);let i=this._triggerFadeOuts(t,n);r.clear(),n.length>0&&this.notifyTileObbsChanged(n),i&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,n){for(let[r,i]of this._tileFadeInsAwaitingInitialSort){if(i>e||!t.has(r))continue;let a=this._tileHandles.get(r);if(!a){this._tileFadeInsAwaitingInitialSort.delete(r);continue}let o=this._getFadeDurationForPendingVisibilityChange(i),s=a.lifecycleState===0;a.lifecycleState!==2&&(a.lifecycleState=2,s&&this._popTileFromCache(a),n.push(a)),this.fadeHelper.fadeTile(a,0,o),this._tileFadeInsAwaitingInitialSort.delete(r)}}_triggerFadeOuts(e,t){let n=!1;for(let[r,i]of this._tileFadeOutsAwaitingInitialSort){if(i>e)continue;let a=this._tileHandles.get(r);if(a){let e=a.lifecycleState===2,r=this._getFadeDurationForPendingVisibilityChange(i);this.fadeHelper.fadeTile(a,1,r),e&&a.lifecycleState===0&&(t.push(a),n=!0)}this._tileFadeOutsAwaitingInitialSort.delete(r)}return n}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(this._fadeDurationPerVisibilityChange.size!==0)for(let t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(T(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(T(e.handle),e)}destroy(){this._initializationController=n(this._initializationController),this._createRenderableAbortController.abort(),N(this),this._suspendedHandle&&=r(this._suspendedHandle),this._intersectionHandler&&=(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(let{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=i(this._shadows),this._prepassDepthRenderer=i(this._prepassDepthRenderer),this._renderer=i(this._renderer),this._memCache.destroy(),this.data=i(this.data)}_canProjectWithoutEngine(){if(this.view.state.viewingMode===1||y(this.view.renderSpatialReference)||b(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&x(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(this.layer.esriCrsSpatialReference.vcsWkid===115700)return!1;let e=E(this.layer.esriCrsSpatialReference);if(!e){let t=this.layer.esriCrsSpatialReference,n=S(t),r=`meters`;!n&&t.wkid&&t.wkid!==-1&&(r=u(C.units[C[t.wkid]])),r&&(e=new g({heightModel:`gravity-related-height`,heightUnit:r}))}let t=this.view.heightModelInfo;return this._useEsriCrs=v(e,t,!1)===0,this._useEsriCrs&&(e&&(this._metersPerVCSUnit=d(1,e.heightUnit,`meters`)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(!e?.offset)this._wasm?.setLayerOffset(this,0);else if(!this._useEsriCrs)this._wasm?.setLayerOffset(this,D(e));else{let t=O(e?.unit)/this._metersPerVCSUnit,n=e?.offset??0;this._wasm?.setLayerOffset(this,n*t)}}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){let e=[];for(let t of this._tileHandles.values())t.lifecycleState!==0&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange(`updating`)}get maximumGaussianCount(){return this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*this.view.quality}set maximumGaussianCount(e){this._set(`maximumGaussianCount`,e)}_freeInvisibleTiles(){for(let e of this._tileHandles.values())e.lifecycleState===0&&!this._renderablesBeingCreated.has(e.handle)&&this._deleteTile(e)}extractHeader(e){let t=e.length-4,n=this.reinterpretU32AsFloat(e[t]),r=this.reinterpretU32AsFloat(e[t+1]),i=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(e[t+3]&255));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:n,y:r,z:i},invPosScale:a}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(n=>{n.lifecycleState===0?t++:e++});let n=this.data?.textureAtlasMemory??0,r=this.data?.headerTextureMemory??0,i=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,o=this.data?.sortBufferMemory??0;return new k(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,n,r,i,a,o)}get test(){}};e([f()],$.prototype,`layer`,void 0),e([f({readOnly:!0})],$.prototype,`_clippingBox`,null),e([f()],$.prototype,`elevationOffset`,null),e([f({readOnly:!0})],$.prototype,`visibleAtCurrentScale`,null),e([f()],$.prototype,`fullExtentInLocalViewSpatialReference`,void 0),e([f()],$.prototype,`maximumGaussianCount`,null),$=Q=e([p(`esri.views.3d.layers.GaussianSplatLayerView3D`)],$);const re=$;export{re as default};
2
+ import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as n,removeMaybe as r,destroyMaybe as i}from"../../../core/maybe.js";import{throwIfAborted as a}from"../../../core/promiseUtils.js";import{watch as o,whenOnce as s,initial as c}from"../../../core/reactiveUtils.js";import{Milliseconds as l}from"../../../core/time.js";import{isUint32Array as u}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as d,convertUnit as f}from"../../../core/units.js";import{property as p,subclass as m}from"../../../core/accessorSupport/decorators.js";import{fromValues as h}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as g}from"../../../geometry/ellipsoidUtils.js";import _ from"../../../geometry/HeightModelInfo.js";import{create as v}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as y}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as b,isWebMercator as x,equals as S,isGeographic as C}from"../../../geometry/support/spatialReferenceUtils.js";import w from"../../../geometry/support/WKIDUnitConversion.js";import{validateEntity3D as T,makeCacheKey as E,getHeightModelInfoFromVCS as D}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as O}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as k}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as A}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as j}from"./LayerView3D.js";import{addLayerViewToWasm as M,getLyr3DWasm as N,removeLayerViewFromWasm as P}from"./Lyr3DWasm.js";import{LayerElevationProvider as F}from"./i3s/LayerElevationProvider.js";import{ElevationRange as I}from"../support/ElevationRange.js";import{projectToBoundingBox as L}from"../support/extentUtils.js";import{Obb as R}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as z,gaussiansPerPage as B,packedGaussianSizeInU32 as V,splatAtlasTextureWidth as H}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as U}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as W}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as G}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as K}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatDepthRenderer as q}from"../webgl-engine/lib/GaussianSplatDepthRenderer.js";import{GaussianSplatRenderer as J}from"../webgl-engine/lib/GaussianSplatRenderer.js";import{GaussianSplatShadows as Y}from"../webgl-engine/lib/GaussianSplatShadows.js";import X from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Z,isInEffectiveScaleRange as ee}from"../../support/layerViewUtils.js";import{TaskPriority as te}from"../../support/Scheduler.js";var Q;const ne=()=>t.getLogger(`esri.views.3d.layers.GaussianSplatLayerView3D`),re=(()=>{let e=new Int16Array(256);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/255));return e})();let $=class extends j(X){static{Q=this}static{this.createRenderableBatchSize=64}static{this.uploadBatchPageCount=16}constructor(e){super(e),this.type=`gaussian-splat-3d`,this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(z*Q.uploadBatchPageCount),this._tmpTilesWithChangedVisibility=[],this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Set,this._pendingTileFadeOuts=new Map,this._pendingFadeDuration=l(0),this._createRenderableAbortController=new AbortController,this.skipHeightModelInfoValidation=!0,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);let t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask(te.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;let e=v();return L(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderer?.clippingBox??null}initialize(){let{view:e}=this;this.addHandles([o(()=>e.qualitySettings.fadeDuration,e=>{this.data&&(this.fadeHelper.onFadeDurationChanged(e),this.updateFadingTexture())})]),this.addResolvingPromise(this._initializeAsync(e))}async _initializeAsync(e){this._initializationController=new AbortController;let{signal:t}=this._initializationController;if(await s(()=>e?.defaultsFromMap.heightModelInfoReady,t),a(t),!this._canProjectWithoutEngine())throw Z(`layer`,this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._wasmLayerId=await M(this,t),a(t),this._renderer=new J({view:e,layerView:this}),this.data=new U(this._renderer,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadows=new Y({view:e,layerView:this}),this.fadeHelper=new W(this),this._prepassDepthRenderer=new q({view:e,layerView:this});let n=new G(this);this._intersectionHandler=n,e.sceneIntersectionHelper.addIntersectionHandler(n),this._elevationProvider=new F({view:e,layerElevationSource:this,intersectionHandler:n}),e.elevationProvider.register(2,this._elevationProvider),this.addHandles([o(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),o(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),c)]),this._suspendedHandle=o(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),c),this.addHandles([o(()=>this._clippingBox,e=>{this._renderer&&(this._renderer.clippingBox=e)},c),o(()=>this.maximumGaussianCount,e=>this._wasm?.setMaximumGaussianSplatCount(Math.min(e,this.data.textureAtlas.maximumSupportedVisibleGaussians)),c)]),this._initializationController=null}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}updateFadingTexture(){this.data.fadingTexture.updateTexture(this.data.textureAtlas.pageAllocator.pageCount)}get _wasm(){return N(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return O(this.layer.elevationInfo)}get elevationRange(){let e=this.fullExtent;return e?.zmin&&e?.zmax?new I(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return ee(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){let e=this._wasm;return this._wasmLayerId<0||e==null?!1:e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating}updatingFlagChanged(){this.notifyChange(`updating`)}async createRenderable(e){if(this.destroyed||this.destroying)throw Error(`IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy`);let{entity3d:t}=e;if(!T(t))throw Error(`entity3D not valid`);let n=t.desc.geometry.prims[t.validPrimitiveIndices[0]].atrbs[0],r=t.assets[n.assetId];if(!r)throw Error(`entity3D not valid`);let i=r.count;if(i===0)return ne().warnOnce(`encountered tile with zero Gaussians`),()=>({memUsageBytes:0,numGaussians:0});let a=null;if(r.dataType===`U32`&&u(r.data))a=r.data;else throw Error(`unexpected GaussianSplat Entity3D asset.data format`);let o=this.extractHeader(a),s=2.048,c=o.tileOrigin.x*s,l=o.tileOrigin.y*s,d=o.tileOrigin.z*s,f=t.desc,p=f.obb.quaternion,m=new R(f.obb.center,f.obb.halfSize,h(...p)),_=this.view.state.isGlobal,v=_?g(this.view.spatialReference).radius:0,y={handle:e.handle,bufferView:a,totalGaussians:i,packedHeader:o.packedHeader,tileOrigin:{x:c,y:l,z:d},invPosScale:o.invPosScale,obb:m,origin:{x:m.centerX,y:m.centerY,z:m.centerZ},isGlobal:_,ellipsoidRadius:v};this._renderablesBeingCreated.add(e.handle);let b;try{b=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(y,e),this._createRenderableAbortController.signal)}catch(t){throw this._renderablesBeingCreated.delete(e.handle),t}return this._renderablesBeingCreated.delete(e.handle),()=>b}*_createRenderableTask(e,t){let{handle:n,bufferView:r,totalGaussians:i,packedHeader:a,tileOrigin:o,invPosScale:s,obb:c,origin:l,isGlobal:u,ellipsoidRadius:d}=e,f=o.x,p=o.y,m=o.z,h=l.x,g=l.y,_=l.z,v=new Float32Array(i*3),y=new Uint32Array(i),b=new Uint32Array(i),x=[],S=Math.ceil(i/B),C=1/0,w=-1/0,T=1/0,E=-1/0,D=0,O=-1,k=0,A=0;for(let e=0;e<i;e++){let n=e*V,i=r[n],a=r[n+1],o=r[n+2],c=r[n+3],l=a&16383,d=a>>>14&16383,x=a>>>28&15|(o&1023)<<4,S=c>>>24,j=re[S],M=(o>>>10&255)+j,N=(o>>>18&255)+j,P=(o>>>26&63|(c&3)<<6)+j,F=M>0?M:0,I=N>0?N:0,L=P>0?P:0,R=F|I<<8|L<<16,z=Math.max(F,I,L),B=l*s+f,H=d*s+p,U=x*s+m;if(v[D]=B-h,v[D+1]=H-g,v[D+2]=U-_,u){let e=B*B+H*H+U*U;T=Math.min(T,e),E=Math.max(E,e)}else C=Math.min(C,U),w=Math.max(w,U);y[e]=i,b[e]=R,z>O&&(O=z),S>k&&(k=S),D+=3,A++,A===Q.createRenderableBatchSize&&(A=0,t.madeProgress()&&(t=yield))}A>0&&t.madeProgress()&&(t=yield),u&&(C=Math.sqrt(T)-d,w=Math.sqrt(E)-d);let j=this._extractGaussianSplatMbsRadiusSquared(O),{fullExtent:M}=this.layer;M?.hasZ&&M.zmax&&M.zmin&&(C=Math.max(C,M.zmin),w=Math.min(w,M.zmax));let N=new I(C,w),P=this.data.textureAtlas,F=this.data.headerTexture;try{for(let e=0;e<S;e+=Q.uploadBatchPageCount){let n=Math.min(S,e+Q.uploadBatchPageCount);for(let t=e;t<n;t++){let e=P.allocatePage();if(e===null&&(this._freeInvisibleTiles(),e=P.allocatePage()),e===null)throw Error(`ran out of gaussian splat memory`);x.push(e)}for(let t=e;t<n;){let e=x[t],o=t+1;for(;o<n&&x[o]===x[o-1]+1;)o++;let s=o-t,c=i-t*B,l=Math.min(c,s*B),u=t*z,d=l*V;this._pageBuffer.set(r.subarray(u,u+d));let f=e*B,p=f%H,m=Math.floor(f/H);P.update(p,m,this._pageBuffer,s),F.update(e,a,s),t=o}t.madeProgress()&&(t=yield)}}catch(e){throw P.freePages(x),e}let L=new K(n,c,x,v,y,b,i,j,k/255,N);return this._tileHandles.set(n,L),this._cacheTileMemory+=L.usedMemory,this._memCache.put(`${L.handle}`,L),{memUsageBytes:L.usedMemory,numGaussians:i}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*9}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._pendingTileFadeOuts.delete(e);let t=this.data?.textureAtlas,n=!1,r=this._tileHandles.get(e);if(r){let i=!1;for(let t of this._pendingTileFadeOuts.values())t.incomingTileHandles.has(e)&&(t.visibilityChange=this._currentLyr3dVisibilityChange+1,i=!0);i&&(this._currentLyr3dVisibilityChange++,n=!0),r.lifecycleState===0?this._cacheTileMemory-=r.usedMemory:(n=!0,this.fadeHelper.onTileDiscarded(r),this._usedTileMemory-=r.usedMemory,this._intersectionHandler.removeTile(r)),t&&r.pageIds.forEach(e=>t.freePage(e)),this.freeObject(r),this._tileHandles.delete(e)}n&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(e.length,t=>{for(let{obb:n}of e)if(!t(n))break})}setRenderableVisibility(e,t,n){let r=this.fadeHelper.updateFadeDuration(),i=new ie(this._currentLyr3dVisibilityChange+1),a=new Set,o=!1;for(let s=0;s<n;s++){let n=this._tileHandles.get(e[s]);if(!n)continue;let c=t[s]?this._prepareTileFadeIn(n,r):this._prepareTileFadeOut(n,i);t[s]&&i.incomingTileHandles.add(n.handle),c&&a.add(n.handle),o||=c}if(o){if(this._currentLyr3dVisibilityChange++,this._pendingFadeDuration=r,this._updatePendingTileHandoffs(a,i),i.incomingTileHandles.size===0)for(let e of this._tileFadeInsAwaitingInitialSort)i.incomingTileHandles.add(e);this.updateGaussians()}}_updatePendingTileHandoffs(e,t){for(let n of new Set(this._pendingTileFadeOuts.values())){if(n===t)continue;let r=!1;for(let i of e)n.incomingTileHandles.has(i)&&(r=!0,t.incomingTileHandles.size>0&&n.incomingTileHandles.delete(i));if(r){n.visibilityChange=t.visibilityChange;for(let e of t.incomingTileHandles)n.incomingTileHandles.add(e)}}}_prepareTileFadeIn(e,t){let n=this._pendingTileFadeOuts.delete(e.handle);return e.lifecycleState===2?(this.fadeHelper.fadeTile(e,0,t),!1):this._tileFadeInsAwaitingInitialSort.has(e.handle)?n:(e.lifecycleState===0&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.add(e.handle),!0)}_prepareTileFadeOut(e,t){let n=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return n&&e.lifecycleState===1&&(this.moveTileToCache(e),e.lifecycleState=0),e.lifecycleState===2?this._pendingTileFadeOuts.has(e.handle)?n:(this._pendingTileFadeOuts.set(e.handle,t),!0):n}_onSortComplete(e,t){let n=this._tmpTilesWithChangedVisibility;n.length=0,this._triggerFadeIns(e,n);let r=this._triggerFadeOuts(t,n);n.length>0&&this.notifyTileObbsChanged(n),r&&this.updateGaussians()}_triggerFadeIns(e,t){for(let n of e)this._tileHandles.get(n.handle)===n&&this._tileFadeInsAwaitingInitialSort.delete(n.handle)&&(n.lifecycleState=2,t.push(n),this.fadeHelper.fadeTile(n,0,this._pendingFadeDuration))}_triggerFadeOuts(e,t){let n=!1;for(let t of this._pendingTileFadeOuts.values())if(e>=t.visibilityChange){n=!0;break}if(!n)return!1;let r=this._pendingFadeDuration,i=this._pendingFadeDuration;for(let e of this._tileHandles.values()){let{fadeDirection:t,fadeDuration:n,fadeProgress:a}=e;if(t!==0||n==null||a==null)continue;let o=n*(1-a);r=l(Math.max(r,o)),i=l(Math.max(i,n))}let a=!1;for(let[n,o]of this._pendingTileFadeOuts){if(e<o.visibilityChange)continue;this._pendingTileFadeOuts.delete(n);let s=this._tileHandles.get(n);if(s){let e=s.lifecycleState===2,n=s.opacityModifier===1?r:i;this.fadeHelper.fadeTile(s,1,n),e&&s.lifecycleState===0&&(t.push(s),a=!0)}}return a}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(E(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(E(e.handle),e)}destroy(){this._initializationController=n(this._initializationController),this._createRenderableAbortController.abort(),P(this),this._suspendedHandle&&=r(this._suspendedHandle),this._intersectionHandler&&=(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(this._tileHandles.size,e=>{for(let{obb:t}of this._tileHandles.values())if(!e(t))break}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadows=i(this._shadows),this._prepassDepthRenderer=i(this._prepassDepthRenderer),this._renderer=i(this._renderer),this._memCache.destroy(),this.data=i(this.data)}_canProjectWithoutEngine(){if(this.view.state.viewingMode===1||b(this.view.renderSpatialReference)||x(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&S(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(this.layer.esriCrsSpatialReference.vcsWkid===115700)return!1;let e=D(this.layer.esriCrsSpatialReference);if(!e){let t=this.layer.esriCrsSpatialReference,n=C(t),r=`meters`;!n&&t.wkid&&t.wkid!==-1&&(r=d(w.units[w[t.wkid]])),r&&(e=new _({heightModel:`gravity-related-height`,heightUnit:r}))}let t=this.view.heightModelInfo;return this._useEsriCrs=y(e,t,!1)===0,this._useEsriCrs&&(e&&(this._metersPerVCSUnit=f(1,e.heightUnit,`meters`)),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(!e?.offset)this._wasm?.setLayerOffset(this,0);else if(!this._useEsriCrs)this._wasm?.setLayerOffset(this,O(e));else{let t=k(e?.unit)/this._metersPerVCSUnit,n=e?.offset??0;this._wasm?.setLayerOffset(this,n*t)}}_slicePlaneEnabledChanged(e){this._renderer&&(this._renderer.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){let e=[];for(let t of this._tileHandles.values())t.lifecycleState!==0&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange(`updating`)}get maximumGaussianCount(){return this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*this.view.quality}set maximumGaussianCount(e){this._set(`maximumGaussianCount`,e)}_freeInvisibleTiles(){for(let e of this._tileHandles.values())e.lifecycleState===0&&!this._renderablesBeingCreated.has(e.handle)&&this._deleteTile(e)}extractHeader(e){let t=e.length-4,n=this.reinterpretU32AsFloat(e[t]),r=this.reinterpretU32AsFloat(e[t+1]),i=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(e[t+3]&255));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:n,y:r,z:i},invPosScale:a}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(n=>{n.lifecycleState===0?t++:e++});let n=this.data?.textureAtlasMemory??0,r=this.data?.headerTextureMemory??0,i=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,o=this.data?.sortBufferMemory??0;return new A(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,n,r,i,a,o)}get test(){}};e([p()],$.prototype,`layer`,void 0),e([p({readOnly:!0})],$.prototype,`_clippingBox`,null),e([p()],$.prototype,`elevationOffset`,null),e([p({readOnly:!0})],$.prototype,`visibleAtCurrentScale`,null),e([p()],$.prototype,`fullExtentInLocalViewSpatialReference`,void 0),e([p()],$.prototype,`maximumGaussianCount`,null),$=Q=e([m(`esri.views.3d.layers.GaussianSplatLayerView3D`)],$);class ie{constructor(e){this.visibilityChange=e,this.incomingTileHandles=new Set}}const ae=$;export{ae as default};
@@ -11,11 +11,11 @@ import{EvaluateAmbientLighting as e}from"./EvaluateAmbientLighting.glsl.js";impo
11
11
  `),p.uniforms.add(i).code.add(d`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
12
12
  float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
13
13
  return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
14
- }`);let w=S?`globalIlluminationOcclusion`:`ssao`,T=S?`factorDirect`:`0.0`,E=S?`factorAmbient`:`1.0`;switch(p.constants.add(`mainLightIrradianceScale`,`float`,S?.75:1),p.constants.add(`ambientIrradianceScale`,`float`,S?1.5:1),S&&(p.uniforms.add(new u(`factorDirect`,e=>e.globalIlluminationDirectFactor),new u(`factorAmbient`,e=>e.globalIlluminationAmbientFactor)),p.constants.add(`globalIlluminationEmissionCompressionWeight`,`float`,.75),p.code.add(d`vec3 evaluateGlobalIlluminationOcclusion() {
15
- return min(1.2 * readGlobalIlluminationOcclusion(), 1.0);
14
+ }`);let w=S?`globalIlluminationOcclusion`:`ssao`,T=S?`factorDirect`:`0.0`,E=S?`factorAmbient`:`1.0`;switch(p.constants.add(`mainLightIrradianceScale`,`float`,S?.75:1),p.constants.add(`ambientIrradianceScale`,`float`,S?1.5:1),S&&(p.uniforms.add(new u(`factorDirect`,e=>e.globalIlluminationDirectFactor),new u(`factorAmbient`,e=>e.globalIlluminationAmbientFactor)),p.constants.add(`globalIlluminationOcclusionBoost`,`float`,1.2),p.constants.add(`globalIlluminationEmissionBoost`,`float`,2.25),p.constants.add(`globalIlluminationEmissionCompressionWeight`,`float`,.75),p.code.add(d`vec3 evaluateGlobalIlluminationOcclusion() {
15
+ return min(globalIlluminationOcclusionBoost * readGlobalIlluminationOcclusion(), 1.0);
16
16
  }
17
17
  vec3 evaluateGlobalIlluminationEmission(vec3 albedoLinear) {
18
- vec3 emission = 2.25 * (0.75 * albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
18
+ vec3 emission = globalIlluminationEmissionBoost * (0.75 * albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
19
19
  vec3 compressedEmission = emission / (emission + 1.0);
20
20
  return mix(emission, compressedEmission, globalIlluminationEmissionCompressionWeight);
21
21
  }`)),y){case 0:case 4:case 3:p.include(a),p.code.add(d`
@@ -4,7 +4,7 @@ void discardByStippleAlpha(float stippleAlpha, float threshold) {}
4
4
  vec4 blendStipple(vec4 color, float stippleAlpha) { return color; }`);return}let p=!(d.draped&&d.stipplePreferContinuous),{vertex:g,fragment:_}=u;d.draped||(n(g,d),g.uniforms.add(new a(`worldToScreenPerDistanceRatio`,({camera:e})=>1/e.screenPixelSizePerDistance)).code.add(s`float computeWorldToScreenRatio(vec3 segmentCenter) {
5
5
  float segmentDistanceToCamera = length(segmentCenter - cameraPosition);
6
6
  return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
7
- }`)),u.varyings.add(`vStippleDistance`,`float`),u.varyings.add(`vStippleDistanceLimits`,`vec2`),u.varyings.add(`vStipplePatternStretch`,`float`),g.code.add(s`
7
+ }`)),u.varyings.add(`vStippleDistance`,`float`),u.varyings.add(`vStippleLimitsAndCaps`,`vec4`),u.varyings.add(`vStipplePatternStretch`,`float`),g.code.add(s`
8
8
  float discretizeStippleDistanceToScreenRatio(float stippleDistanceToScreenRatio) {
9
9
  float step = ${s.float(h)};
10
10
 
@@ -35,9 +35,10 @@ return worldToScreenPerDistanceRatio / segmentDistanceToCamera;
35
35
  }
36
36
  return vec2(startPseudoScreen, startPseudoScreen + segmentLengthPseudoScreen);
37
37
  }
38
- `),_.uniforms.add(new l(`stipplePatternTexture`,e=>e.stippleTexture),new o(`stipplePatternPixelSizeInv`,e=>1/m(e))),d.stippleOffColorEnabled&&_.uniforms.add(new i(`stippleOffColor`,e=>f(e.stippleOffColor))),u.include(t);let v=d.worldSized&&d.imagePattern,{usePerspectiveCorrectStipple:y}=d,b=!d.worldSized;y&&u.varyings.add(`vStipplePerspective`,`vec4`),v?(u.varyings.add(`vStippleV`,`float`),u.fragment.include(e),_.code.add(s`vec4 getStippleColor(out bool isClamped) {
39
- vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
40
- isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;
38
+ `),_.uniforms.add(new l(`stipplePatternTexture`,e=>e.stippleTexture),new o(`stipplePatternPixelSizeInv`,e=>1/m(e))),d.stippleOffColorEnabled&&_.uniforms.add(new i(`stippleOffColor`,e=>f(e.stippleOffColor))),u.include(t);let v=d.worldSized&&d.imagePattern,{usePerspectiveCorrectStipple:y}=d;y&&u.varyings.add(`vStipplePerspective`,`vec4`),v?(u.varyings.add(`vStippleV`,`float`),u.fragment.include(e),_.code.add(s`vec4 getStippleColor(out bool isClamped) {
39
+ vec2 aaCorrectedLimits = vStippleLimitsAndCaps.xy + vec2(1.0, -1.0) / gl_FragCoord.w;
40
+ isClamped = (vStippleLimitsAndCaps.z <= 0.0 && vStippleDistance < aaCorrectedLimits.x) ||
41
+ (vStippleLimitsAndCaps.w <= 0.0 && vStippleDistance > aaCorrectedLimits.y);
41
42
  float u = vStippleDistance * stipplePatternPixelSizeInv;
42
43
  float v = vStippleV == -1.0 ? 0.5 : vStippleV;
43
44
  return texture(stipplePatternTexture, vec2(u, v));
@@ -61,7 +62,21 @@ float opacity = mixExternalOpacity(color.a, 1.0, stippleColor.a, mixMode);
61
62
  return vec4(col, opacity);
62
63
  }`)):_.code.add(s`
63
64
  float getStippleSDF(out bool isClamped) {
64
- float stippleDistance = noPerspectiveRead(${b?`clamp(vStippleDistance, vStippleDistanceLimits.x, vStippleDistanceLimits.y)`:`vStippleDistance`});
65
+ ${c(d.worldSized,s`
66
+ float unclampedStippleDistance = noPerspectiveRead(vStippleDistance);
67
+ float stippleDistancePerPixel = length(vec2(dFdx(unclampedStippleDistance), dFdy(unclampedStippleDistance)));
68
+ `,s`float stippleDistancePerPixel = 1.0;`)}
69
+
70
+ bool clampStart = vStippleLimitsAndCaps.z <= 0.0;
71
+ bool clampEnd = vStippleLimitsAndCaps.w <= 0.0;
72
+ float stippleDistance = vStippleDistance;
73
+ if (clampStart) {
74
+ stippleDistance = max(stippleDistance, vStippleLimitsAndCaps.x);
75
+ }
76
+ if (clampEnd) {
77
+ stippleDistance = min(stippleDistance, vStippleLimitsAndCaps.y);
78
+ }
79
+ stippleDistance = noPerspectiveRead(stippleDistance);
65
80
  float lineSizeInv = noPerspectiveRead(vLineSizeInv);
66
81
 
67
82
  ${c(y,s`
@@ -75,10 +90,9 @@ return vec4(col, opacity);
75
90
  stippleDistance = mix(stipplePerspective.x, stipplePerspective.y, perspectiveFactor);
76
91
  `)}
77
92
 
78
- ${b?s`
79
- vec2 aaCorrectedLimits = vStippleDistanceLimits + vec2(1.0, -1.0) / gl_FragCoord.w;
80
- isClamped = vStippleDistance < aaCorrectedLimits.x || vStippleDistance > aaCorrectedLimits.y;
81
- `:s`isClamped = false;`}
93
+ vec2 aaCorrectedLimits = vStippleLimitsAndCaps.xy + vec2(1.0, -1.0) * stippleDistancePerPixel / gl_FragCoord.w;
94
+ isClamped = (clampStart && vStippleDistance < aaCorrectedLimits.x) ||
95
+ (clampEnd && vStippleDistance > aaCorrectedLimits.y);
82
96
 
83
97
  float u = stippleDistance * stipplePatternPixelSizeInv * lineSizeInv;
84
98
  u = fract(u);
@@ -203,6 +203,7 @@ export abstract class DOMContainer {
203
203
  * view.ui.components = [ "attribution" ];
204
204
  */
205
205
  get ui(): DefaultUI;
206
+ /** @deprecated */
206
207
  set ui(value: DefaultUIProperties);
207
208
  /**
208
209
  * The width of the view in pixels read from the view container element.
@@ -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 n from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import{createScalar as i,createLength as a,toUnit as o}from"../../../core/quantity.js";import{generateUUID as s}from"../../../core/uuid.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{isWebMercator as u,isGeographic as d}from"../../../geometry/support/spatialReferenceUtils.js";import{createViewAlignedCoordinateSystem as f}from"./surfaceCoordinateSystems.js";import{knownFieldDisplayOrders as p}from"./types.js";import{createGeographicCoordinate as m}from"../../interactive/tooltip/fields/parsingAndFormattingUtils.js";import{elevationFromPoint as h}from"../../support/euclideanLengthMeasurementUtils.js";const g={x:p.Coordinates+10,y:p.Coordinates+11,elevation:p.Coordinates+12};let _=class extends t{constructor(e){super(e)}normalizeCtorArgs(e){let{drawTool:t,plugin:n,...r}=e;return{_drawTool:t,_plugin:n,...r}}get positionOfLastUserInput(){return this._drawTool.positionOfLastUserInput}get elevationConstraint(){return this._drawTool.tooltipManager?.elevationConstraint}getSession(e){return this._drawTool.editSessionManager.getSession(e)}readBooleanSetting(e){let t=this._plugin.configuration?.uniqueId;if(t)return this._drawTool.readPluginSettingValue(t,e)}createInteractiveHandle(e,t){let r=this._drawTool.interactiveHandleManager,a=this._drawTool.tooltipManager,o=this._plugin,c=this.session,l=this._drawTool.coordinateHelper;if(!r||!a)throw new n(`draw-tool:interactive-handle-missing-dependencies`,`Attempted to set up an interactive handle without required dependencies.`);let f=e.name??s(),p=e.defaultCaptureMode??`capture-always`,h=r.registerHandle(o,{...e,name:f,editSession:c,defaultCaptureMode:p,captureMode:p});if(this._drawTool.addPromise(r.setupManipulatorForHandle(h,this._drawTool.lastScreenPosition,this._drawTool.movementCommandContext)),!t?.disableDefaultXYFields){let e=l.spatialReference;u(e)||d(e)?(a.createMeasuredField(o,{id:Symbol(`tooltip-long-${f}`),preset:`longitude`,getMeasurementInput:()=>h.outputMapPosition,measure:async e=>m(e?.longitude),fieldProperties:{displayOrder:g.x},fieldFilters:{appliesToHandlesWithName:f}}),a.createMeasuredField(o,{id:Symbol(`tooltip-lat-${f}`),preset:`latitude`,getMeasurementInput:()=>h.outputMapPosition,measure:async e=>m(e?.latitude),fieldProperties:{displayOrder:g.y},fieldFilters:{appliesToHandlesWithName:f}})):(a.createMeasuredField(o,{id:Symbol(`tooltip-x-${f}`),preset:`x`,getMeasurementInput:()=>h.outputMapPosition,measure:async e=>e?i(e.x):null,fieldProperties:{displayOrder:g.x},fieldFilters:{appliesToHandlesWithName:f}}),a.createMeasuredField(o,{id:Symbol(`tooltip-y-${f}`),preset:`y`,getMeasurementInput:()=>h.outputMapPosition,measure:async e=>e?i(e.y):null,fieldProperties:{displayOrder:g.y},fieldFilters:{appliesToHandlesWithName:f}})),this._drawTool.hasZ&&h.role===`primary`&&a.createMeasuredField(o,{id:Symbol(`tooltip-z-${f}`),preset:`elevation`,getMeasurementInput:()=>h.outputMapPosition,measure:async(e,t)=>this.measureElevation(e,t.inputUnitInfos.verticalLength.unit),fieldProperties:{displayOrder:g.elevation},fieldFilters:{appliesToHandlesWithName:f}})}return h}removeInteractiveHandle(e){let t=e;this._drawTool.interactiveHandleManager?.unregisterHandle(this._plugin,t)}createConstraint(e,t){this._drawTool.interactiveHandleManager?.registerCustomConstraint(this._plugin,e,t)}removeConstraint(e){this._drawTool.interactiveHandleManager?.unregisterCustomConstraint(this._plugin,e)}createCustomField(e){if(!this._drawTool.tooltipManager)throw new n(`draw-tool:tooltip-manager-missing`,`Attempted to create a field without access to a tooltip manager.`);return this._drawTool.tooltipManager.createCustomField(this._plugin,e)}createMeasuredField(e){if(!this._drawTool.tooltipManager)throw new n(`draw-tool:tooltip-manager-missing`,`Attempted to create a field without access to a tooltip manager.`);return this._drawTool.tooltipManager.createMeasuredField(this._plugin,e)}requestComplete(){this._drawTool.complete(this._plugin)}requestCancel(e){this._drawTool.lifecycleManager.cancel(this._plugin)}requestBeginDownstreamPlugin(e,t){this._drawTool.lifecycleManager.begin([e],this._plugin,t?.cancelExisting)}async measureLength(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureLength(a,t,e,r)}async measureArea(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureArea(a,t,e,r)}async measureDistance(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureDistance(a,t,e,r)}measureElevation(e,t){let n=this._drawTool,r=h(e);if(!r){let e=n.surfaceManager?.metersPerVerticalUnit;e&&(r=a(n.defaultZ*e,`meters`))}return t&&r&&r.unit!==t?o(r,t):r}getGlobalState(){return this._drawTool.globalStateManager.getGlobalState()}setGlobalState(e,t){this._drawTool.globalStateManager.setGlobalState(this._plugin,e,t)}addOrUpdateGraphic(e,t){let{_plugin:n,_drawTool:i}=this,a=i.renderer;a?.addOrUpdateGraphic(e,t),n.hasHandles(e)||n.addHandles(r(()=>a?.removeGraphic(e)),e)}addOrUpdateVisual(e,t){let n=this._plugin,i=this._drawTool.renderer;i?.addOrUpdateVisual(e,t),n.hasHandles(e)||n.addHandles(r(()=>i?.removeVisual(e)),e)}removeGraphic(e){this._plugin.removeHandles(e)}removeVisual(e){this._plugin.removeHandles(e)}getViewInformation(){return this._drawTool.view}getViewAlignedSurfaceCoordinateSystem(e){let{view:t,coordinateHelper:n}=this._drawTool;return!t||!n?null:f(t,n.pointToVector(e))}};e([c()],_.prototype,`_plugin`,void 0),e([c()],_.prototype,`_drawTool`,void 0),e([c({nonNullable:!0})],_.prototype,`session`,void 0),e([c()],_.prototype,`positionOfLastUserInput`,null),e([c()],_.prototype,`elevationConstraint`,null),_=e([l(`esri.views.draw.support.PluginContext`)],_);export{_ as PluginContext};
2
+ import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import n from"../../../core/Error.js";import{makeHandle as r}from"../../../core/handleUtils.js";import{createScalar as i,createLength as a,toUnit as o}from"../../../core/quantity.js";import{generateUUID as s}from"../../../core/uuid.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{isWebMercator as u,isGeographic as d}from"../../../geometry/support/spatialReferenceUtils.js";import{getEffectiveElevationMode as f}from"../../../support/elevationInfoUtils.js";import{createViewAlignedCoordinateSystem as p}from"./surfaceCoordinateSystems.js";import{knownFieldDisplayOrders as m}from"./types.js";import{createGeographicCoordinate as h}from"../../interactive/tooltip/fields/parsingAndFormattingUtils.js";import{elevationFromPoint as g}from"../../support/euclideanLengthMeasurementUtils.js";const _={x:m.Coordinates+10,y:m.Coordinates+11,elevation:m.Coordinates+12};let v=class extends t{constructor(e){super(e)}normalizeCtorArgs(e){let{drawTool:t,plugin:n,...r}=e;return{_drawTool:t,_plugin:n,...r}}get positionOfLastUserInput(){return this._drawTool.positionOfLastUserInput}get elevationConstraint(){return this._drawTool.tooltipManager?.elevationConstraint}getSession(e){return this._drawTool.editSessionManager.getSession(e)}readBooleanSetting(e){let t=this._plugin.configuration?.uniqueId;if(t)return this._drawTool.readPluginSettingValue(t,e)}createInteractiveHandle(e,t){let r=this._drawTool.interactiveHandleManager,a=this._drawTool.tooltipManager,o=this._plugin,c=this.session,l=this._drawTool.coordinateHelper;if(!r||!a)throw new n(`draw-tool:interactive-handle-missing-dependencies`,`Attempted to set up an interactive handle without required dependencies.`);let p=e.name??s(),m=e.defaultCaptureMode??`capture-always`,g=r.registerHandle(o,{...e,name:p,editSession:c,defaultCaptureMode:m,captureMode:m});if(this._drawTool.addPromise(r.setupManipulatorForHandle(g,this._drawTool.lastScreenPosition,this._drawTool.movementCommandContext)),!t?.disableDefaultXYFields){let e=l.spatialReference;if(u(e)||d(e)?(a.createMeasuredField(o,{id:Symbol(`tooltip-long-${p}`),preset:`longitude`,getMeasurementInput:()=>g.outputMapPosition,measure:async e=>h(e?.longitude),fieldProperties:{displayOrder:_.x},fieldFilters:{appliesToHandlesWithName:p}}),a.createMeasuredField(o,{id:Symbol(`tooltip-lat-${p}`),preset:`latitude`,getMeasurementInput:()=>g.outputMapPosition,measure:async e=>h(e?.latitude),fieldProperties:{displayOrder:_.y},fieldFilters:{appliesToHandlesWithName:p}})):(a.createMeasuredField(o,{id:Symbol(`tooltip-x-${p}`),preset:`x`,getMeasurementInput:()=>g.outputMapPosition,measure:async e=>e?i(e.x):null,fieldProperties:{displayOrder:_.x},fieldFilters:{appliesToHandlesWithName:p}}),a.createMeasuredField(o,{id:Symbol(`tooltip-y-${p}`),preset:`y`,getMeasurementInput:()=>g.outputMapPosition,measure:async e=>e?i(e.y):null,fieldProperties:{displayOrder:_.y},fieldFilters:{appliesToHandlesWithName:p}})),this._drawTool.hasZ&&g.role===`primary`){let e=a.createMeasuredField(o,{id:Symbol(`tooltip-z-${p}`),preset:`elevation`,getMeasurementInput:()=>g.outputMapPosition,measure:async(e,t)=>this.measureElevation(e,t.inputUnitInfos.verticalLength.unit),fieldProperties:{displayOrder:_.elevation},fieldFilters:{appliesToHandlesWithName:p}}).field,{view:t,hasZ:n,elevationInfo:r}=this._drawTool;t.type===`3d`&&f(n,r)!==`absolute-height`&&!e.locked&&e.lock(this.measureElevation(null))}}return g}removeInteractiveHandle(e){let t=e;this._drawTool.interactiveHandleManager?.unregisterHandle(this._plugin,t)}createConstraint(e,t){this._drawTool.interactiveHandleManager?.registerCustomConstraint(this._plugin,e,t)}removeConstraint(e){this._drawTool.interactiveHandleManager?.unregisterCustomConstraint(this._plugin,e)}createCustomField(e){if(!this._drawTool.tooltipManager)throw new n(`draw-tool:tooltip-manager-missing`,`Attempted to create a field without access to a tooltip manager.`);return this._drawTool.tooltipManager.createCustomField(this._plugin,e)}createMeasuredField(e){if(!this._drawTool.tooltipManager)throw new n(`draw-tool:tooltip-manager-missing`,`Attempted to create a field without access to a tooltip manager.`);return this._drawTool.tooltipManager.createMeasuredField(this._plugin,e)}requestComplete(){this._drawTool.complete(this._plugin)}requestCancel(e){this._drawTool.lifecycleManager.cancel(this._plugin)}requestBeginDownstreamPlugin(e,t){this._drawTool.lifecycleManager.begin([e],this._plugin,t?.cancelExisting)}async measureLength(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureLength(a,t,e,r)}async measureArea(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureArea(a,t,e,r)}async measureDistance(e,t,n,r){let{_drawTool:i,_plugin:a}=this;if(n!==`tooltip`||i.tooltipManager?.effectiveEnabled)return await i.measurementManager.measureDistance(a,t,e,r)}measureElevation(e,t){let n=this._drawTool,r=g(e);if(!r){let e=n.surfaceManager?.metersPerVerticalUnit;e&&(r=a(n.defaultZ*e,`meters`))}return t&&r&&r.unit!==t?o(r,t):r}getGlobalState(){return this._drawTool.globalStateManager.getGlobalState()}setGlobalState(e,t){this._drawTool.globalStateManager.setGlobalState(this._plugin,e,t)}addOrUpdateGraphic(e,t){let{_plugin:n,_drawTool:i}=this,a=i.renderer;a?.addOrUpdateGraphic(e,t),n.hasHandles(e)||n.addHandles(r(()=>a?.removeGraphic(e)),e)}addOrUpdateVisual(e,t){let n=this._plugin,i=this._drawTool.renderer;i?.addOrUpdateVisual(e,t),n.hasHandles(e)||n.addHandles(r(()=>i?.removeVisual(e)),e)}removeGraphic(e){this._plugin.removeHandles(e)}removeVisual(e){this._plugin.removeHandles(e)}getViewInformation(){return this._drawTool.view}getViewAlignedSurfaceCoordinateSystem(e){let{view:t,coordinateHelper:n}=this._drawTool;return!t||!n?null:p(t,n.pointToVector(e))}};e([c()],v.prototype,`_plugin`,void 0),e([c()],v.prototype,`_drawTool`,void 0),e([c({nonNullable:!0})],v.prototype,`session`,void 0),e([c()],v.prototype,`positionOfLastUserInput`,null),e([c()],v.prototype,`elevationConstraint`,null),v=e([l(`esri.views.draw.support.PluginContext`)],v);export{v as PluginContext};
@@ -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{createTask as n}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import o from"../../../../core/ReactiveMap.js";import{watch as s,syncAndInitial as c,initial as l}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{isLoaded as p,load as m}from"../../../../geometry/coordinateFormatter.js";import{absoluteHeightElevationInfo as h}from"../../../../support/elevationInfoUtils.js";import{ManagedTooltipField as g}from"../ManagedTooltipField.js";import{getConstraintContext as _}from"../../../interactive/sketch/constraintUtils.js";import{makeTooltip as v}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{makeScalarField as y,makeOrientationField as b,makeAreaField as x,makeLengthField as S,makeRadiusField as C,makeTotalLengthField as w,makeSizeField as T,makeScaleField as E,makeYField as D,makeXField as O,makeLongitudeField as k,makeLatitudeField as A,makeElevationField as j,makeDistanceField as M,makeDirectionField as N}from"../../../interactive/tooltip/fields/fields.js";import{TooltipField as P}from"../../../interactive/tooltip/fields/TooltipField.js";import{DynamicTooltipInfo as F,isKnownConstraintField as I}from"../../../interactive/tooltip/infos/DynamicTooltipInfo.js";let L=class extends t{constructor(e){super(e),this._pluginTooltipFieldRegistry=new o,this._updatingHandles=new f,this._coordinateFormatterLoadTask=null,this._constraintSnapshot=null,this.constraintsEnabled=!0,this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled=!1,this.enabled=!0}initialize(){this.addHandles([s(()=>[this.effectiveEnabled,this.context?.view,this.context?.toolOptions],([e,t,n])=>{let{context:r}=this;e&&t&&n?(this._tooltipInfo??=new F({toolOptions:n,getAllFields:()=>this.allFields,getActiveHandle:()=>this.effectiveActiveHandle,getHelpMessageKey:()=>this.context?.getHelpMessageKey(),viewType:t.type}),this._tooltip||this._setupTooltip(r)):(this._tooltip=a(this._tooltip),this._tooltipInfo=a(this._tooltipInfo),this.inputModeHandle=null)},c)])}destroy(){this._tooltip=a(this._tooltip),this._tooltipInfo=a(this._tooltipInfo)}get context(){return this.getDependencies?.()}get focusedHandle(){return this.context?.getActiveHandle?.()}get allHandles(){return this.context?.getAllHandles?.()}get effectiveActiveHandle(){return this._tooltip?.isInInputMode?this.inputModeHandle:this.focusedHandle}get updating(){return this._updatingHandles.updating}get tooltip(){return this._tooltip}get tooltipInfo(){return this._tooltipInfo}get elevationConstraint(){return this.getConstraints(this.focusedHandle)?.elevation}get allFields(){return Array.from(this._pluginTooltipFieldRegistry.values()).flatMap(e=>Array.from(e.values()))}get effectiveEnabled(){return this.enabled&&(this.context?.toolOptions.tooltips.effectiveEnabled||this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled)}getConstraints(e){let{tooltipInfo:t,context:n}=this,{view:r,editGeometryOperations:i,elevationInfo:a,toolOptions:o}=n??{},s=this.getLastScreenPosition?.();if(!s||!r||!t||!i||!o)return null;let{coordinateHelper:c,spatialReference:l}=i.data,u=r.toMap(s);if(!u)return null;let d=_(u,r,l,a??h,c.hasZ(),o.values.effectiveDirectionMode);return{...V(t.getConstraintFieldsForHandle(e)),context:d}}storeConstraintSnapshot(){let e=this.tooltipInfo?.allFields.filter(e=>e.locked&&!e.unlockOnVertexPlacement).filter(I);if(!e?.length){this._constraintSnapshot=null;return}this._constraintSnapshot=V(e)}unlockOnVertexPlacement(){this.tooltipInfo?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&(e.committed=null)})}unregisterPluginFields(e){let t=this._pluginTooltipFieldRegistry.get(e);t?.forEach(e=>e.destroy()),t?.clear(),this._pluginTooltipFieldRegistry.delete(e)}createMeasuredField(e,{id:t,preset:n,getMeasurementInput:r,measure:i,fieldProperties:a,fieldFilters:o}){let c=this._getOrCreateField(e,t,n,a,o);return c.registerMeasurement(r,i,()=>this.tooltipInfo?.renderContext),c.addHandles(s(()=>this.tooltipInfo?.isEffectiveVisibleField(c.field),e=>c.enabled=!!e,l)),c}createCustomField(e,{id:t,preset:n,fieldProperties:r,fieldFilters:i}){return this._getOrCreateField(e,t,n,r,i)}_setupTooltip(e){let t=this._tooltip=v(()=>({view:e.view,options:e.toolOptions.tooltips,info:this.tooltipInfo}));t.addHandles([s(()=>this.focusedHandle,e=>{(e&&(!t.isInInputMode||this.inputModeHandle==null)||this.inputModeHandle&&!this.allHandles?.includes(this.inputModeHandle))&&(this.inputModeHandle=e)},c),s(()=>this.focusedHandle?.screenPosition,e=>{e?(t.position=e,t.hidden=!1):t.hidden=!0},c),t.on(`commit`,()=>{this.context?.notifyTooltipsChanged()})]),!this._coordinateFormatterLoadTask&&!p()&&(this._coordinateFormatterLoadTask=n(()=>m()),this.addHandles(this._coordinateFormatterLoadTask),this._updatingHandles.addPromise(this._coordinateFormatterLoadTask.promise))}_getOrCreateField(e,t,n,r,a){let s=i(this._pluginTooltipFieldRegistry,e,()=>new o);if(s.has(t))return s.get(t);let c=B(n,r),l=new g({field:c,displayGroup:r?.displayGroup,...a});s.set(t,l);let u=I(c)?this._constraintSnapshot?.[c.name]:void 0;return u&&c.lock(u),l}};e([u()],L.prototype,`_updatingHandles`,void 0),e([u()],L.prototype,`_tooltip`,void 0),e([u()],L.prototype,`_tooltipInfo`,void 0),e([u()],L.prototype,`_coordinateFormatterLoadTask`,void 0),e([u()],L.prototype,`_constraintSnapshot`,void 0),e([u()],L.prototype,`getDependencies`,void 0),e([u()],L.prototype,`getLastScreenPosition`,void 0),e([u()],L.prototype,`context`,null),e([u()],L.prototype,`inputModeHandle`,void 0),e([u()],L.prototype,`focusedHandle`,null),e([u()],L.prototype,`allHandles`,null),e([u()],L.prototype,`effectiveActiveHandle`,null),e([u()],L.prototype,`updating`,null),e([u()],L.prototype,`tooltip`,null),e([u()],L.prototype,`tooltipInfo`,null),e([u()],L.prototype,`constraintsEnabled`,void 0),e([u()],L.prototype,`elevationConstraint`,null),e([u()],L.prototype,`allFields`,null),e([u()],L.prototype,`keepTooltipAliveEvenWhenTooltipsAreNotEnabled`,void 0),e([u()],L.prototype,`enabled`,void 0),e([u()],L.prototype,`effectiveEnabled`,null),L=e([d(`esri.views.draw.support.managers.TooltipManager`)],L);function R(e){return e==null||!(`unit`in e)||!(`rotationType`in e)?null:e}function z(e){return e==null||`rotationType`in e?null:e}function B(e,t){let n=t?{...t}:{};switch(delete n.displayGroup,e){case`area`:return x({...n,name:`area`});case`direction`:return N({...n,name:`direction`});case`distance`:return M({...n,name:`distance`});case`elevation`:{let e=j({...n,name:`elevation`});return e.showAsZ=!0,e}case`latitude`:return A({...n,name:`y`});case`longitude`:return k({...n,name:`x`});case`x`:return O({...n,name:`x`});case`y`:return D({...n,name:`y`});case`orientation`:return b({...n,name:`orientation`});case`scale`:return E({...n,name:`scale`});case`size`:return T({...n,name:`size`});case`totalLength`:return w({...n,name:`totalLength`});case`radius`:return C({...n,name:`radius`});case`generic-length`:return S({...n,name:null});case`generic-area`:return x({...n,name:null});case`generic-angle`:return b({...n,name:null});case`generic-scalar`:return y({...n,name:null});default:if(!n)throw new r(`draw-tool:tooltips:invalid-field-config`,`Attempted to create a tooltip without a preset definition and without tooltip configuration.`);return new P(n)}}function V(e){let t={};for(let n of e)switch(n.name){case`direction`:t[n.name]=n.committed;break;case`distance`:case`elevation`:t[n.name]=n.committed;break;case`x`:t[n.name]=z(n.committed),t.longitude=R(n.committed);break;case`y`:t[n.name]=z(n.committed),t.latitude=R(n.committed)}return t}export{L as TooltipManager};
2
+ import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import{createTask as n}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import{getOrCreateMapValue as i}from"../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../core/maybe.js";import o from"../../../../core/ReactiveMap.js";import{watch as s,syncAndInitial as c,initial as l}from"../../../../core/reactiveUtils.js";import{property as u}from"../../../../core/accessorSupport/decorators.js";import{subclass as d}from"../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as f}from"../../../../core/support/UpdatingHandles.js";import{isLoaded as p,load as m}from"../../../../geometry/coordinateFormatter.js";import{absoluteHeightElevationInfo as h}from"../../../../support/elevationInfoUtils.js";import{ManagedTooltipField as g}from"../ManagedTooltipField.js";import{getConstraintContext as _}from"../../../interactive/sketch/constraintUtils.js";import{makeTooltip as v}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{makeScalarField as y,makeOrientationField as b,makeAreaField as x,makeLengthField as S,makeRadiusField as C,makeTotalLengthField as w,makeSizeField as T,makeScaleField as E,makeYField as D,makeXField as O,makeLongitudeField as k,makeLatitudeField as A,makeElevationField as j,makeDistanceField as M,makeDirectionField as N}from"../../../interactive/tooltip/fields/fields.js";import{TooltipField as P}from"../../../interactive/tooltip/fields/TooltipField.js";import{DynamicTooltipInfo as F,filterFieldsForHandle as I,isKnownConstraintField as L}from"../../../interactive/tooltip/infos/DynamicTooltipInfo.js";let R=class extends t{constructor(e){super(e),this._pluginTooltipFieldRegistry=new o,this._updatingHandles=new f,this._coordinateFormatterLoadTask=null,this._constraintSnapshot=null,this.constraintsEnabled=!0,this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled=!1,this.enabled=!0}initialize(){this.addHandles([s(()=>[this.effectiveEnabled,this.context?.view,this.context?.toolOptions],([e,t,n])=>{let{context:r}=this;e&&t&&n?(this._tooltipInfo??=new F({toolOptions:n,getAllFields:()=>this.allFields,getActiveHandle:()=>this.effectiveActiveHandle,getHelpMessageKey:()=>this.context?.getHelpMessageKey(),viewType:t.type}),this._tooltip||this._setupTooltip(r)):(this._tooltip=a(this._tooltip),this._tooltipInfo=a(this._tooltipInfo),this.inputModeHandle=null)},c)])}destroy(){this._tooltip=a(this._tooltip),this._tooltipInfo=a(this._tooltipInfo)}get context(){return this.getDependencies?.()}get focusedHandle(){return this.context?.getActiveHandle?.()}get allHandles(){return this.context?.getAllHandles?.()}get effectiveActiveHandle(){return this._tooltip?.isInInputMode?this.inputModeHandle:this.focusedHandle}get updating(){return this._updatingHandles.updating}get tooltip(){return this._tooltip}get tooltipInfo(){return this._tooltipInfo}get elevationConstraint(){return I(this.allFields,this.focusedHandle).map(({field:e})=>e).filter(L).find(e=>e.name===`elevation`)?.committed}get allFields(){return Array.from(this._pluginTooltipFieldRegistry.values()).flatMap(e=>Array.from(e.values()))}get effectiveEnabled(){return this.enabled&&(this.context?.toolOptions.tooltips.effectiveEnabled||this.keepTooltipAliveEvenWhenTooltipsAreNotEnabled)}getConstraints(e){let{tooltipInfo:t,context:n}=this,{view:r,editGeometryOperations:i,elevationInfo:a,toolOptions:o}=n??{},s=this.getLastScreenPosition?.();if(!s||!r||!t||!i||!o)return null;let{coordinateHelper:c,spatialReference:l}=i.data,u=r.toMap(s);if(!u)return null;let d=_(u,r,l,a??h,c.hasZ(),o.values.effectiveDirectionMode);return{...H(t.getConstraintFieldsForHandle(e)),context:d}}storeConstraintSnapshot(){let e=I(this.allFields,this.focusedHandle).map(({field:e})=>e).filter(e=>e.locked&&!e.unlockOnVertexPlacement).filter(L);if(!e.length){this._constraintSnapshot=null;return}this._constraintSnapshot=H(e)}unlockOnVertexPlacement(){this.tooltipInfo?.allFields.forEach(e=>{e.unlockOnVertexPlacement&&(e.committed=null)})}unregisterPluginFields(e){let t=this._pluginTooltipFieldRegistry.get(e);t?.forEach(e=>e.destroy()),t?.clear(),this._pluginTooltipFieldRegistry.delete(e)}createMeasuredField(e,{id:t,preset:n,getMeasurementInput:r,measure:i,fieldProperties:a,fieldFilters:o}){let c=this._getOrCreateField(e,t,n,a,o);return c.registerMeasurement(r,i,()=>this.tooltipInfo?.renderContext),c.addHandles(s(()=>this.tooltipInfo?.isEffectiveVisibleField(c.field),e=>c.enabled=!!e,l)),c}createCustomField(e,{id:t,preset:n,fieldProperties:r,fieldFilters:i}){return this._getOrCreateField(e,t,n,r,i)}_setupTooltip(e){let t=this._tooltip=v(()=>({view:e.view,options:e.toolOptions.tooltips,info:this.tooltipInfo}));t.addHandles([s(()=>this.focusedHandle,e=>{(e&&(!t.isInInputMode||this.inputModeHandle==null)||this.inputModeHandle&&!this.allHandles?.includes(this.inputModeHandle))&&(this.inputModeHandle=e)},c),s(()=>this.focusedHandle?.screenPosition,e=>{e?(t.position=e,t.hidden=!1):t.hidden=!0},c),t.on(`commit`,()=>{this.context?.notifyTooltipsChanged()})]),!this._coordinateFormatterLoadTask&&!p()&&(this._coordinateFormatterLoadTask=n(()=>m()),this.addHandles(this._coordinateFormatterLoadTask),this._updatingHandles.addPromise(this._coordinateFormatterLoadTask.promise))}_getOrCreateField(e,t,n,r,a){let s=i(this._pluginTooltipFieldRegistry,e,()=>new o);if(s.has(t))return s.get(t);let c=V(n,r),l=new g({field:c,displayGroup:r?.displayGroup,...a});s.set(t,l);let u=L(c)?this._constraintSnapshot?.[c.name]:void 0;return u&&c.lock(u),l}};e([u()],R.prototype,`_updatingHandles`,void 0),e([u()],R.prototype,`_tooltip`,void 0),e([u()],R.prototype,`_tooltipInfo`,void 0),e([u()],R.prototype,`_coordinateFormatterLoadTask`,void 0),e([u()],R.prototype,`_constraintSnapshot`,void 0),e([u()],R.prototype,`getDependencies`,void 0),e([u()],R.prototype,`getLastScreenPosition`,void 0),e([u()],R.prototype,`context`,null),e([u()],R.prototype,`inputModeHandle`,void 0),e([u()],R.prototype,`focusedHandle`,null),e([u()],R.prototype,`allHandles`,null),e([u()],R.prototype,`effectiveActiveHandle`,null),e([u()],R.prototype,`updating`,null),e([u()],R.prototype,`tooltip`,null),e([u()],R.prototype,`tooltipInfo`,null),e([u()],R.prototype,`constraintsEnabled`,void 0),e([u()],R.prototype,`elevationConstraint`,null),e([u()],R.prototype,`allFields`,null),e([u()],R.prototype,`keepTooltipAliveEvenWhenTooltipsAreNotEnabled`,void 0),e([u()],R.prototype,`enabled`,void 0),e([u()],R.prototype,`effectiveEnabled`,null),R=e([d(`esri.views.draw.support.managers.TooltipManager`)],R);function z(e){return e==null||!(`unit`in e)||!(`rotationType`in e)?null:e}function B(e){return e==null||`rotationType`in e?null:e}function V(e,t){let n=t?{...t}:{};switch(delete n.displayGroup,e){case`area`:return x({...n,name:`area`});case`direction`:return N({...n,name:`direction`});case`distance`:return M({...n,name:`distance`});case`elevation`:{let e=j({...n,name:`elevation`});return e.showAsZ=!0,e}case`latitude`:return A({...n,name:`y`});case`longitude`:return k({...n,name:`x`});case`x`:return O({...n,name:`x`});case`y`:return D({...n,name:`y`});case`orientation`:return b({...n,name:`orientation`});case`scale`:return E({...n,name:`scale`});case`size`:return T({...n,name:`size`});case`totalLength`:return w({...n,name:`totalLength`});case`radius`:return C({...n,name:`radius`});case`generic-length`:return S({...n,name:null});case`generic-area`:return x({...n,name:null});case`generic-angle`:return b({...n,name:null});case`generic-scalar`:return y({...n,name:null});default:if(!n)throw new r(`draw-tool:tooltips:invalid-field-config`,`Attempted to create a tooltip without a preset definition and without tooltip configuration.`);return new P(n)}}function H(e){let t={};for(let n of e)switch(n.name){case`direction`:t[n.name]=n.committed;break;case`distance`:case`elevation`:t[n.name]=n.committed;break;case`x`:t[n.name]=B(n.committed),t.longitude=z(n.committed);break;case`y`:t[n.name]=B(n.committed),t.latitude=z(n.committed)}return t}export{R as TooltipManager};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{handlesGroup as e}from"../../../core/handleUtils.js";import{CurveSnappingHint as t}from"./hints/CurveSnappingHint.js";import{IntersectionSnappingHint as n}from"./hints/IntersectionSnappingHint.js";import{LineSnappingHint as r}from"./hints/LineSnappingHint.js";import{ParallelSnappingHint as i}from"./hints/ParallelSnappingHint.js";import{PointSnappingHint as a}from"./hints/PointSnappingHint.js";import{RightAngleSnappingHint as o}from"./hints/RightAngleSnappingHint.js";class s{draw(s,l){let u=c(s),d=this.sortUniqueHints(u),f=[];for(let e of d)e instanceof n&&f.push(this.visualizeIntersectionPoint(e,l)),e instanceof r&&f.push(this.visualizeLine(e,l)),e instanceof t&&f.push(this.visualizeCurve(e,l)),e instanceof i&&f.push(this.visualizeParallelSign(e,l)),e instanceof o&&f.push(this.visualizeRightAngleQuad(e,l)),e instanceof a&&f.push(this.visualizePoint(e,l));return e(f)}sortUniqueHints(e){return e}}function c(e){let t=[];for(let n of e){let e=!0;for(let r of t)if(n.equals(r)){e=!1;break}e&&t.push(n)}return t}export{s as SnappingVisualizer};
2
+ import{handlesGroup as e}from"../../../core/handleUtils.js";import{CurveSnappingHint as t}from"./hints/CurveSnappingHint.js";import{IntersectionSnappingHint as n}from"./hints/IntersectionSnappingHint.js";import{LineSnappingHint as r}from"./hints/LineSnappingHint.js";import{ParallelSnappingHint as i}from"./hints/ParallelSnappingHint.js";import{PointSnappingHint as a}from"./hints/PointSnappingHint.js";import{RightAngleSnappingHint as o}from"./hints/RightAngleSnappingHint.js";class s{draw(s,l){let u=c(s),d=this.sortUniqueHints(u),f=[];for(let e=0;e<d.length;++e){let s=d[e];s instanceof n&&f.push(this.visualizeIntersectionPoint(s,l,e)),s instanceof r&&f.push(this.visualizeLine(s,l,e)),s instanceof t&&f.push(this.visualizeCurve(s,l,e)),s instanceof i&&f.push(this.visualizeParallelSign(s,l,e)),s instanceof o&&f.push(this.visualizeRightAngleQuad(s,l,e)),s instanceof a&&f.push(this.visualizePoint(s,l,e))}return e(f)}sortUniqueHints(e){return e}}function c(e){let t=[];for(let n of e){let e=!0;for(let r of t)if(n.equals(r)){e=!1;break}e&&t.push(n)}return t}export{s as SnappingVisualizer};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{SketchTooltipInfo as i}from"./SketchTooltipInfo.js";let a=class extends i{constructor(e){super(e),this.type=`dynamic`,this.renderContext=null,this.helpMessage=void 0,this._isVisibleField=e=>{if(!e.visible)return!1;let t=e.name;switch(t){case`x`:case`y`:return this.visibleElements.coordinates;default:return this.visibleElements[t]??!0}}}initialize(){this.addHandles(t(()=>this.getHelpMessageKey?.(),e=>this.helpMessage=e??void 0))}get availableFields(){return this.getAllFields?.()?.map(e=>e.field)??[]}get availableFieldsForCurrentHandle(){let e=this.getAllFields?.(),t=this.getActiveHandle?.();return l(e??[],t)}get allManagedFields(){let{availableFieldsForCurrentHandle:e}=this,t=this.getActiveHandle?.(),n=this._getXyMode(t);return(this._useCoordinateDisplay(t,n)?e.filter(e=>s(e.field)):this._useDirectionDistanceDisplay(t,n)?e.filter(e=>c(e.field)):e).filter(e=>this._isVisibleField(e.field)).sort((e,t)=>o(e.field,t.field))}get fieldsGroupedForDisplay(){let e=this.allManagedFields,t=new Map,n=[];for(let n of e){let e=n.displayGroup;t.has(e)||t.set(e,[]),t.get(e)?.push(n)}for(let[e,r]of t.entries())if(r.length!==2||!e)n.push(...r.map(e=>e.field));else{let e=r.toSorted((e,t)=>o(e.field,t.field));n.push({left:e[0].field,right:e[1].field})}return n}get xyMode(){return this._getXyMode(this.getActiveHandle?.())}get allFields(){return this.allManagedFields.map(e=>e.field)}getConstraintFieldsForHandle(e){let t=this.getAllFields?.(),n=this._getXyMode(e),r=l(t??[],e).map(e=>e.field).filter(u);return(this._useCoordinateDisplay(e,n)?r.filter(s):this._useDirectionDistanceDisplay(e,n)?r.filter(c):r).filter(this._isVisibleField)}getConstraintFieldByName(e,t){return this.getConstraintFieldsForHandle(e).find(e=>e.name===t)}isEffectiveVisibleField(e){let{allFields:t,renderContext:n}=this;return e.visible&&!!n&&t.includes(e)}_getXyMode(e){let t=this.toolOptions.tooltips.xyMode,n=e?.editSession?.endVertex?.leftSegment?.leftVertex&&e?.role===`primary`?`direction-distance`:`coordinates`;return t===`auto`?n:t}_useCoordinateDisplay(e,t){let{availableFields:n}=this;return(t===`coordinates`||e?.role===`secondary`)&&n.some(e=>e.name===`x`)&&n.some(e=>e.name===`y`)}_useDirectionDistanceDisplay(e,t){let{availableFields:n}=this;return t===`direction-distance`&&e?.role===`primary`&&n.some(e=>e.name===`distance`)&&n.some(e=>e.name===`direction`)}};e([n()],a.prototype,`type`,void 0),e([n()],a.prototype,`getAllFields`,void 0),e([n()],a.prototype,`getActiveHandle`,void 0),e([n()],a.prototype,`getHelpMessageKey`,void 0),e([n()],a.prototype,`availableFields`,null),e([n()],a.prototype,`availableFieldsForCurrentHandle`,null),e([n()],a.prototype,`allManagedFields`,null),e([n()],a.prototype,`fieldsGroupedForDisplay`,null),e([n()],a.prototype,`xyMode`,null),e([n()],a.prototype,`allFields`,null),e([n()],a.prototype,`renderContext`,void 0),e([n()],a.prototype,`helpMessage`,void 0),a=e([r(`esri.views.interactive.tooltip.infos.DynamicTooltipInfo`)],a);function o(e,t){return e.displayOrder-t.displayOrder}function s(e){return e.name!==`direction`&&e.name!==`distance`}function c(e){return e.name!==`x`&&e.name!==`y`}function l(e,t){let{name:n,role:r}=t??{};return e?.filter(e=>(e.appliesToHandlesWithName==null||e.appliesToHandlesWithName===n)&&(e.appliesToHandlesWithRole==null||e.appliesToHandlesWithRole===r))??[]}function u(e){switch(e.name){case`direction`:case`distance`:case`elevation`:case`x`:case`y`:return!0;default:return!1}}export{a as DynamicTooltipInfo,u as isKnownConstraintField};
2
+ import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{SketchTooltipInfo as i}from"./SketchTooltipInfo.js";let a=class extends i{constructor(e){super(e),this.type=`dynamic`,this.renderContext=null,this.helpMessage=void 0,this._isVisibleField=e=>{if(!e.visible)return!1;let t=e.name;switch(t){case`x`:case`y`:return this.visibleElements.coordinates;default:return this.visibleElements[t]??!0}}}initialize(){this.addHandles(t(()=>this.getHelpMessageKey?.(),e=>this.helpMessage=e??void 0))}get availableFields(){return this.getAllFields?.()?.map(e=>e.field)??[]}get availableFieldsForCurrentHandle(){let e=this.getAllFields?.(),t=this.getActiveHandle?.();return l(e??[],t)}get allManagedFields(){let{availableFieldsForCurrentHandle:e}=this,t=this.getActiveHandle?.(),n=this._getXyMode(t);return(this._useCoordinateDisplay(t,n)?e.filter(e=>s(e.field)):this._useDirectionDistanceDisplay(t,n)?e.filter(e=>c(e.field)):e).filter(e=>this._isVisibleField(e.field)).sort((e,t)=>o(e.field,t.field))}get fieldsGroupedForDisplay(){let e=this.allManagedFields,t=new Map,n=[];for(let n of e){let e=n.displayGroup;t.has(e)||t.set(e,[]),t.get(e)?.push(n)}for(let[e,r]of t.entries())if(r.length!==2||!e)n.push(...r.map(e=>e.field));else{let e=r.toSorted((e,t)=>o(e.field,t.field));n.push({left:e[0].field,right:e[1].field})}return n}get xyMode(){return this._getXyMode(this.getActiveHandle?.())}get allFields(){return this.allManagedFields.map(e=>e.field)}getConstraintFieldsForHandle(e){let t=this.getAllFields?.(),n=this._getXyMode(e),r=l(t??[],e).map(e=>e.field).filter(u);return(this._useCoordinateDisplay(e,n)?r.filter(s):this._useDirectionDistanceDisplay(e,n)?r.filter(c):r).filter(this._isVisibleField)}getConstraintFieldByName(e,t){return this.getConstraintFieldsForHandle(e).find(e=>e.name===t)}isEffectiveVisibleField(e){let{allFields:t,renderContext:n}=this;return e.visible&&!!n&&t.includes(e)}_getXyMode(e){let t=this.toolOptions.tooltips.xyMode,n=e?.editSession?.endVertex?.leftSegment?.leftVertex&&e?.role===`primary`?`direction-distance`:`coordinates`;return t===`auto`?n:t}_useCoordinateDisplay(e,t){let{availableFields:n}=this;return(t===`coordinates`||e?.role===`secondary`)&&n.some(e=>e.name===`x`)&&n.some(e=>e.name===`y`)}_useDirectionDistanceDisplay(e,t){let{availableFields:n}=this;return t===`direction-distance`&&e?.role===`primary`&&n.some(e=>e.name===`distance`)&&n.some(e=>e.name===`direction`)}};e([n()],a.prototype,`type`,void 0),e([n()],a.prototype,`getAllFields`,void 0),e([n()],a.prototype,`getActiveHandle`,void 0),e([n()],a.prototype,`getHelpMessageKey`,void 0),e([n()],a.prototype,`availableFields`,null),e([n()],a.prototype,`availableFieldsForCurrentHandle`,null),e([n()],a.prototype,`allManagedFields`,null),e([n()],a.prototype,`fieldsGroupedForDisplay`,null),e([n()],a.prototype,`xyMode`,null),e([n()],a.prototype,`allFields`,null),e([n()],a.prototype,`renderContext`,void 0),e([n()],a.prototype,`helpMessage`,void 0),a=e([r(`esri.views.interactive.tooltip.infos.DynamicTooltipInfo`)],a);function o(e,t){return e.displayOrder-t.displayOrder}function s(e){return e.name!==`direction`&&e.name!==`distance`}function c(e){return e.name!==`x`&&e.name!==`y`}function l(e,t){let{name:n,role:r}=t??{};return e?.filter(e=>(e.appliesToHandlesWithName==null||e.appliesToHandlesWithName===n)&&(e.appliesToHandlesWithRole==null||e.appliesToHandlesWithRole===r))??[]}function u(e){switch(e.name){case`direction`:case`distance`:case`elevation`:case`x`:case`y`:return!0;default:return!1}}export{a as DynamicTooltipInfo,l as filterFieldsForHandle,u as isKnownConstraintField};
@@ -340,6 +340,7 @@ export default abstract class FeatureLikeLayerView extends LayerView {
340
340
  * ```
341
341
  */
342
342
  get highlightOptions(): HighlightOptions | null | undefined;
343
+ /** @deprecated */
343
344
  set highlightOptions(value: HighlightOptionsProperties | null | undefined);
344
345
  /** The layer being viewed. */
345
346
  get layer(): FeatureLikeLayerViewLayer;
@@ -50,6 +50,7 @@ export default abstract class GraphicsLayerView extends LayerView {
50
50
  * ```
51
51
  */
52
52
  get highlightOptions(): HighlightOptions | null | undefined;
53
+ /** @deprecated */
53
54
  set highlightOptions(value: HighlightOptionsProperties | null | undefined);
54
55
  /** The layer being viewed. */
55
56
  get layer(): GraphicsLayer;
@@ -80,6 +80,7 @@ export default abstract class ImageryLayerView extends LayerView {
80
80
  * ```
81
81
  */
82
82
  get highlightOptions(): HighlightOptions | null | undefined;
83
+ /** @deprecated */
83
84
  set highlightOptions(value: HighlightOptionsProperties | null | undefined);
84
85
  /**
85
86
  * An object that provides the user access to