@arcgis/core 5.2.0-next.161 → 5.2.0-next.163
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.
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/092e311cb7aea92a6a26.js +1 -0
- package/assets/esri/core/workers/chunks/17c6d66b47aa690df0d4.js +1 -0
- package/assets/esri/core/workers/chunks/1e1c45f75020d5e05dc3.js +1 -0
- package/assets/esri/core/workers/chunks/{4ed76fb5f6096a089f5b.js → 1f7f4f821d422b46cae7.js} +1 -1
- package/assets/esri/core/workers/chunks/1fe24ffcd88280d84fbe.js +1 -0
- package/assets/esri/core/workers/chunks/25a3bd8bede2d07d3a54.js +1 -0
- package/assets/esri/core/workers/chunks/2ad69cc496235702bbf2.js +1 -0
- package/assets/esri/core/workers/chunks/3f46acfda693c70abbdd.js +1 -0
- package/assets/esri/core/workers/chunks/434a8ba841a59e0deab9.js +1 -0
- package/assets/esri/core/workers/chunks/45fd2b456a6997584ca1.js +1 -0
- package/assets/esri/core/workers/chunks/{8480fe6b4372dbbfa7cc.js → 46c5371c7a627537098c.js} +10 -10
- package/assets/esri/core/workers/chunks/53ff68d4f9e365fc15cd.js +1 -0
- package/assets/esri/core/workers/chunks/542e5640ea1b80ef801a.js +1 -0
- package/assets/esri/core/workers/chunks/5a9b7eb26f936f03d02e.js +1 -0
- package/assets/esri/core/workers/chunks/5d76f4d97beee494bbbf.js +1 -0
- package/assets/esri/core/workers/chunks/5dc604e3691f36f03959.js +1 -0
- package/assets/esri/core/workers/chunks/5f07f52bb8b7721f08d3.js +1 -0
- package/assets/esri/core/workers/chunks/{32b351b047ce1eb58146.js → 60c79934799927114074.js} +1 -1
- package/assets/esri/core/workers/chunks/67f54efc817b241f8746.js +1 -0
- package/assets/esri/core/workers/chunks/7159d9c36869cd82599e.js +29 -0
- package/assets/esri/core/workers/chunks/771dd92cb3e6a3427f66.js +1 -0
- package/assets/esri/core/workers/chunks/792d2b62356a1d953c88.js +1 -0
- package/assets/esri/core/workers/chunks/89c8b0f684c1f27d149e.js +1 -0
- package/assets/esri/core/workers/chunks/{9401cc22373566e1171e.js → 8a7b02037151767542f1.js} +1 -1
- package/assets/esri/core/workers/chunks/8ab57cb1bfd3dc8d3c2a.js +1 -0
- package/assets/esri/core/workers/chunks/95b82cbbe355266c65d7.js +1 -0
- package/assets/esri/core/workers/chunks/97b5f4302fb867c829f4.js +1 -0
- package/assets/esri/core/workers/chunks/9de5ad77bc37ec142218.js +1 -0
- package/assets/esri/core/workers/chunks/a65951f1d5702cfd996e.js +1 -0
- package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.js +1 -0
- package/assets/esri/core/workers/chunks/aa4f3751f0d830113bed.js +1 -0
- package/assets/esri/core/workers/chunks/b1d989b72203113a06fe.js +1 -0
- package/assets/esri/core/workers/chunks/{fc73737b41e086f0ce0b.js → b59aaf30c7fe2c8d1aaa.js} +1 -1
- package/assets/esri/core/workers/chunks/b6d71a4ab788a09714f3.js +1 -0
- package/assets/esri/core/workers/chunks/b704f489d0f072a0bfcd.js +1 -0
- package/assets/esri/core/workers/chunks/{28b74bc77f7c13080074.js → be97a629e2ae4d13ceb3.js} +1 -1
- package/assets/esri/core/workers/chunks/{d33360c4f85203edafff.js → bf4d913e523eae2fda28.js} +1 -1
- package/assets/esri/core/workers/chunks/{d6cd0039d6e9c40961e3.js → d1f98c5249c487eb96f1.js} +1 -1
- package/assets/esri/core/workers/chunks/e077e321a3109c2fbbe2.js +1 -0
- package/assets/esri/core/workers/chunks/e251921bc5367258c4d2.js +1 -0
- package/assets/esri/core/workers/chunks/ee08ae5b73439a1ff666.js +1 -0
- package/assets/esri/core/workers/chunks/fcaf9450642fcef83286.js +1 -0
- package/assets/esri/core/workers/chunks/feb41abc03d677df6f73.js +1 -0
- package/assets/esri/themes/base/widgets/_OrientedImageryViewer.scss +2 -5
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/RealisticTree.glsl.js +1 -1
- package/chunks/RibbonLine.glsl.js +70 -64
- package/config.d.ts +11 -30
- package/config.js +1 -1
- package/core/workers/workerFactory.js +1 -1
- package/core/workers.d.ts +17 -0
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +39 -19
- package/layers/FeatureLayer.js +1 -1
- package/layers/MapImageLayer.d.ts +10 -3
- package/layers/MapNotesLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.d.ts +64 -1
- package/layers/SubtypeGroupLayer.js +1 -1
- package/layers/geospatialPDF/GeospatialPDFLayerWorker.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/graphics/sources/support/QueryTask.js +1 -1
- package/layers/knowledgeGraph/KnowledgeGraphSublayer.d.ts +16 -16
- package/layers/mixins/ArcGISMapService.js +1 -1
- package/layers/ogc/ogcFeatureUtils.js +1 -1
- package/layers/support/LabelClass.d.ts +20 -2
- package/layers/support/Sublayer.d.ts +61 -17
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/TimeInformation.js +2 -0
- package/package.json +2 -2
- package/rest/layerSources/DynamicDataLayer.d.ts +4 -2
- package/rest/layerSources/DynamicDataLayer.js +1 -1
- package/rest/layerSources/DynamicMapLayer.d.ts +1 -1
- package/rest/layerSources/DynamicWorkspaceLayer.d.ts +49 -0
- package/rest/layerSources/DynamicWorkspaceLayer.js +2 -0
- package/rest/layerSources/typeUtils.js +2 -0
- package/rest/query/operations/queryRelatedRecords.js +1 -1
- package/rest/query/operations/queryUtils.js +1 -1
- package/rest/support/Query.js +1 -1
- package/rest/support/RelationshipQuery.js +1 -1
- package/rest/support/timeUtils.js +2 -0
- package/symbols/LineSymbol3D.d.ts +5 -3
- package/symbols/TextSymbol.d.ts +27 -2
- package/views/2d/analysis/AreaMeasurement/AreaMeasurementTool.js +1 -1
- package/views/2d/analysis/AreaMeasurementAnalysisView2D.js +1 -1
- package/views/2d/analysis/DistanceMeasurement/DistanceMeasurementTool.js +1 -1
- package/views/2d/analysis/DistanceMeasurementAnalysisView2D.js +1 -1
- package/views/2d/analysis/ElevationProfileAnalysisView2D.d.ts +6 -0
- package/views/2d/analysis/ElevationProfileAnalysisView2D.js +1 -1
- package/views/2d/layers/features/layerAdapters/FeatureLayerAdapter.js +1 -1
- package/views/2d/layers/features/layerAdapters/SubtypeGroupLayerAdapter.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/analysis/ElevationProfileAnalysisView3D.d.ts +6 -0
- package/views/3d/analysis/ElevationProfileAnalysisView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedPlacementPointPlugin.js +1 -1
- package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
- package/views/3d/environment/SunLighting.d.ts +17 -1
- package/views/3d/environment/SunLighting.js +1 -1
- package/views/3d/environment/VirtualLighting.d.ts +17 -1
- package/views/3d/environment/VirtualLighting.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/manipulators/ResizeManipulator.js +1 -1
- package/views/3d/interactive/manipulators/RotateManipulator.js +1 -1
- package/views/3d/interactive/manipulators/ShiftManipulator.js +1 -1
- package/views/3d/interactive/visualElements/ExtendedLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/LineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/OutlineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/ParallelLineVisualElement.js +1 -1
- package/views/3d/interactive/visualElements/RightAngleQuadVisualElement.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/support/elevationUpdateUtils.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentData.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/SymbolColor.glsl.js +3 -3
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialExternalColor.glsl.js +2 -2
- package/views/3d/webgl-engine/core/shaderLibrary/output/getEmissions.glsl.js +2 -2
- package/views/3d/webgl-engine/lib/GridLocalOriginFactory.js +1 -1
- package/views/3d/webgl-engine/lib/RenderFeature.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/BasemapView.js +1 -1
- package/views/BreakpointsOwner.d.ts +6 -0
- package/views/GroundView.d.ts +1 -1
- package/views/GroundView.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/support/ScheduledQueueProcessor.js +1 -1
- package/views/types.d.ts +3 -0
- package/views/webgl/ShaderBuilder.js +1 -1
- package/widgets/Daylight/DaylightViewModel.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/Sketch/SketchViewModel.d.ts +61 -2
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/TimeSlider/TimeSliderViewModel.d.ts +3 -2
- package/widgets/TimeSlider.d.ts +5 -4
- package/assets/esri/core/workers/chunks/0a5a9885ee6f5b5f99f0.js +0 -1
- package/assets/esri/core/workers/chunks/0bd5012da287469b17d5.js +0 -1
- package/assets/esri/core/workers/chunks/112befb3b5b406f29298.js +0 -1
- package/assets/esri/core/workers/chunks/172cfeb5f415e4662432.js +0 -1
- package/assets/esri/core/workers/chunks/2d13a22f7b2427927fdc.js +0 -1
- package/assets/esri/core/workers/chunks/3e3e076fa5e8d5d5f33f.js +0 -1
- package/assets/esri/core/workers/chunks/42fd2a7b22b03dacc6a7.js +0 -1
- package/assets/esri/core/workers/chunks/43cf862577bf37344ff4.js +0 -1
- package/assets/esri/core/workers/chunks/4be559c53fe5ac0d0d2e.js +0 -1
- package/assets/esri/core/workers/chunks/4e350d6c76957f5beb70.js +0 -1
- package/assets/esri/core/workers/chunks/4fe34da1c5d63e66ce98.js +0 -1
- package/assets/esri/core/workers/chunks/510502a4c9a2ba8d3f7b.js +0 -1
- package/assets/esri/core/workers/chunks/612104dff305ff062dfa.js +0 -29
- package/assets/esri/core/workers/chunks/6c9266120d46e8c69dbf.js +0 -1
- package/assets/esri/core/workers/chunks/6c9acd9e4e201dc380e9.js +0 -1
- package/assets/esri/core/workers/chunks/74c866e0b66e61751861.js +0 -1
- package/assets/esri/core/workers/chunks/830ab9b8d000169da675.js +0 -1
- package/assets/esri/core/workers/chunks/8ff23ac0abeea0073b47.js +0 -1
- package/assets/esri/core/workers/chunks/939942b00ba380e2957e.js +0 -1
- package/assets/esri/core/workers/chunks/95dbbddac6581b9d671f.js +0 -1
- package/assets/esri/core/workers/chunks/a40b6d8b5c73e06e14d4.js +0 -1
- package/assets/esri/core/workers/chunks/aa1ac7954e4f0fefe15b.js +0 -1
- package/assets/esri/core/workers/chunks/b5df193c93e9c19f9700.js +0 -1
- package/assets/esri/core/workers/chunks/befa32b9e7b3fbdd431e.js +0 -1
- package/assets/esri/core/workers/chunks/c2c1f51a4668055c2838.js +0 -1
- package/assets/esri/core/workers/chunks/d0f5bee9db1ad51ae687.js +0 -1
- package/assets/esri/core/workers/chunks/d95d63e8d51244d71afb.js +0 -1
- package/assets/esri/core/workers/chunks/dfd2dc5cdc97ffba8926.js +0 -1
- package/assets/esri/core/workers/chunks/e1b7806ab3e1967b15f0.js +0 -1
- package/assets/esri/core/workers/chunks/e1f5d00878f27e1d413e.js +0 -1
- package/assets/esri/core/workers/chunks/e8bf653376a607f00897.js +0 -1
- package/assets/esri/core/workers/chunks/f4a7aa3cdbc0c429c359.js +0 -1
- package/assets/esri/core/workers/chunks/ffbcb816b611049a6276.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Handles.js";import{destroyHandle as i,handlesGroup as a}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as o}from"../../../../core/lang.js";import{mapCollection as s}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as c,destroyMaybe as l}from"../../../../core/maybe.js";import{memoize as u}from"../../../../core/memoize.js";import{ignoreAbortErrors as d}from"../../../../core/promiseUtils.js";import{initial as f,watch as p,sync as m,syncAndInitial as h,when as g}from"../../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../../core/accessorSupport/decorators.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Point.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as C,applyConstraint as ee,computeConstraint as te,constraintDependencies as ne}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as re,LengthDimensionPointManipulator as w,pointManipulatorHandles as T,createOffsetManipulator as E,offsetManipulatorHandles as D,LineOfSightOrientationManipulator as O,headingManipulatorHandles as k,rotationManipulatorHandles as A,createMeasureTypeManipulator as j,measureTypeManipulatorHandles as M,updateOffsetManipulatorTransform as N,updateHeadingManipulatorTransform as P,updateRotationManipulatorTransform as F,updateMeasureTypeManipulatorTransform as I,unfocusedOffsetWidth as L,focusedOffsetWidth as R}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as z,arePointsVerticallyAligned as B,computationToGeometryDependencies as V,computeGeometryFromDimension as H}from"./lengthDimensionUtils.js";import{disabledPointColor as U,pointRadius as ie,getTransparentAccentColor as W,getContrastColor as G,initialOffsetPx as K}from"./settings.js";import{getRotateHeadingTexture as q}from"../images/Factory.js";import{SnappingVisualizer3D as J}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as Y}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as ae}from"../../interactive/visualElements/VerticesVisualElement.js";import{Parameters as oe,ImageMaterial as se}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as X}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as ce}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as Z}from"../../../interactive/coordinateHelper.js";import{EditGeometry as le}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as ue}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as de}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as fe}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquireForFeaturePlacement as pe}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as me}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as he}from"../../../interactive/snapping/snappingUtils.js";let Q=class extends n{constructor(e){super(e),this._stagedDimension=null,this._snappingManagerResult=null,this._computationManipulators=new Map,this._computationHandles=new r,this._updatingHandles=new b,this._getSnappingContext=u(e=>new de({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new ue(new le(`point`,Z(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new J}));let{view:t}=e;this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:X(2)}),this._constraintSnappingIndicator=new Y({view:t,attached:!0,width:1,renderOccluded:4,stipplePattern:X(5),isDecoration:!0});let n=U.toUnitRGBA();this._stagedStartIndicator=new ae({view:t,attached:!1,elevationInfo:{mode:`absolute-height`,offset:0},spatialReference:e.view.renderCoordsHelper.spatialReference,color:n,size:ie*2,outlineSize:0,renderOccluded:4,isDecoration:!0})}initialize(){let{view:e}=this;this._snappingOperation=new me({view:e});let t=W(e.effectiveTheme),n=G(e.effectiveTheme),r=!e.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=q(e.stage.textures,{accentColor:t,contrastColor:n,preMultiplyAlpha:r});let a=new oe(this._textureHandle.managedTexture,!1);a.renderOccluded=16,a.isDecoration=!0,this._orientationManipulatorMaterial=new se(a);let o=s(()=>this.analysisViewData.computations,({computation:e})=>this._createManipulators(e));this.addHandles([this._updatingHandles.add(()=>({accentColor:W(e.effectiveTheme),contrastColor:G(e.effectiveTheme)}),({accentColor:t,contrastColor:n})=>{let i=this._textureHandle;this._textureHandle=q(e.stage.textures,{accentColor:t,contrastColor:n,preMultiplyAlpha:r}),this._orientationManipulatorMaterial.setParameters({managedTexture:this._textureHandle.managedTexture}),i?.release();let a=t.toUnitRGBA();this._unfocusedOffsetManipulatorMaterial.setParameters({color:a}),this._focusedOffsetManipulatorMaterial.setParameters({color:a}),this._thinOffsetManipulatorMaterial.setParameters({color:a}),this._constraintSnappingIndicator.color=a},f),i(o),p(()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation}),({stagedPoint:e,stagedComputation:t})=>{if(t==null||e==null)return;let n=S(e,new x);this._applyPointUpdate(t,{endPoint:n})},m),p(()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}),(e,t)=>{let{stagedDimension:n,selectedComputation:r,firstGrabbedManipulator:i}=e;if(n!==t?.stagedDimension||i!==t?.firstGrabbedManipulator){for(let[t,n]of this._computationManipulators)this._updateManipulators(t,n,e);return}for(let n of[r,t?.selectedComputation])if(n!=null){let t=this._computationManipulators.get(n);t!=null&&this._updateManipulators(n,t,e)}},h),this._updatingHandles.add(()=>this.analysis.style.lineSize,e=>this._updateManipulatorStyle(e),f),this._updatingHandles.add(()=>this.view.state.camera,()=>{this._stagedComputation!=null&&this._updateStagedDimensionOffset(this._stagedComputation)}),this._updatingHandles.add(()=>{let e=this._stagedComputation;if(!e)return null;let t=e.elevationAlignedStartPoint,n=y();return t!=null&&this.view.renderCoordsHelper.toRenderCoords(t,n)?n:null},e=>{e==null?this._stagedStartIndicator.attached=!1:(this._stagedStartIndicator.vertices=[e],this._stagedStartIndicator.attached=!0)})]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),he(this,()=>{let e=this._activeComputation,t=this._stagedComputation;if(e==null||t!=null){let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);this._updatingHandles.consumePromise(d(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}if(e!=null){let{start:t,end:n}=this._computationManipulators.get(e);if(t.grabbing||n.grabbing){let n=t.grabbing?`start`:`end`,r=this._computeConstraint(e);C(e,n,{constraint:r,view:this.view})}}})}destroy(){this._textureHandle=c(this._textureHandle),this._snappingOperation=l(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy()}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager?.options}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){return this._snappingManagerResult||(this._snappingManagerResult=pe(this.view),this.addHandles(this._snappingManagerResult)),this._snappingManagerResult.snappingManager}get _activeComputation(){if(this._stagedComputation!=null)return this._stagedComputation;let{selectedComputation:e}=this.analysisViewData;return this.hasGrabbedManipulators&&e!=null?e:null}get _stagedComputation(){let e=this._stagedDimension,t=this.analysisViewData.computations.at(-1)?.computation;return e==null||t==null||t.dimension!==e?null:t}get _constraintHandles(){return[g(()=>this.analysisViewData.selectedComputation,e=>{e.previousConstraint=this._computeConstraint(e)},{...h,equals:o}),p(()=>{let e=this._activeComputation;if(e==null)return null;let{measureType:t,orientation:n}=e.dimension;return{measureType:t,orientation:n,computation:e}},(e,t)=>{if(e!=null&&t==null){let{measureType:t,orientation:n,computation:r}=e;switch(r.previousConstraint){case 0:r.preConstraintProperties={measureType:`horizontal`,orientation:0};break;case 1:r.preConstraintProperties={measureType:`vertical`,orientation:0};break;case 2:r.preConstraintProperties={measureType:`direct`,orientation:n};break;default:r.preConstraintProperties={measureType:t,orientation:n}}}e==null&&t!=null&&(t.computation.preConstraintProperties=null)},m)]}get _snappingIndicatorHandles(){let e=`snapping-indicator-event-handles`;return[this._updatingHandles.add(()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation}),({stagedComputation:t,activeComputation:n})=>{let r=this._constraintSnappingIndicator;if(this.removeHandles(e),n==null){r.attached=!1;return}if(n===t)r.attached=!0;else{let{start:t,end:i}=this._computationManipulators.get(n),a=()=>{r.attached=t.grabbing||i.grabbing};a(),this.addHandles([t.events.on(`grab-changed`,a),i.events.on(`grab-changed`,a)],e)}}),this._updatingHandles.add(()=>{let e=this._activeComputation;return e==null?{}:{geometry:e.geometry,constraint:e.previousConstraint}},({geometry:e,constraint:t})=>{let n=this._constraintSnappingIndicator;e!=null&&t!=null&&t!==2?(n.visible=!0,n.setGeometryFromSegment(e.directSegment)):n.visible=!1})]}removeStaged(){return this._stagedDimension!=null&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(e){let{_stagedDimension:t}=this;if(t==null){let t=this._onUnstagedClick(e);return this.analysis.dimensions.add(t),null}return this._onStagedClick(e),t}onPointerMove({mapPoint:e,pointerType:t}){if(t===`touch`)return;let n=this._getSnappingContext(t);this._updatingHandles.consumePromise(d(this._snappingOperation.snap({point:e},this._ensureSnappingManager(),n)))}onManipulatorSelectionChanged(){this.analysisViewData.selectedComputation!=null&&(this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null))}_onUnstagedClick({mapPoint:e,pointerType:n}){let r=e;if(n===`mouse`){let t=this._getSnappingContext(n);r=this._ensureSnappingManager().update({point:e,context:t})}let i=new t({startPoint:S(r,new x),endPoint:null,measureType:`horizontal`});return this._stagedDimension=i,this._resetSnappingState(),i}_onStagedClick({mapPoint:e,pointerType:t}){let n=this._stagedComputation;if(n==null)return;let r=e;if(t===`mouse`){let n=this._getSnappingContext(t);r=this._ensureSnappingManager().update({point:e,context:n})}let i=S(r,new x);this._applyPointUpdate(n,{endPoint:i}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._ensureSnappingManager().doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(e){let t=this._setupPointManipulator(e,{isStart:!0}),n=this._setupPointManipulator(e,{isStart:!1}),r=this._setupOffsetManipulator(e),i=this._setupHeadingManipulator(e),o=this._setupRotationManipulator(e),s=this._setupMeasureTypeManipulator(e,`direct`),c=this._setupMeasureTypeManipulator(e,`horizontal`),l=this._setupMeasureTypeManipulator(e,`vertical`),u=new re({start:t,end:n,offset:r,heading:i,rotation:o,direct:s,horizontal:c,vertical:l});this._setupComputationToManipulatorsSync(e,u),this._computationManipulators.set(e,u),this.manipulators.addMany(u.values());let d=a(u.values().map(e=>e.events.on(`focus-changed`,()=>{u.values().some(e=>e.focused)&&this._resetSnappingState()})));return{manipulators:u,remove:()=>{d.remove(),this._computationHandles.remove(e),this._computationManipulators.delete(e);for(let e of u.values())this.manipulators.remove(e)}}}_setupComputationToManipulatorsSync(e,t){this._computationHandles.add([p(()=>e.geometry,()=>this._updateManipulators(e,t),{...h,equals:o})],e)}_setupPointManipulator(e,t){let{view:n}=this,{dimension:r}=e,i=new w(n,{metadata:r}),a=T(i,{isStart:t.isStart,createSnappingPipelineStep:e=>fe({snappingContext:this._getSnappingContext(e),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:r,onUpdate:t=>this._applyPointUpdate(e,t),view:n});return this._computationHandles.add(a,e),i}_setupOffsetManipulator(e){let{view:t}=this,n=E(t,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:e.dimension}),r=D(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupHeadingManipulator(e){let{view:t}=this,n=new O(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),r=k(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupRotationManipulator(e){let{view:t}=this,n=new O(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),r=A(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupMeasureTypeManipulator(e,t){let{view:n}=this,r=j(n,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:e.dimension}),i=M(r,{computation:e,manipulatorMeasureType:t,view:n});return this._computationHandles.add(i,e),r}_updateManipulators(e,t,n={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){let{stagedDimension:r,selectedComputation:i,firstGrabbedManipulator:a}=n,{start:o,end:s,offset:c,heading:l,rotation:u}=t,d=i===e,f=z(e),{dimension:p}=e;for(let e of t.values()){let t=f&&r==null&&(a==null||e===a);e===c?(e.available=t,e.selected=d):e.available=t&&d}if(!f)return;this._computeConstraint(e)==null?t.manipulatorForMeasureType(p.measureType).available=!1:t.forEachMeasureTypeManipulator(e=>e.available=!1);for(let e of[l,u])(p.measureType!==`direct`||p.offset===0)&&(e.available=!1);B(e)?u.available=!1:l.available=!1;let{geometry:m}=e;o.renderLocation=m.directSegment.startRenderSpace,s.renderLocation=m.directSegment.endRenderSpace;let{renderCoordsHelper:h}=this.view;N(c,m,h),l.available&&P(l,e,h),u.available&&F(u,e,h),t.forEachMeasureTypeManipulator((t,n)=>{t.available&&I(t,e,n,h)})}_updateManipulatorStyle(e){let t=L(e),n=R(e),r={lineSizePt:e,material:this._orientationManipulatorMaterial};for(let{offset:e,heading:t,rotation:i}of this._computationManipulators.values())e.radius=n/2,t.update(r),i.update(r);this._unfocusedOffsetManipulatorMaterial.setParameters({width:t}),this._focusedOffsetManipulatorMaterial.setParameters({width:n})}_applyPointUpdate(e,t){let{view:n}=this,r=V(e);`startPoint`in t&&(r.elevationAlignedStartPoint=t.startPoint),`endPoint`in t&&(r.elevationAlignedEndPoint=t.endPoint);let i=H(r,n.renderCoordsHelper);if(i==null)return;let a=this._computeConstraint({...r,geometry:i});ee(e,t,{...r,constraint:a,unconstrainedGeometry:i,view:n}),e===this._stagedComputation&&this._updateStagedDimensionOffset(e)}_updateStagedDimensionOffset(e){if(e.geometry==null)return;e.geometry.directSegment.eval(.5,$);let{state:t,renderCoordsHelper:n}=this.view,r=t.camera.computeScreenPixelSizeAt($);e.dimension.offset=K*r*n.unitInMeters}_computeConstraint(e){return te(ne(e,this._ensureSnappingManager().options),this.view)}_createOffsetManipulatorMaterial(e){return new ce({width:1,renderOccluded:4,writeDepth:!1,polygonOffset:3,isDecoration:!0},e.state.isGlobal)}get test(){}};e([_({constructOnly:!0})],Q.prototype,`analysis`,void 0),e([_({constructOnly:!0})],Q.prototype,`analysisViewData`,void 0),e([_({constructOnly:!0})],Q.prototype,`manipulators`,void 0),e([_({constructOnly:!0})],Q.prototype,`parentTool`,void 0),e([_({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([_({readOnly:!0})],Q.prototype,`updating`,null),e([_()],Q.prototype,`firstGrabbedManipulator`,null),e([_()],Q.prototype,`hasGrabbedManipulators`,null),e([_()],Q.prototype,`snappingOptions`,null),e([_()],Q.prototype,`_stagedDimension`,void 0),e([_()],Q.prototype,`_snappingManager`,null),e([_()],Q.prototype,`_activeComputation`,null),e([_()],Q.prototype,`_stagedComputation`,null),e([_()],Q.prototype,`_snappingManagerResult`,void 0),Q=e([v(`esri.views.3d.analysis.Dimension.LengthDimensionSubTool`)],Q);const $=y();export{Q as LengthDimensionSubTool};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../analysis/LengthDimension.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Handles.js";import{destroyHandle as i,handlesGroup as a}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{equals as o}from"../../../../core/lang.js";import{mapCollection as s}from"../../../../core/mapCollectionUtils.js";import{releaseMaybe as c,destroyMaybe as l}from"../../../../core/maybe.js";import{memoize as u}from"../../../../core/memoize.js";import{ignoreAbortErrors as d}from"../../../../core/promiseUtils.js";import{initial as f,watch as p,sync as m,syncAndInitial as h,when as g}from"../../../../core/reactiveUtils.js";import{property as _,subclass as v}from"../../../../core/accessorSupport/decorators.js";import{create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as b}from"../../../../core/support/UpdatingHandles.js";import x from"../../../../geometry/Point.js";import{clonePoint as S}from"../../../../layers/graphics/hydratedFeatures.js";import{reapplyConstraint as C,applyConstraint as ee,computeConstraint as te,constraintDependencies as ne}from"./lengthDimensionConstraintUtils.js";import{LengthDimensionManipulators as re,LengthDimensionPointManipulator as w,pointManipulatorHandles as T,createOffsetManipulator as E,offsetManipulatorHandles as D,LineOfSightOrientationManipulator as O,headingManipulatorHandles as k,rotationManipulatorHandles as A,createMeasureTypeManipulator as j,measureTypeManipulatorHandles as M,updateOffsetManipulatorTransform as N,updateHeadingManipulatorTransform as P,updateRotationManipulatorTransform as F,updateMeasureTypeManipulatorTransform as I,unfocusedOffsetWidth as L,focusedOffsetWidth as R}from"./lengthDimensionManipulatorUtils.js";import{isValidComputation as z,arePointsVerticallyAligned as B,computationToGeometryDependencies as V,computeGeometryFromDimension as H}from"./lengthDimensionUtils.js";import{disabledPointColor as U,pointRadius as ie,getTransparentAccentColor as W,getContrastColor as G,initialOffsetPx as K}from"./settings.js";import{getRotateHeadingTexture as q}from"../images/Factory.js";import{SnappingVisualizer3D as J}from"../../interactive/SnappingVisualizer3D.js";import{LineVisualElement as Y}from"../../interactive/visualElements/LineVisualElement.js";import{VerticesVisualElement as ae}from"../../interactive/visualElements/VerticesVisualElement.js";import{Parameters as oe,ImageMaterial as se}from"../../webgl-engine/materials/ImageMaterial.js";import{createStipplePatternSimple as X}from"../../webgl-engine/materials/lineStippleUtils.js";import{RibbonLineMaterial as ce}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createCoordinateHelper as Z}from"../../../interactive/coordinateHelper.js";import{EditGeometry as le}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as ue}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as de}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as fe}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquireForFeaturePlacement as pe}from"../../../interactive/snapping/SnappingManagerPool.js";import{SnappingOperation as me}from"../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as he}from"../../../interactive/snapping/snappingUtils.js";let Q=class extends n{constructor(e){super(e),this._stagedDimension=null,this._snappingManagerResult=null,this._computationManipulators=new Map,this._computationHandles=new r,this._updatingHandles=new b,this._getSnappingContext=u(e=>new de({elevationInfo:{mode:`absolute-height`,offset:0},pointer:e,editGeometryOperations:new ue(new le(`point`,Z(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new J}));let{view:t}=e;this._unfocusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._focusedOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._thinOffsetManipulatorMaterial=this._createOffsetManipulatorMaterial(t),this._thinOffsetManipulatorMaterial.setParameters({stipplePattern:X(2)}),this._constraintSnappingIndicator=new Y({view:t,attached:!0,width:1,renderOccluded:4,stipplePattern:X(5),isDecoration:!0});let n=U.toUnitRGBA();this._stagedStartIndicator=new ae({view:t,attached:!1,elevationInfo:{mode:`absolute-height`,offset:0},spatialReference:e.view.renderCoordsHelper.spatialReference,color:n,size:ie*2,outlineSize:0,renderOccluded:4,isDecoration:!0})}initialize(){let{view:e}=this;this._snappingOperation=new me({view:e});let t=W(e.effectiveTheme),n=G(e.effectiveTheme),r=!e.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this._textureHandle=q(e.stage.textures,{accentColor:t,contrastColor:n,preMultiplyAlpha:r});let a=new oe(this._textureHandle.managedTexture,!1);a.renderOccluded=16,a.isDecoration=!0,this._orientationManipulatorMaterial=new se(a);let o=s(()=>this.analysisViewData.computations,({computation:e})=>this._createManipulators(e));this.addHandles([this._updatingHandles.add(()=>({accentColor:W(e.effectiveTheme),contrastColor:G(e.effectiveTheme)}),({accentColor:t,contrastColor:n})=>{let i=this._textureHandle;this._textureHandle=q(e.stage.textures,{accentColor:t,contrastColor:n,preMultiplyAlpha:r}),this._orientationManipulatorMaterial.setParameters({managedTexture:this._textureHandle.managedTexture}),i?.release();let a=t.toUnitRGBA();this._unfocusedOffsetManipulatorMaterial.setParameters({color:a}),this._focusedOffsetManipulatorMaterial.setParameters({color:a}),this._thinOffsetManipulatorMaterial.setParameters({color:a}),this._constraintSnappingIndicator.color=a},f),i(o),p(()=>({stagedPoint:this._snappingOperation.stagedPoint,stagedComputation:this._stagedComputation}),({stagedPoint:e,stagedComputation:t})=>{if(t==null||e==null)return;let n=S(e,new x);this._applyPointUpdate(t,{endPoint:n})},m),p(()=>({stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}),(e,t)=>{let{stagedDimension:n,selectedComputation:r,firstGrabbedManipulator:i}=e;if(n!==t?.stagedDimension||i!==t?.firstGrabbedManipulator){for(let[t,n]of this._computationManipulators)this._updateManipulators(t,n,e);return}for(let n of[r,t?.selectedComputation])if(n!=null){let t=this._computationManipulators.get(n);t!=null&&this._updateManipulators(n,t,e)}},h),this._updatingHandles.add(()=>this.analysis.style.lineSize,e=>this._updateManipulatorStyle(e),f),this._updatingHandles.add(()=>this.view.state.camera,()=>{this._stagedComputation!=null&&this._updateStagedDimensionOffset(this._stagedComputation)}),this._updatingHandles.add(()=>{let e=this._stagedComputation;if(!e)return null;let t=e.elevationAlignedStartPoint,n=y();return t!=null&&this.view.renderCoordsHelper.toRenderCoords(t,n)?n:null},e=>{e==null?this._stagedStartIndicator.attached=!1:(this._stagedStartIndicator.vertices=[e],this._stagedStartIndicator.attached=!0)})]),this.addHandles(this._constraintHandles),this.addHandles(this._snappingIndicatorHandles),he(this,()=>{let e=this._activeComputation,t=this._stagedComputation;if(e==null||t!=null){let e=this.view.inputManager.latestPointerInfo?.type??`mouse`,t=this._getSnappingContext(e);this._updatingHandles.consumePromise(d(this._snappingOperation.snapAgainNearPreviousMapPoint(this._ensureSnappingManager(),t)))}if(e!=null){let{start:t,end:n}=this._computationManipulators.get(e);if(t.grabbing||n.grabbing){let n=t.grabbing?`start`:`end`,r=this._computeConstraint(e);C(e,n,{constraint:r,view:this.view})}}})}destroy(){this._textureHandle=c(this._textureHandle),this._snappingOperation=l(this._snappingOperation),this._computationHandles.destroy(),this._constraintSnappingIndicator.destroy(),this._stagedStartIndicator.destroy()}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get firstGrabbedManipulator(){return this.parentTool.firstGrabbedManipulator}get hasGrabbedManipulators(){return this.parentTool.hasGrabbedManipulators}get snappingOptions(){return this._snappingManager?.options}get _snappingManager(){return this._snappingManagerResult?.snappingManager}_ensureSnappingManager(){return this._snappingManagerResult||(this._snappingManagerResult=pe(this.view),this.addHandles(this._snappingManagerResult)),this._snappingManagerResult.snappingManager}get _activeComputation(){if(this._stagedComputation!=null)return this._stagedComputation;let{selectedComputation:e}=this.analysisViewData;return this.hasGrabbedManipulators&&e!=null?e:null}get _stagedComputation(){let e=this._stagedDimension,t=this.analysisViewData.computations.at(-1)?.computation;return e==null||t==null||t.dimension!==e?null:t}get _constraintHandles(){return[g(()=>this.analysisViewData.selectedComputation,e=>{e.previousConstraint=this._computeConstraint(e)},{...h,equals:o}),p(()=>{let e=this._activeComputation;if(e==null)return null;let{measureType:t,orientation:n}=e.dimension;return{measureType:t,orientation:n,computation:e}},(e,t)=>{if(e!=null&&t==null){let{measureType:t,orientation:n,computation:r}=e;switch(r.previousConstraint){case 0:r.preConstraintProperties={measureType:`horizontal`,orientation:0};break;case 1:r.preConstraintProperties={measureType:`vertical`,orientation:0};break;case 2:r.preConstraintProperties={measureType:`direct`,orientation:n};break;default:r.preConstraintProperties={measureType:t,orientation:n}}}e==null&&t!=null&&(t.computation.preConstraintProperties=null)},m)]}get _snappingIndicatorHandles(){let e=`snapping-indicator-event-handles`;return[this._updatingHandles.add(()=>({stagedComputation:this._stagedComputation,activeComputation:this._activeComputation}),({stagedComputation:t,activeComputation:n})=>{let r=this._constraintSnappingIndicator;if(this.removeHandles(e),n==null){r.attached=!1;return}if(n===t)r.attached=!0;else{let{start:t,end:i}=this._computationManipulators.get(n),a=()=>{r.attached=t.grabbing||i.grabbing};a(),this.addHandles([t.events.on(`grab-changed`,a),i.events.on(`grab-changed`,a)],e)}}),this._updatingHandles.add(()=>{let e=this._activeComputation;return e==null?{}:{geometry:e.geometry,constraint:e.previousConstraint}},({geometry:e,constraint:t})=>{let n=this._constraintSnappingIndicator;e!=null&&t!=null&&t!==2?(n.visible=!0,n.setGeometryFromSegment(e.directSegment)):n.visible=!1})]}removeStaged(){return this._stagedDimension!=null&&(this.analysis.dimensions.remove(this._stagedDimension),this._stagedDimension=null,!0)}onDeactivate(){this.removeStaged(),this._resetSnappingState()}onClick(e){let{_stagedDimension:t}=this;if(t==null){let t=this._onUnstagedClick(e);return this.analysis.dimensions.add(t),null}return this._onStagedClick(e),t}onPointerMove({mapPoint:e,pointerType:t}){if(t===`touch`)return;let n=this._getSnappingContext(t);this._updatingHandles.consumePromise(d(this._snappingOperation.snap({point:e},this._ensureSnappingManager(),n)))}onManipulatorSelectionChanged(){this.analysisViewData.selectedComputation!=null&&(this._computationManipulators.get(this.analysisViewData.selectedComputation).offset.selected||(this.analysisViewData.selectedDimension=null))}_onUnstagedClick({mapPoint:e,pointerType:n}){let r=e;if(n===`mouse`){let t=this._getSnappingContext(n);r=this._ensureSnappingManager().update({point:e,context:t})}let i=new t({startPoint:S(r,new x),endPoint:null,measureType:`horizontal`});return this._stagedDimension=i,this._resetSnappingState(),i}_onStagedClick({mapPoint:e,pointerType:t}){let n=this._stagedComputation;if(n==null)return;let r=e;if(t===`mouse`){let n=this._getSnappingContext(t);r=this._ensureSnappingManager().update({point:e,context:n})}let i=S(r,new x);this._applyPointUpdate(n,{endPoint:i}),this._stagedDimension=null,this._resetSnappingState()}_resetSnappingState(){this._ensureSnappingManager().doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}_createManipulators(e){let t=this._setupPointManipulator(e,{isStart:!0}),n=this._setupPointManipulator(e,{isStart:!1}),r=this._setupOffsetManipulator(e),i=this._setupHeadingManipulator(e),o=this._setupRotationManipulator(e),s=this._setupMeasureTypeManipulator(e,`direct`),c=this._setupMeasureTypeManipulator(e,`horizontal`),l=this._setupMeasureTypeManipulator(e,`vertical`),u=new re({start:t,end:n,offset:r,heading:i,rotation:o,direct:s,horizontal:c,vertical:l});this._setupComputationToManipulatorsSync(e,u),this._computationManipulators.set(e,u),this.manipulators.addMany(u.values());let d=a(u.values().map(e=>e.events.on(`focus-changed`,()=>{u.values().some(e=>e.focused)&&this._resetSnappingState()})));return{manipulators:u,remove:()=>{d.remove(),this._computationHandles.remove(e),this._computationManipulators.delete(e);for(let e of u.values())this.manipulators.remove(e)}}}_setupComputationToManipulatorsSync(e,t){this._computationHandles.add([p(()=>e.geometry,()=>this._updateManipulators(e,t),{...h,equals:o})],e)}_setupPointManipulator(e,t){let{view:n}=this,{dimension:r}=e,i=new w(n,{metadata:r}),a=T(i,{isStart:t.isStart,createSnappingPipelineStep:e=>fe({snappingContext:this._getSnappingContext(e),snappingManager:this._snappingManager,updatingHandles:this._updatingHandles}),dimension:r,onUpdate:t=>this._applyPointUpdate(e,t),view:n});return this._computationHandles.add(a,e),i}_setupOffsetManipulator(e){let{view:t}=this,n=E(t,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,metadata:e.dimension}),r=D(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupHeadingManipulator(e){let{view:t}=this,n=new O(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),r=k(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupRotationManipulator(e){let{view:t}=this,n=new O(t,{lineSizePt:this.analysis.style.lineSize,material:this._orientationManipulatorMaterial,metadata:e.dimension}),r=A(n,{computation:e,view:t});return this._computationHandles.add(r,e),n}_setupMeasureTypeManipulator(e,t){let{view:n}=this,r=j(n,{lineSizePt:this.analysis.style.lineSize,unfocusedMaterial:this._unfocusedOffsetManipulatorMaterial,focusedMaterial:this._focusedOffsetManipulatorMaterial,thinOffsetManipulatorMaterial:this._thinOffsetManipulatorMaterial,metadata:e.dimension}),i=M(r,{computation:e,manipulatorMeasureType:t,view:n});return this._computationHandles.add(i,e),r}_updateManipulators(e,t,n={stagedDimension:this._stagedDimension,selectedComputation:this.analysisViewData.selectedComputation,firstGrabbedManipulator:this.firstGrabbedManipulator}){let{stagedDimension:r,selectedComputation:i,firstGrabbedManipulator:a}=n,{start:o,end:s,offset:c,heading:l,rotation:u}=t,d=i===e,f=z(e),{dimension:p}=e;for(let e of t.values()){let t=f&&r==null&&(a==null||e===a);e===c?(e.available=t,e.selected=d):e.available=t&&d}if(!f)return;this._computeConstraint(e)==null?t.manipulatorForMeasureType(p.measureType).available=!1:t.forEachMeasureTypeManipulator(e=>e.available=!1);for(let e of[l,u])(p.measureType!==`direct`||p.offset===0)&&(e.available=!1);B(e)?u.available=!1:l.available=!1;let{geometry:m}=e;o.renderLocation=m.directSegment.startRenderSpace,s.renderLocation=m.directSegment.endRenderSpace;let{renderCoordsHelper:h}=this.view;N(c,m,h),l.available&&P(l,e,h),u.available&&F(u,e,h),t.forEachMeasureTypeManipulator((t,n)=>{t.available&&I(t,e,n,h)})}_updateManipulatorStyle(e){let t=L(e),n=R(e),r={lineSizePt:e,material:this._orientationManipulatorMaterial};for(let{offset:e,heading:t,rotation:i}of this._computationManipulators.values())e.radius=n/2,t.update(r),i.update(r);this._unfocusedOffsetManipulatorMaterial.setParameters({width:t}),this._focusedOffsetManipulatorMaterial.setParameters({width:n})}_applyPointUpdate(e,t){let{view:n}=this,r=V(e);`startPoint`in t&&(r.elevationAlignedStartPoint=t.startPoint),`endPoint`in t&&(r.elevationAlignedEndPoint=t.endPoint);let i=H(r,n.renderCoordsHelper);if(i==null)return;let a=this._computeConstraint({...r,geometry:i});ee(e,t,{...r,constraint:a,unconstrainedGeometry:i,view:n}),e===this._stagedComputation&&this._updateStagedDimensionOffset(e)}_updateStagedDimensionOffset(e){if(e.geometry==null)return;e.geometry.directSegment.eval(.5,$);let{state:t,renderCoordsHelper:n}=this.view,r=t.camera.computeScreenPixelSizeAt($);e.dimension.offset=K*r*n.unitInMeters}_computeConstraint(e){return te(ne(e,this._ensureSnappingManager().options),this.view)}_createOffsetManipulatorMaterial(e){return new ce({width:1,renderOccluded:4,writeDepth:!1,polygonOffset:3,isDecoration:!0},e)}get test(){}};e([_({constructOnly:!0})],Q.prototype,`analysis`,void 0),e([_({constructOnly:!0})],Q.prototype,`analysisViewData`,void 0),e([_({constructOnly:!0})],Q.prototype,`manipulators`,void 0),e([_({constructOnly:!0})],Q.prototype,`parentTool`,void 0),e([_({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([_({readOnly:!0})],Q.prototype,`updating`,null),e([_()],Q.prototype,`firstGrabbedManipulator`,null),e([_()],Q.prototype,`hasGrabbedManipulators`,null),e([_()],Q.prototype,`snappingOptions`,null),e([_()],Q.prototype,`_stagedDimension`,void 0),e([_()],Q.prototype,`_snappingManager`,null),e([_()],Q.prototype,`_activeComputation`,null),e([_()],Q.prototype,`_stagedComputation`,null),e([_()],Q.prototype,`_snappingManagerResult`,void 0),Q=e([v(`esri.views.3d.analysis.Dimension.LengthDimensionSubTool`)],Q);const $=y();export{Q as LengthDimensionSubTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{lengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as t}from"../../../../core/Cyclical.js";import{rad2deg as n}from"../../../../core/mathUtils.js";import{watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{identity as o,scale as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as l,copy as u,exactEquals as d,length as f,set as p,sub as m,subtract as h,cross as g,dot as ee}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,ZEROS as v,fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as te}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import ne from"../../../../geometry/Point.js";import{fromPositionAndNormal as b,create as x,signedDistance as re,getNormal as ie}from"../../../../geometry/support/plane.js";import{sv3d as S}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as ae}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as C,computeOffsetForPoint as oe,computeSegmentForMeasureType as se,computeOffsetAxis as ce,dimensionStartToEnd as le,headingFromGeometry as w,computeGeometryFromDimension as ue,computationToGeometryDependencies as T,directUp as E,directStartToEnd as D}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as O,pointRadius as de,lengthFraction as k,minLengthMeters as fe,linePaddingPx as pe,focusedLinePaddingPx as me,orientationFocusMultiplier as he,orientationDiscScale as ge,orientationCalloutWidth as _e,markerLineSizeFraction as ve,orientationCalloutOffsetPx as ye,orientationSnapThresholdDegrees as be}from"./settings.js";import{Manipulator3D as A}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as xe,worldScaledManipulatorSettings as j,calculateTranslateRotateFromBases as M,rotateManipulatorDefaults as N,calculateInputRotationTransform as Se}from"../../interactive/manipulatorUtils.js";import{RenderObject as P}from"../../interactive/RenderObject.js";import{screenToMap3D as Ce,hideManipulatorWhileDragging as F,screenToRenderPlane as I}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as we}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as Te}from"../../support/engineContent/marker.js";import{Attribute as L}from"../../webgl-engine/lib/Attribute.js";import{Geometry as Ee}from"../../webgl-engine/lib/Geometry.js";import{createSphereGeometry as De,createPolylineGeometry as R}from"../../webgl-engine/lib/GeometryUtil.js";import{RibbonLineMaterial as Oe}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as z,resetProperties as B,EventPipeline as ke}from"../../../interactive/dragEventPipeline.js";class Ae{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find(t=>this.hasOwnProperty(t)&&e===this[t])}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(t){for(let n of e)t(this.manipulatorForMeasureType(n),n)}manipulatorForMeasureType(e){switch(e){case`direct`:return this.direct;case`horizontal`:return this.horizontal;case`vertical`:return this.vertical}}}class je extends A{constructor(e,t){let n=xe(O(e.effectiveTheme).toUnitRGBA()),i=[new P(De(n,1,32,32),X)];super({view:e,renderObjects:i,metadata:t.metadata,available:!1,grabCursor:`crosshair`,radius:de,collisionPriority:1}),this._themeHandle=r(()=>({color:O(e.effectiveTheme).toUnitRGBA()}),e=>n.setParameters(e))}destroy(){this._themeHandle.remove(),super.destroy()}}function Me(e,t){let n=[y(-.5,0,0),y(.5,0,0)],r=R(t.unfocusedMaterial,n.map(e=>l(_(),e,k))),i=r.instantiate({material:t.focusedMaterial});return new A({view:e,renderObjects:[new P(r,9|X),new P(i,2|X)],collisionType:{type:`line`,paths:[n]},radius:J(t.lineSizePt)/2,metadata:t.metadata,available:!1,...j})}class Ne extends A{constructor(e,{lineSizePt:t,material:n,metadata:a}){super({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:a}),this._options={calloutColor:te(),lineSizePt:t,material:n},this._themeHandle=r(()=>O(e.effectiveTheme).toUnitRGBA(),e=>{this._options.calloutColor=e,Y(this,V({...this._options,metadata:this.metadata}))},i)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,Y(this,V({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function V({calloutColor:e,lineSizePt:t,material:n,metadata:r}){return{calloutLength:.25*Te*ve*a(t)+ye,calloutColor:e,calloutWidth:_e,customStateMask:X,discScale:ge,focusMultiplier:he,material:n,metadata:r}}function Pe(e,t){let n=[y(-.5,0,0),y(.5,0,0)],r=R(t.thinOffsetManipulatorMaterial,n),i=R(t.unfocusedMaterial,n.map(e=>l(_(),e,k))),a=i.instantiate({material:t.focusedMaterial});return new A({view:e,renderObjects:[new P(i,1|X),new P(a,2|X),new P(r,X)],collisionType:{type:`line`,paths:[n]},radius:J(t.lineSizePt)/2,available:!1,metadata:t.metadata,...j})}function Fe(e,{isStart:t,createSnappingPipelineStep:n,dimension:r,onUpdate:i,view:a}){let o=t?`startPoint`:`endPoint`;return[z(e,(e,t,s,c)=>{let l=F(e),{snappingStep:u,cancelSnapping:d}=n(c);s.next(l).next(B(r,[o,`measureType`,`orientation`])).next(d),t.next(l).next(Ce(a)).next(...u).next(e=>{let t=ae(e.mapEnd,new ne);i(o===`startPoint`?{startPoint:t}:{endPoint:t})})})]}function Ie(e,{computation:t,view:n}){return[z(e,(e,r,i)=>{if(!C(t)||!e.selected)return;let{geometry:a,dimension:o}=t,s=F(e);r.next(s).next(W(n,o,a.dimensionSegment,a.primaryOffsetAxis)),i.next(s).next(B(o,[`offset`]))})]}function Le(e,{computation:t,view:n}){return[z(e,(e,r,i)=>{H({cancel:i,computation:t,settingHeading:!0,steps:r,view:n})})]}function Re(e,{computation:t,view:n}){return[z(e,(e,r,i)=>{H({cancel:i,computation:t,settingHeading:!1,steps:r,view:n})}),e.events.on(`immediate-click`,e=>{ze(e,t,n)})]}function ze(e,n,r){let{dimension:i,geometry:a}=n;if(i.orientation===90||i.orientation===270){i.orientation=0,e.stopPropagation();return}if(a==null)return;let{renderCoordsHelper:o}=r,s=ue({...T(n),orientation:90},o),c=ue({...T(n),orientation:270},o);if(s==null||c==null)return;let l=w(s,o),u=w(c,o),d=G(a,r),f=t.shortestSignedDiff(d,l),p=t.shortestSignedDiff(d,u);i.orientation=Math.abs(f)<Math.abs(p)?90:270,e.stopPropagation()}function H(e){let{cancel:t,computation:r,settingHeading:i,steps:a,view:o}=e;if(!C(r))return;let{renderCoordsHelper:s}=o,{dimension:c,geometry:l}=r,d=_(),f=q(_(),l,l.directSegment,s),p=qe(S.get(),{forHeading:i,geometry:l,renderCoordsHelper:s}),m=b(f,p,x()),h=i?c.orientation??w(l,o.renderCoordsHelper):c.orientation??0;a.next(I(o,m)).next(e=>{e.action===`start`&&u(d,e.renderStart);let t=ie(m),r=Se(d,e.renderEnd,f,t),a=h-n(r);i||(a=U(a)),c.orientation=a}),t.next(B(c,[`orientation`]))}function U(e){let n=t.normalize(e)%90;return n<be?e-n:90-n<be?e+(90-n):e}function Be(e,{computation:t,manipulatorMeasureType:n,view:r}){let i=`direct`,a=0,o=0;return[e.events.on(`grab-changed`,s=>{if(s.action!==`start`||!C(t))return;let{dimension:c,geometry:l}=t;i=c.measureType,a=c.offset,o=c.orientation;let d=u(S.get(),e.renderLocation);c.measureType=n,c.offset=oe(d,n,l,r.renderCoordsHelper),c.orientation=0}),z(e,(e,s,c)=>{if(!C(t))return;let{geometry:l,dimension:u}=t,{renderCoordsHelper:d}=r,f=se(Qe,n,t,d),p=ce(S.get(),{measureType:n,directSegment:l.directSegment,renderCoordsHelper:d}),m=F(e);s.next(m).next(W(r,u,f,p)),c.next(m).next(e=>(u.measureType=i,u.offset=a,u.orientation=o,e))})]}function W(e,t,n,r){let i=h(S.get(),n.endRenderSpace,n.startRenderSpace);g(i,i,r);let a=b(n.startRenderSpace,i,x()),o=b(n.startRenderSpace,r,x()),s=t.offset,c=0,l,u=new ke;return u.next(I(e,a)).next(n=>{n.action===`start`&&(c=re(o,n.renderStart));let r=(re(o,n.renderEnd)-c)*e.renderCoordsHelper.unitInMeters;t.offset=s+r,l=n}),e=>(u.execute(e),l)}function G(e,t){let{directSegment:n}=e,{renderCoordsHelper:r}=t,i=E(S.get(),e,r),a=D(S.get(),e),o=g(S.get(),a,i),{viewForward:s}=t.state.camera;ee(o,s)>0&&l(o,o,-1);let c=n.eval(.5,S.get());return r.headingAtPosition(c,o)}function Ve(e,t,n){let{dimensionSegment:r,primaryOffsetAxis:i}=t,a=le(Z,t),c=d(a,v)?o($):M(a,i,v,$),l=Math.max(f(a),fe/n.unitInMeters);s(c,c,p(Z,l,l,l)),e.modelTransform=c,e.renderLocation=r.eval(.5,Z)}function He(e,t,n){K(e,t,n,{forHeading:!0})}function Ue(e,t,n){K(e,t,n,{forHeading:!1})}function K(e,t,n,{forHeading:r}){let{dimension:i,geometry:a}=t,{primaryOffsetAxis:o}=a,s=l(We,o,i.offset>=0?1:-1),c=qe(Ge,{forHeading:r,geometry:a,renderCoordsHelper:n});g(c,c,s),e.modelTransform=M(s,c,v,$),e.renderLocation=q(Z,a,a.dimensionSegment,n)}const We=_(),Ge=_();function Ke(e,t,n,r){let{geometry:i}=t,a=se(Qe,n,t,r),o=ce(Z,{measureType:n,directSegment:i.directSegment,renderCoordsHelper:r}),c=m(Q,a.endRenderSpace,a.startRenderSpace),l=M(c,o,v,$),u=f(c);s(l,l,p(Q,u,u,u)),e.modelTransform=l,e.renderLocation=a.eval(.5,Q)}function q(e,t,n,r){let{startRenderSpace:i,endRenderSpace:a}=n,o=Je(t,r)?i:a;return u(e,o)}function qe(e,{forHeading:t,geometry:n,renderCoordsHelper:r}){return t?E(e,n,r):le(e,n,{invert:!0})}function Je(e,t){let n=D(Ye,e),r=E(Xe,e,t);return ee(n,r)>0}const Ye=_(),Xe=_();function Ze(e){return a(e)+pe}function J(e){return a(e)+me}function Y(e,t){let n=t.material,r=t.focusMultiplier??N.focusMultiplier,i=t.calloutLength??N.calloutLength,a=N.discRadius*(t.discScale??1),o=a*r,s=(e,t)=>{let n=[0,1,2,2,3,0];return new Ee(t,[[`position`,new L([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],n,3,!0)],[`uv0`,new L([0,0,1,0,1,1,0,1],n,2,!0)]])},c=t.calloutWidth??N.calloutWidth,l=new Oe({width:c,color:t.calloutColor,renderOccluded:4,isDecoration:!0},e.view.state.isGlobal),u=R(l,[[0,0,0],[i-a,0,0]]),d=R(l,[[0,0,0],[i-o,0,0]]),f=t.customStateMask??0;e.collisionType={type:`disc`,direction:[0,0,1],offset:[i,0,0]},e.focusMultiplier=r,e.metadata=t.metadata,e.radius=a,e.renderObjects=[new P(s(a,n),1|f),new P(u,1|f),new P(s(o,n),2|f),new P(d,2|f)]}const X=16,Z=_(),Q=_(),$=c(),Qe=new we;export{X as DidPointerMoveRecentlyFlag,Ae as LengthDimensionManipulators,je as LengthDimensionPointManipulator,Ne as LineOfSightOrientationManipulator,G as automaticHeadingFromCamera,Pe as createMeasureTypeManipulator,Me as createOffsetManipulator,J as focusedOffsetWidth,Le as headingManipulatorHandles,Be as measureTypeManipulatorHandles,Ie as offsetManipulatorHandles,Fe as pointManipulatorHandles,Re as rotationManipulatorHandles,U as snapOrientationToNearestRightAngle,Ze as unfocusedOffsetWidth,He as updateHeadingManipulatorTransform,Ke as updateMeasureTypeManipulatorTransform,Ve as updateOffsetManipulatorTransform,Ue as updateRotationManipulatorTransform};
|
|
2
|
+
import{lengthDimensionMeasureType as e}from"../../../../analysis/dimensionUtils.js";import{cyclicalDegrees as t}from"../../../../core/Cyclical.js";import{rad2deg as n}from"../../../../core/mathUtils.js";import{watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{pt2px as a}from"../../../../core/screenUtils.js";import{identity as o,scale as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{scale as l,copy as u,exactEquals as d,length as f,set as p,sub as m,subtract as h,cross as g,dot as ee}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,ZEROS as v,fromValues as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as te}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import ne from"../../../../geometry/Point.js";import{fromPositionAndNormal as b,create as x,signedDistance as re,getNormal as ie}from"../../../../geometry/support/plane.js";import{sv3d as S}from"../../../../geometry/support/vectorStacks.js";import{clonePoint as ae}from"../../../../layers/graphics/hydratedFeatures.js";import{isValidComputation as C,computeOffsetForPoint as oe,computeSegmentForMeasureType as se,computeOffsetAxis as ce,dimensionStartToEnd as le,headingFromGeometry as w,computeGeometryFromDimension as ue,computationToGeometryDependencies as T,directUp as E,directStartToEnd as D}from"./lengthDimensionUtils.js";import{getTransparentAccentColor as O,pointRadius as de,lengthFraction as k,minLengthMeters as fe,linePaddingPx as pe,focusedLinePaddingPx as me,orientationFocusMultiplier as he,orientationDiscScale as ge,orientationCalloutWidth as _e,markerLineSizeFraction as ve,orientationCalloutOffsetPx as ye,orientationSnapThresholdDegrees as be}from"./settings.js";import{Manipulator3D as A}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as xe,worldScaledManipulatorSettings as j,calculateTranslateRotateFromBases as M,rotateManipulatorDefaults as N,calculateInputRotationTransform as Se}from"../../interactive/manipulatorUtils.js";import{RenderObject as P}from"../../interactive/RenderObject.js";import{screenToMap3D as Ce,hideManipulatorWhileDragging as F,screenToRenderPlane as I}from"../../interactive/editingTools/dragEventPipeline3D.js";import{EuclideanSegment as we}from"../../interactive/visualElements/support/Segment.js";import{markerSizePerLineWidth as Te}from"../../support/engineContent/marker.js";import{Attribute as L}from"../../webgl-engine/lib/Attribute.js";import{Geometry as Ee}from"../../webgl-engine/lib/Geometry.js";import{createSphereGeometry as De,createPolylineGeometry as R}from"../../webgl-engine/lib/GeometryUtil.js";import{RibbonLineMaterial as Oe}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as z,resetProperties as B,EventPipeline as ke}from"../../../interactive/dragEventPipeline.js";class Ae{constructor(e){this.start=e.start,this.end=e.end,this.offset=e.offset,this.heading=e.heading,this.rotation=e.rotation,this.direct=e.direct,this.horizontal=e.horizontal,this.vertical=e.vertical}manipulatorName(e){return Object.keys(this).find(t=>this.hasOwnProperty(t)&&e===this[t])}values(){return[this.start,this.end,this.offset,this.heading,this.rotation,this.direct,this.horizontal,this.vertical]}forEachMeasureTypeManipulator(t){for(let n of e)t(this.manipulatorForMeasureType(n),n)}manipulatorForMeasureType(e){switch(e){case`direct`:return this.direct;case`horizontal`:return this.horizontal;case`vertical`:return this.vertical}}}class je extends A{constructor(e,t){let n=xe(O(e.effectiveTheme).toUnitRGBA()),i=[new P(De(n,1,32,32),X)];super({view:e,renderObjects:i,metadata:t.metadata,available:!1,grabCursor:`crosshair`,radius:de,collisionPriority:1}),this._themeHandle=r(()=>({color:O(e.effectiveTheme).toUnitRGBA()}),e=>n.setParameters(e))}destroy(){this._themeHandle.remove(),super.destroy()}}function Me(e,t){let n=[y(-.5,0,0),y(.5,0,0)],r=R(t.unfocusedMaterial,n.map(e=>l(_(),e,k))),i=r.instantiate({material:t.focusedMaterial});return new A({view:e,renderObjects:[new P(r,9|X),new P(i,2|X)],collisionType:{type:`line`,paths:[n]},radius:J(t.lineSizePt)/2,metadata:t.metadata,available:!1,...j})}class Ne extends A{constructor(e,{lineSizePt:t,material:n,metadata:a}){super({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:a}),this._options={calloutColor:te(),lineSizePt:t,material:n},this._themeHandle=r(()=>O(e.effectiveTheme).toUnitRGBA(),e=>{this._options.calloutColor=e,Y(this,V({...this._options,metadata:this.metadata}))},i)}update({lineSizePt:e,material:t}){this._options.lineSizePt=e,this._options.material=t,Y(this,V({...this._options,metadata:this.metadata}))}destroy(){this._themeHandle.remove(),super.destroy()}}function V({calloutColor:e,lineSizePt:t,material:n,metadata:r}){return{calloutLength:.25*Te*ve*a(t)+ye,calloutColor:e,calloutWidth:_e,customStateMask:X,discScale:ge,focusMultiplier:he,material:n,metadata:r}}function Pe(e,t){let n=[y(-.5,0,0),y(.5,0,0)],r=R(t.thinOffsetManipulatorMaterial,n),i=R(t.unfocusedMaterial,n.map(e=>l(_(),e,k))),a=i.instantiate({material:t.focusedMaterial});return new A({view:e,renderObjects:[new P(i,1|X),new P(a,2|X),new P(r,X)],collisionType:{type:`line`,paths:[n]},radius:J(t.lineSizePt)/2,available:!1,metadata:t.metadata,...j})}function Fe(e,{isStart:t,createSnappingPipelineStep:n,dimension:r,onUpdate:i,view:a}){let o=t?`startPoint`:`endPoint`;return[z(e,(e,t,s,c)=>{let l=F(e),{snappingStep:u,cancelSnapping:d}=n(c);s.next(l).next(B(r,[o,`measureType`,`orientation`])).next(d),t.next(l).next(Ce(a)).next(...u).next(e=>{let t=ae(e.mapEnd,new ne);i(o===`startPoint`?{startPoint:t}:{endPoint:t})})})]}function Ie(e,{computation:t,view:n}){return[z(e,(e,r,i)=>{if(!C(t)||!e.selected)return;let{geometry:a,dimension:o}=t,s=F(e);r.next(s).next(W(n,o,a.dimensionSegment,a.primaryOffsetAxis)),i.next(s).next(B(o,[`offset`]))})]}function Le(e,{computation:t,view:n}){return[z(e,(e,r,i)=>{H({cancel:i,computation:t,settingHeading:!0,steps:r,view:n})})]}function Re(e,{computation:t,view:n}){return[z(e,(e,r,i)=>{H({cancel:i,computation:t,settingHeading:!1,steps:r,view:n})}),e.events.on(`immediate-click`,e=>{ze(e,t,n)})]}function ze(e,n,r){let{dimension:i,geometry:a}=n;if(i.orientation===90||i.orientation===270){i.orientation=0,e.stopPropagation();return}if(a==null)return;let{renderCoordsHelper:o}=r,s=ue({...T(n),orientation:90},o),c=ue({...T(n),orientation:270},o);if(s==null||c==null)return;let l=w(s,o),u=w(c,o),d=G(a,r),f=t.shortestSignedDiff(d,l),p=t.shortestSignedDiff(d,u);i.orientation=Math.abs(f)<Math.abs(p)?90:270,e.stopPropagation()}function H(e){let{cancel:t,computation:r,settingHeading:i,steps:a,view:o}=e;if(!C(r))return;let{renderCoordsHelper:s}=o,{dimension:c,geometry:l}=r,d=_(),f=q(_(),l,l.directSegment,s),p=qe(S.get(),{forHeading:i,geometry:l,renderCoordsHelper:s}),m=b(f,p,x()),h=i?c.orientation??w(l,o.renderCoordsHelper):c.orientation??0;a.next(I(o,m)).next(e=>{e.action===`start`&&u(d,e.renderStart);let t=ie(m),r=Se(d,e.renderEnd,f,t),a=h-n(r);i||(a=U(a)),c.orientation=a}),t.next(B(c,[`orientation`]))}function U(e){let n=t.normalize(e)%90;return n<be?e-n:90-n<be?e+(90-n):e}function Be(e,{computation:t,manipulatorMeasureType:n,view:r}){let i=`direct`,a=0,o=0;return[e.events.on(`grab-changed`,s=>{if(s.action!==`start`||!C(t))return;let{dimension:c,geometry:l}=t;i=c.measureType,a=c.offset,o=c.orientation;let d=u(S.get(),e.renderLocation);c.measureType=n,c.offset=oe(d,n,l,r.renderCoordsHelper),c.orientation=0}),z(e,(e,s,c)=>{if(!C(t))return;let{geometry:l,dimension:u}=t,{renderCoordsHelper:d}=r,f=se(Qe,n,t,d),p=ce(S.get(),{measureType:n,directSegment:l.directSegment,renderCoordsHelper:d}),m=F(e);s.next(m).next(W(r,u,f,p)),c.next(m).next(e=>(u.measureType=i,u.offset=a,u.orientation=o,e))})]}function W(e,t,n,r){let i=h(S.get(),n.endRenderSpace,n.startRenderSpace);g(i,i,r);let a=b(n.startRenderSpace,i,x()),o=b(n.startRenderSpace,r,x()),s=t.offset,c=0,l,u=new ke;return u.next(I(e,a)).next(n=>{n.action===`start`&&(c=re(o,n.renderStart));let r=(re(o,n.renderEnd)-c)*e.renderCoordsHelper.unitInMeters;t.offset=s+r,l=n}),e=>(u.execute(e),l)}function G(e,t){let{directSegment:n}=e,{renderCoordsHelper:r}=t,i=E(S.get(),e,r),a=D(S.get(),e),o=g(S.get(),a,i),{viewForward:s}=t.state.camera;ee(o,s)>0&&l(o,o,-1);let c=n.eval(.5,S.get());return r.headingAtPosition(c,o)}function Ve(e,t,n){let{dimensionSegment:r,primaryOffsetAxis:i}=t,a=le(Z,t),c=d(a,v)?o($):M(a,i,v,$),l=Math.max(f(a),fe/n.unitInMeters);s(c,c,p(Z,l,l,l)),e.modelTransform=c,e.renderLocation=r.eval(.5,Z)}function He(e,t,n){K(e,t,n,{forHeading:!0})}function Ue(e,t,n){K(e,t,n,{forHeading:!1})}function K(e,t,n,{forHeading:r}){let{dimension:i,geometry:a}=t,{primaryOffsetAxis:o}=a,s=l(We,o,i.offset>=0?1:-1),c=qe(Ge,{forHeading:r,geometry:a,renderCoordsHelper:n});g(c,c,s),e.modelTransform=M(s,c,v,$),e.renderLocation=q(Z,a,a.dimensionSegment,n)}const We=_(),Ge=_();function Ke(e,t,n,r){let{geometry:i}=t,a=se(Qe,n,t,r),o=ce(Z,{measureType:n,directSegment:i.directSegment,renderCoordsHelper:r}),c=m(Q,a.endRenderSpace,a.startRenderSpace),l=M(c,o,v,$),u=f(c);s(l,l,p(Q,u,u,u)),e.modelTransform=l,e.renderLocation=a.eval(.5,Q)}function q(e,t,n,r){let{startRenderSpace:i,endRenderSpace:a}=n,o=Je(t,r)?i:a;return u(e,o)}function qe(e,{forHeading:t,geometry:n,renderCoordsHelper:r}){return t?E(e,n,r):le(e,n,{invert:!0})}function Je(e,t){let n=D(Ye,e),r=E(Xe,e,t);return ee(n,r)>0}const Ye=_(),Xe=_();function Ze(e){return a(e)+pe}function J(e){return a(e)+me}function Y(e,t){let n=t.material,r=t.focusMultiplier??N.focusMultiplier,i=t.calloutLength??N.calloutLength,a=N.discRadius*(t.discScale??1),o=a*r,s=(e,t)=>{let n=[0,1,2,2,3,0];return new Ee(t,[[`position`,new L([i-e,-e,0,i+e,-e,0,i+e,e,0,i-e,e,0],n,3,!0)],[`uv0`,new L([0,0,1,0,1,1,0,1],n,2,!0)]])},c=t.calloutWidth??N.calloutWidth,l=new Oe({width:c,color:t.calloutColor,renderOccluded:4,isDecoration:!0},e.view),u=R(l,[[0,0,0],[i-a,0,0]]),d=R(l,[[0,0,0],[i-o,0,0]]),f=t.customStateMask??0;e.collisionType={type:`disc`,direction:[0,0,1],offset:[i,0,0]},e.focusMultiplier=r,e.metadata=t.metadata,e.radius=a,e.renderObjects=[new P(s(a,n),1|f),new P(u,1|f),new P(s(o,n),2|f),new P(d,2|f)]}const X=16,Z=_(),Q=_(),$=c(),Qe=new we;export{X as DidPointerMoveRecentlyFlag,Ae as LengthDimensionManipulators,je as LengthDimensionPointManipulator,Ne as LineOfSightOrientationManipulator,G as automaticHeadingFromCamera,Pe as createMeasureTypeManipulator,Me as createOffsetManipulator,J as focusedOffsetWidth,Le as headingManipulatorHandles,Be as measureTypeManipulatorHandles,Ie as offsetManipulatorHandles,Fe as pointManipulatorHandles,Re as rotationManipulatorHandles,U as snapOrientationToNearestRightAngle,Ze as unfocusedOffsetWidth,He as updateHeadingManipulatorTransform,Ke as updateMeasureTypeManipulatorTransform,Ve as updateOffsetManipulatorTransform,Ue as updateRotationManipulatorTransform};
|
|
@@ -38,6 +38,12 @@ import type { ElevationProfileStatistics, ElevationProfileEffectiveDisplayUnits,
|
|
|
38
38
|
export default abstract class ElevationProfileAnalysisView3D extends AnalysisView3D {
|
|
39
39
|
/** The elevation profile analysis associated with the analysis view. */
|
|
40
40
|
get analysis(): ElevationProfileAnalysis;
|
|
41
|
+
/**
|
|
42
|
+
* Whether placement has at least two committed vertices and can be stopped.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
get canStopPlacing(): boolean;
|
|
41
47
|
/**
|
|
42
48
|
* Units used for all the [results](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ElevationProfileAnalysisView3D/#results) and [statistics](https://developers.arcgis.com/javascript/latest/references/core/views/3d/analysis/ElevationProfileAnalysisView3D/#statistics) of the elevation profile analysis.
|
|
43
49
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"./AnalysisView3D.js";import{ElevationProfileLineSceneComputation as a}from"./ElevationProfile/ElevationProfileLineSceneComputation.js";import{ElevationProfileVisualization3D as o}from"./ElevationProfile/ElevationProfileVisualization3D.js";import{ElevationProfileController as s}from"../../analysis/ElevationProfile/ElevationProfileController.js";import{ElevationProfileLineGroundComputation as c}from"../../analysis/ElevationProfile/ElevationProfileLineGroundComputation.js";import{ElevationProfileLineInputComputation as l}from"../../analysis/ElevationProfile/ElevationProfileLineInputComputation.js";import{ElevationProfileLineQueryComputation as u}from"../../analysis/ElevationProfile/ElevationProfileLineQueryComputation.js";import{ElevationProfileTool as d}from"../../analysis/ElevationProfile/ElevationProfileTool.js";let f=class extends i{constructor(e){super(e),this.type=`elevation-profile-view-3d`,this.analysis=null,this.indicatorRelativePosition=null}initialize(){let{analysis:e,view:t}=this;this._controller=new s({analysis:e,analysisViewData:this,view:t,computationFactory:{create:e=>{switch(e.profile.type){case`ground`:return new c(e);case`input`:return new l(e);case`query`:return new u(e);case`scene`:return new a(e)}}}}),this._visualization=new o({view:t,analysisViewData:this}),this._sketchTool=new d({view:t,analysisViewData:this})}destroy(){this._controller?.destroy(),this._visualization?.destroy(),this._sketchTool?.destroy()}get effectiveDisplayUnits(){return this._controller?.effectiveDisplayUnits??{distance:`meters`,elevation:`meters`}}get error(){return this._controller?.error}get flatProfiles(){return this._controller?.flatProfiles??m}get indicatorPoints(){return this._controller?.indicatorPoints??[]}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get progress(){return this._controller?.progress??0}get results(){return this._controller?.results??[]}get statistics(){return this._controller?.statistics}get updating(){return this._controller?.updating===!0||this._visualization?.updating===!0||this._sketchTool?.updating===!0}get visible(){return super.visible}set visible(e){super.visible=e}get sketchGraphic(){return this._sketchTool?.sketchGraphic}get toolState(){return this._sketchTool?.state??`idle`}place(e){return this._sketchTool.place(e)}pickFeature(e){return this._sketchTool.pickFeature(e)}get testData(){return{visualization:this._visualization}}};e([n({readOnly:!0})],f.prototype,`type`,void 0),e([n({constructOnly:!0,nonNullable:!0})],f.prototype,`analysis`,void 0),e([n({readOnly:!0})],f.prototype,`effectiveDisplayUnits`,null),e([n({readOnly:!0})],f.prototype,`error`,null),e([n()],f.prototype,`flatProfiles`,null),e([n()],f.prototype,`indicatorRelativePosition`,void 0),e([n()],f.prototype,`indicatorPoints`,null),e([n({readOnly:!0})],f.prototype,`progress`,null),e([n({readOnly:!0})],f.prototype,`results`,null),e([n({readOnly:!0})],f.prototype,`statistics`,null),e([n({readOnly:!0})],f.prototype,`updating`,null),e([n()],f.prototype,`sketchGraphic`,null),e([n()],f.prototype,`toolState`,null),e([n()],f.prototype,`_controller`,void 0),e([n()],f.prototype,`_visualization`,void 0),e([n()],f.prototype,`_sketchTool`,void 0),f=e([r(`esri.views.3d.analysis.ElevationProfileAnalysisView3D`)],f);const p=f,m=new t;export{p as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Collection.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"./AnalysisView3D.js";import{ElevationProfileLineSceneComputation as a}from"./ElevationProfile/ElevationProfileLineSceneComputation.js";import{ElevationProfileVisualization3D as o}from"./ElevationProfile/ElevationProfileVisualization3D.js";import{ElevationProfileController as s}from"../../analysis/ElevationProfile/ElevationProfileController.js";import{ElevationProfileLineGroundComputation as c}from"../../analysis/ElevationProfile/ElevationProfileLineGroundComputation.js";import{ElevationProfileLineInputComputation as l}from"../../analysis/ElevationProfile/ElevationProfileLineInputComputation.js";import{ElevationProfileLineQueryComputation as u}from"../../analysis/ElevationProfile/ElevationProfileLineQueryComputation.js";import{ElevationProfileTool as d}from"../../analysis/ElevationProfile/ElevationProfileTool.js";let f=class extends i{constructor(e){super(e),this.type=`elevation-profile-view-3d`,this.analysis=null,this.indicatorRelativePosition=null}initialize(){let{analysis:e,view:t}=this;this._controller=new s({analysis:e,analysisViewData:this,view:t,computationFactory:{create:e=>{switch(e.profile.type){case`ground`:return new c(e);case`input`:return new l(e);case`query`:return new u(e);case`scene`:return new a(e)}}}}),this._visualization=new o({view:t,analysisViewData:this}),this._sketchTool=new d({view:t,analysisViewData:this})}destroy(){this._controller?.destroy(),this._visualization?.destroy(),this._sketchTool?.destroy()}get effectiveDisplayUnits(){return this._controller?.effectiveDisplayUnits??{distance:`meters`,elevation:`meters`}}get error(){return this._controller?.error}get flatProfiles(){return this._controller?.flatProfiles??m}get indicatorPoints(){return this._controller?.indicatorPoints??[]}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get progress(){return this._controller?.progress??0}get results(){return this._controller?.results??[]}get statistics(){return this._controller?.statistics}get updating(){return this._controller?.updating===!0||this._visualization?.updating===!0||this._sketchTool?.updating===!0}get visible(){return super.visible}set visible(e){super.visible=e}get sketchGraphic(){return this._sketchTool?.sketchGraphic}get toolState(){return this._sketchTool?.state??`idle`}get canStopPlacing(){return this._sketchTool?.canStopPlacing??!1}place(e){return this._sketchTool.place(e)}pickFeature(e){return this._sketchTool.pickFeature(e)}get testData(){return{visualization:this._visualization}}};e([n({readOnly:!0})],f.prototype,`type`,void 0),e([n({constructOnly:!0,nonNullable:!0})],f.prototype,`analysis`,void 0),e([n({readOnly:!0})],f.prototype,`effectiveDisplayUnits`,null),e([n({readOnly:!0})],f.prototype,`error`,null),e([n()],f.prototype,`flatProfiles`,null),e([n()],f.prototype,`indicatorRelativePosition`,void 0),e([n()],f.prototype,`indicatorPoints`,null),e([n({readOnly:!0})],f.prototype,`progress`,null),e([n({readOnly:!0})],f.prototype,`results`,null),e([n({readOnly:!0})],f.prototype,`statistics`,null),e([n({readOnly:!0})],f.prototype,`updating`,null),e([n()],f.prototype,`sketchGraphic`,null),e([n()],f.prototype,`toolState`,null),e([n()],f.prototype,`canStopPlacing`,null),e([n()],f.prototype,`_controller`,void 0),e([n()],f.prototype,`_visualization`,void 0),e([n()],f.prototype,`_sketchTool`,void 0),f=e([r(`esri.views.3d.analysis.ElevationProfileAnalysisView3D`)],f);const p=f,m=new t;export{p as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{lineOfSightPlacementLeafPluginMarker as a}from"./LineOfSightPlacementLeafPlugin.js";import{PluginBase as o}from"../../../draw/plugins/PluginBase.js";var s,c;const l=Symbol(`line-of-sight-observer-vertex`),u=Symbol(`line-of-sight-observer-plugin-marker`);let d=class extends o{constructor(){super(...arguments),this[s]=!0,this[c]=!0,this.observer=null,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null}static{s=u,c=a}start(e){super.start(e),this.preservedIntersection=null;let{session:r,positionOfLastUserInput:i}=e,a=this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??i:this.inputMapPosition??i;a&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&r.appendOrReplacePoint(l,a),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?a??void 0:void 0}
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{lineOfSightPlacementLeafPluginMarker as a}from"./LineOfSightPlacementLeafPlugin.js";import{PluginBase as o}from"../../../draw/plugins/PluginBase.js";var s,c;const l=Symbol(`line-of-sight-observer-vertex`),u=Symbol(`line-of-sight-observer-plugin-marker`);let d=class extends o{constructor(){super(...arguments),this[s]=!0,this[c]=!0,this.observer=null,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null}static{s=u,c=a}start(e){super.start(e),this.preservedIntersection=null;let{session:r,positionOfLastUserInput:i}=e,a=this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??i:this.inputMapPosition??i;a&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&r.appendOrReplacePoint(l,a),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?a??void 0:void 0}),this.addHandles(t(()=>this._interactiveHandle?.outputMapPosition,e=>{e&&!this._isComplete&&this._session?.appendOrReplacePoint(l,e)},n),this._ownHandlesKey))}};e([r({constructOnly:!0})],d.prototype,`observer`,void 0),e([r()],d.prototype,`defaultCaptureMode`,void 0),e([r()],d.prototype,`inputMapPosition`,void 0),e([r()],d.prototype,`preservedIntersection`,void 0),e([r()],d.prototype,`_interactiveHandle`,void 0),d=e([i(`esri.views.3d.analysis.LineOfSight.LineOfSightObserverPlugin`)],d);function f(e){return!!e&&u in e}function p(e={}){return{uniqueId:Symbol(`line-of-sight-observer-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new d(e)}}export{d as LineOfSightObserverPlugin,p as createLineOfSightObserverPluginConfiguration,f as isLineOfSightObserverPlugin,u as lineOfSightObserverPluginMarker};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,sync as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as s,updateLineOfSightItemFromAuthoredPoint as c,convertLineOfSightElevationMode as l}from"./LineOfSightAuthoringUtils.js";import{lineOfSightPlacementLeafPluginMarker as u}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as d}from"./LineOfSightRayIntersector.js";import{PluginBase as f}from"../../../draw/plugins/PluginBase.js";var p,m;const h=Symbol(`line-of-sight-target-vertex`),g=Symbol(`line-of-sight-target-plugin-marker`);let _=class extends f{constructor(){super(...arguments),this[p]=!0,this[m]=!0,this.target=null,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null,this._intersector=null,this._changingElevationMode=!1}static{p=g,m=u}initialize(){this._intersector=new d({view:this.view})}destroy(){this._intersector=n(this._intersector)}start(e){super.start(e),this.preservedIntersection=null;let{positionOfLastUserInput:a,session:o}=e,l=this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??a:this.inputMapPosition??a;l&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&o.appendOrReplacePoint(h,l);let u=this.defaultCaptureMode===`capture-always`&&l!=null;this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?l??void 0:void 0}
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as n}from"../../../../core/maybe.js";import{watch as r,sync as i}from"../../../../core/reactiveUtils.js";import{property as a,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as s,updateLineOfSightItemFromAuthoredPoint as c,convertLineOfSightElevationMode as l}from"./LineOfSightAuthoringUtils.js";import{lineOfSightPlacementLeafPluginMarker as u}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as d}from"./LineOfSightRayIntersector.js";import{PluginBase as f}from"../../../draw/plugins/PluginBase.js";var p,m;const h=Symbol(`line-of-sight-target-vertex`),g=Symbol(`line-of-sight-target-plugin-marker`);let _=class extends f{constructor(){super(...arguments),this[p]=!0,this[m]=!0,this.target=null,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null,this._intersector=null,this._changingElevationMode=!1}static{p=g,m=u}initialize(){this._intersector=new d({view:this.view})}destroy(){this._intersector=n(this._intersector)}start(e){super.start(e),this.preservedIntersection=null;let{positionOfLastUserInput:a,session:o}=e,l=this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??a:this.inputMapPosition??a;l&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&o.appendOrReplacePoint(h,l);let u=this.defaultCaptureMode===`capture-always`&&l!=null;this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:this.defaultCaptureMode===`grabbable-object`?l??void 0:void 0}),this.addHandles(r(()=>[this._interactiveHandle?.outputMapPosition,this.getElevationInfo()],([e,r])=>{if(!e||this._isComplete||this._changingElevationMode)return;let i=this.analysisViewData.cursorTarget??new t,a={elevationInfo:r},o=this._interactiveHandle?.screenPosition,l=o&&this._intersector?this._intersector.getScreenPointIntersection(o):null;if(this._session?.appendOrReplacePoint(h,e),u){u=!1,this._clearCursorTarget();return}if(l!=null){this.analysisViewData.cursorTarget=i,s(this.view,i,l,{...a,snappedMapPoint:e});return}if(o!=null&&this.preservedIntersection!=null){this.analysisViewData.cursorTarget=i,s(this.view,i,this.preservedIntersection,{...a,snappedMapPoint:e});return}if(o!=null){this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget);return}if(!this._intersector||!c(this.view,i,this._intersector,e,{...a,preservedIntersection:this.preservedIntersection})){this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget);return}this.analysisViewData.cursorTarget=i},i),this._ownHandlesKey))}changeElevationMode(e,t,n){let r=this.analysisViewData.cursorTarget,i=r?.position,a=i?l({view:this.view,point:i,sourceElevationInfo:r.elevationInfo,mode:e,preserveZ:t}):null;this._changingElevationMode=!0;try{n();let e=this._interactiveHandle?.outputMapPosition;e&&this._session?.appendOrReplacePoint(h,e),r&&a&&(r.position=a.position,r.elevationInfo=a.elevationInfo)}finally{this._changingElevationMode=!1}}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}_clearCursorTarget(){this.analysisViewData.cursorTarget=n(this.analysisViewData.cursorTarget)}};e([a({constructOnly:!0})],_.prototype,`analysis`,void 0),e([a({constructOnly:!0})],_.prototype,`analysisViewData`,void 0),e([a({constructOnly:!0})],_.prototype,`view`,void 0),e([a({constructOnly:!0})],_.prototype,`target`,void 0),e([a({constructOnly:!0})],_.prototype,`getElevationInfo`,void 0),e([a()],_.prototype,`defaultCaptureMode`,void 0),e([a()],_.prototype,`inputMapPosition`,void 0),e([a()],_.prototype,`preservedIntersection`,void 0),e([a()],_.prototype,`_interactiveHandle`,void 0),e([a()],_.prototype,`_intersector`,void 0),_=e([o(`esri.views.3d.analysis.LineOfSight.LineOfSightTargetPlugin`)],_);function v(e){return!!e&&g in e}function y(e){return{uniqueId:Symbol(`line-of-sight-target-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new _(e)}}export{_ as LineOfSightTargetPlugin,y as createLineOfSightTargetPluginConfiguration,v as isLineOfSightTargetPlugin,g as lineOfSightTargetPluginMarker};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Handles.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import{deg2rad as n,clamp as r}from"../../../../core/mathUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,initial as o}from"../../../../core/reactiveUtils.js";import{fromYRotation as s,fromXRotation as c,fromScaling as l,fromZRotation as u,fromRotation as d,multiply as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as m,sub as h,scale as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as y}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as b}from"./ViewshedConfiguration.js";import{screenToCircleAngle as x,getViewshedRotationMatrix as S}from"./viewshedToolUtils.js";import{Manipulator3D as C}from"../../interactive/Manipulator3D.js";import{RenderObject as w}from"../../interactive/RenderObject.js";import{InteractiveManipulation as T}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as E}from"../../webgl-engine/lib/GeometryUtil.js";import{assert as D}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as O}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as k}from"../../../interactive/dragEventPipeline.js";class A extends T{constructor(t){super(),this._handles=new e,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles=i(this._handles),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(e,n){let r=Object.values(this._manipulators);return t(r.map(({manipulator:t,side:r})=>k(t,(t,i,a,o,s)=>{let c=L(r,n),l=i.next(e=>({...e,manipulatorType:2,side:r}));e(t,x(l,this._view,c,n),a)})))}updateManipulatorsTransform(e){e.arcCentersPoints(H),this._forEachManipulatorInfo(t=>this._updateArcManipulatorTransform(t,e,H[t.side]))}updateManipulatorVisuals(e){this._forEachManipulatorInfo(t=>this._updateArcManipulatorVisuals(t,e))}_updateArcManipulatorVisuals({manipulator:e,side:t},n){let r=[];if(n!=null){let[i,a]=j(t,n,this._unfocusedArcMaterial);r.push(new w(i,1),new w(i.instantiate({material:this._focusedArcMaterial}),2)),e.collisionType={type:`line`,paths:[a]}}e.renderObjects=r,e.radius=b.collisionRadius}_updateArcManipulatorTransform({manipulator:e,side:t},r,i){let a=r.horizontalFieldOfView,o=n(r.verticalFieldOfView/2),h=n(a/2),g=F(t);e.renderLocation=i;let _=p(),v=e=>{f(_,e,_)};v(s(z,n(-90))),g||v(c(z,o));let y=r.farDistanceRenderSpace;v(l(z,m(B,y,y,y))),v(u(z,P(t))),v(S(r,z));let b,x;g?(b=h,x=r.tiltedUpVector):(x=r.rightVector,b=o),b*=t===`right`||t===`bottom`?-1:1;let C=d(z,b,x);C!=null&&v(C),e.modelTransform=_}_createManipulators(){let e=this._createArcManipulator(`left`),t=this._createArcManipulator(`right`),n=this._createArcManipulator(`top`),r=this._createArcManipulator(`bottom`);this._manipulators={left:e,right:t,top:n,bottom:r},[[r.manipulator,n.manipulator],[e.manipulator,t.manipulator]].forEach(([e,t])=>{e.metadata={pairedManipulator:t},t.metadata={pairedManipulator:e}})}_createArcManipulator(e){let t=new C({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),n={manipulator:t,side:e};return this._updateArcManipulatorVisuals(n),this._handles.add(t.events.on([`focus-changed`,`grab-changed`],e=>{let n=t.metadata?.pairedManipulator;n!=null&&(n.hovering!==t.hovering&&(n.hovering=t.hovering),n.grabbing!==t.grabbing&&(n.grabbing=t.grabbing))})),n}_createArcMaterial(e){let t=b.getFovArcWidth(e),n=new O({renderOccluded:4,isDecoration:!0,width:t},this._view
|
|
2
|
+
import e from"../../../../core/Handles.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import{deg2rad as n,clamp as r}from"../../../../core/mathUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,initial as o}from"../../../../core/reactiveUtils.js";import{fromYRotation as s,fromXRotation as c,fromScaling as l,fromZRotation as u,fromRotation as d,multiply as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as m,sub as h,scale as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{f as y}from"../../../../chunks/boundedPlane.js";import{viewshedToolManipulatorConfiguration as b}from"./ViewshedConfiguration.js";import{screenToCircleAngle as x,getViewshedRotationMatrix as S}from"./viewshedToolUtils.js";import{Manipulator3D as C}from"../../interactive/Manipulator3D.js";import{RenderObject as w}from"../../interactive/RenderObject.js";import{InteractiveManipulation as T}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as E}from"../../webgl-engine/lib/GeometryUtil.js";import{assert as D}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as O}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as k}from"../../../interactive/dragEventPipeline.js";class A extends T{constructor(t){super(),this._handles=new e,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles=i(this._handles),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(e,n){let r=Object.values(this._manipulators);return t(r.map(({manipulator:t,side:r})=>k(t,(t,i,a,o,s)=>{let c=L(r,n),l=i.next(e=>({...e,manipulatorType:2,side:r}));e(t,x(l,this._view,c,n),a)})))}updateManipulatorsTransform(e){e.arcCentersPoints(H),this._forEachManipulatorInfo(t=>this._updateArcManipulatorTransform(t,e,H[t.side]))}updateManipulatorVisuals(e){this._forEachManipulatorInfo(t=>this._updateArcManipulatorVisuals(t,e))}_updateArcManipulatorVisuals({manipulator:e,side:t},n){let r=[];if(n!=null){let[i,a]=j(t,n,this._unfocusedArcMaterial);r.push(new w(i,1),new w(i.instantiate({material:this._focusedArcMaterial}),2)),e.collisionType={type:`line`,paths:[a]}}e.renderObjects=r,e.radius=b.collisionRadius}_updateArcManipulatorTransform({manipulator:e,side:t},r,i){let a=r.horizontalFieldOfView,o=n(r.verticalFieldOfView/2),h=n(a/2),g=F(t);e.renderLocation=i;let _=p(),v=e=>{f(_,e,_)};v(s(z,n(-90))),g||v(c(z,o));let y=r.farDistanceRenderSpace;v(l(z,m(B,y,y,y))),v(u(z,P(t))),v(S(r,z));let b,x;g?(b=h,x=r.tiltedUpVector):(x=r.rightVector,b=o),b*=t===`right`||t===`bottom`?-1:1;let C=d(z,b,x);C!=null&&v(C),e.modelTransform=_}_createManipulators(){let e=this._createArcManipulator(`left`),t=this._createArcManipulator(`right`),n=this._createArcManipulator(`top`),r=this._createArcManipulator(`bottom`);this._manipulators={left:e,right:t,top:n,bottom:r},[[r.manipulator,n.manipulator],[e.manipulator,t.manipulator]].forEach(([e,t])=>{e.metadata={pairedManipulator:t},t.metadata={pairedManipulator:e}})}_createArcManipulator(e){let t=new C({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),n={manipulator:t,side:e};return this._updateArcManipulatorVisuals(n),this._handles.add(t.events.on([`focus-changed`,`grab-changed`],e=>{let n=t.metadata?.pairedManipulator;n!=null&&(n.hovering!==t.hovering&&(n.hovering=t.hovering),n.grabbing!==t.grabbing&&(n.grabbing=t.grabbing))})),n}_createArcMaterial(e){let t=b.getFovArcWidth(e),n=new O({renderOccluded:4,isDecoration:!0,width:t},this._view);return this._handles.add(a(()=>this._view.effectiveTheme.accentColor.toUnitRGBA(),e=>n.setParameters({color:e}),o)),n}forEachManipulator(e){Object.values(this._manipulators).forEach(({manipulator:t})=>e(t,2))}_forEachManipulatorInfo(e){Object.values(this._manipulators).forEach(t=>e(t))}get test(){return{manipulators:this._manipulators}}}function j(e,t,i){let{horizontalFieldOfView:a,verticalFieldOfView:o}=t,s=F(e),c=(s?o:a)/2,l=n(r(c,0,15)),u=s?1:Math.max(Math.sin(n(90-o/2)),.1),d=M(-l/2,l/2,u);return[E(i,d),d]}function M(e,t,n,r=10){D(r>1,`createArcPolylineGeometry() needs at least 2 for numVertices`);let i=t-e;if(i<=0||n<=0)return[v(0,0,.01),v(0,0,-.01)];let a=[],o=i/r;for(let i=0;i<r;i++){let s=e+i*o;i===r-1&&(s=t);let c=Math.cos(s)*n,l=Math.sin(s)*n,u=v(c-n,0,l);a.push(u)}return a}function N(e){switch(e){case`left`:return 0;case`bottom`:return 1;case`right`:return 2;case`top`:return 3}}function P(e){return N(e)*R}function F(e){return e===`left`||e===`right`}function I(e){return e===`left`?`right`:e===`right`?`left`:e===`top`?`bottom`:`top`}function L(e,t){let{elevationAlignedObserverRenderSpace:n,elevationAlignedTargetRenderSpace:r,tiltedUpVector:i,rightVector:a,farDistanceRenderSpace:o}=t,s=h(B,r,n),c=F(e)?a:i,l=g(V,c,o);return y(n,s,l)}const R=Math.PI/2,z=p(),B=_(),V=_(),H={top:_(),bottom:_(),left:_(),right:_()};export{A as ViewshedFieldOfViewManipulation,M as createArcPolylineVertices,I as flipSide,F as isSideHorizontal,P as sideToRad};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var o;const s=Symbol(`viewshed-placement-point-plugin-marker`);let c=class extends a{static{o=s}constructor(e){super(e),this[o]=!0,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol(`viewshed-placement-point-vertex`)}start(e){super.start(e);let{positionOfLastUserInput:t,session:n}=e,r=this._getInitialMapPoint(t);r&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&(n.appendOrReplacePoint(this._vertexId,r),this.outputMapPosition=r.clone()),this._ensureInteractiveHandle(e,r)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(e,r){if(this._interactiveHandle)return;let{defaultCaptureMode:i}=this;this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:i,inputMapPosition:i===`grabbable-object`?r:void 0},{disableDefaultXYFields:this.step===`target
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t,sync as n}from"../../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{PluginBase as a}from"../../../draw/plugins/PluginBase.js";var o;const s=Symbol(`viewshed-placement-point-plugin-marker`);let c=class extends a{static{o=s}constructor(e){super(e),this[o]=!0,this.defaultCaptureMode=`capture-always`,this.inputMapPosition=null,this.outputMapPosition=null,this.screenPosition=null,this.hasCommittedPoint=!1,this._vertexId=Symbol(`viewshed-placement-point-vertex`)}start(e){super.start(e);let{positionOfLastUserInput:t,session:n}=e,r=this._getInitialMapPoint(t);r&&(this.defaultCaptureMode===`grabbable-object`||!this._interactiveHandle)&&(n.appendOrReplacePoint(this._vertexId,r),this.outputMapPosition=r.clone()),this._ensureInteractiveHandle(e,r)}completeStep(){this.hasCommittedPoint=!0,this._context?.requestComplete()}_ensureInteractiveHandle(e,r){if(this._interactiveHandle)return;let{defaultCaptureMode:i}=this;this._interactiveHandle=e.createInteractiveHandle({defaultCaptureMode:i,inputMapPosition:i===`grabbable-object`?r:void 0},{disableDefaultXYFields:this.step===`target`}),this.addHandles(t(()=>{let e=this._interactiveHandle;return{outputMapPosition:e?.outputMapPosition,screenPosition:e?.screenPosition}},({outputMapPosition:e,screenPosition:t})=>{this.outputMapPosition=e?.clone(),this.screenPosition=t,e&&!this._isComplete&&this._session?.appendOrReplacePoint(this._vertexId,e)},n),this._ownHandlesKey)}_getInitialMapPoint(e){return this.defaultCaptureMode===`grabbable-object`?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??e:this.inputMapPosition??e}};e([r({constructOnly:!0})],c.prototype,`step`,void 0),e([r()],c.prototype,`defaultCaptureMode`,void 0),e([r()],c.prototype,`inputMapPosition`,void 0),e([r()],c.prototype,`outputMapPosition`,void 0),e([r()],c.prototype,`screenPosition`,void 0),e([r()],c.prototype,`hasCommittedPoint`,void 0),e([r()],c.prototype,`_interactiveHandle`,void 0),c=e([i(`esri.views.3d.analysis.Viewshed.ViewshedPlacementPointPlugin`)],c);function l(e){return{uniqueId:Symbol(`viewshed-${e}-plugin`),kind:[`vertex`],geometryType:`point`,hidden:!0,localizationKey:`leaf-point-segment`,icon:`point`,create:()=>new c({step:e})}}export{c as ViewshedPlacementPointPlugin,l as createViewshedPlacementPointPluginConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{getFeatureId as t,updatePointsFromFeatureReference as n}from"../../../analysis/featureReferenceUtils.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{mapCollection as i}from"../../../core/mapCollectionUtils.js";import{abortMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{watch as s,initial as c,when as l,syncAndInitial as u}from"../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../core/accessorSupport/decorators.js";import{copy as p,exactEquals as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as g,isLoaded as _}from"../../../geometry/projectionUtils.js";import v from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as y}from"./support/projectionUtils.js";import{registerAnalysisView as b,unselectViewshedInOtherAnalysisViews as x}from"./Viewshed/analysisViewRegister.js";import{ViewshedComputedData as S}from"./Viewshed/ViewshedComputedData.js";import C from"./Viewshed/ViewshedTool.js";import{ViewshedVisualization as w}from"./Viewshed/ViewshedVisualization.js";import{createElevationUpdateHandle as T}from"../support/elevationUpdateUtils.js";import{Intersector as E}from"../webgl-engine/lib/Intersector.js";import{Viewshed as D}from"../webgl-engine/lib/Viewshed.js";let O=class extends v{constructor(e){super(e),this.type=`viewshed-view-3d`,this.analysis=null,this._tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._viewshedRenderNode=null,this._intersector=null}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get toolActive(){return this._tool?.active??!1}get toolCreating(){return this._tool?.creating??!1}get stagedViewshed(){return this._tool?.stagedViewshed}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){let t=e!=null&&this.analysis.viewsheds.includes(e)?e:null;this._unselectOtherViewsheds(t),this._selectedViewshed=t}get selectedViewshedComputedData(){return this._tool?.selectedViewshedComputedData}get updating(){return!!this._tool?.updating}get _isDecoration(){return!this.parent}initialize(){let e=this.view;this.addHandles(b(e,this)),this._viewshedRenderNode=new D({view:e,selectedViewshed:()=>this.selectedViewshed??this.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new E(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=0,this.viewshedComputedDataHandles=i(()=>this.analysis.viewsheds,t=>{let n=new S({view:e,viewshed:t}),i=Symbol();return this.addHandles([s(()=>({valid:n.valid,canProject:g(n.observer?.spatialReference,this.view.spatialReference)||_()}),({valid:e,canProject:t},i)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(n):i?.valid&&i?.canProject&&this._removeViewshedsFromRenderer(n),t||y(this.analysis,n.observer.spatialReference,r.getLogger(this)))},c),T({view:e,geometry:n.observer,onElevationChanges:()=>n.onElevationChange()}),s(()=>[e.state.camera,e.slice.plane,n.elevationAlignedObserverRenderSpace,n.elevationAlignedTargetRenderSpace,n.verticalFieldOfView,n.horizontalFieldOfView,n.feature],()=>{this._updateObserverFromFeature(e,n)},c)],i),{viewshedComputedData:n,remove:()=>{this.selectedViewshed===n.viewshed&&(this.selectedViewshed=null),this.removeHandles(i),this._removeViewshedsFromRenderer(n),n.destroy()}}}),this._visualization=new w({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this._tool=new C({analysis:this.analysis,analysisViewData:this,view:e}),this.addHandles([s(()=>this.visible,e=>{let t=this.viewshedComputedDataHandles;if(t==null)return;e||(this.selectedViewshed=null);let n=t.items.values().map(e=>e.viewshedComputedData).filter(e=>e.valid).toArray();e?this._addViewshedsToRenderer(n):this._removeViewshedsFromRenderer(n)}),l(()=>this.interactive,()=>this._unselectOtherViewsheds(this.selectedViewshed),u)])}destroy(){this.userOperation=a(this.userOperation),this._tool=o(this._tool),this._visualization=o(this._visualization);let e=this.viewshedComputedDataHandles;e!=null&&this._removeViewshedsFromRenderer(e.items.map(e=>e.viewshedComputedData))}async createViewsheds(e){return this._tool.place(`multiple`,e)}place(e){return this._tool.place(`single`,e)}_addViewshedsToRenderer(e){this._viewshedRenderNode.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderNode.updateViewsheds({removes:e})}_updateObserverFromFeature(e,r){let i=r.elevationAlignedObserverRenderSpace,a=r.elevationAlignedTargetRenderSpace,o=p(h(),i),s={observer:i,observerSurfaceNormal:null,observerAdjusted:o,observerFeatureId:t(r.feature),target:a,targetSurfaceNormal:null,targetAdjusted:p(h(),a),targetFeatureId:null};n(e,this._intersector,s,e=>Math.min(e,.05*r.farDistanceRenderSpace)),r.observerRenderSpaceOverride=m(o,i)?null:o}_unselectOtherViewsheds(e){e!=null&&x(this.view,this)}get test(){}};e([d({readOnly:!0})],O.prototype,`type`,void 0),e([d({constructOnly:!0,nonNullable:!0})],O.prototype,`analysis`,void 0),e([d()],O.prototype,`_tool`,void 0),e([d()],O.prototype,`toolActive`,null),e([d()],O.prototype,`toolCreating`,null),e([d()],O.prototype,`stagedViewshed`,null),e([d()],O.prototype,`_selectedViewshed`,void 0),e([d()],O.prototype,`selectedViewshed`,null),e([d()],O.prototype,`selectedViewshedComputedData`,null),e([d()],O.prototype,`viewshedComputedDataHandles`,void 0),e([d()],O.prototype,`userOperation`,void 0),e([d()],O.prototype,`updating`,null),e([d()],O.prototype,`_visualization`,void 0),e([d()],O.prototype,`_viewshedRenderNode`,void 0),O=e([f(`esri.views.3d.analysis.ViewshedAnalysisView3D`)],O);const k=O;export{k as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{getFeatureId as t,updatePointsFromFeatureReference as n}from"../../../analysis/featureReferenceUtils.js";import"../../../core/has.js";import r from"../../../core/Logger.js";import{mapCollection as i}from"../../../core/mapCollectionUtils.js";import{abortMaybe as a,destroyMaybe as o}from"../../../core/maybe.js";import{watch as s,initial as c,when as l,syncAndInitial as u}from"../../../core/reactiveUtils.js";import{property as d,subclass as f}from"../../../core/accessorSupport/decorators.js";import{copy as p,exactEquals as m}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{canProjectWithoutEngine as g,isLoaded as _}from"../../../geometry/projectionUtils.js";import v from"./AnalysisView3D.js";import{logFailedGeometryProjectionError as y}from"./support/projectionUtils.js";import{registerAnalysisView as b,unselectViewshedInOtherAnalysisViews as x}from"./Viewshed/analysisViewRegister.js";import{ViewshedComputedData as S}from"./Viewshed/ViewshedComputedData.js";import C from"./Viewshed/ViewshedTool.js";import{ViewshedVisualization as w}from"./Viewshed/ViewshedVisualization.js";import{createElevationUpdateHandle as T}from"../support/elevationUpdateUtils.js";import{Intersector as E}from"../webgl-engine/lib/Intersector.js";import{Viewshed as D}from"../webgl-engine/lib/Viewshed.js";let O=class extends v{constructor(e){super(e),this.type=`viewshed-view-3d`,this.analysis=null,this._tool=null,this._selectedViewshed=null,this.viewshedComputedDataHandles=null,this.userOperation=null,this._viewshedRenderNode=null,this._intersector=null}get visible(){return super.visible}set visible(e){super.visible=e}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get toolActive(){return this._tool?.active??!1}get toolCreating(){return this._tool?.creating??!1}get stagedViewshed(){return this._tool?.stagedViewshed}get selectedViewshed(){return this._selectedViewshed}set selectedViewshed(e){let t=e!=null&&this.analysis.viewsheds.includes(e)?e:null;this._unselectOtherViewsheds(t),this._selectedViewshed=t}get selectedViewshedComputedData(){return this._tool?.selectedViewshedComputedData}get updating(){return!!this._tool?.updating}get _isDecoration(){return!this.parent}initialize(){let e=this.view;this.addHandles(b(e,this)),this._viewshedRenderNode=new D({view:e,selectedViewshed:()=>this.selectedViewshed??this.stagedViewshed,isDecoration:this._isDecoration}),this._intersector=new E(this.view.state.viewingMode),this._intersector.options.hud=!1,this._intersector.options.store=0,this.viewshedComputedDataHandles=i(()=>this.analysis.viewsheds,t=>{let n=new S({view:e,viewshed:t}),i=Symbol();return this.addHandles([s(()=>({valid:n.valid,canProject:g(n.observer?.spatialReference,this.view.spatialReference)||_()}),({valid:e,canProject:t},i)=>{this.visible&&(e&&t?this._addViewshedsToRenderer(n):i?.valid&&i?.canProject&&this._removeViewshedsFromRenderer(n),t||y(this.analysis,n.observer.spatialReference,r.getLogger(this)))},c),T({view:e,geometry:()=>n.observer,onElevationChanges:()=>n.onElevationChange()}),s(()=>[e.state.camera,e.slice.plane,n.elevationAlignedObserverRenderSpace,n.elevationAlignedTargetRenderSpace,n.verticalFieldOfView,n.horizontalFieldOfView,n.feature],()=>{this._updateObserverFromFeature(e,n)},c)],i),{viewshedComputedData:n,remove:()=>{this.selectedViewshed===n.viewshed&&(this.selectedViewshed=null),this.removeHandles(i),this._removeViewshedsFromRenderer(n),n.destroy()}}}),this._visualization=new w({view:e,analysisViewData:this,isDecoration:this._isDecoration}),this._tool=new C({analysis:this.analysis,analysisViewData:this,view:e}),this.addHandles([s(()=>this.visible,e=>{let t=this.viewshedComputedDataHandles;if(t==null)return;e||(this.selectedViewshed=null);let n=t.items.values().map(e=>e.viewshedComputedData).filter(e=>e.valid).toArray();e?this._addViewshedsToRenderer(n):this._removeViewshedsFromRenderer(n)}),l(()=>this.interactive,()=>this._unselectOtherViewsheds(this.selectedViewshed),u)])}destroy(){this.userOperation=a(this.userOperation),this._tool=o(this._tool),this._visualization=o(this._visualization);let e=this.viewshedComputedDataHandles;e!=null&&this._removeViewshedsFromRenderer(e.items.map(e=>e.viewshedComputedData))}async createViewsheds(e){return this._tool.place(`multiple`,e)}place(e){return this._tool.place(`single`,e)}_addViewshedsToRenderer(e){this._viewshedRenderNode.updateViewsheds({adds:e})}_removeViewshedsFromRenderer(e){this._viewshedRenderNode.updateViewsheds({removes:e})}_updateObserverFromFeature(e,r){let i=r.elevationAlignedObserverRenderSpace,a=r.elevationAlignedTargetRenderSpace,o=p(h(),i),s={observer:i,observerSurfaceNormal:null,observerAdjusted:o,observerFeatureId:t(r.feature),target:a,targetSurfaceNormal:null,targetAdjusted:p(h(),a),targetFeatureId:null};n(e,this._intersector,s,e=>Math.min(e,.05*r.farDistanceRenderSpace)),r.observerRenderSpaceOverride=m(o,i)?null:o}_unselectOtherViewsheds(e){e!=null&&x(this.view,this)}get test(){}};e([d({readOnly:!0})],O.prototype,`type`,void 0),e([d({constructOnly:!0,nonNullable:!0})],O.prototype,`analysis`,void 0),e([d()],O.prototype,`_tool`,void 0),e([d()],O.prototype,`toolActive`,null),e([d()],O.prototype,`toolCreating`,null),e([d()],O.prototype,`stagedViewshed`,null),e([d()],O.prototype,`_selectedViewshed`,void 0),e([d()],O.prototype,`selectedViewshed`,null),e([d()],O.prototype,`selectedViewshedComputedData`,null),e([d()],O.prototype,`viewshedComputedDataHandles`,void 0),e([d()],O.prototype,`userOperation`,void 0),e([d()],O.prototype,`updating`,null),e([d()],O.prototype,`_visualization`,void 0),e([d()],O.prototype,`_viewshedRenderNode`,void 0),O=e([f(`esri.views.3d.analysis.ViewshedAnalysisView3D`)],O);const k=O;export{k as default};
|
|
@@ -2,7 +2,7 @@ import type WebSceneSunLighting from "../../../webscene/SunLighting.js";
|
|
|
2
2
|
import type { EventedMixin } from "../../../core/Evented.js";
|
|
3
3
|
import type { SunLightingProperties as WebSceneSunLightingProperties } from "../../../webscene/SunLighting.js";
|
|
4
4
|
|
|
5
|
-
export interface SunLightingProperties extends WebSceneSunLightingProperties, Partial<Pick<SunLighting, "cameraTrackingEnabled">> {
|
|
5
|
+
export interface SunLightingProperties extends WebSceneSunLightingProperties, Partial<Pick<SunLighting, "cameraTrackingEnabled" | "globalIllumination">> {
|
|
6
6
|
/**
|
|
7
7
|
* The current date and time of the simulated sun. When setting the date, specifying the time zone is important,
|
|
8
8
|
* otherwise the time zone of the browser will be used. This might lead to different lighting for users in different
|
|
@@ -63,6 +63,22 @@ export default class SunLighting extends SunLightingSuperclass {
|
|
|
63
63
|
*/
|
|
64
64
|
get date(): Date;
|
|
65
65
|
set date(value: (Date | number | string));
|
|
66
|
+
/**
|
|
67
|
+
* Enables global illumination for more realistic lighting in the scene. Emissive materials illuminate nearby
|
|
68
|
+
* surfaces, while areas where surrounding objects block ambient light receive more natural shading.
|
|
69
|
+
*
|
|
70
|
+
* **Known limitations**
|
|
71
|
+
*
|
|
72
|
+
* - Is not supported with [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/).
|
|
73
|
+
* - Is disabled at high camera altitudes.
|
|
74
|
+
* - May produce temporarily noisy lighting after camera or scene changes.
|
|
75
|
+
* - May reduce rendering performance.
|
|
76
|
+
*
|
|
77
|
+
* @default false
|
|
78
|
+
* @beta
|
|
79
|
+
* @since 5.2
|
|
80
|
+
*/
|
|
81
|
+
accessor globalIllumination: boolean;
|
|
66
82
|
/** Indicates that the light source is simulated position of the sun. */
|
|
67
83
|
get type(): "sun";
|
|
68
84
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../../core/Evented.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../webscene/SunLighting.js";var a;let o=a=class extends t(i){static calculateTimezoneOffset({hours:e,minutes:t,seconds:n}){return Math.round(e+t/60+n/3600)}constructor(e){super(e),this.cameraTrackingEnabled=!0,this.positionTimezoneInfo={hours:0,minutes:0,seconds:0,autoUpdated:!0},this.type=`sun`;let t=new Date().getFullYear(),n=new Date(`March 15, `+t+` 12:00:00 UTC`);this._set(`defaultDate`,n),this._set(`date`,n)}get defaultDate(){return new Date(this._get(`defaultDate`))}static fromWebsceneLighting(e){return new a(e.cloneConstructProperties())}set defaultDate(e){let t=this._get(`date`)===this._get(`defaultDate`);e=new Date(e),this._set(`defaultDate`,e),t&&this._set(`date`,e)}set date(e){e!=null&&(this.positionTimezoneInfo.autoUpdated=!1,this._set(`date`,new Date(e)))}autoUpdate(e,t){let n=a.calculateTimezoneOffset(this.positionTimezoneInfo);this.positionTimezoneInfo.hours=t.hours,this.positionTimezoneInfo.minutes=t.minutes,this.positionTimezoneInfo.seconds=t.seconds;let r=null;e!=null&&(this.positionTimezoneInfo.autoUpdated=!0,isNaN(e.getTime())?(r=this.defaultDate.getTime(),this._set(`date`,this.defaultDate)):(r=this.date&&this.date.getTime(),this._set(`date`,new Date(e))));let i=a.calculateTimezoneOffset(this.positionTimezoneInfo);if(n!==i&&(s.target=this,s.timezoneOffset=i,this.emit(`timezone-will-change`,s),s.target=null),e!=null)return isNaN(e.getTime())||r!==e.getTime()}clone(){let e=this._get(`date`)===this._get(`defaultDate`),t=new a({...this.cloneConstructProperties(),defaultDate:this.defaultDate
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../../core/Evented.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../webscene/SunLighting.js";var a;let o=a=class extends t(i){static calculateTimezoneOffset({hours:e,minutes:t,seconds:n}){return Math.round(e+t/60+n/3600)}constructor(e){super(e),this.cameraTrackingEnabled=!0,this.globalIllumination=!1,this.positionTimezoneInfo={hours:0,minutes:0,seconds:0,autoUpdated:!0},this.type=`sun`;let t=new Date().getFullYear(),n=new Date(`March 15, `+t+` 12:00:00 UTC`);this._set(`defaultDate`,n),this._set(`date`,n)}get defaultDate(){return new Date(this._get(`defaultDate`))}static fromWebsceneLighting(e){return new a(e.cloneConstructProperties())}set defaultDate(e){let t=this._get(`date`)===this._get(`defaultDate`);e=new Date(e),this._set(`defaultDate`,e),t&&this._set(`date`,e)}set date(e){e!=null&&(this.positionTimezoneInfo.autoUpdated=!1,this._set(`date`,new Date(e)))}autoUpdate(e,t){let n=a.calculateTimezoneOffset(this.positionTimezoneInfo);this.positionTimezoneInfo.hours=t.hours,this.positionTimezoneInfo.minutes=t.minutes,this.positionTimezoneInfo.seconds=t.seconds;let r=null;e!=null&&(this.positionTimezoneInfo.autoUpdated=!0,isNaN(e.getTime())?(r=this.defaultDate.getTime(),this._set(`date`,this.defaultDate)):(r=this.date&&this.date.getTime(),this._set(`date`,new Date(e))));let i=a.calculateTimezoneOffset(this.positionTimezoneInfo);if(n!==i&&(s.target=this,s.timezoneOffset=i,this.emit(`timezone-will-change`,s),s.target=null),e!=null)return isNaN(e.getTime())||r!==e.getTime()}clone(){let e=this._get(`date`)===this._get(`defaultDate`),t=new a({...this.cloneConstructProperties(),...this.cloneNonPersistentConstructProperties(),defaultDate:this.defaultDate});return e&&t._set(`date`,t._get(`defaultDate`)),t.positionTimezoneInfo.autoUpdated=this.positionTimezoneInfo.autoUpdated,t.positionTimezoneInfo.hours=this.positionTimezoneInfo.hours,t.positionTimezoneInfo.minutes=this.positionTimezoneInfo.minutes,t.positionTimezoneInfo.seconds=this.positionTimezoneInfo.seconds,t}cloneWithWebsceneLighting(e){let t=this.clone();return e.date!=null&&(t.date=e.date),t.directShadowsEnabled=e.directShadowsEnabled,t.glow=e.glow?.clone(),t.displayUTCOffset=e.displayUTCOffset,t}cloneNonPersistentConstructProperties(){return{cameraTrackingEnabled:this.cameraTrackingEnabled,globalIllumination:this.globalIllumination}}};e([n({type:Boolean})],o.prototype,`cameraTrackingEnabled`,void 0),e([n({type:Boolean})],o.prototype,`globalIllumination`,void 0),e([n({type:Date})],o.prototype,`defaultDate`,null),e([n({type:Date})],o.prototype,`date`,null),e([n({readOnly:!0,type:[`sun`],json:{write:!0}})],o.prototype,`type`,void 0),o=a=e([r(`esri.views.3d.environment.SunLighting`)],o);const s={target:null,timezoneOffset:0},c=o;export{c as default};
|
|
@@ -2,7 +2,7 @@ import type WebSceneVirtualLighting from "../../../webscene/VirtualLighting.js";
|
|
|
2
2
|
import type { EventedMixin } from "../../../core/Evented.js";
|
|
3
3
|
import type { VirtualLightingProperties as WebSceneVirtualLightingProperties } from "../../../webscene/VirtualLighting.js";
|
|
4
4
|
|
|
5
|
-
export interface VirtualLightingProperties extends WebSceneVirtualLightingProperties {}
|
|
5
|
+
export interface VirtualLightingProperties extends WebSceneVirtualLightingProperties, Partial<Pick<VirtualLighting, "globalIllumination">> {}
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The VirtualLighting class allows you to change the lighting in the scene to virtual light. The position of the light
|
|
@@ -41,6 +41,22 @@ export interface VirtualLightingProperties extends WebSceneVirtualLightingProper
|
|
|
41
41
|
*/
|
|
42
42
|
export default class VirtualLighting extends VirtualLightingSuperclass {
|
|
43
43
|
constructor(properties?: VirtualLightingProperties);
|
|
44
|
+
/**
|
|
45
|
+
* Enables global illumination for more realistic lighting in the scene. Emissive materials illuminate nearby
|
|
46
|
+
* surfaces, while areas where surrounding objects block ambient light receive more natural shading.
|
|
47
|
+
*
|
|
48
|
+
* **Known limitations**
|
|
49
|
+
*
|
|
50
|
+
* - Is not supported with [GaussianSplatLayer](https://developers.arcgis.com/javascript/latest/references/core/layers/GaussianSplatLayer/).
|
|
51
|
+
* - Is disabled at high camera altitudes.
|
|
52
|
+
* - May produce temporarily noisy lighting after camera or scene changes.
|
|
53
|
+
* - May reduce rendering performance.
|
|
54
|
+
*
|
|
55
|
+
* @default false
|
|
56
|
+
* @beta
|
|
57
|
+
* @since 5.2
|
|
58
|
+
*/
|
|
59
|
+
accessor globalIllumination: boolean;
|
|
44
60
|
/**
|
|
45
61
|
* Indicates that the light source is virtual light. Virtual light is top - right position respect to the camera
|
|
46
62
|
* enabling user to observe the scene independant to the possition of the sun.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../../core/Evented.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../webscene/VirtualLighting.js";var a;let o=a=class extends t(i){constructor(e){super(e),this.cameraTrackingEnabled=!0,this.type=`virtual`}clone(){return new a({...this.cloneConstructProperties()
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedMixin as t}from"../../../core/Evented.js";import{property as n,subclass as r}from"../../../core/accessorSupport/decorators.js";import i from"../../../webscene/VirtualLighting.js";var a;let o=a=class extends t(i){constructor(e){super(e),this.cameraTrackingEnabled=!0,this.globalIllumination=!1,this.type=`virtual`}clone(){return new a({...this.cloneConstructProperties(),...this.cloneNonPersistentConstructProperties()})}static fromWebsceneLighting(e){return new a(e.cloneConstructProperties())}cloneWithWebsceneLighting(e){let t=this.clone();return t.directShadowsEnabled=e.directShadowsEnabled,t.glow=e.glow?.clone(),t}cloneNonPersistentConstructProperties(){return{cameraTrackingEnabled:this.cameraTrackingEnabled,globalIllumination:this.globalIllumination}}};e([n({type:Boolean})],o.prototype,`cameraTrackingEnabled`,void 0),e([n({type:Boolean})],o.prototype,`globalIllumination`,void 0),e([n({readOnly:!0,type:[`virtual`],json:{write:{isRequired:!0}}})],o.prototype,`type`,void 0),o=a=e([r(`esri.views.3d.environment.VirtualLighting`)],o);const s=o;export{s as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Collection.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{debounce as o}from"../../../../../core/promiseUtils.js";import{scale as s,zeroMeters as c}from"../../../../../core/quantity.js";import{watch as l,initial as u,syncAndInitial as d}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as m}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as ee}from"../../../../../core/support/UpdatingHandles.js";import te from"../../../../../geometry/Point.js";import{makeDehydratedPoint as h}from"../../../../../layers/graphics/dehydratedPoint.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as _}from"../geometryUtils.js";import{manipulatedObjectGeometry as v,supportsElevationMode as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as x}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as S}from"../tooltipUtils3D.js";import{createVisualElements as C}from"../visualElementUtils.js";import{discRadius as ne}from"../manipulations/config.js";import{MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as T}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as E}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as D}from"./isSupportedObject.js";import{OutlineVisualElement as O}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as k}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as A,resetManipulatedObjectMany as j}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as M}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as N}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import P from"../../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as F}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as I}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as L,enterInputModeIfAvailable as R}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as z}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as H}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as U}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class G{constructor(e){this.objects=e,this.type=`move-start`}}class K{constructor(e,t,n){this.dx=e,this.dy=t,this.objects=n,this.type=`move`}}class q{constructor(e){this.objects=e,this.type=`move-stop`}}class J{constructor(e){this.objects=e,this.type=`hold`}}const Y=Symbol(`manipulators`),X=Symbol(`tooltips`),Z=Symbol(`move-manipulator-display`);let Q=class extends M{get _infos(){return Array.from(this._infosByType.values())}constructor(e){super(e),this._infosByType=new Map,this.events=new r,this.objects=new n,this.enableVisualElements=!0,this.enableZ=!0,this.manipulatorRadius=null,this.toolOptions=new P,this.type=`move-3d`,this._measurementWorker=new W({preloadGeodetic:!0}),this._ownedTooltip=null,this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new ee,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=o(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){let{view:e}=this;this.tooltip??=this._ownedTooltip=L(()=>({view:e,options:this.toolOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,e=>{e.removed.forEach(e=>this.removeHandles(e)),this._updateObjectInfos(e),this._setupObjectUpdateHandles(e.added),this._refreshManipulators(),this._connectTooltips()}));let t=this.objects.toArray();this._updateObjectInfos({added:t,removed:[]}),this._setupObjectUpdateHandles(t),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this._ownedTooltip=a(this._ownedTooltip),this._moveManipulation=a(this._moveManipulation),this._set(`view`,null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(e){if(this.destroyed||R(e,this.tooltip))return;let t=this.firstGrabbedManipulator;if(e.type===`hold`&&t!=null){let e=this._getActiveObjectInfos(this._infos,t).map(({object:e})=>e);this.events.emit(`hold`,new J(e))}return super.onInputEvent(e)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){let{objects:e}=this;if(e.length!==1)return!1;let t=v(e.at(0))?.type;return t===`point`||t===`mesh`}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:e,removed:t}){for(let t of e){if(D(t)!==0)continue;let e=new re(t);this._infosByType.set(t,e)}for(let e of t)this._infosByType.delete(e)}_setupObjectUpdateHandles(e){for(let t of e){let e=this._infosByType.get(t);this.addHandles(x(e.object),t),y(t)&&this.addHandles(l(()=>{let{mode:e,unit:n,offset:r}=t.elevationInfo;return[e,n,r]},()=>this._refreshManipulators()),t)}}_refreshManipulators(){if(this.removeHandles(Y),this.removeHandles(Z),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),this._infosByType.size===0)return;let e=this._infos;this._createManipulators(e),this._createVisualElements(e),this._updateMoveManipulation(e)}_createManipulators(e){for(let t of e){let n=t.object;t.manipulationXY=new E({tool:this,view:this.view,object:n}),t.manipulationXY.forEachManipulator(e=>{this.addHandles([e.events.on(`immediate-click`,e=>{this.events.emit(`immediate-click`,{...e,object:n}),e.stopPropagation()}),e.events.on(`grab-changed`,({action:e})=>{e===`start`?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],Y)}),this.addHandles(t.manipulationXY.createDragPipeline((t,n,r,i)=>this._buildDragEventPipeline(e,0,t,n,r,i)),Y)}this._createMoveManipulation(e)}_updateMoveManipulatorDisplay(){let e=this._infos.some(e=>e.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!e),this.removeHandles(Z),e&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Z)}_createMoveManipulation(e){let t=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:this.manipulatorRadius??(e.length===1?w.radiusForSymbol(e[0].object.graphic?.symbol):ne)});this._moveManipulation=t,t.elevationInfo={mode:`absolute-height`,offset:0},t.forEachManipulator(e=>{this.addHandles(e.events.on(`immediate-click`,n=>{let r=this.objects.at(0);!t.zManipulation.hasManipulator(e)&&this.objects.length===1&&r&&this.events.emit(`immediate-click`,{...n,object:r}),n.stopPropagation()}),Y)});let n=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._showTooltip(e):this._hideTooltip()}),t.events.on(`grab-changed`,()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=c)})],Y)};this._moveManipulation.xyManipulation.forEachManipulator(n(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(n(1)),this._moveManipulation.zManipulation.forEachManipulator(n(2));let r=()=>this._updateMoveManipulation(e);for(let t of e){this.addHandles([t.object.on(`committed`,r),this._updatingHandles.add(()=>t.object.visible,r)],Y);let n=Symbol();this.addHandles(this._updatingHandles.add(()=>t.object.isDraped,r=>{this._updateMoveManipulation(e),this.removeHandles(n),r&&this.addHandles(k({view:this.view,geometry:t.object.graphic?.geometry,elevationInfo:t.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(e)}),n)},u),Y),this.addHandles(i(()=>this.removeHandles(n)),Y)}let a=e[e.length-1];this.addHandles(a.object.on(`committed`,()=>this._updateMoveManipulationAngle(a)),Y);let{object:o}=a,{operations:s}=o;if(s){let n=o.graphic;this.addHandles(t.createDragPipeline((t,n,r,i,a)=>this._buildDragEventPipeline(e,t,n,r,i,a),o.elevationInfo,s.data.spatialReference,n),Y)}this._updateMoveManipulationAngle(a)}_createVisualElements(e){if(this.enableVisualElements)for(let t of e){let n=t.object,r=C({view:this.view,object:n,forEachManipulator:e=>{t.manipulationXY?.forEachManipulator(e),this._moveManipulation?.forEachManipulator(e)},onManipulatorsChanged:()=>i()});r!=null&&(t.geometryRepresentation=r.visualElement,t.geometryRepresentation instanceof O&&this.addHandles([t.geometryRepresentation.events.on(`attachment-origin-changed`,()=>{t.object.isDraped||this._updateMoveManipulation(e)}),this._updatingHandles.add(()=>t.object.isDraped,()=>this._updateMoveManipulation(e))],Y),this.addHandles(r,Y))}}_updateMoveManipulationAngle(e){this._moveManipulation&&(this._moveManipulation.angle=_(v(e.object)))}_updateMoveManipulation(e){let t=h(0,0,0,this.view.spatialReference),n=0,r=!1,i=this._moveManipulation;if(i){for(let i of e){if(!i.object.visible)continue;this.enableZ&&b(i.object.operations,i.object.elevationInfo)&&(r=!0);let e=i.geometryRepresentation instanceof O&&!i.object.isDraped?i.geometryRepresentation.attachmentOrigin:i.object.origin;if(e!=null){let{x:r,y:i,z:a}=e;t.x+=r,t.y+=i,a&&(t.z??=0,t.z+=a),n++}}n>0?(t.x/=n,t.y/=n,t.z??=0,t.z/=n,i.location=t,i.xyManipulation.available=!0,i.xyAxisManipulation.available=!0,i.zManipulation.available=r):i.available=!1}}_buildDragEventPipeline(e,t,n,r,i,a){let o=[],s=[],c=null,l=null,u=()=>{for(let e of o)e.dragging=!1;o.length=0,s.length=0,c=null,l=null,this._updateMoveManipulatorDisplay()};if(e.length===1&&t===0){let t=e[0].object;({steps:r,cancel:i}=this._buildSnappingPipelineSteps(t,t.elevationInfo,r,i,a))}return i=i.next(e=>l?.(e)).next(()=>(s.length&&this.events.emit(`move-stop`,new q(s)),this.destroyed||u(),null)),r=r.next(t=>{if(t.action===`start`){o.length=0,s.length=0;for(let t of this._getActiveObjectInfos(e,n))o.push(t),s.push(t.object),t.dragging=!0;if(s.length!==0&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),c=A(s),l=j(s),this._emitRecordUndo(),this.events.emit(`move-start`,new G(s)),this.destroyed))return null}return s.length===0?null:t}).next(e=>c?.(e)).next(e=>(this._updateMoveTooltip(t,e),e)).next(e=>{switch(e.action){case`start`:case`update`:if(e.translationX||e.translationY||e.translationZ){let t=this.view.toScreen(e.mapStart),n=this.view.toScreen(e.mapEnd);if(!t||!n)return null;let r=n.x-t.x,i=n.y-t.y;if(this.events.emit(`move`,new K(r,i,s)),this.destroyed)return null}break;case`end`:if(this.events.emit(`move-stop`,new q(s)),this.destroyed)return null;u()}return null}),{steps:r,cancel:i}}_getActiveObjectInfos(e,t){return e.filter(e=>!e.dragging&&(e.manipulationXY?.hasManipulator(t)||!e.manipulationXY?.grabbing))}_connectTooltips(){this.removeHandles(X),this._latestTooltipInfo=null;let e;if(this._shouldShowMovePointTooltip){let t=this.objects.at(0),{events:n}=this;this._movePointTooltipInfo??=new z({viewType:this.view.type,toolOptions:this.toolOptions});let r={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),n.emit(`move-start`,new G([t]))},onMove:()=>n.emit(`move`,new K(0,0,[t])),onMoveStop:()=>n.emit(`move-stop`,new q([t])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};e=S(this.tooltip,t,()=>({toolOptions:this.toolOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:r,onRecordUndo:e=>n.emit(`record-undo`,{updates:[e]})}))}else e=this._updatingHandles.add(()=>this.toolOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,e=>{this.tooltip.info=e},d);this.addHandles(e,X)}_showTooltip(e){this._shouldShowMovePointTooltip||this._updateMoveTooltip(e)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(e,t){if(this._shouldShowMovePointTooltip||this.objects.length===0)return;let{toolOptions:n}=this;switch(e){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new B({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,(e,t)=>this._measurementWorker.autoDistance2DBetweenPoints($(e),$(t))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,async(e,n)=>s(await this._measurementWorker.autoDistance2DBetweenPoints($(e),$(n)),T(t))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new H({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,U))}this._latestTooltipInfo.toolOptions=n}async _updateMoveTooltipDistanceAsync(e,t,n){if(t!=null&&t.action!==`end`){let{mapStart:r,mapEnd:i}=t;e.distance=await n(r,i)??c}else e.distance=c}_emitRecordUndo(){let e=this.objects.toArray().map(e=>e.createUndoRecord?.()).filter(t);e.length>0&&this.events.emit(`record-undo`,{updates:e})}_buildSnappingPipelineSteps(e,t,n,r,i){let a=v(e);if(a==null||a.type!==`point`&&a.type!==`mesh`)return{steps:n,cancel:r};let o=(a.type===`point`?a:a.origin).clone(),s=new F({elevationInfo:t,pointer:i,editGeometryOperations:N.fromGeometry(o,this.view.state.viewingMode),visualizer:new g,excludeFeature:e.graphic}),c=this.snappingManager,{snappingStep:l,cancelSnapping:u}=I({snappingContext:s,snappingManager:c,updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(u),n=n.next(e=>{let t=s.coordinateHelper.pointToVector(o);return{...e,snapOrigin:t}}).next(...l),{steps:n,cancel:r}}get test(){}};e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`objects`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableVisualElements`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableZ`,void 0),e([f({constructOnly:!0})],Q.prototype,`manipulatorRadius`,void 0),e([f({constructOnly:!0,type:P})],Q.prototype,`toolOptions`,void 0),e([f({constructOnly:!0})],Q.prototype,`snappingManager`,void 0),e([f()],Q.prototype,`type`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`tooltip`,void 0),e([f()],Q.prototype,`_ownedTooltip`,void 0),e([f()],Q.prototype,`_latestTooltipInfo`,void 0),e([f()],Q.prototype,`_shouldShowMovePointTooltip`,null),e([f()],Q.prototype,`activeTooltipInfo`,null),Q=e([p(`esri.views.3d.interactive.editingTools.move.MoveTool3D`)],Q);const $=m(te);class re{constructor(e){this.object=e,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{J as HoldEvent,K as MoveEvent,G as MoveStartEvent,q as MoveStopEvent,Q as MoveTool3D};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import n from"../../../../../core/Collection.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import{makeHandle as i}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{debounce as o}from"../../../../../core/promiseUtils.js";import{scale as s,zeroMeters as c}from"../../../../../core/quantity.js";import{watch as l,initial as u,syncAndInitial as d}from"../../../../../core/reactiveUtils.js";import{property as f,subclass as p}from"../../../../../core/accessorSupport/decorators.js";import{ensureType as m}from"../../../../../core/accessorSupport/ensureType.js";import{UpdatingHandles as ee}from"../../../../../core/support/UpdatingHandles.js";import te from"../../../../../geometry/Point.js";import{makeDehydratedPoint as h}from"../../../../../layers/graphics/dehydratedPoint.js";import{SnappingVisualizer3D as g}from"../../SnappingVisualizer3D.js";import{orientation as _}from"../geometryUtils.js";import{manipulatedObjectGeometry as v,supportsElevationMode as y}from"../manipulatedObjectUtils.js";import{canMoveZOperations as b}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as x}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as S}from"../tooltipUtils3D.js";import{createVisualElements as C}from"../visualElementUtils.js";import{discRadius as ne}from"../manipulations/config.js";import{MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as T}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as E}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as D}from"./isSupportedObject.js";import{OutlineVisualElement as O}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as k}from"../../../support/elevationUpdateUtils.js";import{dragManipulatedObjectMany as A,resetManipulatedObjectMany as j}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as M}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as N}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import P from"../../../../interactive/options/InteractiveToolOptions.js";import{SnappingContext as F}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as I}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as L,enterInputModeIfAvailable as R}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as z}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as B}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as V}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as H}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{verticalSignedDistanceBetweenPoints as U}from"../../../../support/euclideanLengthMeasurementUtils.js";import{GeometryWorkerHandle as W}from"../../../../support/GeometryWorkerHandle.js";class G{constructor(e){this.objects=e,this.type=`move-start`}}class K{constructor(e,t,n){this.dx=e,this.dy=t,this.objects=n,this.type=`move`}}class q{constructor(e){this.objects=e,this.type=`move-stop`}}class J{constructor(e){this.objects=e,this.type=`hold`}}const Y=Symbol(`manipulators`),X=Symbol(`tooltips`),Z=Symbol(`move-manipulator-display`);let Q=class extends M{get _infos(){return Array.from(this._infosByType.values())}constructor(e){super(e),this._infosByType=new Map,this.events=new r,this.objects=new n,this.enableVisualElements=!0,this.enableZ=!0,this.manipulatorRadius=null,this.toolOptions=new P,this.type=`move-3d`,this._measurementWorker=new W({preloadGeodetic:!0}),this._ownedTooltip=null,this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new ee,this._moveManipulation=null,this._updateMoveTooltipDistanceDebounced=o(this._updateMoveTooltipDistanceAsync.bind(this))}initialize(){let{view:e}=this;this.tooltip??=this._ownedTooltip=L(()=>({view:e,options:this.toolOptions.tooltips})),this.addHandles(this._updatingHandles.addOnCollectionChange(()=>this.objects,e=>{e.removed.forEach(e=>this.removeHandles(e)),this._updateObjectInfos(e),this._setupObjectUpdateHandles(e.added),this._refreshManipulators(),this._connectTooltips()}));let t=this.objects.toArray();this._updateObjectInfos({added:t,removed:[]}),this._setupObjectUpdateHandles(t),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this._ownedTooltip=a(this._ownedTooltip),this._moveManipulation=a(this._moveManipulation),this._set(`view`,null),this._updatingHandles.destroy(),this._measurementWorker.destroy()}onInputEvent(e){if(this.destroyed||R(e,this.tooltip))return;let t=this.firstGrabbedManipulator;if(e.type===`hold`&&t!=null){let e=this._getActiveObjectInfos(this._infos,t).map(({object:e})=>e);this.events.emit(`hold`,new J(e))}return super.onInputEvent(e)}get updating(){return this._updatingHandles.updating||!!this.snappingManager?.updating}get _shouldShowMovePointTooltip(){let{objects:e}=this;if(e.length!==1)return!1;let t=v(e.at(0))?.type;return t===`point`||t===`mesh`}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:e,removed:t}){for(let t of e){if(D(t)!==0)continue;let e=new re(t);this._infosByType.set(t,e)}for(let e of t)this._infosByType.delete(e)}_setupObjectUpdateHandles(e){for(let t of e){let e=this._infosByType.get(t);this.addHandles(x(e.object),t),y(t)&&this.addHandles(l(()=>{let{mode:e,unit:n,offset:r}=t.elevationInfo;return[e,n,r]},()=>this._refreshManipulators()),t)}}_refreshManipulators(){if(this.removeHandles(Y),this.removeHandles(Z),this._moveManipulation=a(this._moveManipulation),this.manipulators.removeAll(),this._infosByType.size===0)return;let e=this._infos;this._createManipulators(e),this._createVisualElements(e),this._updateMoveManipulation(e)}_createManipulators(e){for(let t of e){let n=t.object;t.manipulationXY=new E({tool:this,view:this.view,object:n}),t.manipulationXY.forEachManipulator(e=>{this.addHandles([e.events.on(`immediate-click`,e=>{this.events.emit(`immediate-click`,{...e,object:n}),e.stopPropagation()}),e.events.on(`grab-changed`,({action:e})=>{e===`start`?this._showTooltip(0):this._hideTooltip(),this._updateMoveManipulatorDisplay()})],Y)}),this.addHandles(t.manipulationXY.createDragPipeline((t,n,r,i)=>this._buildDragEventPipeline(e,0,t,n,r,i)),Y)}this._createMoveManipulation(e)}_updateMoveManipulatorDisplay(){let e=this._infos.some(e=>e.manipulationXY?.grabbing);this._moveManipulation&&(this._moveManipulation.interactive=!e),this.removeHandles(Z),e&&this._moveManipulation&&this.addHandles(this._moveManipulation.hideManipulators(),Z)}_createMoveManipulation(e){let t=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:this.manipulatorRadius??(e.length===1?w.radiusForSymbol(e[0].object.graphic?.symbol):ne)});this._moveManipulation=t,t.elevationInfo={mode:`absolute-height`,offset:0},t.forEachManipulator(e=>{this.addHandles(e.events.on(`immediate-click`,n=>{let r=this.objects.at(0);!t.zManipulation.hasManipulator(e)&&this.objects.length===1&&r&&this.events.emit(`immediate-click`,{...n,object:r}),n.stopPropagation()}),Y)});let n=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._showTooltip(e):this._hideTooltip()}),t.events.on(`grab-changed`,()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=c)})],Y)};this._moveManipulation.xyManipulation.forEachManipulator(n(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(n(1)),this._moveManipulation.zManipulation.forEachManipulator(n(2));let r=()=>this._updateMoveManipulation(e);for(let t of e){this.addHandles([t.object.on(`committed`,r),this._updatingHandles.add(()=>t.object.visible,r)],Y);let n=Symbol();this.addHandles(this._updatingHandles.add(()=>t.object.isDraped,r=>{this._updateMoveManipulation(e),this.removeHandles(n),r&&this.addHandles(k({view:this.view,geometry:()=>t.object.graphic?.geometry,elevationInfo:t.object.elevationInfo,onElevationChanges:()=>this._updateMoveManipulation(e)}),n)},u),Y),this.addHandles(i(()=>this.removeHandles(n)),Y)}let a=e[e.length-1];this.addHandles(a.object.on(`committed`,()=>this._updateMoveManipulationAngle(a)),Y);let{object:o}=a,{operations:s}=o;if(s){let n=o.graphic;this.addHandles(t.createDragPipeline((t,n,r,i,a)=>this._buildDragEventPipeline(e,t,n,r,i,a),o.elevationInfo,s.data.spatialReference,n),Y)}this._updateMoveManipulationAngle(a)}_createVisualElements(e){if(this.enableVisualElements)for(let t of e){let n=t.object,r=C({view:this.view,object:n,forEachManipulator:e=>{t.manipulationXY?.forEachManipulator(e),this._moveManipulation?.forEachManipulator(e)},onManipulatorsChanged:()=>i()});r!=null&&(t.geometryRepresentation=r.visualElement,t.geometryRepresentation instanceof O&&this.addHandles([t.geometryRepresentation.events.on(`attachment-origin-changed`,()=>{t.object.isDraped||this._updateMoveManipulation(e)}),this._updatingHandles.add(()=>t.object.isDraped,()=>this._updateMoveManipulation(e))],Y),this.addHandles(r,Y))}}_updateMoveManipulationAngle(e){this._moveManipulation&&(this._moveManipulation.angle=_(v(e.object)))}_updateMoveManipulation(e){let t=h(0,0,0,this.view.spatialReference),n=0,r=!1,i=this._moveManipulation;if(i){for(let i of e){if(!i.object.visible)continue;this.enableZ&&b(i.object.operations,i.object.elevationInfo)&&(r=!0);let e=i.geometryRepresentation instanceof O&&!i.object.isDraped?i.geometryRepresentation.attachmentOrigin:i.object.origin;if(e!=null){let{x:r,y:i,z:a}=e;t.x+=r,t.y+=i,a&&(t.z??=0,t.z+=a),n++}}n>0?(t.x/=n,t.y/=n,t.z??=0,t.z/=n,i.location=t,i.xyManipulation.available=!0,i.xyAxisManipulation.available=!0,i.zManipulation.available=r):i.available=!1}}_buildDragEventPipeline(e,t,n,r,i,a){let o=[],s=[],c=null,l=null,u=()=>{for(let e of o)e.dragging=!1;o.length=0,s.length=0,c=null,l=null,this._updateMoveManipulatorDisplay()};if(e.length===1&&t===0){let t=e[0].object;({steps:r,cancel:i}=this._buildSnappingPipelineSteps(t,t.elevationInfo,r,i,a))}return i=i.next(e=>l?.(e)).next(()=>(s.length&&this.events.emit(`move-stop`,new q(s)),this.destroyed||u(),null)),r=r.next(t=>{if(t.action===`start`){o.length=0,s.length=0;for(let t of this._getActiveObjectInfos(e,n))o.push(t),s.push(t.object),t.dragging=!0;if(s.length!==0&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),c=A(s),l=j(s),this._emitRecordUndo(),this.events.emit(`move-start`,new G(s)),this.destroyed))return null}return s.length===0?null:t}).next(e=>c?.(e)).next(e=>(this._updateMoveTooltip(t,e),e)).next(e=>{switch(e.action){case`start`:case`update`:if(e.translationX||e.translationY||e.translationZ){let t=this.view.toScreen(e.mapStart),n=this.view.toScreen(e.mapEnd);if(!t||!n)return null;let r=n.x-t.x,i=n.y-t.y;if(this.events.emit(`move`,new K(r,i,s)),this.destroyed)return null}break;case`end`:if(this.events.emit(`move-stop`,new q(s)),this.destroyed)return null;u()}return null}),{steps:r,cancel:i}}_getActiveObjectInfos(e,t){return e.filter(e=>!e.dragging&&(e.manipulationXY?.hasManipulator(t)||!e.manipulationXY?.grabbing))}_connectTooltips(){this.removeHandles(X),this._latestTooltipInfo=null;let e;if(this._shouldShowMovePointTooltip){let t=this.objects.at(0),{events:n}=this;this._movePointTooltipInfo??=new z({viewType:this.view.type,toolOptions:this.toolOptions});let r={onBeforeUpdate:()=>this.endDrag(),onMoveStart:()=>{this._emitRecordUndo(),n.emit(`move-start`,new G([t]))},onMove:()=>n.emit(`move`,new K(0,0,[t])),onMoveStop:()=>n.emit(`move-stop`,new q([t])),onRotateStart:()=>{},onRotate:()=>{},onRotateStop:()=>{},onScaleStart:()=>{},onScale:()=>{},onScaleStop:()=>{}};e=S(this.tooltip,t,()=>({toolOptions:this.toolOptions,activeTooltipInfo:this._movePointTooltipInfo,callbacks:r,onRecordUndo:e=>n.emit(`record-undo`,{updates:[e]})}))}else e=this._updatingHandles.add(()=>this.toolOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null,e=>{this.tooltip.info=e},d);this.addHandles(e,X)}_showTooltip(e){this._shouldShowMovePointTooltip||this._updateMoveTooltip(e)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(e,t){if(this._shouldShowMovePointTooltip||this.objects.length===0)return;let{toolOptions:n}=this;switch(e){case 0:this._latestTooltipInfo=this._translateTooltipInfo??=new B({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,(e,t)=>this._measurementWorker.autoDistance2DBetweenPoints($(e),$(t))));break;case 1:this._latestTooltipInfo=this._translateXYTooltipInfo??=new V({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,async(e,n)=>s(await this._measurementWorker.autoDistance2DBetweenPoints($(e),$(n)),T(t))));break;case 2:this._latestTooltipInfo=this._translateZTooltipInfo??=new H({toolOptions:n}),this._updatingHandles.consumePromise(this._updateMoveTooltipDistanceDebounced(this._latestTooltipInfo,t,U))}this._latestTooltipInfo.toolOptions=n}async _updateMoveTooltipDistanceAsync(e,t,n){if(t!=null&&t.action!==`end`){let{mapStart:r,mapEnd:i}=t;e.distance=await n(r,i)??c}else e.distance=c}_emitRecordUndo(){let e=this.objects.toArray().map(e=>e.createUndoRecord?.()).filter(t);e.length>0&&this.events.emit(`record-undo`,{updates:e})}_buildSnappingPipelineSteps(e,t,n,r,i){let a=v(e);if(a==null||a.type!==`point`&&a.type!==`mesh`)return{steps:n,cancel:r};let o=(a.type===`point`?a:a.origin).clone(),s=new F({elevationInfo:t,pointer:i,editGeometryOperations:N.fromGeometry(o,this.view.state.viewingMode),visualizer:new g,excludeFeature:e.graphic}),c=this.snappingManager,{snappingStep:l,cancelSnapping:u}=I({snappingContext:s,snappingManager:c,updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(u),n=n.next(e=>{let t=s.coordinateHelper.pointToVector(o);return{...e,snapOrigin:t}}).next(...l),{steps:n,cancel:r}}get test(){}};e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`objects`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableVisualElements`,void 0),e([f({constructOnly:!0,nonNullable:!0})],Q.prototype,`enableZ`,void 0),e([f({constructOnly:!0})],Q.prototype,`manipulatorRadius`,void 0),e([f({constructOnly:!0,type:P})],Q.prototype,`toolOptions`,void 0),e([f({constructOnly:!0})],Q.prototype,`snappingManager`,void 0),e([f()],Q.prototype,`type`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`tooltip`,void 0),e([f()],Q.prototype,`_ownedTooltip`,void 0),e([f()],Q.prototype,`_latestTooltipInfo`,void 0),e([f()],Q.prototype,`_shouldShowMovePointTooltip`,null),e([f()],Q.prototype,`activeTooltipInfo`,null),Q=e([p(`esri.views.3d.interactive.editingTools.move.MoveTool3D`)],Q);const $=m(te);class re{constructor(e){this.object=e,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}export{J as HoldEvent,K as MoveEvent,G as MoveStartEvent,q as MoveStopEvent,Q as MoveTool3D};
|