@arcgis/core 5.2.0-next.50 → 5.2.0-next.52

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 (58) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{de50a19944617cd426b8.js → 0ffd0190adfed8e5937a.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{877c848beaf9a939862c.js → 290fbc6d32c799841ccc.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{851bcc75acac4a2f199b.js → 2d6d2d4df05bba9fa4a6.js} +1 -1
  5. package/assets/esri/core/workers/chunks/{304a22c580ce103480cb.js → 2fbb00a29faeaa02912b.js} +1 -1
  6. package/assets/esri/core/workers/chunks/{9d0a9d465ec3a8ba1ed2.js → 5d6d07ecebf881ad913f.js} +1 -1
  7. package/assets/esri/core/workers/chunks/{0037a878499d8a512772.js → 61d3fcb419d6bf7e355e.js} +38 -19
  8. package/assets/esri/core/workers/chunks/{cdb331b58e22f8c1c988.js → 77f19d204a4673b1e676.js} +2 -2
  9. package/assets/esri/core/workers/chunks/{1bc45872d22d61dbd7d1.js → 7e2bf6dd26c3cf0b49b0.js} +1 -1
  10. package/assets/esri/core/workers/chunks/{baac90da0703891d59c4.js → 847ce06b14a921cd16f0.js} +1 -1
  11. package/assets/esri/core/workers/chunks/a1fcef22b6151a7f7917.js +1 -0
  12. package/assets/esri/core/workers/chunks/{0ea374f7b16745b9bbc7.js → a239f1e82dde4f7ada32.js} +1 -1
  13. package/assets/esri/core/workers/chunks/{47af3525396f890f2a6b.js → c38992b250731137cb1a.js} +1 -1
  14. package/assets/esri/core/workers/chunks/{5ec8b02e097cf6718462.js → ce719d3aec8b52bfe160.js} +1 -1
  15. package/assets/esri/core/workers/chunks/{b0b37c67a14a4dfb6538.js → cef7f4237539574f0730.js} +1 -1
  16. package/chunks/CutFillMinMaxDepth.glsl.js +1 -1
  17. package/chunks/CutFillReduction.glsl.js +5 -14
  18. package/chunks/CutFillTotalDepth.glsl.js +1 -1
  19. package/chunks/GlobalIllumination.glsl.js +41 -30
  20. package/chunks/GlobalIlluminationBlur.glsl.js +19 -11
  21. package/chunks/GlobalIlluminationUpscale.glsl.js +10 -10
  22. package/chunks/GlowBlur.glsl.js +1 -1
  23. package/chunks/GlowComposite.glsl.js +1 -1
  24. package/chunks/Stars.glsl.js +7 -12
  25. package/config.js +1 -1
  26. package/core/types.d.ts +5 -1
  27. package/kernel.js +1 -1
  28. package/package.json +3 -3
  29. package/rest/networks/support/TraverseAssociationsParameters.d.ts +26 -4
  30. package/support/revision.js +1 -1
  31. package/third-party-notices.txt +0 -66
  32. package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
  33. package/views/3d/analysis/LineOfSight/LineOfSightPlacementController.js +1 -1
  34. package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
  35. package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
  36. package/views/3d/analysis/LineOfSight/LineOfSightTool2.js +1 -1
  37. package/views/3d/analysis/LineOfSight/types.d.ts +28 -0
  38. package/views/3d/analysis/LineOfSightAnalysisView3D.d.ts +7 -7
  39. package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
  40. package/views/3d/interactive/editingTools/manipulations/Manipulation.js +1 -1
  41. package/views/3d/interactive/editingTools/manipulations/MoveManipulation.js +1 -1
  42. package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
  43. package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
  44. package/views/3d/interactive/editingTools/transform/ExtentTransformTool.js +1 -1
  45. package/views/3d/interactive/editingTools/transform/ScaleRotateTransform.js +1 -1
  46. package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
  47. package/views/3d/support/hitTest.js +1 -1
  48. package/views/3d/webgl-engine/core/FBOCacheFormats.js +1 -1
  49. package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
  50. package/views/3d/webgl-engine/lib/CutFillComputation.js +1 -1
  51. package/views/3d/webgl-engine/lib/Renderer.js +1 -1
  52. package/views/3d/webgl-engine/shaders/CutFillReductionTechniqueConfiguration.js +1 -1
  53. package/views/SceneView.d.ts +24 -12
  54. package/views/SceneView.js +1 -1
  55. package/widgets/LineOfSight/LineOfSightViewModel.js +1 -1
  56. package/widgets/support/AnalysisViewModelMixin.js +1 -1
  57. package/assets/esri/core/workers/chunks/5ce168ae45ab7e7a71d1.js +0 -1
  58. /package/assets/esri/core/workers/chunks/{cdb331b58e22f8c1c988.js.LICENSE.txt → 77f19d204a4673b1e676.js.LICENSE.txt} +0 -0
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"../../../../analysis/LineOfSightAnalysisObserver.js";import n from"../../../../analysis/LineOfSightAnalysisTarget.js";import{length as o,normalize as t,scaleAndAdd as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as r,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as i,getGraphicEffectiveElevationInfo as s,getConvertedElevation as a}from"../../../../support/elevationInfoUtils.js";import c from"../../../../symbols/support/ElevationInfo.js";function f(e){return e?.clone()??null}function p(e){return e?.clone()??null}function d(n,o=null){return m(n,o,()=>new e)}function v(e,o=null){return m(e,o,()=>new n)}function m(e,n,o){if(null==e)return null;const t=n??o();return t.position=e.position?.clone()??null,t.elevationInfo=e.elevationInfo?.clone()??null,t.feature=e.feature??null,t}function I(e,n,o=null){const t=n.clone();return t.z=a(e,n,o??i,i),t}function g(e,n,o,t=null){const l=I(n,o,t);try{return e.getMapPointIntersection(l)}catch{return null}}function h(e,n,o,{sourceElevationInfo:t=i,preservedIntersection:l=null,useSnappedAbsoluteHeight:r=!1,preferPreservedIntersection:u=!1}){const s=I(n,o,t);return null!=l&&u||null!=l&&!r||l?.mapPoint?.equals(s)?l:g(e,n,o,t)??l}function b(e,n,o,t,{defaultElevationInfo:l=null,sourceElevationInfo:r=i,preservedIntersection:u=null,useSnappedAbsoluteHeight:s=!1,preferPreservedIntersection:a=!1}={}){const c=h(o,e,t,{sourceElevationInfo:r,preservedIntersection:u,useSnappedAbsoluteHeight:s,preferPreservedIntersection:a});return null!=c&&(P(e,n,c,{snappedMapPoint:t,defaultElevationInfo:l,sourceElevationInfo:r,useSnappedAbsoluteHeight:s||!c.mapPoint?.equals(t)}),!0)}function P(e,n,o,{snappedMapPoint:t=o.mapPoint,defaultElevationInfo:l=null,sourceElevationInfo:r=i,useSnappedAbsoluteHeight:u=!1}={}){if(null==t)return n.position=null,n.elevationInfo=null,void(n.feature=null);const f=I(e,t,r),p=!("relative-to-ground"===r?.mode||"on-the-ground"===r?.mode)&&(u||"ground"!==o.context?.type&&!o.mapPoint?.equals(f));switch(o.context?.type){case"graphic":{const e=o.context.graphic,t=s(e);"on-the-ground"===t.mode&&(t.mode="relative-to-ground",t.offset=0),n.elevationInfo=new c(t),n.feature=e;break}case"gaussian-splat":return n.elevationInfo=l?.clone()??null,n.feature=null,p&&(n.elevationInfo=null),void(n.position=y(e,f,n.elevationInfo,o.normal));case"ground":n.elevationInfo=l?.clone()??new c({mode:"on-the-ground"}),n.feature=null;break;default:n.elevationInfo=l?.clone()??null,n.feature=null}p&&(n.elevationInfo=null);const d=f.clone();d.z=a(e,f,i,n.elevationInfo),n.position=d}function y(e,n,s,c){const f=n.clone(),p=r(n.x,n.y,n.z??0);if(!e.renderCoordsHelper.toRenderCoords(p,n.spatialReference,p)||0===o(c))return f.z=a(e,f,i,s),f;const d=4,v=e.state.camera.computeScreenPixelSizeAt(p)*d,m=t(u(),c);l(p,p,m,v);const I=e.renderCoordsHelper.fromRenderCoords(p,f);return null==I?(f.z=a(e,f,i,s),f):(I.z=a(e,I,i,s),I)}export{y as getGaussianSplatOffsetPosition,g as getLineOfSightMapPointIntersection,d as restoreLineOfSightObserverState,v as restoreLineOfSightTargetState,f as snapshotLineOfSightObserverState,p as snapshotLineOfSightTargetState,b as updateLineOfSightItemFromAuthoredPoint,P as updateLineOfSightItemFromIntersection};
2
+ import e from"../../../../analysis/LineOfSightAnalysisObserver.js";import n from"../../../../analysis/LineOfSightAnalysisTarget.js";import{length as o,normalize as t,scaleAndAdd as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as l,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{absoluteHeightElevationInfo as s,getGraphicEffectiveElevationInfo as u,getConvertedElevation as a}from"../../../../support/elevationInfoUtils.js";import c from"../../../../symbols/support/ElevationInfo.js";function p(e){return e?.clone()??null}function f(e){return e?.clone()??null}function d(n,o=null){return v(n,o,()=>new e)}function m(e,o=null){return v(e,o,()=>new n)}function v(e,n,o){if(null==e)return null;const t=n??o();return t.position=e.position?.clone()??null,t.elevationInfo=e.elevationInfo?.clone()??null,t.feature=e.feature??null,t}function I(e,n,o=null){const t=n.clone();return t.z=a(e,n,o??s,s),t}function g(e,n,o,t=null){const r=I(n,o,t);try{return e.getMapPointIntersection(r)}catch{return null}}function h(e,n,o,{elevationInfo:t=null,sourceElevationInfo:r=s,preservedIntersection:l=null,useSnappedAbsoluteHeight:i=!1,preferPreservedIntersection:u=!1}){const a=i&&null==t?s:t??r,c=I(n,o,a);return null!=l&&u||null!=l&&!i||l?.mapPoint?.equals(c)?l:g(e,n,o,a)??l}function y(e,n,o,t,{elevationInfo:r=null,sourceElevationInfo:l=s,preservedIntersection:i=null,useSnappedAbsoluteHeight:u=!1,preferPreservedIntersection:a=!1}={}){const c=h(o,e,t,{elevationInfo:r,sourceElevationInfo:l,preservedIntersection:i,useSnappedAbsoluteHeight:u,preferPreservedIntersection:a});return null!=c&&(P(e,n,c,{snappedMapPoint:t,elevationInfo:r,sourceElevationInfo:l,useSnappedAbsoluteHeight:u||!c.mapPoint?.equals(t)}),!0)}function P(e,n,o,{snappedMapPoint:t=o.mapPoint,elevationInfo:r=null,sourceElevationInfo:l=s,useSnappedAbsoluteHeight:i=!1}={}){if(null==t)return n.position=null,n.elevationInfo=null,void(n.feature=null);const p=o.context,f=I(e,t,i&&null==r?s:r??l),d=null==r&&(i||"ground"!==o.context?.type&&!o.mapPoint?.equals(f));let m=r?.clone()??null;const v="graphic"===p?.type?p.graphic:null;if(null==r&&!d)switch(p?.type){case"graphic":{const e=u(p.graphic);"on-the-ground"===e.mode&&(e.mode="relative-to-ground",e.offset=0),m=new c(e);break}case"ground":m=new c({mode:"on-the-ground"})}if(n.elevationInfo=m,n.feature=v,"gaussian-splat"===p?.type)n.position=b(e,f,m,o.normal);else{const o=f.clone();o.z=a(e,f,s,m),n.position=o}}function b(e,n,u,c){const p=n.clone(),f=l(n.x,n.y,n.z??0);if(!e.renderCoordsHelper.toRenderCoords(f,n.spatialReference,f)||0===o(c))return p.z=a(e,p,s,u),p;const d=4,m=e.state.camera.computeScreenPixelSizeAt(f)*d,v=t(i(),c);r(f,f,v,m);const I=e.renderCoordsHelper.fromRenderCoords(f,p);return null==I?(p.z=a(e,p,s,u),p):(I.z=a(e,I,s,u),I)}export{b as getGaussianSplatOffsetPosition,g as getLineOfSightMapPointIntersection,d as restoreLineOfSightObserverState,m as restoreLineOfSightTargetState,p as snapshotLineOfSightObserverState,f as snapshotLineOfSightTargetState,y as updateLineOfSightItemFromAuthoredPoint,P as updateLineOfSightItemFromIntersection};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import o from"../../../../core/Accessor.js";import{isSome as e}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{when as i,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as a,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as r}from"../../../../support/elevationInfoUtils.js";import{createDrawTool as l}from"./lineOfSightPlacementUtils.js";import{createLineOfSightRootPluginConfiguration as d}from"./LineOfSightRootPlugin.js";import{Manipulator3D as p}from"../../interactive/Manipulator3D.js";const h=Symbol("hiddenManipulatorHandle");let u=class extends o{get active(){return!!this._drawTool?.active}get canRedo(){return this._drawTool?.canRedo??!1}get canUndo(){return this._drawTool?.canUndo??!1}get updating(){return this._drawTool?.updating??!1}get activeTooltipInfo(){return this._drawTool?.activeTooltipInfo??null}get tooltip(){return this._drawTool?.tooltip??null}constructor(t){super(t),this.visible=!0,this.placementElevationInfo=null,this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1}initialize(){this.addHandles([i(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},n)])}destroy(){this._destroyDrawTool()}get activeSnappingManager(){return this.active?this._drawTool?.snappingManager??null:null}get _snapToSceneEnabled(){const t=this._sourceElevationInfo?.mode;return"relative-to-ground"!==t&&"on-the-ground"!==t&&null}get _defaultElevationInfo(){return this.placementElevationInfo}get _sourceElevationInfo(){return this.placementElevationInfo??r}continue(){if(this._drawTool?.active)return;this._sessionStartedWithValidAnalysis=this.analysis.valid;const{drawTool:t,renderer:o}=this._createDrawTool();this._drawTool=t,this._renderer=o,this.view.addAndActivateTool(t),t.begin([d({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultElevationInfo:this._defaultElevationInfo,sourceElevationInfo:this._sourceElevationInfo,view:this.view})])}stop(){this._destroyDrawTool()}redo(){this._drawTool?.redo()}undo(){this._drawTool?.undo()}get testInfo(){}_createDrawTool(){return l({analysis:this.analysis,analysisViewData:this.analysisViewData,view:this.view,getSnapToSceneEnabled:()=>this._snapToSceneEnabled,getSourceElevationInfo:()=>this._sourceElevationInfo,getVisible:()=>this.visible,onCancel:t=>{t!==this._drawTool||this._sessionStartedWithValidAnalysis||null!=this.analysis.observer||(this.analysis.clear(),this.analysisViewData.cursorTarget=null),this._destroyDrawTool(t)},onComplete:t=>this._destroyDrawTool(t),onManipulatorCountChange:t=>this._hideManipulatorOnAppearance(t),shouldPreventVertexAdd:this.shouldPreventVertexAdd})}_destroyDrawTool(t=this._drawTool){if(null==t)return;const o=t===this._drawTool;this.view.activeTool===t&&(this.view.activeTool=null),this.view.tools.includes(t)&&this.view.tools.remove(t),t.destroy(),o&&(this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1)}_hideManipulatorOnAppearance(t){t.removeHandles(h),t.addHandles(t.manipulators.toArray().map(t=>t instanceof p?t.disableDisplay():null).filter(e),h)}};t([a({constructOnly:!0})],u.prototype,"view",void 0),t([a({constructOnly:!0})],u.prototype,"analysis",void 0),t([a({constructOnly:!0})],u.prototype,"analysisViewData",void 0),t([a({constructOnly:!0})],u.prototype,"parent",void 0),t([a({constructOnly:!0})],u.prototype,"shouldPreventVertexAdd",void 0),t([a()],u.prototype,"visible",void 0),t([a()],u.prototype,"placementElevationInfo",void 0),t([a()],u.prototype,"active",null),t([a()],u.prototype,"canRedo",null),t([a()],u.prototype,"canUndo",null),t([a()],u.prototype,"updating",null),t([a()],u.prototype,"activeTooltipInfo",null),t([a()],u.prototype,"tooltip",null),t([a()],u.prototype,"_drawTool",void 0),t([a()],u.prototype,"_renderer",void 0),u=t([s("esri.views.3d.analysis.LineOfSight.LineOfSightPlacementController")],u);export{u as LineOfSightPlacementController};
2
+ import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{isSome as o}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{when as i,syncAndInitial as n}from"../../../../core/reactiveUtils.js";import{property as a,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{absoluteHeightElevationInfo as s}from"../../../../support/elevationInfoUtils.js";import{createDrawTool as l}from"./lineOfSightPlacementUtils.js";import{createLineOfSightRootPluginConfiguration as d}from"./LineOfSightRootPlugin.js";import{Manipulator3D as p}from"../../interactive/Manipulator3D.js";const h=Symbol("hiddenManipulatorHandle");let c=class extends e{get active(){return!!this._drawTool?.active}get canRedo(){return this._drawTool?.canRedo??!1}get canUndo(){return this._drawTool?.canUndo??!1}get updating(){return this._drawTool?.updating??!1}get activeTooltipInfo(){return this._drawTool?.activeTooltipInfo??null}get tooltip(){return this._drawTool?.tooltip??null}constructor(t){super(t),this.visible=!0,this.observerPlacementElevationInfo=null,this.targetPlacementElevationInfo=null,this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1}initialize(){this.addHandles([i(()=>!this.active,()=>{this.analysisViewData.cursorTarget=null},n)])}destroy(){this._destroyDrawTool()}get activeSnappingManager(){return this.active?this._drawTool?.snappingManager??null:null}get _snapToSceneEnabled(){const t=this._effectiveElevationInfo.mode;return"relative-to-ground"!==t&&"on-the-ground"!==t&&null}get _placementElevationInfo(){return null==this.analysis.observer?this.observerPlacementElevationInfo:this.targetPlacementElevationInfo}get _effectiveElevationInfo(){return this._placementElevationInfo??s}continue(){if(this._drawTool?.active)return;this._sessionStartedWithValidAnalysis=this.analysis.valid;const{drawTool:t,renderer:e}=this._createDrawTool();this._drawTool=t,this._renderer=e,this.view.addAndActivateTool(t),t.begin([d({analysis:this.analysis,analysisViewData:this.analysisViewData,observerElevationInfo:this.observerPlacementElevationInfo,targetElevationInfo:this.targetPlacementElevationInfo,view:this.view})])}stop(){this._destroyDrawTool()}redo(){this._drawTool?.redo()}undo(){this._drawTool?.undo()}get testInfo(){}_createDrawTool(){return l({analysis:this.analysis,analysisViewData:this.analysisViewData,view:this.view,getSnapToSceneEnabled:()=>this._snapToSceneEnabled,getSourceElevationInfo:()=>this._effectiveElevationInfo,getVisible:()=>this.visible,onCancel:t=>{t!==this._drawTool||this._sessionStartedWithValidAnalysis||null!=this.analysis.observer||(this.analysis.clear(),this.analysisViewData.cursorTarget=null),this._destroyDrawTool(t)},onComplete:t=>this._destroyDrawTool(t),onManipulatorCountChange:t=>this._hideManipulatorOnAppearance(t),shouldPreventVertexAdd:this.shouldPreventVertexAdd})}_destroyDrawTool(t=this._drawTool){if(null==t)return;const e=t===this._drawTool;this.view.activeTool===t&&(this.view.activeTool=null),this.view.tools.includes(t)&&this.view.tools.remove(t),t.destroy(),e&&(this._drawTool=null,this._renderer=null,this._sessionStartedWithValidAnalysis=!1)}_hideManipulatorOnAppearance(t){t.removeHandles(h),t.addHandles(t.manipulators.toArray().map(t=>t instanceof p?t.disableDisplay():null).filter(o),h)}};t([a({constructOnly:!0})],c.prototype,"view",void 0),t([a({constructOnly:!0})],c.prototype,"analysis",void 0),t([a({constructOnly:!0})],c.prototype,"analysisViewData",void 0),t([a({constructOnly:!0})],c.prototype,"parent",void 0),t([a({constructOnly:!0})],c.prototype,"shouldPreventVertexAdd",void 0),t([a()],c.prototype,"visible",void 0),t([a()],c.prototype,"observerPlacementElevationInfo",void 0),t([a()],c.prototype,"targetPlacementElevationInfo",void 0),t([a()],c.prototype,"active",null),t([a()],c.prototype,"canRedo",null),t([a()],c.prototype,"canUndo",null),t([a()],c.prototype,"updating",null),t([a()],c.prototype,"activeTooltipInfo",null),t([a()],c.prototype,"tooltip",null),t([a()],c.prototype,"_drawTool",void 0),t([a()],c.prototype,"_renderer",void 0),c=t([r("esri.views.3d.analysis.LineOfSight.LineOfSightPlacementController")],c);export{c as LineOfSightPlacementController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisObserver.js";import i from"../../../../analysis/LineOfSightAnalysisTarget.js";import s from"../../../../core/Collection.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{isPoint as a,isMultipoint as l}from"../../../../geometry/support/typeUtils.js";import{updateLineOfSightItemFromAuthoredPoint as u}from"./LineOfSightAuthoringUtils.js";import{isLineOfSightObserverPlugin as h,createLineOfSightObserverPluginConfiguration as c}from"./LineOfSightObserverPlugin.js";import{isLineOfSightPlacementLeafPlugin as g}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{isLineOfSightTargetPlugin as m,createLineOfSightTargetPluginConfiguration as _}from"./LineOfSightTargetPlugin.js";import{PluginBase as f}from"../../../draw/plugins/PluginBase.js";let d=class extends f{constructor(){super(...arguments),this.defaultElevationInfo=null,this.sourceElevationInfo=null,this._intersector=null,this._downstreamPlugin=null,this._initialObserver=null,this._operationObserver=null,this._initialTargets=new s,this._operationTargets=new s}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=n(this._intersector)}start(t){super.start(t),this._initialObserver=this.analysis.observer,this._operationObserver=this._initialObserver,y(this._initialTargets,this.analysis.targets.toArray()),this._operationTargets.removeAll(),t.session.appendOrReplacePart(null,[]),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}beforeAttachPlugin(t){return{geometryType:"point",useStandaloneSession:!0}}beforeComplete(){return{downstreamPluginCompletionMode:"cancel"}}attachPlugin(t){this._downstreamPlugin=t}afterUndoRedo(){this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}detachPlugin(t,s){if(this._downstreamPlugin===t&&(this._downstreamPlugin=null),m(t)&&this._clearCursorTarget(),"complete"!==s)return void this._syncAnalysisFromSession();const n=this._context?.getSession(t)?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"point"});if(!n||!a(n))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._truncateItemsToSession();const r=g(t)?t.preservedIntersection:null,o=!!g(t)&&t.usesSnappedAbsoluteHeight;if(h(t)){const i=t.observer??this._operationObserver??new e;if(!this._intersector||!u(this.view,i,this._intersector,n,{defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,preservedIntersection:r,useSnappedAbsoluteHeight:o,preferPreservedIntersection:!0}))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._operationObserver=i}else if(m(t)){const e=t.target??new i;if(!this._intersector||!u(this.view,e,this._intersector,n,{defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,preservedIntersection:r,useSnappedAbsoluteHeight:o,preferPreservedIntersection:!0}))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._operationTargets.add(e)}this._appendCommittedPoint(n),this._syncAnalysisFromSession(),this._restartDownstreamPlugin(),this._clearCursorTarget()}_appendCommittedPoint(t){const e=this._session;e&&(e.appendOrReplacePoint(null,t),e.appendOrReplacePart(null,[]),e.automaticRestart=!1,e.groupGeometryChanges())}_clearCursorTarget(){this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget)}_truncateItemsToSession(){const t=this._getCommittedPointCount();null==this._initialObserver&&0===t&&(this._operationObserver=null),this._operationTargets.splice(this._getCommittedOperationTargetCount(t))}_restartDownstreamPlugin(){const t=null==this.analysis.observer,e=t?this._createObserverPluginConfiguration():this._createTargetPluginConfiguration();t&&h(this._downstreamPlugin)||!t&&m(this._downstreamPlugin)||this._context?.requestBeginDownstreamPlugin(e,{cancelExisting:!0})}_createObserverPluginConfiguration(t=null){return c({observer:t,defaultCaptureMode:t?"grabbable-object":"capture-always",inputMapPosition:t?.position??null})}_createTargetPluginConfiguration(t=null){return _({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultCaptureMode:t?"grabbable-object":"capture-always",defaultElevationInfo:this.defaultElevationInfo,inputMapPosition:t?.position??null,sourceElevationInfo:this.sourceElevationInfo,target:t,view:this.view})}_syncAnalysisFromSession(){const t=this._getCommittedPointCount(),e=this._getCommittedOperationTargetCount(t);this.analysis.observer=this._getActiveObserver(t),y(this.analysis.targets,this._initialTargets.toArray().concat(this._operationTargets.toArray().slice(0,e)))}_getActiveObserver(t){return null!=this._initialObserver?this._operationObserver??null:t>0?this._operationObserver:null}_getCommittedOperationTargetCount(t){return Math.max(0,t-(null!=this._initialObserver?0:Math.min(t,1)))}_getCommittedPointCount(){const t=this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"multipoint"});return t&&l(t)?t.points.length:0}};function v(t){return{uniqueId:Symbol("line-of-sight-root-plugin"),kind:["multipart"],geometryType:"multipoint",hidden:!0,localizationKey:"line-of-sight-root",icon:"point",create:()=>new d(t)}}function y(t,e){let i=-1;for(let s=0;s<Math.min(t.length,e.length);s++)if(t.getItemAt(s)!==e[s]){i=s;break}if(-1===i){if(t.length===e.length)return;i=Math.min(t.length,e.length)}t.splice(i,t.length-i,...e.slice(i))}t([r({constructOnly:!0})],d.prototype,"analysis",void 0),t([r({constructOnly:!0})],d.prototype,"analysisViewData",void 0),t([r({constructOnly:!0})],d.prototype,"view",void 0),t([r({constructOnly:!0})],d.prototype,"defaultElevationInfo",void 0),t([r({constructOnly:!0})],d.prototype,"sourceElevationInfo",void 0),t([r()],d.prototype,"_intersector",void 0),t([r()],d.prototype,"_downstreamPlugin",void 0),d=t([o("esri.views.3d.analysis.LineOfSight.LineOfSightRootPlugin")],d);export{d as LineOfSightRootPlugin,v as createLineOfSightRootPluginConfiguration};
2
+ import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisObserver.js";import i from"../../../../analysis/LineOfSightAnalysisTarget.js";import s from"../../../../core/Collection.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{isPoint as a,isMultipoint as l}from"../../../../geometry/support/typeUtils.js";import{updateLineOfSightItemFromAuthoredPoint as u}from"./LineOfSightAuthoringUtils.js";import{isLineOfSightObserverPlugin as h,createLineOfSightObserverPluginConfiguration as g}from"./LineOfSightObserverPlugin.js";import{isLineOfSightPlacementLeafPlugin as c}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{isLineOfSightTargetPlugin as m,createLineOfSightTargetPluginConfiguration as _}from"./LineOfSightTargetPlugin.js";import{PluginBase as y}from"../../../draw/plugins/PluginBase.js";let v=class extends y{constructor(){super(...arguments),this.observerElevationInfo=null,this.targetElevationInfo=null,this._intersector=null,this._downstreamPlugin=null,this._initialObserver=null,this._operationObserver=null,this._initialTargets=new s,this._operationTargets=new s}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=r(this._intersector)}start(t){super.start(t),this._initialObserver=this.analysis.observer,this._operationObserver=this._initialObserver,f(this._initialTargets,this.analysis.targets.toArray()),this._operationTargets.removeAll(),t.session.appendOrReplacePart(null,[]),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}beforeAttachPlugin(t){return{geometryType:"point",useStandaloneSession:!0}}beforeComplete(){return{downstreamPluginCompletionMode:"cancel"}}attachPlugin(t){this._downstreamPlugin=t}afterUndoRedo(){this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}detachPlugin(t,s){if(this._downstreamPlugin===t&&(this._downstreamPlugin=null),m(t)&&this._clearCursorTarget(),"complete"!==s)return void this._syncAnalysisFromSession();const r=this._context?.getSession(t)?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"point"});if(!r||!a(r))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._truncateItemsToSession();const n=c(t)?t.preservedIntersection:null,o=!!c(t)&&t.usesSnappedAbsoluteHeight;if(h(t)){const i=t.observer??this._operationObserver??new e;if(!this._intersector||!u(this.view,i,this._intersector,r,{elevationInfo:this.observerElevationInfo,preservedIntersection:n,useSnappedAbsoluteHeight:o,preferPreservedIntersection:!0}))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._operationObserver=i}else if(m(t)){const e=t.target??new i;if(!this._intersector||!u(this.view,e,this._intersector,r,{elevationInfo:this.targetElevationInfo,preservedIntersection:n,useSnappedAbsoluteHeight:o,preferPreservedIntersection:!0}))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._operationTargets.add(e)}this._appendCommittedPoint(r),this._syncAnalysisFromSession(),this._restartDownstreamPlugin(),this._clearCursorTarget()}_appendCommittedPoint(t){const e=this._session;e&&(e.appendOrReplacePoint(null,t),e.appendOrReplacePart(null,[]),e.automaticRestart=!1,e.groupGeometryChanges())}_clearCursorTarget(){this.analysisViewData.cursorTarget=r(this.analysisViewData.cursorTarget)}_truncateItemsToSession(){const t=this._getCommittedPointCount();null==this._initialObserver&&0===t&&(this._operationObserver=null),this._operationTargets.splice(this._getCommittedOperationTargetCount(t))}_restartDownstreamPlugin(){const t=null==this.analysis.observer,e=t?this._createObserverPluginConfiguration():this._createTargetPluginConfiguration();t&&h(this._downstreamPlugin)||!t&&m(this._downstreamPlugin)||this._context?.requestBeginDownstreamPlugin(e,{cancelExisting:!0})}_createObserverPluginConfiguration(t=null){return g({observer:t,defaultCaptureMode:t?"grabbable-object":"capture-always",inputMapPosition:t?.position??null})}_createTargetPluginConfiguration(t=null){return _({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultCaptureMode:t?"grabbable-object":"capture-always",elevationInfo:this.targetElevationInfo,inputMapPosition:t?.position??null,target:t,view:this.view})}_syncAnalysisFromSession(){const t=this._getCommittedPointCount(),e=this._getCommittedOperationTargetCount(t);this.analysis.observer=this._getActiveObserver(t),f(this.analysis.targets,this._initialTargets.toArray().concat(this._operationTargets.toArray().slice(0,e)))}_getActiveObserver(t){return null!=this._initialObserver?this._operationObserver??null:t>0?this._operationObserver:null}_getCommittedOperationTargetCount(t){return Math.max(0,t-(null!=this._initialObserver?0:Math.min(t,1)))}_getCommittedPointCount(){const t=this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"multipoint"});return t&&l(t)?t.points.length:0}};function d(t){return{uniqueId:Symbol("line-of-sight-root-plugin"),kind:["multipart"],geometryType:"multipoint",hidden:!0,localizationKey:"line-of-sight-root",icon:"point",create:()=>new v(t)}}function f(t,e){let i=-1;for(let s=0;s<Math.min(t.length,e.length);s++)if(t.getItemAt(s)!==e[s]){i=s;break}if(-1===i){if(t.length===e.length)return;i=Math.min(t.length,e.length)}t.splice(i,t.length-i,...e.slice(i))}t([n({constructOnly:!0})],v.prototype,"analysis",void 0),t([n({constructOnly:!0})],v.prototype,"analysisViewData",void 0),t([n({constructOnly:!0})],v.prototype,"view",void 0),t([n({constructOnly:!0})],v.prototype,"observerElevationInfo",void 0),t([n({constructOnly:!0})],v.prototype,"targetElevationInfo",void 0),t([n()],v.prototype,"_intersector",void 0),t([n()],v.prototype,"_downstreamPlugin",void 0),v=t([o("esri.views.3d.analysis.LineOfSight.LineOfSightRootPlugin")],v);export{v as LineOfSightRootPlugin,d as createLineOfSightRootPluginConfiguration};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as s,sync as o}from"../../../../core/reactiveUtils.js";import{property as n,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as a,updateLineOfSightItemFromAuthoredPoint as l}from"./LineOfSightAuthoringUtils.js";import{LineOfSightRayIntersector as u}from"./LineOfSightRayIntersector.js";import{PluginBase as p}from"../../../draw/plugins/PluginBase.js";var c;const d=Symbol("line-of-sight-target-vertex"),h=Symbol("line-of-sight-target-plugin-marker");let v=class extends p{constructor(){super(...arguments),this[c]=!0,this.target=null,this.defaultElevationInfo=null,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.preservedIntersection=null,this.sourceElevationInfo=null,this._interactiveHandle=null,this._intersector=null}static{c=h}initialize(){this._intersector=new u({view:this.view})}destroy(){this._intersector=i(this._intersector)}get usesSnappedAbsoluteHeight(){const t=this._interactiveHandle,e=t?.inputMapPosition,i=t?.outputMapPosition;return null!=e&&null!=i&&!e.equals(i)}start(t){super.start(t),this.preservedIntersection=null;const{positionOfLastUserInput:n,session:r}=t,u="grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??n:this.inputMapPosition??n;!u||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||r.appendOrReplacePoint(d,u);let p="capture-always"===this.defaultCaptureMode&&null!=u;this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=t.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?u??void 0:void 0}),this.addHandles(s(()=>this._interactiveHandle?.outputMapPosition,t=>{if(!t||this._isComplete)return;const s=this.analysisViewData.cursorTarget??new e,o=this.usesSnappedAbsoluteHeight,n=this._interactiveHandle?.screenPosition,r=n&&this._intersector?this._intersector.getScreenPointIntersection(n):null;return this._session?.appendOrReplacePoint(d,t),p?(p=!1,void this._clearCursorTarget()):null!=r?(this.analysisViewData.cursorTarget=s,void a(this.view,s,r,{snappedMapPoint:t,defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,useSnappedAbsoluteHeight:o})):null!=n&&null!=this.preservedIntersection?(this.analysisViewData.cursorTarget=s,void a(this.view,s,this.preservedIntersection,{snappedMapPoint:t,defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,useSnappedAbsoluteHeight:o})):void(null==n&&this._intersector&&l(this.view,s,this._intersector,t,{defaultElevationInfo:this.defaultElevationInfo,sourceElevationInfo:this.sourceElevationInfo,preservedIntersection:this.preservedIntersection,useSnappedAbsoluteHeight:o,preferPreservedIntersection:!0})?this.analysisViewData.cursorTarget=s:this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget))},o),this._ownHandlesKey))}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}_clearCursorTarget(){this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget)}};function f(t){return!!t&&h in t}function g(t){return{uniqueId:Symbol("line-of-sight-target-plugin"),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new v(t)}}t([n({constructOnly:!0})],v.prototype,"analysis",void 0),t([n({constructOnly:!0})],v.prototype,"analysisViewData",void 0),t([n({constructOnly:!0})],v.prototype,"view",void 0),t([n({constructOnly:!0})],v.prototype,"target",void 0),t([n({constructOnly:!0})],v.prototype,"defaultElevationInfo",void 0),t([n()],v.prototype,"defaultCaptureMode",void 0),t([n()],v.prototype,"inputMapPosition",void 0),t([n()],v.prototype,"preservedIntersection",void 0),t([n({constructOnly:!0})],v.prototype,"sourceElevationInfo",void 0),t([n()],v.prototype,"_interactiveHandle",void 0),t([n()],v.prototype,"_intersector",void 0),v=t([r("esri.views.3d.analysis.LineOfSight.LineOfSightTargetPlugin")],v);export{v as LineOfSightTargetPlugin,g as createLineOfSightTargetPluginConfiguration,f as isLineOfSightTargetPlugin,h as lineOfSightTargetPluginMarker};
2
+ import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as s,sync as r}from"../../../../core/reactiveUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as a,updateLineOfSightItemFromAuthoredPoint as l}from"./LineOfSightAuthoringUtils.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{PluginBase as u}from"../../../draw/plugins/PluginBase.js";var c;const d=Symbol("line-of-sight-target-vertex"),h=Symbol("line-of-sight-target-plugin-marker");let v=class extends u{constructor(){super(...arguments),this[c]=!0,this.target=null,this.elevationInfo=null,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null,this._intersector=null}static{c=h}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=i(this._intersector)}get usesSnappedAbsoluteHeight(){const t=this._interactiveHandle,e=t?.inputMapPosition,i=t?.outputMapPosition;return null!=e&&null!=i&&!e.equals(i)}start(t){super.start(t),this.preservedIntersection=null;const{positionOfLastUserInput:o,session:n}=t,p="grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??o:this.inputMapPosition??o;!p||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||n.appendOrReplacePoint(d,p);let u="capture-always"===this.defaultCaptureMode&&null!=p;this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=t.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?p??void 0:void 0}),this.addHandles(s(()=>this._interactiveHandle?.outputMapPosition,t=>{if(!t||this._isComplete)return;const s=this.analysisViewData.cursorTarget??new e,r=this.usesSnappedAbsoluteHeight,o=this._interactiveHandle?.screenPosition,n=o&&this._intersector?this._intersector.getScreenPointIntersection(o):null;return this._session?.appendOrReplacePoint(d,t),u?(u=!1,void this._clearCursorTarget()):null!=n?(this.analysisViewData.cursorTarget=s,void a(this.view,s,n,{snappedMapPoint:t,elevationInfo:this.elevationInfo,useSnappedAbsoluteHeight:r})):null!=o&&null!=this.preservedIntersection?(this.analysisViewData.cursorTarget=s,void a(this.view,s,this.preservedIntersection,{snappedMapPoint:t,elevationInfo:this.elevationInfo,useSnappedAbsoluteHeight:r})):void(null==o&&this._intersector&&l(this.view,s,this._intersector,t,{elevationInfo:this.elevationInfo,preservedIntersection:this.preservedIntersection,useSnappedAbsoluteHeight:r,preferPreservedIntersection:!0})?this.analysisViewData.cursorTarget=s:this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget))},r),this._ownHandlesKey))}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}_clearCursorTarget(){this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget)}};function g(t){return!!t&&h in t}function y(t){return{uniqueId:Symbol("line-of-sight-target-plugin"),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new v(t)}}t([o({constructOnly:!0})],v.prototype,"analysis",void 0),t([o({constructOnly:!0})],v.prototype,"analysisViewData",void 0),t([o({constructOnly:!0})],v.prototype,"view",void 0),t([o({constructOnly:!0})],v.prototype,"target",void 0),t([o({constructOnly:!0})],v.prototype,"elevationInfo",void 0),t([o()],v.prototype,"defaultCaptureMode",void 0),t([o()],v.prototype,"inputMapPosition",void 0),t([o()],v.prototype,"preservedIntersection",void 0),t([o()],v.prototype,"_interactiveHandle",void 0),t([o()],v.prototype,"_intersector",void 0),v=t([n("esri.views.3d.analysis.LineOfSight.LineOfSightTargetPlugin")],v);export{v as LineOfSightTargetPlugin,y as createLineOfSightTargetPluginConfiguration,g as isLineOfSightTargetPlugin,h as lineOfSightTargetPluginMarker};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import{LineOfSightPlacementController as n}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as l}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as h}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as c}from"../../../input/InputManager.js";import{AnalysisToolBase as p}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as d}from"../../../interactive/keybindings.js";const y={ready:"ready",creating:"creating",created:"created"};let _=class extends p{constructor(t){super(t),this._operationManager=new h,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new r({view:t.view}),this._reshapeTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._reshapeIntersector,view:t.view}),this._placementController=new n({...t,parent:this,shouldPreventVertexAdd:(t,e)=>this._reshapeTool.hasManipulatorAt(t,e)})}get active(){return this._reshapeTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?y.creating:null!=this.analysis.observer?.position?y.created:y.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._reshapeTool.updating||this._placementController.updating}initialize(){this.addHandles([this.view.on("key-down",t=>this._onKeyDown(t),c.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===y.created,t=>{t?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,t=>{this.visible=t},s),i(()=>{const{analysis:t}=this,{observer:e,targets:i}=t;return{observer:e,observerPosition:e?.position,observerElevationInfo:e?.elevationInfo,observerFeature:e?.feature,targets:i.toArray().map(t=>[t,t.position,t.elevationInfo,t.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,t=>{this.analysisViewData.editable=t},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementController.stop(),this._reshapeTool.destroy(),this._placementController.destroy(),this._reshapeIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(t,o)=>{const a=this.analysis.clone();let n=!1,r=!1;const l=()=>{r||(r=!0,this.stop(),o.aborted||!this.analysis.valid||this.analysis.equals(a)?t.reject():t.resolve({}))};t.handles.push(e(()=>this.stop()),i(()=>this._placementController.active,t=>{t?n=!0:n&&l()},s)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.placementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.stop(),this._reshapeTool.visible=!1}_onKeyDown(t){const e=t.key;e===d.undo&&this.canUndo?(t.stopPropagation(),this.undo()):e===d.redo&&this.canRedo?(t.stopPropagation(),this.redo()):e===d.cancel&&!this.active&&this._reshapeTool.hasSelection&&this._reshapeTool.clearSelection()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateReshapeTool?this._placementController.active?this._placementController:null:this._reshapeTool:null}get _canActivateReshapeTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateReshapeTool;if(this._placementController.visible=this.visible&&t,this._reshapeTool.isParentToolInteracting=t&&this._placementController.active,!t)return this._placementController.stop(),this._hideReshapeTool(),this.analysisViewData.cursorTarget=null,void v(this.view,this);if(this._placementController.active||!e)return this._hideReshapeTool(),void v(this.view,this);if(this._reshapeTool.visible=!0,this.analysisViewData.cursorTarget=null,!this._reshapeTool.active&&!this._reshapeTool.hasSelection){const t=this.analysis.targets.at(-1);null!=t&&this._reshapeTool.applySelection({type:"target",target:t})}v(this.view,this)}finally{this._syncingActiveTool=!1}}}_syncItemsFromAnalysis(){this._syncActiveTool()}};t([o({constructOnly:!0})],_.prototype,"view",void 0),t([o({constructOnly:!0})],_.prototype,"analysis",void 0),t([o({constructOnly:!0})],_.prototype,"analysisViewData",void 0),t([o()],_.prototype,"active",null),t([o()],_.prototype,"canRedo",null),t([o()],_.prototype,"canUndo",null),t([o()],_.prototype,"state",null),t([o()],_.prototype,"cursor",null),t([o()],_.prototype,"updating",null),t([o()],_.prototype,"removeIncompleteOnCancel",void 0),t([o()],_.prototype,"_canActivateReshapeTool",null),_=t([a("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],_);export{_ as LineOfSightTool2};
2
+ import{__decorate as e}from"tslib";import{makeHandle as t}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as a}from"../../../../core/accessorSupport/decorators.js";import n from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightPlacementController as r}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as l}from"./LineOfSightRayIntersector.js";import{LineOfSightReshapeTool3D as h}from"./LineOfSightReshapeTool3D.js";import{ExclusiveOperationManager as c}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as p}from"../../../input/InputManager.js";import{AnalysisToolBase as v}from"../../../interactive/AnalysisToolBase.js";import{deactivevateTool as d}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as y}from"../../../interactive/keybindings.js";const _={ready:"ready",creating:"creating",created:"created"};let u=class extends v{constructor(e){super(e),this._operationManager=new c,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1,this._reshapeIntersector=new l({view:e.view}),this._reshapeTool=new h({analysis:e.analysis,analysisViewData:e.analysisViewData,intersector:this._reshapeIntersector,view:e.view}),this._placementController=new r({...e,parent:this,shouldPreventVertexAdd:(e,t)=>this._reshapeTool.hasManipulatorAt(e,t)})}get active(){return this._reshapeTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?_.creating:null!=this.analysis.observer?.position?_.created:_.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._reshapeTool.updating||this._placementController.updating}initialize(){this.addHandles([this.view.on("key-down",e=>this._onKeyDown(e),p.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),s),i(()=>this.state===_.created,e=>{e?this.finishToolCreation():this._set("created",!1)},s),i(()=>this.analysisViewData.visible,e=>{this.visible=e},s),i(()=>{const{analysis:e}=this,{observer:t,targets:i}=e;return{observer:t,observerPosition:t?.position,observerElevationInfo:t?.elevationInfo,observerFeature:t?.feature,targets:i.toArray().map(e=>[e,e.position,e.elevationInfo,e.feature])}},()=>this._syncItemsFromAnalysis(),s),i(()=>this.editable,e=>{this.analysisViewData.editable=e},s)])}destroy(){this._operationManager.destroy(),this._reshapeTool.stop(),this._placementController.stop(),this._reshapeTool.destroy(),this._placementController.destroy(),this._reshapeIntersector.destroy()}place(e){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(o,a)=>{const{elevationInfo:n}=e??{},r=n&&"observer"in n?n.observer:n,l=n&&"targets"in n?n.targets:n;this._placementController.observerPlacementElevationInfo=m(r),this._placementController.targetPlacementElevationInfo=m(l);const h=this.analysis.clone();let c=!1,p=!1;const v=()=>{if(!p){if(p=!0,this.stop(),!this.analysis.valid)return this.analysis.clear(),void o.reject();a.aborted||this.analysis.equals(h)?o.reject():o.resolve({})}};o.handles.push(t(()=>this.stop()),i(()=>this._placementController.active,e=>{e?c=!0:c&&v()},s)),this.continue()},e)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.observerPlacementElevationInfo=null,this._placementController.targetPlacementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}onEditableChange(){this.analysisViewData.editable=this.editable,this._reshapeTool.setEditableFlag(1,!0),this._reshapeTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideReshapeTool(){this._reshapeTool.stop(),this._reshapeTool.visible=!1}_onKeyDown(e){const t=e.key;t===y.undo&&this.canUndo?(e.stopPropagation(),this.undo()):t===y.redo&&this.canRedo?(e.stopPropagation(),this.redo()):t===y.cancel&&!this.active&&this._reshapeTool.hasSelection&&this._reshapeTool.clearSelection()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateReshapeTool?this._placementController.active?this._placementController:null:this._reshapeTool:null}get _canActivateReshapeTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const e=this.analysisViewData.interactive,t=this._canActivateReshapeTool;if(this._placementController.visible=this.visible&&e,this._reshapeTool.isParentToolInteracting=e&&this._placementController.active,!e)return this._placementController.stop(),this._hideReshapeTool(),this.analysisViewData.cursorTarget=null,void d(this.view,this);if(this._placementController.active)return this._reshapeTool.stop(),this._reshapeTool.visible=this.visible,void d(this.view,this);if(!t)return this._hideReshapeTool(),void d(this.view,this);if(this._reshapeTool.visible=!0,this.analysisViewData.cursorTarget=null,!this._reshapeTool.active&&!this._reshapeTool.hasSelection){const e=this.analysis.targets.at(-1);null!=e&&this._reshapeTool.applySelection({type:"target",target:e})}d(this.view,this)}finally{this._syncingActiveTool=!1}}}_syncItemsFromAnalysis(){this._syncActiveTool()}};function m(e){if(null==e)return null;const{featureExpressionInfo:t,mode:i,offset:s,unit:o}=e;return new n({featureExpressionInfo:t,mode:i,offset:s,unit:o})}e([o({constructOnly:!0})],u.prototype,"view",void 0),e([o({constructOnly:!0})],u.prototype,"analysis",void 0),e([o({constructOnly:!0})],u.prototype,"analysisViewData",void 0),e([o()],u.prototype,"active",null),e([o()],u.prototype,"canRedo",null),e([o()],u.prototype,"canUndo",null),e([o()],u.prototype,"state",null),e([o()],u.prototype,"cursor",null),e([o()],u.prototype,"updating",null),e([o()],u.prototype,"removeIncompleteOnCancel",void 0),e([o()],u.prototype,"_canActivateReshapeTool",null),u=e([a("esri.views.3d.analysis.LineOfSight.LineOfSightTool2")],u);export{u as LineOfSightTool2};
@@ -3,6 +3,34 @@
3
3
  *
4
4
  * @since 5.0
5
5
  */
6
+ import type ElevationInfo from "../../../../symbols/support/ElevationInfo.js";
7
+ import type { AbortOptions } from "../../../../core/promiseUtils.js";
8
+ import type { ElevationInfoProperties } from "../../../../symbols/support/ElevationInfo.js";
9
+
10
+ /**
11
+ * Elevation information used when placing a line-of-sight analysis interactively.
12
+ *
13
+ * @since 5.2
14
+ */
15
+ export type LineOfSightPlacementElevationInfo = ElevationInfo | ElevationInfoProperties | {
16
+ observer: ElevationInfo | ElevationInfoProperties;
17
+ targets: ElevationInfo | ElevationInfoProperties;
18
+ };
19
+
20
+ /**
21
+ * Options for placing a line of sight analysis interactively.
22
+ *
23
+ * @since 5.2
24
+ */
25
+ export interface LineOfSightPlacementOptions extends AbortOptions {
26
+ /**
27
+ * Specifies how placed items are positioned on the vertical axis (z). A single elevation information object applies
28
+ * to both the observer and targets. Alternatively, separate elevation information can be provided for each.
29
+ *
30
+ * @since 5.2
31
+ */
32
+ elevationInfo?: LineOfSightPlacementElevationInfo | null;
33
+ }
6
34
 
7
35
  /** @since 5.0 */
8
36
  export interface LineOfSightPlacementResult {}
@@ -2,8 +2,7 @@ import type LineOfSightAnalysis from "../../../analysis/LineOfSightAnalysis.js";
2
2
  import type Collection from "../../../core/Collection.js";
3
3
  import type AnalysisView3D from "./AnalysisView3D.js";
4
4
  import type LineOfSightAnalysisResult from "./LineOfSightAnalysisResult.js";
5
- import type { AbortOptions } from "../../../core/promiseUtils.js";
6
- import type { LineOfSightPlacementResult } from "./LineOfSight/types.js";
5
+ import type { LineOfSightPlacementOptions, LineOfSightPlacementResult } from "./LineOfSight/types.js";
7
6
 
8
7
  /**
9
8
  * Represents the analysis view of a [LineOfSightAnalysis](https://developers.arcgis.com/javascript/latest/references/core/analysis/LineOfSightAnalysis/)
@@ -109,15 +108,16 @@ export default abstract class LineOfSightAnalysisView3D extends AnalysisView3D {
109
108
  * const abortController = new AbortController();
110
109
  *
111
110
  * try {
112
- * await analysisView.place({ signal: abortController.signal });
111
+ * await analysisView.place({
112
+ * elevationInfo: { mode: "relative-to-ground", offset: 2 },
113
+ * signal: abortController.signal
114
+ * });
113
115
  * } catch (error) {
114
- * if (error.name === "AbortError") {
115
- * console.log("Placement operation was cancelled.");
116
- * }
116
+ * // handle error
117
117
  * }
118
118
  *
119
119
  * // cancel the placement operation at some later point
120
120
  * abortController.abort();
121
121
  */
122
- place(options?: AbortOptions | null | undefined): Promise<LineOfSightPlacementResult>;
122
+ place(options?: LineOfSightPlacementOptions | null | undefined): Promise<LineOfSightPlacementResult>;
123
123
  }
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{runUntracked as m}from"../../../../core/accessorSupport/tracking.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxes as h}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{sqrDist as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as y,scale as _,set as v,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,fromValues as j,clone as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as R}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Multipoint.js";import{projectOrLoad as C}from"../../../../geometry/projectionUtils.js";import{e as T}from"../../../../chunks/containsOperator.js";import{e as O}from"../../../../chunks/convexHullOperator.js";import{e as L}from"../../../../chunks/simplifyOperator.js";import{e as G}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as V}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as D}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as H,create as M,fromExtent as I,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as U}from"../../../../geometry/support/coordinateSystem.js";import{isClockwise as S}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as k}from"../../../../geometry/support/DoubleArray.js";import{t as A}from"../../../../chunks/vec3.js";import F from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as W}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as q}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as B,VolumeMeasurementPerimeterTooLargeError as N,VolumeMeasurementUnsupportedCoordinateSystemError as z,VolumeMeasurementUnsupportedLayerTransparencyError as Z}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as J}from"./VolumeMeasurementRawResult.js";import K from"./VolumeMeasurementResult.js";import{ElevationContext as Q}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as X}from"../../support/ElevationProvider.js";import{Obb as Y}from"../../support/orientedBoundingBox.js";import{polygonToRenderInfoElevationAligned as $}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as ee}from"../../terrain/tileUtils.js";import{CutFillComputation as te,TargetGeometryRenderInfo as re}from"../../webgl-engine/lib/CutFillComputation.js";import{GeometryWorkerHandle as oe}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as ie}from"../../../support/layerViewUtils.js";let ne=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new oe,this.depthExtremaPositions=null,this.analysisObb=null,this._updatingHandles=new R,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new ee,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computation.done)return;const{renderCoordsHelper:i}=this.view,n=new q({extent:t,localOrigin:r,renderCoordsHelper:i});this._computation.update(n,o),this._determineDataCoverage(n,e);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computation.done).then(()=>{this._updateDepthExtremaPositions(n,this._computation.getResult())})]);if(this.error)return void(this._rawResult=null);const l=this._computation.getResult();this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=(e,t)=>{const{frustum:r}=this._computation,{cameraDimensions:o}=e;t.extent&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t.extent),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computation=new te({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,transparencyError:!!this._unsupportedLayerTransparencyError}),({localOrigin:e,targetGeometryRenderInfo:t,transparencyError:r})=>{const o=this._projectedGeometry,i=o?.extent;if(!o||!i||!e||!t||r)return this._rawResult=null,this.depthExtremaPositions=null,this.analysisObb=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(o,i,e,t))})])}destroy(){this._updatingHandles.destroy(),this._computation.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=L(e),r=C(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&W(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?j(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;return e?m(()=>{const t=e.clone();return se(this.view.elevationProvider,t),t}):null}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._localOrigin;if(!e||!t)return null;const{elevationProvider:r,renderCoordsHelper:o}=this.view,i=$(e,r,o,Q.fromElevationInfo(new F({mode:"absolute-height"})));if(n(i))return this._updatingHandles.consumePromise(i),null;if(null==i)return null;const{positions:s,polygonIndices:a,vertexCount:l}=i,u=k(3*l),p=c(),m=c();return V(e.spatialReference,t,p,o.spatialReference),m[12]=-p[12],m[13]=-p[13],m[14]=-p[14],A(u,s,m),new re(u,a)}get updating(){return this._computation.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new K({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>ie(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new B}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new N:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new N:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new z:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new Z:null}get _perimeterForError(){const e=this._projectedGeometry;if(null==e)return null;let t=null;for(const r of e.rings){if(!S(r))continue;const e=ue(pe(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(D(e.extent,e.spatialReference,ce,this.view.spatialReference),I(t,he),P(ce,he)&&this.notifyChange("elevationAlignedGeometry"))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ae(t.cut.totalDepth,a,l)*u,m=ae(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new J({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,d=E(s);return 0!==h&&(y(d,d,l,r*(m/t.width-.5)),y(d,d,a,o*(c/t.height-.5))),y(d,d,u,-ae(p,i,n)),d},m={cut:p(t.cut),fill:p(t.fill)};this.depthExtremaPositions=m,this.analysisObb=le(e,m)}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new x({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(me(e.radius,t)&&(e.getCorners(we),n.points.length=0,we.forEach(e=>{const t=r.fromRenderCoords(e,je,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=O(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=G(i);return!!s&&T(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;this._intersectingTiles.length=0,I(e,de);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(de)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>me(t.radius*r,e))}};function se(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=X(e,t,"ground")??0))}function ae(e,t,r){return e*(r-t)+t}function le(e,t){const{boundingRect:r,eastVector:o,northVector:i,upVector:n}=e;U(t.cut,o,i,n,fe),U(t.fill,o,i,n,ge);const s=.5*(r[0]+r[2]),a=.5*(r[1]+r[3]),l=Math.min(fe[2],ge[2]),u=Math.max(fe[2],ge[2]),p=.5*(l+u);return _(ye,o,s),y(ye,ye,i,a),y(ye,ye,n,p),v(_e,.5*(r[2]-r[0]),.5*(r[3]-r[1]),.5*(u-l)),b(ve,n),new Y(ye,_e,h(be,ve,o,i))}function ue(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=f(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=f(r,t)),Math.sqrt(o)}function*pe(e){const t=g();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([u()],ne.prototype,"_projectedGeometry",null),e([u()],ne.prototype,"_localOrigin",null),e([u()],ne.prototype,"elevationAlignedGeometry",null),e([u()],ne.prototype,"targetGeometry",null),e([u()],ne.prototype,"_targetGeometryRenderInfo",null),e([u({constructOnly:!0})],ne.prototype,"analysis",void 0),e([u({constructOnly:!0})],ne.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],ne.prototype,"view",void 0),e([u()],ne.prototype,"updating",null),e([u()],ne.prototype,"result",null),e([u()],ne.prototype,"depthExtremaPositions",void 0),e([u()],ne.prototype,"analysisObb",void 0),e([u()],ne.prototype,"error",null),e([u()],ne.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],ne.prototype,"_insufficientDataError",null),e([u()],ne.prototype,"_perimeterTooLargeError",null),e([u()],ne.prototype,"_perimeterTooLargeLocalError",null),e([u()],ne.prototype,"_perimeterTooLargeGlobalError",null),e([u()],ne.prototype,"_unsupportedCoordinateSystemError",null),e([u()],ne.prototype,"_unsupportedLayerTransparencyError",null),e([u()],ne.prototype,"_perimeterForError",null),e([u()],ne.prototype,"_computation",void 0),e([u({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([u()],ne.prototype,"_rawResult",void 0),e([u()],ne.prototype,"_sufficientDataCoverage",void 0),ne=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],ne);const me=(e,t)=>e<(t.width+t.height)/2,ce=H(),he=H(),de=M(),fe=w(),ge=w(),ye=w(),_e=w(),ve=w(),be=d(),we=new Array(8).fill(0).map(()=>w()),je=w();export{ne as VolumeMeasurementCutFillController};
2
+ import{__decorate as e}from"tslib";import{volumeMeasurementConfiguration as t}from"../../../../analysis/VolumeMeasurement/volumeMeasurementConfiguration.js";import r from"../../../../core/Accessor.js";import o from"../../../../core/Logger.js";import{debounce as i,isPromiseLike as n}from"../../../../core/promiseUtils.js";import{createVolume as s}from"../../../../core/quantity.js";import{whenOnce as a,watch as l}from"../../../../core/reactiveUtils.js";import{property as u,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{runUntracked as m}from"../../../../core/accessorSupport/tracking.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{setAxes as h}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/quatf64.js";import{sqrDist as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scaleAndAdd as y,scale as _,set as v,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as w,fromValues as j,clone as E}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as x}from"../../../../core/support/UpdatingHandles.js";import R from"../../../../geometry/Multipoint.js";import{projectOrLoad as C}from"../../../../geometry/projectionUtils.js";import{e as T}from"../../../../chunks/containsOperator.js";import{e as O}from"../../../../chunks/convexHullOperator.js";import{e as L}from"../../../../chunks/simplifyOperator.js";import{e as G}from"../../../../chunks/unionOperator.js";import{computeTranslationToOriginAndRotation as V}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBoundingRect as D}from"../../../../geometry/projection/projectBoundingRect.js";import{empty as H,create as M,fromExtent as I,intersects as P}from"../../../../geometry/support/aaBoundingRect.js";import{vectorCoordinates as U}from"../../../../geometry/support/coordinateSystem.js";import{isClockwise as S}from"../../../../geometry/support/coordsUtils.js";import{newDoubleArray as k}from"../../../../geometry/support/DoubleArray.js";import{t as A}from"../../../../chunks/vec3.js";import F from"../../../../symbols/support/ElevationInfo.js";import{logFailedGeometryProjectionError as W}from"../support/projectionUtils.js";import{VolumeMeasurementCutFillComputation as q}from"./VolumeMeasurementCutFillComputation.js";import{VolumeMeasurementInsufficientDataError as B,VolumeMeasurementPerimeterTooLargeError as N,VolumeMeasurementUnsupportedCoordinateSystemError as z,VolumeMeasurementUnsupportedLayerTransparencyError as Z}from"./volumeMeasurementErrors.js";import{VolumeMeasurementRawResult as J}from"./VolumeMeasurementRawResult.js";import K from"./VolumeMeasurementResult.js";import{ElevationContext as Q}from"../../layers/graphics/ElevationContext.js";import{getElevationAtPoint as X}from"../../support/ElevationProvider.js";import{Obb as Y}from"../../support/orientedBoundingBox.js";import{polygonToRenderInfoElevationAligned as $}from"../../support/renderInfoUtils/polygon.js";import{IteratorPreorder as ee}from"../../terrain/tileUtils.js";import{CutFillComputation as te,TargetGeometryRenderInfo as re}from"../../webgl-engine/lib/CutFillComputation.js";import{GeometryWorkerHandle as oe}from"../../../support/GeometryWorkerHandle.js";import{isIntegratedMeshLayerView as ie}from"../../../support/layerViewUtils.js";let ne=class extends r{constructor(e){super(e),this._measurementWorkerHandle=new oe,this.depthExtremaPositions=null,this.analysisObb=null,this._updatingHandles=new x,this._rawResult=null,this._sufficientDataCoverage=!0,this._tileIterator=new ee,this._intersectingObbs=[],this._intersectingTiles=[],this._debouncedUpdate=i(async(e,t,r,o)=>{if(!this._computation.done)return;const{renderCoordsHelper:i}=this.view,n=new q({extent:t,localOrigin:r,renderCoordsHelper:i});this._computation.update(n,o),this._determineDataCoverage(n,e);const[s]=await Promise.allSettled([this._measurementWorkerHandle.areaHorizontal(e,{returnLength:!0}),a(()=>this._computation.done).then(()=>{this._updateDepthExtremaPositions(n,this._computation.result)})]);if(this.error)return void(this._rawResult=null);const l=this._computation.result;this._updateResult(n,l,"fulfilled"===s.status?s.value:null)}),this._determineDataCoverage=(e,t)=>{const{frustum:r}=this._computation,{cameraDimensions:o}=e;t.extent&&r&&(this._intersectingObbs.length=0,this._imLayerViewsAffectingMeasurement.forEach(e=>{this._findIntersectingObbs(e,r)}),this._intersectingObbs.length?this._sufficientDataCoverage=this._sufficientIntegratedMeshCoverage(t,o):(this._findIntersectingTerrainTiles(t.extent),this._sufficientDataCoverage=this._sufficientTerrainCoverage(o)))}}initialize(){const e=this.view;this._computation=new te({view:e}),this.addHandles([this._createElevationUpdateHandle(),l(()=>({localOrigin:this._localOrigin,targetGeometryRenderInfo:this._targetGeometryRenderInfo,transparencyError:!!this._unsupportedLayerTransparencyError}),({localOrigin:e,targetGeometryRenderInfo:t,transparencyError:r})=>{const o=this._projectedGeometry,i=o?.extent;if(!o||!i||!e||!t||r)return this._rawResult=null,this.depthExtremaPositions=null,this.analysisObb=null,void(this._sufficientDataCoverage=!0);this._updatingHandles.consumePromise(this._debouncedUpdate(o,i,e,t))})])}destroy(){this._updatingHandles.destroy(),this._computation.destroy(),this._measurementWorkerHandle.destroy()}get _projectedGeometry(){const e=this.analysis.geometry;if(!e||!this.analysis.valid)return null;const t=L(e),r=C(t,this.view.spatialReference);return r.pending?(this._updatingHandles.consumePromise(r.pending),null):(t&&!r.geometry&&W(this.analysis,e.spatialReference,o.getLogger(this)),r.geometry)}get _localOrigin(){const e=this._projectedGeometry?.extent;return e?j(e.center.x,e.center.y,0):null}get elevationAlignedGeometry(){const e=this._projectedGeometry;return e?m(()=>{const t=e.clone();return se(this.view.elevationProvider,t),t}):null}get targetGeometry(){const{elevationAlignedGeometry:e}=this;if(!e)return null;const t=this.analysis.measureType,{effectiveTargetElevation:r}=this.analysisViewData;if("stockpile"===t||null==r)return e;const o=e.clone();return o.rings.forEach(e=>e.forEach(e=>e[2]=r)),o}get _targetGeometryRenderInfo(){const e=this.targetGeometry,t=this._localOrigin;if(!e||!t)return null;const{elevationProvider:r,renderCoordsHelper:o}=this.view,i=$(e,r,o,Q.fromElevationInfo(new F({mode:"absolute-height"})));if(n(i))return this._updatingHandles.consumePromise(i),null;if(null==i)return null;const{positions:s,polygonIndices:a,vertexCount:l}=i,u=k(3*l),p=c(),m=c();return V(e.spatialReference,t,p,o.spatialReference),m[12]=-p[12],m[13]=-p[13],m[14]=-p[14],A(u,s,m),new re(u,a)}get updating(){return this._computation.updating||this._updatingHandles.updating}get result(){const e=this._rawResult,{volume:t,area:r,length:o}=this.analysisViewData.effectiveDisplayUnits;return e?new K({measureType:this.analysis.measureType,rawResult:e,volumeUnit:t,areaUnit:r,lengthUnit:o}):null}get error(){return this._unsupportedCoordinateSystemError??this._unsupportedLayerTransparencyError??this._perimeterTooLargeError??this._insufficientDataError}get _imLayerViewsAffectingMeasurement(){return this.view.allLayerViews.filter(e=>ie(e)).filter(e=>e.visible&&!e.suspended)}get _insufficientDataError(){return this._sufficientDataCoverage?null:new B}get _perimeterTooLargeError(){return this._perimeterTooLargeLocalError??this._perimeterTooLargeGlobalError}get _perimeterTooLargeLocalError(){const{spatialReference:e,state:{isLocal:r}}=this.view;if(!r||!e.isWebMercator)return null;const o=this._perimeterForError,{maxPerimeterLocalWebMercator:i}=t;return null!=o&&o>i?new N:null}get _perimeterTooLargeGlobalError(){if(!this.view.state.isGlobal)return null;const e=this._perimeterForError,{maxPerimeterGlobal:r}=t;return null!=e&&e>r?new N:null}get _unsupportedCoordinateSystemError(){return this.view.state.isLocal&&this.view.spatialReference.isGeographic?new z:null}get _unsupportedLayerTransparencyError(){return this.view.map.ground&&this.view.map.ground.opacity<1?new Z:null}get _perimeterForError(){const e=this._projectedGeometry;if(null==e)return null;let t=null;for(const r of e.rings){if(!S(r))continue;const e=ue(pe(r));t=e?Math.max(t??0,e):t}return null!=t?t*e.spatialReference.metersPerUnit:null}_createElevationUpdateHandle(){const e=e=>{const t=this._projectedGeometry?.extent;"ground"===e.context&&t&&(D(e.extent,e.spatialReference,ce,this.view.spatialReference),I(t,he),P(ce,he)&&this.notifyChange("elevationAlignedGeometry"))};return this.view.elevationProvider.on("elevation-change",t=>e(t))}_updateResult(e,t,r){if(!t)return;const{unitInMeters:o}=this.view.renderCoordsHelper,{dimensions:{width:i,height:n},cameraNearFar:{near:a,far:l}}=e,u=i/t.width*(n/t.height),p=ae(t.cut.totalDepth,a,l)*u,m=ae(t.fill.totalDepth,a,l)*u,c=o**3;this._rawResult=new J({cutVolume:s(Math.abs(p*c),"cubic-meters"),fillVolume:s(m*c,"cubic-meters"),area:r?.area,perimeter:r?.length})}_updateDepthExtremaPositions(e,t){if(!t)return;const{dimensions:{width:r,height:o},cameraNearFar:{near:i,far:n},cameraPositionRenderSpace:s,northVector:a,eastVector:l,upVector:u}=e,p=e=>{const{depthExtremum:p,depthExtremumCoords:[m,c],totalDepth:h}=e,d=E(s);return 0!==h&&(y(d,d,l,r*(m/t.width-.5)),y(d,d,a,o*(c/t.height-.5))),y(d,d,u,-ae(p,i,n)),d},m={cut:p(t.cut),fill:p(t.fill)};this.depthExtremaPositions=m,this.analysisObb=le(e,m)}_findIntersectingObbs(e,t){const r=this._intersectingObbs;"integrated-mesh-3d"===e.type&&e.getVisibleNodes().forEach(o=>{e.isNodeLoaded(o.index)&&o.geometryObbInRenderSR?.intersectsFrustum(t)&&r.push(o.geometryObbInRenderSR)}),"integrated-mesh-3dtiles"===e.type&&e.forEachVisibleComponentObject(({obb:e})=>{e.intersectsFrustum(t)&&r.push(e)})}_sufficientIntegratedMeshCoverage(e,t){const{renderCoordsHelper:r,spatialReference:o}=this.view,i=[],n=new R({spatialReference:o});if(this._intersectingObbs.forEach(e=>{if(me(e.radius,t)&&(e.getCorners(we),n.points.length=0,we.forEach(e=>{const t=r.fromRenderCoords(e,je,o);t&&n.addPoint([t[0],t[1]])}),n.points.length)){const e=O(n);"polygon"===e?.type&&i.push(e)}}),!i.length)return!1;const s=G(i);return!!s&&T(s,e)}_findIntersectingTerrainTiles(e){const{basemapTerrain:t}=this.view;this._intersectingTiles.length=0,I(e,de);const r=this._tileIterator;r.reset(t.rootTiles);for(let o=r.next();o;o=r.next())o.intersectsExtent(de)?o.rendered&&this._intersectingTiles.push(o):r.skipSubtree()}_sufficientTerrainCoverage(e){const{basemapTerrain:{tilingScheme:t}}=this.view;if(!this._intersectingTiles.length)return!1;const r=256/t.pixelSize;return this._intersectingTiles.every(t=>me(t.radius*r,e))}};function se(e,t){t.hasZ=!0,t.rings.forEach(t=>t.forEach(t=>t[2]=X(e,t,"ground")??0))}function ae(e,t,r){return e*(r-t)+t}function le(e,t){const{boundingRect:r,eastVector:o,northVector:i,upVector:n}=e;U(t.cut,o,i,n,fe),U(t.fill,o,i,n,ge);const s=.5*(r[0]+r[2]),a=.5*(r[1]+r[3]),l=Math.min(fe[2],ge[2]),u=Math.max(fe[2],ge[2]),p=.5*(l+u);return _(ye,o,s),y(ye,ye,i,a),y(ye,ye,n,p),v(_e,.5*(r[2]-r[0]),.5*(r[3]-r[1]),.5*(u-l)),b(ve,n),new Y(ye,_e,h(be,ve,o,i))}function ue(e){if(!e)return null;let t=null,r=null,o=0;for(const i of e)t||(t=[i[0],i[1]]),r?o+=f(r,i):r=[0,0],r[0]=i[0],r[1]=i[1];return t&&r&&(o+=f(r,t)),Math.sqrt(o)}function*pe(e){const t=g();for(let r=0;r<e.length;r++)t[0]=e[r][0],t[1]=e[r][1],yield t}e([u()],ne.prototype,"_projectedGeometry",null),e([u()],ne.prototype,"_localOrigin",null),e([u()],ne.prototype,"elevationAlignedGeometry",null),e([u()],ne.prototype,"targetGeometry",null),e([u()],ne.prototype,"_targetGeometryRenderInfo",null),e([u({constructOnly:!0})],ne.prototype,"analysis",void 0),e([u({constructOnly:!0})],ne.prototype,"analysisViewData",void 0),e([u({constructOnly:!0})],ne.prototype,"view",void 0),e([u()],ne.prototype,"updating",null),e([u()],ne.prototype,"result",null),e([u()],ne.prototype,"depthExtremaPositions",void 0),e([u()],ne.prototype,"analysisObb",void 0),e([u()],ne.prototype,"error",null),e([u()],ne.prototype,"_imLayerViewsAffectingMeasurement",null),e([u()],ne.prototype,"_insufficientDataError",null),e([u()],ne.prototype,"_perimeterTooLargeError",null),e([u()],ne.prototype,"_perimeterTooLargeLocalError",null),e([u()],ne.prototype,"_perimeterTooLargeGlobalError",null),e([u()],ne.prototype,"_unsupportedCoordinateSystemError",null),e([u()],ne.prototype,"_unsupportedLayerTransparencyError",null),e([u()],ne.prototype,"_perimeterForError",null),e([u()],ne.prototype,"_computation",void 0),e([u({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([u()],ne.prototype,"_rawResult",void 0),e([u()],ne.prototype,"_sufficientDataCoverage",void 0),ne=e([p("esri.views.3d.analysis.VolumeMeasurement.VolumeMeasurementCutFillController")],ne);const me=(e,t)=>e<(t.width+t.height)/2,ce=H(),he=H(),de=M(),fe=w(),ge=w(),ye=w(),_e=w(),ve=w(),be=d(),we=new Array(8).fill(0).map(()=>w()),je=w();export{ne as VolumeMeasurementCutFillController};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{Manipulator3D as a}from"../../Manipulator3D.js";class t{constructor(){this._available=!0}set location(a){this._forEachManipulator3D(t=>t.location=a)}set elevationAlignedLocation(a){this._forEachManipulator3D(t=>t.elevationAlignedLocation=a)}set elevationInfo(a){this._forEachManipulator3D(t=>t.elevationInfo=a)}get renderLocation(){let a;return this._forEachManipulator3D(t=>{a||(a=t.renderLocation)}),a}set renderLocation(a){this._forEachManipulator3D(t=>t.renderLocation=a)}get available(){return this._available}set available(a){this._available=a,this._forEachManipulator3D(t=>t.available=a)}get hovering(){return this.someManipulator(a=>a.hovering)}get grabbing(){return this.someManipulator(a=>a.grabbing)}get dragging(){return this.someManipulator(a=>a.dragging)}get selected(){return this.someManipulator(a=>a.selected)}hasManipulator(a){return this.someManipulator(t=>t===a)}someManipulator(a){let t=!1;return this.forEachManipulator(o=>{!t&&a(o)&&(t=!0)}),t}_forEachManipulator3D(t){this.forEachManipulator((o,e)=>{o instanceof a&&t(o,e)})}}export{t as Manipulation};
2
+ import{isSome as a}from"../../../../../core/arrayUtils.js";import{handlesGroup as t}from"../../../../../core/handleUtils.js";import{Manipulator3D as r}from"../../Manipulator3D.js";class i{constructor(){this._available=!0}set location(a){this._forEachManipulator3D(t=>t.location=a)}set elevationAlignedLocation(a){this._forEachManipulator3D(t=>t.elevationAlignedLocation=a)}set elevationInfo(a){this._forEachManipulator3D(t=>t.elevationInfo=a)}get renderLocation(){let a;return this._forEachManipulator3D(t=>{a||(a=t.renderLocation)}),a}set renderLocation(a){this._forEachManipulator3D(t=>t.renderLocation=a)}get available(){return this._available}set available(a){this._available=a,this._forEachManipulator3D(t=>t.available=a)}get hovering(){return this.someManipulator(a=>a.hovering)}get grabbing(){return this.someManipulator(a=>a.grabbing)}get dragging(){return this.someManipulator(a=>a.dragging)}get selected(){return this.someManipulator(a=>a.selected)}hasManipulator(a){return this.someManipulator(t=>t===a)}someManipulator(a){let t=!1;return this.forEachManipulator(r=>{!t&&a(r)&&(t=!0)}),t}hideManipulators(){return this._hideManipulators()}hideManipulatorsExceptGrabbedGroup(){return this._hideManipulators(this.mapManipulators((a,t)=>a.grabbing?t:null).filter(a))}_hideManipulators(a){const r=new Set(a);return t(this.mapManipulators((a,t)=>r.has(t)?null:a.disableDisplay?.()))}_forEachManipulator3D(a){this.forEachManipulator((t,i)=>{t instanceof r&&a(t,i)})}mapManipulators(a){const t=[];return this.forEachManipulator((r,i)=>{t.push(a(r,i))}),t}}export{i as Manipulation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import i from"../../../../../core/Handles.js";import{handlesGroup as a}from"../../../../../core/handleUtils.js";import has from"../../../../../core/has.js";import{when as t}from"../../../../../core/reactiveUtils.js";import{discRadiusSmall as n,discRadius as e}from"./config.js";import{InteractiveManipulation as s}from"./InteractiveManipulation.js";import{MoveXYAxisManipulation as o}from"./MoveXYAxisManipulation.js";import{MoveXYDiscManipulation as l}from"./MoveXYDiscManipulation.js";import{MoveZManipulation as r}from"./MoveZManipulation.js";class p extends s{constructor(a){super(),this._handles=new i;const{tool:t,view:n,snapToScene:e,radius:s}=a;this._view=n,this.xyManipulation=new l({tool:t,view:n,snapToScene:e,radius:s}),this.xyAxisManipulation=new o({tool:t,view:n,radius:s}),this.zManipulation=new r({tool:t,view:n,radius:s}),this.xyManipulation.available=a.xyAvailable,this.xyAxisManipulation.available=a.xyAxisAvailable,this.zManipulation.available=a.zAvailable,this._autoHideXYAxis(),this.forEachManipulator(i=>this._handles.add(i.events.on("grab-changed",()=>this._updateManipulatorInteractivity())))}destroy(){this._handles.destroy(),this.xyManipulation.destroy(),this.xyAxisManipulation.destroy(),this.zManipulation.destroy()}createManipulatedObjectDragPipeline(i,t,n){return a([this.xyManipulation.createManipulatedObjectDragPipeline((a,t,n,e,s)=>i(0,a,t,n,e,s),t,n),this.xyAxisManipulation.createManipulatedObjectDragPipeline((a,t,n,e,s)=>i(1,a,t,n,e,s),t,n),this.zManipulation.createManipulatedObjectDragPipeline((a,t,n,e,s)=>i(2,a,t,n,e,s),t,n)])}createDragPipeline(i,t,n,e){return a([this.xyManipulation.createDragPipeline((a,t,n,e,s)=>i(0,a,t,n,e,s),t,n,e),this.xyAxisManipulation.createDragPipeline((a,t,n,e,s)=>i(1,a,t,n,e,s),t,n,e),this.zManipulation.createDragPipeline((a,t,n,e,s)=>i(2,a,t,n,e,s),n)])}set snapToScene(i){this.xyManipulation.snapToScene=i}set angle(i){this.xyAxisManipulation.angle=i}set radius(i){this.xyAxisManipulation.radius=i,this.xyManipulation.radius=i,this.zManipulation.radius=i}set displayScale(i){this.xyManipulation.displayScale=i,this.xyAxisManipulation.displayScale=i}forEachManipulator(i){this.xyManipulation.forEachManipulator(a=>i(a,1)),this.xyAxisManipulation.forEachManipulator(a=>i(a,1)),this.zManipulation.forEachManipulator(a=>i(a,0))}get _xyAxisVisible(){const i=this.xyManipulation.someManipulator(i=>i.focused)||this.xyAxisManipulation.someManipulator(i=>i.focused);return this._view.inputManager&&"touch"===this._view.inputManager.latestPointerInfo?.type||i}_autoHideXYAxis(){const i=this.xyAxisManipulation,a=this.xyManipulation;if(has("esri-mobile"))return;const n=[];a.forEachManipulator(i=>n.push(i)),i.forEachManipulator(i=>n.push(i));const e=()=>{const a=[];this._xyAxisVisible||i.forEachManipulator(i=>a.push(i.disableDisplay())),this._handles.remove(u),this._handles.add(a,u)};for(const t of n)this._handles.add(t.events.on("focus-changed",e));this._view.inputManager&&this._handles.add(t(()=>this._view.inputManager?.latestPointerInfo?.type,e)),e()}static radiusForSymbol(i){const a=null!=i&&"point-3d"===i.type&&i.symbolLayers;return!!a&&a.some(i=>"icon"===i.type)?n:e}}const u="disable-xy-axis-display";export{p as MoveManipulation};
2
+ import i from"../../../../../core/Handles.js";import{handlesGroup as a}from"../../../../../core/handleUtils.js";import has from"../../../../../core/has.js";import{when as t}from"../../../../../core/reactiveUtils.js";import{discRadiusSmall as n,discRadius as e}from"./config.js";import{InteractiveManipulation as s}from"./InteractiveManipulation.js";import{MoveXYAxisManipulation as o}from"./MoveXYAxisManipulation.js";import{MoveXYDiscManipulation as l}from"./MoveXYDiscManipulation.js";import{MoveZManipulation as r}from"./MoveZManipulation.js";class p extends s{constructor(a){super(),this._handles=new i;const{tool:t,view:n,snapToScene:e,radius:s}=a;this._view=n,this.xyManipulation=new l({tool:t,view:n,snapToScene:e,radius:s}),this.xyAxisManipulation=new o({tool:t,view:n,radius:s}),this.zManipulation=new r({tool:t,view:n,radius:s}),this.xyManipulation.available=a.xyAvailable,this.xyAxisManipulation.available=a.xyAxisAvailable,this.zManipulation.available=a.zAvailable,this._autoHideXYAxis(),this.forEachManipulator(i=>this._handles.add(i.events.on("grab-changed",()=>{this._updateManipulatorInteractivity(),this._updateManipulatorDisplay()})))}destroy(){this._handles.destroy(),this.xyManipulation.destroy(),this.xyAxisManipulation.destroy(),this.zManipulation.destroy()}createManipulatedObjectDragPipeline(i,t,n){return a([this.xyManipulation.createManipulatedObjectDragPipeline((a,t,n,e,s)=>i(0,a,t,n,e,s),t,n),this.xyAxisManipulation.createManipulatedObjectDragPipeline((a,t,n,e,s)=>i(1,a,t,n,e,s),t,n),this.zManipulation.createManipulatedObjectDragPipeline((a,t,n,e,s)=>i(2,a,t,n,e,s),t,n)])}createDragPipeline(i,t,n,e){return a([this.xyManipulation.createDragPipeline((a,t,n,e,s)=>i(0,a,t,n,e,s),t,n,e),this.xyAxisManipulation.createDragPipeline((a,t,n,e,s)=>i(1,a,t,n,e,s),t,n,e),this.zManipulation.createDragPipeline((a,t,n,e,s)=>i(2,a,t,n,e,s),n)])}set snapToScene(i){this.xyManipulation.snapToScene=i}set angle(i){this.xyAxisManipulation.angle=i}set radius(i){this.xyAxisManipulation.radius=i,this.xyManipulation.radius=i,this.zManipulation.radius=i}set displayScale(i){this.xyManipulation.displayScale=i,this.xyAxisManipulation.displayScale=i}forEachManipulator(i){this.xyManipulation.forEachManipulator(a=>i(a,1)),this.xyAxisManipulation.forEachManipulator(a=>i(a,1)),this.zManipulation.forEachManipulator(a=>i(a,0))}get _xyAxisVisible(){const i=this.xyManipulation.someManipulator(i=>i.focused)||this.xyAxisManipulation.someManipulator(i=>i.focused);return this._view.inputManager&&"touch"===this._view.inputManager.latestPointerInfo?.type||i}_autoHideXYAxis(){const i=this.xyAxisManipulation,a=this.xyManipulation;if(has("esri-mobile"))return;const n=[a,i].flatMap(i=>i.mapManipulators(i=>i)),e=()=>{const a=this._xyAxisVisible?null:i.hideManipulators();this._handles.remove(u),this._handles.add(a,u)};for(const t of n)this._handles.add(t.events.on("focus-changed",e));this._view.inputManager&&this._handles.add(t(()=>this._view.inputManager?.latestPointerInfo?.type,e)),e()}_updateManipulatorDisplay(){const i=this.grabbing?this.hideManipulatorsExceptGrabbedGroup():null;this._handles.remove(h),this._handles.add(i,h)}static radiusForSymbol(i){const a=null!=i&&"point-3d"===i.type&&i.symbolLayers;return!!a&&a.some(i=>"icon"===i.type)?n:e}}const u=Symbol("hideXyAxisManipulators"),h=Symbol("hideManipulatorsExceptGrabbedTypes");export{p as MoveManipulation};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{debounce as a}from"../../../../../core/promiseUtils.js";import{scale as l,zeroMeters as r}from"../../../../../core/quantity.js";import{watch as p,initial as c,syncAndInitial as h}from"../../../../../core/reactiveUtils.js";import{property as m,subclass as u}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as d}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as v}from"../../../../../core/support/UpdatingHandles.js";import f from"../../../../../geometry/Point.js";import{makeDehydratedPoint as _}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as g}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as M}from"../../SnappingVisualizer3D.js";import{orientation as b}from"../geometryUtils.js";import{manipulatedObjectGeometry as j}from"../manipulatedObjectUtils.js";import{canMoveZOperations as y}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as T}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as w}from"../tooltipUtils3D.js";import{createVisualElements as I}from"../visualElementUtils.js";import{discRadius as S}from"../manipulations/config.js";import{MoveManipulation as H}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as x}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as O}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as P}from"./isSupportedObject.js";import{OutlineVisualElement as k}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as D}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as U}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as C,enterInputModeIfAvailable as Z}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as F}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as G}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as W}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as B}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as N}from"../../../../support/GeometryWorkerHandle.js";class q{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class J{constructor(t){this.objects=t,this.type="move-stop"}}const K=Symbol("manipulators"),Q=Symbol("tooltips");let $=class extends A{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new z,this.type="move-3d",this._measurementWorker=new N({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new v,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=a(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){const{view:t}=this;this.tooltip=C(()=>({view:t,options:this.sketchOptions.tooltips})),this.addHandles([this.objects.on("change",t=>{t.removed.forEach(t=>this.removeHandles(t)),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()}),this.objects.on("change",()=>this._connectTooltips())]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(t){if(!this.destroyed&&!Z(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=j(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(0!==P(e))continue;const t=new ot(e);this._infos.set(e,t)}for(const e of o)this._infos.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(T(t.object),o)}}_refreshManipulators(){if(this.removeHandles(K),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new O({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator(t=>{this.addHandles([t.events.on("immediate-click",t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}),t.events.on("grab-changed",({action:t})=>{"start"===t?this._showTooltip(0):this._hideTooltip()})],K)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),K)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new H({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?H.radiusForSymbol(t[0].object.graphic?.symbol):S});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator(t=>{this.addHandles(t.events.on("immediate-click",e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()}),K)});const e=t=>o=>{this.addHandles([o.events.on("focus-changed",({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()}),o.events.on("grab-changed",()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=r)})],K)};this._moveManipulation.xyManipulation.forEachManipulator(e(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(1)),this._moveManipulation.zManipulation.forEachManipulator(e(2));const i=()=>this._updateMoveManipulation(t);for(const r of t){this.addHandles([r.object.on("committed",i),p(()=>r.object.visible,i)],K);const o=Symbol();this.addHandles(p(()=>r.object.isDraped,e=>{this._updateMoveManipulation(t),this.removeHandles(o),e&&this.addHandles(D({view:this.view,geometry:r.object.graphic?.geometry,elevationInfo:r.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(t)}),o)},c),K),this.addHandles(n(()=>this.removeHandles(o)),K)}const s=t[t.length-1];this.addHandles(s.object.on("committed",()=>this._updateMoveManipulationAngle(s)),K);const{object:a}=s,{operations:l}=a;if(l){const e=a.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),a.elevationInfo,l.data.spatialReference,e),K)}this._updateMoveManipulationAngle(s)}_createVisualElements(t){for(const o of t){const e=o.object,i=I({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof k&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),p(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],K),this.addHandles(i,K))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=b(j(t.object)))}_updateMoveManipulation(t){const o=_(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&y(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof k&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&0===o){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next(t=>p?.(t)).next(()=>(l.length&&this.events.emit("move-stop",new J(l)),this.destroyed||c(),null)),{steps:i=i.next(o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=U(l),this._emitRecordUndo(),this.events.emit("move-start",new q(l)),this.destroyed))return null}return 0!==l.length?o:null}).next(t=>r?.(t)).next(t=>(this._updateMoveTooltip(o,t),t)).next(t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd);if(!o||!e)return null;const i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new L(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new J(l)),this.destroyed)return null;c()}return null}),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(Q),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new F({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new q([o]))},onMove:()=>e.emit("move",new L(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new J([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=w(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=p(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},h);this.addHandles(t,Q)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new G({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,(t,o)=>this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(o))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,async(t,e)=>l(await this._measurementWorker.autoDistance2DBetweenPoints(tt(t),tt(e)),x(o))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new W({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,B))}this._latestTooltipInfo.sketchOptions=e}async _updateMoveTooltipDistanceAsync(t,o,e){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:n}=o,s=await e(i,n);t.distance=s??r}else t.distance=r}_emitRecordUndo(){const t=this.objects.toArray().map(t=>t.createUndoRecord?.()).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=j(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:R.fromGeometry(a,this.view.state.viewingMode),visualizer:new M,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(c),{steps:e=e.next(o=>{a.z=g(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...p),cancel:i}}get test(){}};t([m({constructOnly:!0,nonNullable:!0})],$.prototype,"view",void 0),t([m()],$.prototype,"objects",void 0),t([m({constructOnly:!0,nonNullable:!0})],$.prototype,"enableZ",void 0),t([m({constructOnly:!0,type:z})],$.prototype,"sketchOptions",void 0),t([m({constructOnly:!0})],$.prototype,"snappingManager",void 0),t([m()],$.prototype,"type",void 0),t([m()],$.prototype,"updating",null),t([m()],$.prototype,"_latestTooltipInfo",void 0),t([m()],$.prototype,"_shouldShowMovePointTooltip",null),t([m()],$.prototype,"activeTooltipInfo",null),$=t([u("esri.views.3d.interactive.editingTools.move.MoveTool3D")],$);const tt=d(f);class ot{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{L as MoveEvent,q as MoveStartEvent,J as MoveStopEvent,$ as MoveTool3D};
2
+ import{__decorate as t}from"tslib";import{isSome as o}from"../../../../../core/arrayUtils.js";import e from"../../../../../core/Collection.js";import{EventEmitter as i}from"../../../../../core/Evented.js";import{makeHandle as n}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as s}from"../../../../../core/maybe.js";import{debounce as a}from"../../../../../core/promiseUtils.js";import{scale as l,zeroMeters as r}from"../../../../../core/quantity.js";import{watch as p,initial as h,syncAndInitial as c}from"../../../../../core/reactiveUtils.js";import{property as u,subclass as m}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as d}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as v}from"../../../../../core/support/UpdatingHandles.js";import f from"../../../../../geometry/Point.js";import{makeDehydratedPoint as _}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as g}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as M}from"../../SnappingVisualizer3D.js";import{orientation as y}from"../geometryUtils.js";import{manipulatedObjectGeometry as b}from"../manipulatedObjectUtils.js";import{canMoveZOperations as j}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as T}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as w}from"../tooltipUtils3D.js";import{createVisualElements as I}from"../visualElementUtils.js";import{discRadius as S}from"../manipulations/config.js";import{MoveManipulation as H}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as D}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as x}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as O}from"./isSupportedObject.js";import{OutlineVisualElement as P}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as k}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as U}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as R}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import z from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as B,enterInputModeIfAvailable as C}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as Z}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as F}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as G}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as W}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as N}from"../../../../support/GeometryWorkerHandle.js";class q{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,e){this.dx=t,this.dy=o,this.objects=e,this.type="move"}}class J{constructor(t){this.objects=t,this.type="move-stop"}}const K=Symbol("manipulators"),Q=Symbol("tooltips"),$=Symbol("move-manipulator-display");let tt=class extends A{get _infos(){return Array.from(this._infosByType.values())}constructor(t){super(t),this._infosByType=new Map,this.events=new i,this.objects=new e,this.enableZ=!0,this.sketchOptions=new z,this.type="move-3d",this._measurementWorker=new N({preloadGeodetic:!0}),this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new v,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=a(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){const{view:t}=this;this.tooltip=B(()=>({view:t,options:this.sketchOptions.tooltips})),this.addHandles([this.objects.on("change",t=>{t.removed.forEach(t=>this.removeHandles(t)),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()}),this.objects.on("change",()=>this._connectTooltips())]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=s(this.tooltip),this._moveManipulation=s(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(t){if(!this.destroyed&&!C(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){const{objects:t}=this;if(1!==t.length)return!1;const o=b(t.at(0))?.type;return"point"===o||"mesh"===o}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const e of t){if(0!==O(e))continue;const t=new et(e);this._infosByType.set(e,t)}for(const e of o)this._infosByType.delete(e)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infosByType.get(o);this.addHandles(T(t.object),o)}}_refreshManipulators(){if(this.removeHandles(K),this.removeHandles($),this._moveManipulation=s(this._moveManipulation),this.manipulators.removeAll(),0===this._infosByType.size)return;const t=this._infos;this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const e=o.object;o.manipulationXY=new x({tool:this,view:this.view,object:e}),o.manipulationXY.forEachManipulator(t=>{this.addHandles([t.events.on("immediate-click",t=>{this.events.emit("immediate-click",{...t,object:e}),t.stopPropagation()}),t.events.on("grab-changed",({action:t})=>{"start"===t?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],K)}),this.addHandles(o.manipulationXY.createDragPipeline((o,e,i,n)=>this._buildDragEventPipeline(t,0,o,e,i,n)),K)}this._createMoveManipulation(t)}_updateMoveManipulatorDisplay(){const t=this._infos.some(t=>t.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!t),this.removeHandles($),t&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),$)}_createMoveManipulation(t){const o=new H({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?H.radiusForSymbol(t[0].object.graphic?.symbol):S});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator(t=>{this.addHandles(t.events.on("immediate-click",e=>{const i=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&i&&this.events.emit("immediate-click",{...e,object:i}),e.stopPropagation()}),K)});const e=t=>o=>{this.addHandles([o.events.on("focus-changed",({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()}),o.events.on("grab-changed",()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=r)})],K)};this._moveManipulation.xyManipulation.forEachManipulator(e(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(e(1)),this._moveManipulation.zManipulation.forEachManipulator(e(2));const i=()=>this._updateMoveManipulation(t);for(const r of t){this.addHandles([r.object.on("committed",i),p(()=>r.object.visible,i)],K);const o=Symbol();this.addHandles(p(()=>r.object.isDraped,e=>{this._updateMoveManipulation(t),this.removeHandles(o),e&&this.addHandles(k({view:this.view,geometry:r.object.graphic?.geometry,elevationInfo:r.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(t)}),o)},h),K),this.addHandles(n(()=>this.removeHandles(o)),K)}const s=t[t.length-1];this.addHandles(s.object.on("committed",()=>this._updateMoveManipulationAngle(s)),K);const{object:a}=s,{operations:l}=a;if(l){const e=a.graphic;this.addHandles(o.createDragPipeline((o,e,i,n,s)=>this._buildDragEventPipeline(t,o,e,i,n,s),a.elevationInfo,l.data.spatialReference,e),K)}this._updateMoveManipulationAngle(s)}_createVisualElements(t){for(const o of t){const e=o.object,i=I({view:this.view,object:e,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>n()});null!=i&&(o.geometryRepresentation=i.visualElement,o.geometryRepresentation instanceof P&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",()=>{o.object.isDraped||this._updateMoveManipulation(t)}),p(()=>o.object.isDraped,()=>this._updateMoveManipulation(t))],K),this.addHandles(i,K))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=y(b(t.object)))}_updateMoveManipulation(t){const o=_(0,0,0,this.view.spatialReference);let e=0,i=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&j(n.object.operations,n.object.elevationInfo)&&(i=!0);const t=n.geometryRepresentation instanceof P&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:i,y:n,z:s}=t;o.x+=i,o.y+=n,s&&(o.z??=0,o.z+=s),e++}}e>0?(o.x/=e,o.y/=e,o.z??=0,o.z/=e,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=i):n.available=!1}}_buildDragEventPipeline(t,o,e,i,n,s){const a=[],l=[];let r=null,p=null;const h=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._updateMoveManipulatorDisplay()};if(1===t.length&&0===o){const o=t[0].object;({steps:i,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,i,n,s))}return n=n.next(t=>p?.(t)).next(()=>(l.length&&this.events.emit("move-stop",new J(l)),this.destroyed||h(),null)),{steps:i=i.next(o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(e)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=U(l),this._emitRecordUndo(),this.events.emit("move-start",new q(l)),this.destroyed))return null}return 0!==l.length?o:null}).next(t=>r?.(t)).next(t=>(this._updateMoveTooltip(o,t),t)).next(t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),e=this.view.toScreen(t.mapEnd);if(!o||!e)return null;const i=e.x-o.x,n=e.y-o.y;if(this.events.emit("move",new L(i,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new J(l)),this.destroyed)return null;h()}return null}),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(Q),this._shouldShowMovePointTooltip){const o=this.objects.at(0),{events:e}=this;this._movePointTooltipInfo??=new Z({viewType:this.view.type,sketchOptions:this.sketchOptions});const i={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),e.emit("move-start",new q([o]))},onMove:()=>e.emit("move",new L(0,0,[o])),onMoveStop:()=>e.emit("move-stop",new J([o])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};t=w(this.tooltip,o,()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:i}))}else t=p(()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,t=>{this.tooltip.info=t},c);this.addHandles(t,Q)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:e}=this;switch(t){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new F({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,(t,o)=>this._measurementWorker.autoDistance2DBetweenPoints(ot(t),ot(o))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new G({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,async(t,e)=>l(await this._measurementWorker.autoDistance2DBetweenPoints(ot(t),ot(e)),D(o))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new V({sketchOptions:e}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,o,W))}this._latestTooltipInfo.sketchOptions=e}async _updateMoveTooltipDistanceAsync(t,o,e){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:n}=o,s=await e(i,n);t.distance=s??r}else t.distance=r}_emitRecordUndo(){const t=this.objects.toArray().map(t=>t.createUndoRecord?.()).filter(o);t.length>0&&this.events.emit("record-undo",{updates:t})}_buildSnappingPipelineSteps(t,o,e,i,n){const s=b(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:e,cancel:i};const a=("point"===s.type?s:s.origin).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:R.fromGeometry(a,this.view.state.viewingMode),visualizer:new M,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:h}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return i=i.next(h),{steps:e=e.next(o=>{a.z=g(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}}).next(...p),cancel:i}}get test(){}};t([u({constructOnly:!0,nonNullable:!0})],tt.prototype,"view",void 0),t([u()],tt.prototype,"objects",void 0),t([u({constructOnly:!0,nonNullable:!0})],tt.prototype,"enableZ",void 0),t([u({constructOnly:!0,type:z})],tt.prototype,"sketchOptions",void 0),t([u({constructOnly:!0})],tt.prototype,"snappingManager",void 0),t([u()],tt.prototype,"type",void 0),t([u()],tt.prototype,"updating",null),t([u()],tt.prototype,"_latestTooltipInfo",void 0),t([u()],tt.prototype,"_shouldShowMovePointTooltip",null),t([u()],tt.prototype,"activeTooltipInfo",null),tt=t([m("esri.views.3d.interactive.editingTools.move.MoveTool3D")],tt);const ot=d(f);class et{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{L as MoveEvent,q as MoveStartEvent,J as MoveStopEvent,tt as MoveTool3D};