@arcgis/core 5.2.0-next.161 → 5.2.0-next.162
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0a5a9885ee6f5b5f99f0.js → 167b057ad50e6aef54de.js} +1 -1
- package/assets/esri/core/workers/chunks/17c6d66b47aa690df0d4.js +1 -0
- package/assets/esri/core/workers/chunks/{8480fe6b4372dbbfa7cc.js → 46c5371c7a627537098c.js} +10 -10
- package/assets/esri/core/workers/chunks/{60737732ce495bbdd0fc.js → 5f4feca26102088ea565.js} +1 -1
- package/assets/esri/core/workers/chunks/6da7229433105a69eb3f.js +1 -0
- package/assets/esri/core/workers/chunks/849879c8aed16315194c.js +1 -0
- package/assets/esri/core/workers/chunks/{9401cc22373566e1171e.js → 8a7b02037151767542f1.js} +1 -1
- package/assets/esri/core/workers/chunks/{4ed76fb5f6096a089f5b.js → 8e4a7027d171fb60e51e.js} +1 -1
- package/assets/esri/core/workers/chunks/{32b351b047ce1eb58146.js → 9ce8b9b80da146a5bbf5.js} +1 -1
- package/assets/esri/core/workers/chunks/a6f969851d4278865cc5.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/{172cfeb5f415e4662432.js → d7429b58c90e015263ad.js} +1 -1
- package/assets/esri/core/workers/chunks/{612104dff305ff062dfa.js → dfc81e66196c402f39b4.js} +2 -2
- 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.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +7 -5
- package/layers/FeatureLayer.js +1 -1
- package/layers/MapImageLayer.d.ts +9 -3
- package/layers/MapNotesLayer.d.ts +2 -2
- package/layers/SubtypeGroupLayer.d.ts +1 -1
- package/layers/SubtypeGroupLayer.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/Sublayer.d.ts +29 -15
- package/layers/support/Sublayer.js +1 -1
- 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 +45 -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/symbols/LineSymbol3D.d.ts +5 -3
- 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/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/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/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechniqueConfiguration.js +1 -1
- package/views/BreakpointsOwner.d.ts +6 -0
- package/views/analysis/ElevationProfile/ElevationProfileTool.js +1 -1
- package/views/types.d.ts +3 -0
- package/views/webgl/ShaderBuilder.js +1 -1
- package/assets/esri/core/workers/chunks/3e3e076fa5e8d5d5f33f.js +0 -1
- package/assets/esri/core/workers/chunks/510502a4c9a2ba8d3f7b.js +0 -1
- package/assets/esri/core/workers/chunks/e8bf653376a607f00897.js +0 -1
- package/assets/esri/core/workers/chunks/f4a7aa3cdbc0c429c359.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{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};
|
|
@@ -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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n}from"../../../../../core/arrayUtils.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a,handlesGroup as o,destroyHandle as s}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as c,removeMaybe as l}from"../../../../../core/maybe.js";import{initial as u,on as d,watch as f,syncAndInitial as p,when as m,sync as h}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as y,subtract as b,lerp as x,set as ee,add as te,scale as ne}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,create as ie}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ae}from"../../../../../core/support/UpdatingHandles.js";import oe from"../../../../../geometry/Point.js";import se from"../../../../../geometry/Polyline.js";import{projectPoint as ce}from"../../../../../geometry/projectionUtils.js";import le from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as ue}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as de}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as fe}from"../../../../../symbols/support/utils.js";import{Manipulator3D as S}from"../../Manipulator3D.js";import{createManipulatorMaterials as C,createSphereGeometryAsOffsets as w,placeAtObject as pe,screenSizeManipulatorSettings as me}from"../../manipulatorUtils.js";import{RenderObject as T}from"../../RenderObject.js";import{SegmentLabels3D as he}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as ge}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as E,screenToRenderPlaneFromEvent as _e,convertToMapCoordinates as ve}from"../dragEventPipeline3D.js";import{orientation as ye}from"../geometryUtils.js";import{canMoveZOperations as D}from"../manipulatorUtils.js";import{Settings as be}from"../settings.js";import{createVisualElements as xe}from"../visualElementUtils.js";import{discRadiusSmall as Se}from"../manipulations/config.js";import{MoveManipulation as O}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Ce}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as k,createEdgeOffsetIntersectionPlane as A,createEdgeOffsetOperation as j,edgeOffsetRotationMatrix as we,screenEdgeLengthSquared as Te,getDistanceInGeometrySR as Ee}from"./edgeOffsetUtils.js";import{createTooltipInfos as De,connectTooltipToManipulatedObject as Oe,getUpdatedTranslateObjectTooltipInfo as ke,getUpdatedEdgeOffsetTooltipInfo as M}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as N}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as Ae}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as P}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as F}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as I,addMapDelta as L,createManipulatorDragEventPipeline as R,dragAtLocation as z,addScreenDelta as je}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as Me}from"../../../../interactive/keybindings.js";import{SnappingContext as B}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as V}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Ne,enterInputModeIfAvailable as H}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Pe}from"../../../../support/GeometryWorkerHandle.js";const U=Symbol(),W=Symbol(),Fe=Symbol(),G=Symbol();let K=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(G)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new i,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new ae,this._recreatingManipulators=!1,this._settings=new be({getTheme:()=>this.view.effectiveTheme}),this.events=new r,this.activeTooltipInfo=null,this._measurementWorker=new Pe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit(`reshape`,{type:`reshape`,object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit(`move`,{type:`move`,object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){let{view:e}=this,t=this._settings.manipulators,n=t.vertex;this.tooltipInfos=De(this._toolOptions,e),this._vertexManipulatorMaterials=C({color:n.color.toUnitRGBA(),outlineColor:n.outlineColor.toUnitRGBA(),focusedOutlineColor:n.focusedOutlineColor.toUnitRGBA(),screenSize:n,renderOccluded:n.renderOccluded});let r=t.edge;this._edgeManipulatorMaterials=C({color:r.color.toUnitRGBA(),outlineColor:r.outlineColor.toUnitRGBA(),screenSize:r,renderOccluded:r.renderOccluded});let i=t.edgeOffset;this._edgeOffsetManipulatorMaterials=C({color:i.color.toUnitRGBA(),focusedColor:i.focusedColor.toUnitRGBA(),renderOccluded:i.renderOccluded,shaded:!1});let a=t.selected;this._selectedManipulatorMaterials=C({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),focusedOutlineColor:a.focusedOutlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded}),this.tooltip=Ne(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{let e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:n,selectedSettings:r})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),n.applyColor(this._edgeOffsetManipulatorMaterials.material),n.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),r.applyColor(this._selectedManipulatorMaterials.material),r.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),r.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(let t of this._manipulatorInfos)t.manipulator.available=e,Y(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:n})=>{e!=null&&(e.visible=t,e.edgeDistance=n?`far`:`default`)},u),Oe(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{t===`input`&&e!==`input`&&this._resetTooltip()}),d(()=>this._operations,`vertex-update`,e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,`change`,e=>{(e.operation===`undo`||e.operation===`redo`)&&this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=c(this._segmentLabels),this.tooltip=c(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return e.type!==`key-down`||e.key!==Me.enterInputMode?!1:this.activeTooltipInfo?.type===`reshape-edge-offset`?this._enterInputModeDuringEdgeOffset(e):H(e,this.tooltip)?(this.tool.endDrag(),!0):!1}removeSelectedVertices(){let e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type===`vertex`);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit(`manipulators-changed`)}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(W),this.removeHandles(G),this._moveManipulation=c(this._moveManipulation),this._objectMoveManipulation=c(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(this._operations==null)return;let t=this.object.elevationInfo;for(let{vertices:n,segments:r,index:i}of this._operations.data.parts){let a=e?.byPartIndex.get(i);for(let e of n){let n=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,n)}for(let e of r)e.type===`line`&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit(`undo`),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),(!this._operations||this._segmentLabels?.context?.editGeometryOperations!==this._operations)&&(this._segmentLabels=c(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){let e=this._toolOptions.labels;this._segmentLabels=new he({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if(t.action===`end`)return t;let n=0,r=[],i=e===1&&this._someVerticesSelected;for(let e of this._manipulatorInfos)e.type===`vertex`&&(!e.manipulator.grabbing&&(!i||e.manipulator.selected)&&r.push(e),n++);if(r.length===n){if(i||this._hideReshapeControls(),this._moveVertices(r,t),this._updateEventState(1),this.destroyed)return t;this.events.emit(`move`,{type:`move`,dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(r,t),this._updateEventState(2),this.destroyed)return t;this.events.emit(`reshape`,{type:`reshape`,object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),a(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],G)}_showReshapeControls(){this.removeHandles(G)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){let t=this._manipulatorInfos.filter(Y).find(t=>t.manipulator===e||t.edgeManipulator===e);t!=null&&(this.removeHandles(W),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],W))}_hideReshapeManipulators(e){return o(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Y(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(U):this.tool.manipulators.forEach(({manipulator:e})=>{let t=e.disableDisplay?.();t&&this.addHandles(t,U)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>t.type===`vertex`&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;let{mapDeltaX:t,mapDeltaY:n,mapDeltaZ:r}=e;if(!t&&!n&&!r)return;let i=[];this._forEachVertex(t=>{let{selected:n,grabbing:r}=t.manipulator;(n&&!r||t===e.info)&&i.push(t)}),this._moveVertices(i,e,1),this.events.emit(`reshape`,{type:`reshape`,object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(this._numGrabbing!==0||this._numDragging!==0))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object}),this.destroyed||this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit(`reshape`,{type:`reshape-start`,object:this.object});break;case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit(`reshape`,{type:`reshape-start`,object:this.object})}}if(this.destroyed)return!1;let n=this._reshapeEventState!==e;return this._reshapeEventState=e,n}_createObjectMoveManipulation(){let{tool:e,view:t,object:n,_operations:r}=this;if(r){if(this._objectMoveManipulation=new Ce({tool:e,view:t,object:n}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,n,i)=>{n.next(e=>this._trackNumDragging(e)).next(t=>(t.action===`start`&&(e=r.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{t.action===`end`&&(this._showReshapeControls(),this._resetTooltip(),e=l(e))}),i.next(()=>this._onDragCancel(!0,()=>e=l(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on(`immediate-click`,e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){let{object:t,tool:n,view:r,_operations:i}=this;if(!i)return;this._moveManipulation=new O({tool:n,view:r,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&D(t.operations,t.elevationInfo),snapToScene:!1,radius:O.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on(`immediate-click`,t=>{!this._moveManipulation.zManipulation.hasManipulator(e)&&!this._manipulatorInfos.some(e=>e.manipulator.selected)&&this.events.emit(`immediate-click`,{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));let a=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(a(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(a(1)),this._moveManipulation.zManipulation.forEachManipulator(a(2)),this._moveManipulation.elevationInfo={mode:`absolute-height`,offset:0};let o=i.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((r,a,o,s,c)=>{let{snappingStep:l,cancelSnapping:u}=V({predicate:e=>!!e.info,snappingManager:n.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:e,pointer:c,excludeFeature:t.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next(e=>(this._onDragCancel(),e)).next(u),o=o.next(e=>this._trackNumDragging(e)).next(e=>{let t=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.manipulatorType===1&&t.length===1?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(I(this.view,e,t.graphic??void 0)).next(...l).next(L()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(e.action===`end`&&this._showReshapeControls(),this._updateTranslateTooltip(r,e),e)),{steps:o,cancel:s}},e,o,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on(`committed`,()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Fe),e&&this.addHandles(Ae({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Fe)},u)])}_createVisualElements(){let{object:e,view:t}=this,n=xe({view:t,object:e,forEachManipulator:e=>{if(!(this.destroyed||this._recreatingManipulators)){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(let t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on(`manipulators-changed`,e)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof N?n.visualElement:null);let r=this._outlineVisualElement;if(r!=null){let t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>r.events,`attachment-origin-changed`,t,{onListenerAdd:t}))}this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){let n=this.view,r=this._operations;if(e.part.vertices.length<=2||!r)return null;let i=r.data.spatialReference,a=this._settings.manipulators.edgeOffset,s=a.size/2,c=s+a.collisionPadding,l=s/c,u=l/2,d=l*Math.sqrt(3)/2,{height:f,offset:p}=a,{material:m,focusedMaterial:h}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){let e=P(m,d,u,u,f,p);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){let e=P(m,-d,u,u,f,-p);this._edgeOffsetManipulatorGeometryOutside=e}let g=[new T(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryInside.instantiate({material:h}),2),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:h}),2)],_=new S({view:n,renderObjects:g,elevationInfo:t.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?t:{mode:`absolute-height`,offset:0},worldOriented:!1,focusMultiplier:1,radius:c,available:this.object.visible,collisionType:{type:`disc`,direction:re(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:J(i)}),v=new S({view:n,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?`move`:`default`,metadata:{deleting:!1},location:J(i)}),y={manipulator:_,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(y,a.minSquaredEdgeLength);let b=()=>this._updateEdgeOffsetManipulator(y);b(),y.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>this._getManipulatorInfoFromHandle(e)?.manipulator.events.on(`location-update`,b)));let x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([y.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),R(_,this._createEdgeOffsetPipeline(y,t,r)),R(v,this._createEdgePipeline(y,t,r)),v.events.on(`immediate-click`,x),_.events.on(`immediate-click`,x),_.events.on(`focus-changed`,()=>this._resetTooltip()),_.events.on(`grab-changed`,({screenPoint:e,action:t})=>{y.grabMapPoint=t===`start`?k(e,this.view,this.object,y):null})],_),this._manipulatorInfos.push(y),this.manipulators.addMany([_,v]),this.events.emit(`manipulators-changed`),y}_autoHideEdgeOffsetManipulator(e,t){let n=e.manipulator,r=e.edgeManipulator,i=()=>{e.visibilityHandle=l(e.visibilityHandle);let i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),c=i!=null&&s!=null&&Te(i.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!n.focused&&!r.focused||c)&&(n.grabbable=!c,r.grabbable=!c,e.visibilityHandle=o([n.disableDisplay(),a(()=>{n.grabbable=!0,r.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([n.events.on(`focus-changed`,i),r.events.on(`focus-changed`,i),a(()=>{l(e.visibilityHandle),r.metadata.deleting=!0,this.manipulators.remove(r)})],n),i()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);let{coordinateHelper:t}=this._operations.data,n=A(this.view,e.manipulator.elevationAlignedLocation,j(t,e.handle,e.manipulator.elevationInfo)),r=this._getManipulatorInfoFromHandle(e.handle.leftVertex),i=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(r==null||i==null)return;let a=r.manipulator.renderLocation,o=i.manipulator.renderLocation,s=n==null?v:we(n,a,o);e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;let c=y(b(Z,a,o))/2;e.edgeManipulator.collisionType={type:`line`,paths:[[[-c,0,0],[c,0,0]]]}}_createEdgePipeline(e,t,n){return(r,i,a,o)=>{if(o===`touch`)this._createEdgeOffsetPipeline(e,t,n)(r,i,a);else if(this.enableMoveObject){let e=this.object.graphic,o=n.data.spatialReference,{elevationAlignedLocation:s}=r;i.next(e=>this._trackNumDragging(e)).next(z(this.view,s)).next(E(this.view,s,t,o,e)).next(je()).next(L()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{e.action===`end`&&(this._showReshapeControls(),this._resetTooltip())}),a.next(()=>this._onDragCancel(!r.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,n){return(r,i,a)=>{let o=this._pendingEdgeOffsetInfo;if(o?.manipulatorInfo===e&&o.mode!==`drag`){a.execute({action:`cancel`});return}this._clearSelection();let{initializeStep:s,cleanup:c}=this._initializeEdgeOffset(e,t,n,a),l=this._applyEdgeOffsetStep(e);i.next(e=>this._trackNumDragging(e)).next(z(this.view,r.elevationAlignedLocation)).next(s).next(_e(this.view)).next(ve(this.view,n.data.spatialReference)).next(L()).next(Ie()).next(e=>this._pendingEdgeOffsetInfo?e:l(e)).next(e=>{e.action===`end`&&!this._pendingEdgeOffsetInfo&&c()}),a.next(()=>{this._exitEdgeOffsetInputMode(),r.metadata.deleting||(c(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,n,r){let{view:i,object:a}=this,s=j(n.data.coordinateHelper,e.handle,t),c=n.createUndoGroup(),u=A(i,e.manipulator.elevationAlignedLocation,s);this._splitEdgesBeforeEdgeOffset(e,s),this._selectEdgeOffsetArrow(e,s);let d,f=()=>{this._cleanEdgeOffsetCollapsedEdges(e,n),d=l(d)},p=this.events.on(`undo`,f);return d=o([this._initializeEdgeOffsetVisualElement(e,a,t,n),c,p,this._connectEdgeOffsetTooltip(e,s,n,()=>{r.execute({action:`cancel`})})]),{initializeStep:e=>s==null||u==null?(f(),null):{...e,operation:s,plane:u},cleanup:f}}_initializeEdgeOffsetVisualElement(e,t,n,r){let i=()=>new se({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:r.data.spatialReference}),a=new N({view:this.view,isDraped:t.isDraped,geometry:i(),elevationInfo:n,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),c=o([f(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{a.color=e.toUnitRGBA(),a.isDraped=t},p),t.on(`committed`,()=>{a.geometry=i()}),s(a)]);return a.attached=!0,c}_applyEdgeOffsetStep(e){return t=>this.destroyed||t.operation==null||!this._operations?t:(this._updateEventState(2),t.signedDistance==null?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit(`reshape`,{type:`reshape`,object:this.object})),this._updateEdgeOffsetTooltip(t)),t)}_cleanEdgeOffsetCollapsedEdges(e,t){let n=e.handle.leftVertex.leftSegment?.leftVertex,r=e.handle.leftVertex,i=e.handle.rightVertex.rightSegment?.rightVertex,a=e.handle.rightVertex,o=t.data.coordinateHelper,s=this.view.pixelSizeAt(o.vectorToDehydratedPoint(r.pos),o.spatialReference),c=[];if(n&&o.distance(n.pos,r.pos)<Le){let e=this._getManipulatorInfoFromHandle(r);e!=null&&c.push(e)}if(o.distance(r.pos,a.pos)<s||i&&o.distance(i.pos,a.pos)<Le){let e=this._getManipulatorInfoFromHandle(a);e!=null&&c.push(e)}c.length&&this._removeVertices(c)}_enterInputModeDuringEdgeOffset(e){let t=this._findActiveEdgeOffsetManipulatorInfo();return t&&H(e,this.tooltip)?t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`drag`},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`hover`},this._connectEdgeOffsetTooltipOnHover(t),!0):!1}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Y).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){let{_operations:t,object:n}=this;if(!t)return;let{elevationInfo:r}=n,i=j(t.data.coordinateHelper,e.handle,r);this._selectEdgeOffsetArrow(e,i),this.addHandles([this._initializeEdgeOffsetVisualElement(e,n,r,t),this._connectEdgeOffsetTooltip(e,i,t,()=>{this.removeHandles(i),this._exitEdgeOffsetInputMode()})],i)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){let t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);t!=null&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){let t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);t!=null&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){let n=e.grabMapPoint??k(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);n&&t.selectArrowFromStartPoint(n)}_connectEdgeOffsetTooltip(e,t,n,r){let i=()=>this.tooltipInfos.edgeOffset.distance.actual,a=i=>{r(),queueMicrotask(()=>{this.view.focus();let r=n.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,Ee(i,e.manipulator.location,t,n)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,n),r.remove()})},s=()=>{let e=i();e==null?r():a(e)};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>s(),h),this.tooltip.on(`discard`,r),this.tooltip.on(`commit`,e=>{e.type===`commit-and-exit`&&s()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,n=!1){let r=this.view,i=this._operations;if(!i)return null;let a=i.data.type,s=i.data.spatialReference;if(e.type===`line`){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(this._vertexManipulatorGeometry==null||this._vertexManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=w(e),this._vertexManipulatorOutlineGeometry=w(t)}if(this._edgeManipulatorGeometry==null||this._edgeManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=w(e),this._edgeManipulatorOutlineGeometry=w(t)}let c=this._vertexManipulatorGeometry,u=this._vertexManipulatorOutlineGeometry,d=[];if(a!==`point`&&a!==`mesh`){d.push(new T(c.instantiate(),Q|4),new T(u.instantiate(),Q|5),new T(u.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),Q|6));{let{material:e,outlineMaterial:t,focusedMaterial:n}=this._selectedManipulatorMaterials;d.push(new T(c.instantiate({material:e}),8),new T(u.instantiate({material:t}),9),new T(u.instantiate({material:n}),10))}}if(this.enableMidpoints){let{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,n=this._edgeManipulatorGeometry,r=this._edgeManipulatorOutlineGeometry,i=$|6,a=$|5;d.push(new T(n.instantiate({material:e}),i),new T(r.instantiate({material:t}),i),new T(n.instantiate(),a),new T(r.instantiate(),a))}let f=e.type===`vertex`,p=new S({view:r,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:a===`point`||a===`mesh`,available:this.object.visible,metadata:{deleting:!1},location:J(s),...me});p.selected=n,this._setTypeSpecificManipulatorSettings(p,e,t);let m=f?{manipulator:p,handle:e,type:`vertex`,selectedIndex:0}:{manipulator:p,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(p),this._updateManipulatorPosition(m),m.type===`edge`){let e=[];for(let t of[m.handle.leftVertex,m.handle.rightVertex]){let n=this._getManipulatorInfoFromHandle(t);n!=null&&e.push(n.manipulator.events.on(`location-update`,()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=o(e),this._manipulatorHandles.add(m.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);let h=R(p,(e,n,a,o)=>{let c=null,{snappingStep:u,cancelSnapping:d}=V({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:t,pointer:o,excludeFeature:this.object.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});a.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>c=l(c)),t)).next(d);let{elevationAlignedLocation:f}=e,p=this.object.graphic??void 0,h=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,i,p):E(r,f,t,s,p);n.next(e=>this._trackNumDragging(e)).next(e=>{if(e.action===`start`&&i&&(c=i.createUndoGroup()),m.type===`edge`){let t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(z(r,f)).next(h).next(I(r,t,p)).next(...u).next(L()).next(e=>{this._perVertexManipulatorDragAction(e),e.action===`end`&&(c=l(c)),this._resetTooltip()})});return this._manipulatorHandles.add([h,p.events.on(`immediate-click`,e=>this._manipulatorClickCallback(e,m)),p.events.on(`select-changed`,()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),p.events.on(`focus-changed`,()=>{this._resetTooltip()})],p),this.events.emit(`manipulators-changed`),m}_screenToSceneMapForVertexDrag(e,t,n){let{view:r}=this,{coordinateHelper:i,spatialReference:a}=t.data,o=null;return t=>{if(t.action===`start`&&(o=i.vectorToPoint(t.snapOrigin)),o==null)return null;let s=r.toMap(t.screenEnd,{exclude:n,excludeLabels:!0});return s==null||(s.z=de(s,r,e),!ce(s,s,a))?null:{...t,mapStart:o,mapEnd:s}}}_trackNumDragging(e){switch(e.action){case`start`:this._numDragging++;break;case`end`:this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit(`move`,{type:`move`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape`,object:this.object})}t?.(),!this.destroyed&&this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,n){let r=this._settings;switch(t.type){case`vertex`:{e.selectable=!0,e.cursor=`move`,e.collisionPriority=2,e.elevationInfo=n;let t=this._operations?.data.type;e.interactive=t!=null&&t!==`point`&&t!==`mesh`;let{size:i,collisionPadding:a}=r.manipulators.vertex;e.radius=i/2+a,e.state=Q;break}case`line`:{e.state=$,e.selectable=!1,e.cursor=`copy`,e.collisionPriority=2;let{size:t,collisionPadding:i}=r.manipulators.edge;e.radius=t/2+i,e.elevationInfo=n.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?n:{mode:`absolute-height`,offset:0};break}}}_watchAndUpdateGrabState(e,t){return e.events.on(`grab-changed`,n=>{this._onGrabStateChanged(e,t,n.action,n.pointerType)})}_onGrabStateChanged(e,t,n,r=`mouse`){if(!this._recreatingManipulators){if(n===`start`)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(W),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(r!==`touch`||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{let{manipulator:t}=e,n=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&n!=null&&n!==`point`&&n!==`mesh`,Y(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(let e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit(`manipulators-changed`))}_removeManipulator(e){e!=null&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),n(this._manipulatorInfos,e),this.events.emit(`manipulators-changed`),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(let t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){let t=this._operations;if(e!=null&&t){if(e.type===`vertex`)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,X),e.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if(e.type===`edge`){let n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(n==null||r==null)return;let i=n.manipulator,a=r.manipulator;if(e.manipulator.elevationInfo?.mode===`on-the-ground`){let n=i.location,r=a.location,o=.5,s=n.x+o*(r.x-n.x),c=n.y+o*(r.y-n.y),l=n.hasZ&&r.hasZ?0:void 0;e.manipulator.location=ue(s,c,l,t.data.spatialReference)}else x(Z,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=Z}}}_splitEdgeManipulator(e,t=.5){let n=this._operations,r=n.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=l(e.locationUpdateHandle);let i=this.object.elevationInfo,a;this.enableEdgeOffset?(this._removeManipulator(e),a=this._createVertexOrEdgeManipulator(r)):(a=e,a.handle=r,a.type=`vertex`,this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,i)),r.leftSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.leftSegment),r.rightSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.rightSegment),this._updateManipulatorPosition(a),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);let o=this._updateEventState(2),s=n.data.coordinateHelper.vectorToArray(a.handle.pos),c=n.data.parts.indexOf(r.part);return this.events.emit(`vertex-add`,{type:`vertex-add`,object:this.object,vertices:[{coordinates:s,componentIndex:c,vertexIndex:r.index}],added:s}),o&&this._updateEventState(0),a}_updateMoveManipulationPosition(){let e=ee(Z,0,0,0),t=0,n=!1,r=null,i=null;for(let a of this._manipulatorInfos)if(a.type===`vertex`){if(!a.manipulator.selected){n=!0;continue}t++,te(e,e,a.manipulator.renderLocation),r==null||a.selectedIndex>r.selectedIndex?(i=r,r=a):(i==null||a.selectedIndex>i.selectedIndex)&&(i=a)}let a=this.object,o=this._operations?.data.geometry;if(t===0){let e=a.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&D(this._operations,a.elevationInfo),this._moveManipulation.angle=ye(o),this._moveManipulation.radius=O.radiusForSymbol(a.graphic?.symbol)}else{let e=a.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&D(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&t!==1;let n=0;if(r!=null){let e=r.handle.pos,t=i==null?r.handle.leftSegment?.leftVertex?r.handle.leftSegment.leftVertex.pos:null:i.handle.pos,a=i==null&&r.handle.rightSegment?.rightVertex?r.handle.rightSegment.rightVertex.pos:null;t&&a?this._moveManipulation.xyAxisManipulation.available=!1:t?n=q(t,e):a&&(n=q(e,a))}this._moveManipulation.angle=n,this._moveManipulation.radius=Se}t!==0&&n?(ne(e,e,1/t),X.spatialReference=this._operations.data.spatialReference,X.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,X),this._moveManipulation.elevationAlignedLocation=X):this._outlineVisualElement!=null&&!this.object.isDraped&&this._outlineVisualElement.attachmentOrigin!=null?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:pe(this._moveManipulation,this.object)}_removeVertices(e){let t=[],n=this._operations;if(!n)return;let r=e.filter(e=>e.type===`vertex`&&n.canRemoveVertex(e.handle.part));if(r.length>0){let e=this._createBeforeVertexRemoveEvent(r);if(this.events.emit(`before-vertex-remove`,e),e.defaultPrevented)return}for(let e of r){let r=e.handle.part;if(n.canRemoveVertex(r)){t.push(e.handle),this._removeManipulator(e),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightSegment));let i=n.removeVertices([e.handle]).removedVertices?.[0].createdSegment;i&&i.type===`line`?this._createVertexOrEdgeManipulator(i):this.enableEdgeOffset&&r.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(r.segments[0]))}}if(t.length>0){let e=t.map(e=>{let t=n.data.parts.indexOf(e.part);return{coordinates:n.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),r=this._updateEventState(2);if(this.destroyed||(this.events.emit(`vertex-remove`,{type:`vertex-remove`,object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)||r&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){let t=this._operations,n=e.map(e=>{let n=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:n,vertexIndex:e.handle.index}}),r=!1;return{type:`before-vertex-remove`,object:this.object,removed:n.map(e=>e.coordinates),vertices:n,get defaultPrevented(){return r},preventDefault(){r=!0}}}_moveVertices(e,t,n=t.action===`start`?0:1){let r=this._operations;if(r&&(e.length>0&&r.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,n),!this._movingManipulatorsHidden))for(let t of e)this._updateManipulatorPosition(t)}_offsetEdge(e,t,n){if(!this._operations)return;let r=t.clone();r.distance=n,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],r),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),t.type===`vertex`&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===F.Right&&this._removeVertices([t])),t.type===`edge`&&e.button===F.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){this._defaultTooltipInfo==null?this._updateTranslateObjectTooltip(e,t):this._resetTooltip()}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ke(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=M(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){let e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&e?.type===`reshape-edge-offset`)return;let t=null;t=this._pendingEdgeOffsetInfo||this._findActiveEdgeOffsetManipulatorInfo()!=null?M(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(e==null||t==null||this.tooltip.mode!==`input`)&&(this.activeTooltipInfo=t)}get _defaultTooltipInfo(){switch(this._operations?.data.type){case`polyline`:case`polygon`:return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case`point`:case`mesh`:return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){let e=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.length===1?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>e.type===`vertex`&&e.manipulator.selected)}_forEachVertex(e){for(let t of this._manipulatorInfos)t.type===`vertex`&&e(t)}get _tooltipsContext(){let{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};e([g()],K.prototype,`_numGrabbing`,void 0),e([g()],K.prototype,`_numDragging`,void 0),e([g()],K.prototype,`_pendingEdgeOffsetInfo`,void 0),e([g()],K.prototype,`_operations`,null),e([g()],K.prototype,`_segmentLabels`,void 0),e([g({constructOnly:!0})],K.prototype,`tool`,void 0),e([g()],K.prototype,`tooltip`,void 0),e([g()],K.prototype,`activeTooltipInfo`,void 0),e([g({readOnly:!0})],K.prototype,`updating`,null),e([g()],K.prototype,`manipulators`,null),e([g()],K.prototype,`view`,null),e([g()],K.prototype,`object`,null),e([g()],K.prototype,`enableZShape`,null),e([g()],K.prototype,`enableDeleteVertices`,null),e([g()],K.prototype,`enableZVertex`,null),e([g()],K.prototype,`autoHideManipulators`,null),e([g()],K.prototype,`enableMoveObject`,null),e([g()],K.prototype,`enableMidpoints`,null),e([g()],K.prototype,`enableEdgeOffset`,null),e([g()],K.prototype,`_toolOptions`,null),e([g()],K.prototype,`_accentColor`,null),e([g()],K.prototype,`_tooltipsContext`,null),K=e([_(`esri.views.3d.interactive.editingTools.reshape.ReshapeOperation`)],K);function Ie(){return e=>{let{operation:t,mapEnd:n}=e;return t==null||n==null?e:{...e,signedDistance:t.signedDistanceToPoint(n)}}}function q(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function J(e){return new oe({x:0,y:0,z:0,spatialReference:e})}function Y(e){return e.type===`edge`&&`edgeManipulator`in e}const X=ue(0,0,void 0,le.WGS84),Z=ie(),Le=1e-6,Q=16,$=32;export{K as ReshapeOperation};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as n}from"../../../../../core/arrayUtils.js";import{EventEmitter as r}from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a,handlesGroup as o,destroyHandle as s}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as c,removeMaybe as l}from"../../../../../core/maybe.js";import{initial as u,on as d,watch as f,syncAndInitial as p,when as m,sync as h}from"../../../../../core/reactiveUtils.js";import{property as g,subclass as _}from"../../../../../core/accessorSupport/decorators.js";import{IDENTITY as v}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{length as y,subtract as b,lerp as x,set as ee,add as te,scale as ne}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as re,create as ie}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as ae}from"../../../../../core/support/UpdatingHandles.js";import oe from"../../../../../geometry/Point.js";import se from"../../../../../geometry/Polyline.js";import{projectPoint as ce}from"../../../../../geometry/projectionUtils.js";import le from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as ue}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as de}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as fe}from"../../../../../symbols/support/utils.js";import{Manipulator3D as S}from"../../Manipulator3D.js";import{createManipulatorMaterials as C,createSphereGeometryAsOffsets as w,placeAtObject as pe,screenSizeManipulatorSettings as me}from"../../manipulatorUtils.js";import{RenderObject as T}from"../../RenderObject.js";import{SegmentLabels3D as he}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as ge}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as E,screenToRenderPlaneFromEvent as _e,convertToMapCoordinates as ve}from"../dragEventPipeline3D.js";import{orientation as ye}from"../geometryUtils.js";import{canMoveZOperations as D}from"../manipulatorUtils.js";import{Settings as be}from"../settings.js";import{createVisualElements as xe}from"../visualElementUtils.js";import{discRadiusSmall as Se}from"../manipulations/config.js";import{MoveManipulation as O}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Ce}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as k,createEdgeOffsetIntersectionPlane as A,createEdgeOffsetOperation as j,edgeOffsetRotationMatrix as we,screenEdgeLengthSquared as Te,getDistanceInGeometrySR as Ee}from"./edgeOffsetUtils.js";import{createTooltipInfos as De,connectTooltipToManipulatedObject as Oe,getUpdatedTranslateObjectTooltipInfo as ke,getUpdatedEdgeOffsetTooltipInfo as M}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as N}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as Ae}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as P}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as F}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as I,addMapDelta as L,createManipulatorDragEventPipeline as R,dragAtLocation as z,addScreenDelta as je}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as Me}from"../../../../interactive/keybindings.js";import{SnappingContext as B}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as V}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as Ne,enterInputModeIfAvailable as H}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Pe}from"../../../../support/GeometryWorkerHandle.js";const U=Symbol(),W=Symbol(),Fe=Symbol(),G=Symbol();let K=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(G)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new i,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new ae,this._recreatingManipulators=!1,this._settings=new be({getTheme:()=>this.view.effectiveTheme}),this.events=new r,this.activeTooltipInfo=null,this._measurementWorker=new Pe({preloadGeodetic:!0}),this._vertexLaserLineVisualElement=null,this._tooltipCallbacks={onBeforeReshape:()=>this.tool.endDrag(),onReshapeStart:()=>this._updateEventState(2),onReshape:()=>this.events.emit(`reshape`,{type:`reshape`,object:this.object}),onReshapeStop:()=>this._updateEventState(0,{forceEnd:!0}),onMoveStart:()=>this._updateEventState(1),onMove:()=>this.events.emit(`move`,{type:`move`,object:this.object,dx:0,dy:0}),onMoveStop:()=>this._updateEventState(0,{forceEnd:!0})}}initialize(){let{view:e}=this,t=this._settings.manipulators,n=t.vertex;this.tooltipInfos=De(this._toolOptions,e),this._vertexManipulatorMaterials=C({color:n.color.toUnitRGBA(),outlineColor:n.outlineColor.toUnitRGBA(),focusedOutlineColor:n.focusedOutlineColor.toUnitRGBA(),screenSize:n,renderOccluded:n.renderOccluded});let r=t.edge;this._edgeManipulatorMaterials=C({color:r.color.toUnitRGBA(),outlineColor:r.outlineColor.toUnitRGBA(),screenSize:r,renderOccluded:r.renderOccluded});let i=t.edgeOffset;this._edgeOffsetManipulatorMaterials=C({color:i.color.toUnitRGBA(),focusedColor:i.focusedColor.toUnitRGBA(),renderOccluded:i.renderOccluded,shaded:!1});let a=t.selected;this._selectedManipulatorMaterials=C({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),focusedOutlineColor:a.focusedOutlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded}),this.tooltip=Ne(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{let e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:n,selectedSettings:r})=>{e.applyColor(this._vertexManipulatorMaterials.material),e.applyOutline(this._vertexManipulatorMaterials.outlineMaterial),e.applyFocusedOutline(this._vertexManipulatorMaterials.focusedMaterial),t.applyColor(this._edgeManipulatorMaterials.material),t.applyOutline(this._edgeManipulatorMaterials.outlineMaterial),n.applyColor(this._edgeOffsetManipulatorMaterials.material),n.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),r.applyColor(this._selectedManipulatorMaterials.material),r.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),r.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(let t of this._manipulatorInfos)t.manipulator.available=e,Y(t)&&(t.edgeManipulator.available=e)}),this._updatingHandles.add(()=>this._numGrabbing+this._numDragging===0,e=>this._toggleAutoHideManipulators(e)),this._updatingHandles.add(()=>({labels:this._segmentLabels,enabled:this._toolOptions.labels.enabled,edgeOffsetEnabled:this.enableEdgeOffset}),({labels:e,enabled:t,edgeOffsetEnabled:n})=>{e!=null&&(e.visible=t,e.edgeDistance=n?`far`:`default`)},u),Oe(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{t===`input`&&e!==`input`&&this._resetTooltip()}),d(()=>this._operations,`vertex-update`,e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),d(()=>this._operations?.data,`change`,e=>{(e.operation===`undo`||e.operation===`redo`)&&this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=c(this._segmentLabels),this.tooltip=c(this.tooltip),this._measurementWorker.destroy()}get updating(){return this._updatingHandles.updating||!!this._segmentLabels?.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get object(){return this.tool.object}get enableZShape(){return this.tool.enableZShape}get enableDeleteVertices(){return this.tool.enableDeleteVertices}get enableZVertex(){return this.tool.enableZVertex}get autoHideManipulators(){return this.tool.autoHideManipulators}get enableMoveObject(){return this.tool.enableMoveObject}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _toolOptions(){return this.tool.toolOptions}get _accentColor(){return this.view.effectiveTheme.accentColor}enterInputModeIfAvailable(e){return e.type!==`key-down`||e.key!==Me.enterInputMode?!1:this.activeTooltipInfo?.type===`reshape-edge-offset`?this._enterInputModeDuringEdgeOffset(e):H(e,this.tooltip)?(this.tool.endDrag(),!0):!1}removeSelectedVertices(){let e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&e.type===`vertex`);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit(`manipulators-changed`)}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(W),this.removeHandles(G),this._moveManipulation=c(this._moveManipulation),this._objectMoveManipulation=c(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(this._operations==null)return;let t=this.object.elevationInfo;for(let{vertices:n,segments:r,index:i}of this._operations.data.parts){let a=e?.byPartIndex.get(i);for(let e of n){let n=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,n)}for(let e of r)e.type===`line`&&this._createVertexOrEdgeManipulator(e,t)}this._createObjectMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}recordUndo(e){this._operations?.recordUndo(e,!0)}get canRedo(){return this._operations?.canRedo??!1}get canUndo(){return this._operations?.canUndo??!1}redo(){return this._operations?.redo()}undo(){return this.events.emit(`undo`),this._operations?.undo()}_recreateManipulators(){if(!this._recreatingManipulators){if(this._recreatingManipulators=!0,this._removeManipulators(),this._resetTooltip(),(!this._operations||this._segmentLabels?.context?.editGeometryOperations!==this._operations)&&(this._segmentLabels=c(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){let e=this._toolOptions.labels;this._segmentLabels=new he({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if(t.action===`end`)return t;let n=0,r=[],i=e===1&&this._someVerticesSelected;for(let e of this._manipulatorInfos)e.type===`vertex`&&(!e.manipulator.grabbing&&(!i||e.manipulator.selected)&&r.push(e),n++);if(r.length===n){if(i||this._hideReshapeControls(),this._moveVertices(r,t),this._updateEventState(1),this.destroyed)return t;this.events.emit(`move`,{type:`move`,dx:t.screenDeltaX,dy:t.screenDeltaY,object:this.object})}else{if(this._moveVertices(r,t),this._updateEventState(2),this.destroyed)return t;this.events.emit(`reshape`,{type:`reshape`,object:this.object})}return t}_hideReshapeControls(){this._movingManipulatorsHidden||this.addHandles([this._hideReshapeManipulators(),this._moveManipulation.hideManipulatorsExceptGrabbedGroup(),a(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],G)}_showReshapeControls(){this.removeHandles(G)}_shouldHideReshapeControlsOnGrab(e){return this._objectMoveManipulation.hasManipulator(e)||this._moveManipulation.hasManipulator(e)&&!this._someVerticesSelected}get _canShowReshapeControls(){return!this._objectMoveManipulation.grabbing&&(!this._moveManipulation.grabbing||this._someVerticesSelected)}_hideManipulatorsForEdgeOffset(e){let t=this._manipulatorInfos.filter(Y).find(t=>t.manipulator===e||t.edgeManipulator===e);t!=null&&(this.removeHandles(W),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],W))}_hideReshapeManipulators(e){return o(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Y(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(U):this.tool.manipulators.forEach(({manipulator:e})=>{let t=e.disableDisplay?.();t&&this.addHandles(t,U)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>t.type===`vertex`&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;let{mapDeltaX:t,mapDeltaY:n,mapDeltaZ:r}=e;if(!t&&!n&&!r)return;let i=[];this._forEachVertex(t=>{let{selected:n,grabbing:r}=t.manipulator;(n&&!r||t===e.info)&&i.push(t)}),this._moveVertices(i,e,1),this.events.emit(`reshape`,{type:`reshape`,object:this.object})}_updateEventState(e,t={}){if(e===this._reshapeEventState)return!1;switch(e){case 0:if(!t.forceEnd&&(this._numGrabbing!==0||this._numDragging!==0))return!1;switch(this._reshapeEventState){case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object})}break;case 1:switch(this._reshapeEventState){case 0:this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape-stop`,object:this.object}),this.destroyed||this.events.emit(`move`,{type:`move-start`,dx:0,dy:0,object:this.object})}break;case 2:switch(this._reshapeEventState){case 0:this.events.emit(`reshape`,{type:`reshape-start`,object:this.object});break;case 1:this._showReshapeControls(),this.events.emit(`move`,{type:`move-stop`,dx:0,dy:0,object:this.object}),this.destroyed||this.events.emit(`reshape`,{type:`reshape-start`,object:this.object})}}if(this.destroyed)return!1;let n=this._reshapeEventState!==e;return this._reshapeEventState=e,n}_createObjectMoveManipulation(){let{tool:e,view:t,object:n,_operations:r}=this;if(r){if(this._objectMoveManipulation=new Ce({tool:e,view:t,object:n}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,n,i)=>{n.next(e=>this._trackNumDragging(e)).next(t=>(t.action===`start`&&(e=r.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{t.action===`end`&&(this._showReshapeControls(),this._resetTooltip(),e=l(e))}),i.next(()=>this._onDragCancel(!0,()=>e=l(e)))})),this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1)))}else this._objectMoveManipulation.forEachManipulator(e=>{e.grabbable=!1,e.cursor=null});this._objectMoveManipulation.forEachManipulator(e=>this._manipulatorHandles.add(e.events.on(`immediate-click`,e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()})))}}_createMoveManipulation(e){let{object:t,tool:n,view:r,_operations:i}=this;if(!i)return;this._moveManipulation=new O({tool:n,view:r,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&D(t.operations,t.elevationInfo),snapToScene:!1,radius:O.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator(e=>this.addHandles([e.events.on(`immediate-click`,t=>{!this._moveManipulation.zManipulation.hasManipulator(e)&&!this._manipulatorInfos.some(e=>e.manipulator.selected)&&this.events.emit(`immediate-click`,{...t,object:this.object}),t.stopPropagation()}),this._watchAndUpdateGrabState(e,!1)]));let a=e=>t=>{this.addHandles([t.events.on(`focus-changed`,({action:t})=>{t===`focus`?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(a(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(a(1)),this._moveManipulation.zManipulation.forEachManipulator(a(2)),this._moveManipulation.elevationInfo={mode:`absolute-height`,offset:0};let o=i.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((r,a,o,s,c)=>{let{snappingStep:l,cancelSnapping:u}=V({predicate:e=>!!e.info,snappingManager:n.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:e,pointer:c,excludeFeature:t.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:!1});return s=s.next(e=>(this._onDragCancel(),e)).next(u),o=o.next(e=>this._trackNumDragging(e)).next(e=>{let t=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.manipulatorType===1&&t.length===1?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(I(this.view,e,t.graphic??void 0)).next(...l).next(L()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>(e.action===`end`&&this._showReshapeControls(),this._updateTranslateTooltip(r,e),e)),{steps:o,cancel:s}},e,o,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),u),t.on(`committed`,()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Fe),e&&this.addHandles(Ae({view:this.view,geometry:()=>t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Fe)},u)])}_createVisualElements(){let{object:e,view:t}=this,n=xe({view:t,object:e,forEachManipulator:e=>{if(!(this.destroyed||this._recreatingManipulators)){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(let t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on(`manipulators-changed`,e)});n!=null&&(this._outlineVisualElement=n.visualElement instanceof N?n.visualElement:null);let r=this._outlineVisualElement;if(r!=null){let t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(d(()=>r.events,`attachment-origin-changed`,t,{onListenerAdd:t}))}this._manipulatorHandles.add(n)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){let n=this.view,r=this._operations;if(e.part.vertices.length<=2||!r)return null;let i=r.data.spatialReference,a=this._settings.manipulators.edgeOffset,s=a.size/2,c=s+a.collisionPadding,l=s/c,u=l/2,d=l*Math.sqrt(3)/2,{height:f,offset:p}=a,{material:m,focusedMaterial:h}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){let e=P(m,d,u,u,f,p);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){let e=P(m,-d,u,u,f,-p);this._edgeOffsetManipulatorGeometryOutside=e}let g=[new T(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryInside.instantiate({material:h}),2),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new T(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:h}),2)],_=new S({view:n,renderObjects:g,elevationInfo:t.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?t:{mode:`absolute-height`,offset:0},worldOriented:!1,focusMultiplier:1,radius:c,available:this.object.visible,collisionType:{type:`disc`,direction:re(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:J(i)}),v=new S({view:n,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?`move`:`default`,metadata:{deleting:!1},location:J(i)}),y={manipulator:_,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(y,a.minSquaredEdgeLength);let b=()=>this._updateEdgeOffsetManipulator(y);b(),y.locationUpdateHandle=o([e.leftVertex,e.rightVertex].map(e=>this._getManipulatorInfoFromHandle(e)?.manipulator.events.on(`location-update`,b)));let x=e=>{this._manipulatorInfos.some(e=>e.manipulator.selected)?this._clearSelection():this.events.emit(`immediate-click`,{...e,object:this.object}),e.stopPropagation()};return this._manipulatorHandles.add([y.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),R(_,this._createEdgeOffsetPipeline(y,t,r)),R(v,this._createEdgePipeline(y,t,r)),v.events.on(`immediate-click`,x),_.events.on(`immediate-click`,x),_.events.on(`focus-changed`,()=>this._resetTooltip()),_.events.on(`grab-changed`,({screenPoint:e,action:t})=>{y.grabMapPoint=t===`start`?k(e,this.view,this.object,y):null})],_),this._manipulatorInfos.push(y),this.manipulators.addMany([_,v]),this.events.emit(`manipulators-changed`),y}_autoHideEdgeOffsetManipulator(e,t){let n=e.manipulator,r=e.edgeManipulator,i=()=>{e.visibilityHandle=l(e.visibilityHandle);let i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),s=this._getManipulatorInfoFromHandle(e.handle.rightVertex),c=i!=null&&s!=null&&Te(i.manipulator.renderLocation,s.manipulator.renderLocation,this.view.state.camera)<t;(!n.focused&&!r.focused||c)&&(n.grabbable=!c,r.grabbable=!c,e.visibilityHandle=o([n.disableDisplay(),a(()=>{n.grabbable=!0,r.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([n.events.on(`focus-changed`,i),r.events.on(`focus-changed`,i),a(()=>{l(e.visibilityHandle),r.metadata.deleting=!0,this.manipulators.remove(r)})],n),i()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);let{coordinateHelper:t}=this._operations.data,n=A(this.view,e.manipulator.elevationAlignedLocation,j(t,e.handle,e.manipulator.elevationInfo)),r=this._getManipulatorInfoFromHandle(e.handle.leftVertex),i=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(r==null||i==null)return;let a=r.manipulator.renderLocation,o=i.manipulator.renderLocation,s=n==null?v:we(n,a,o);e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;let c=y(b(Z,a,o))/2;e.edgeManipulator.collisionType={type:`line`,paths:[[[-c,0,0],[c,0,0]]]}}_createEdgePipeline(e,t,n){return(r,i,a,o)=>{if(o===`touch`)this._createEdgeOffsetPipeline(e,t,n)(r,i,a);else if(this.enableMoveObject){let e=this.object.graphic,o=n.data.spatialReference,{elevationAlignedLocation:s}=r;i.next(e=>this._trackNumDragging(e)).next(z(this.view,s)).next(E(this.view,s,t,o,e)).next(je()).next(L()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{e.action===`end`&&(this._showReshapeControls(),this._resetTooltip())}),a.next(()=>this._onDragCancel(!r.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,n){return(r,i,a)=>{let o=this._pendingEdgeOffsetInfo;if(o?.manipulatorInfo===e&&o.mode!==`drag`){a.execute({action:`cancel`});return}this._clearSelection();let{initializeStep:s,cleanup:c}=this._initializeEdgeOffset(e,t,n,a),l=this._applyEdgeOffsetStep(e);i.next(e=>this._trackNumDragging(e)).next(z(this.view,r.elevationAlignedLocation)).next(s).next(_e(this.view)).next(ve(this.view,n.data.spatialReference)).next(L()).next(Ie()).next(e=>this._pendingEdgeOffsetInfo?e:l(e)).next(e=>{e.action===`end`&&!this._pendingEdgeOffsetInfo&&c()}),a.next(()=>{this._exitEdgeOffsetInputMode(),r.metadata.deleting||(c(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,n,r){let{view:i,object:a}=this,s=j(n.data.coordinateHelper,e.handle,t),c=n.createUndoGroup(),u=A(i,e.manipulator.elevationAlignedLocation,s);this._splitEdgesBeforeEdgeOffset(e,s),this._selectEdgeOffsetArrow(e,s);let d,f=()=>{this._cleanEdgeOffsetCollapsedEdges(e,n),d=l(d)},p=this.events.on(`undo`,f);return d=o([this._initializeEdgeOffsetVisualElement(e,a,t,n),c,p,this._connectEdgeOffsetTooltip(e,s,n,()=>{r.execute({action:`cancel`})})]),{initializeStep:e=>s==null||u==null?(f(),null):{...e,operation:s,plane:u},cleanup:f}}_initializeEdgeOffsetVisualElement(e,t,n,r){let i=()=>new se({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:r.data.spatialReference}),a=new N({view:this.view,isDraped:t.isDraped,geometry:i(),elevationInfo:n,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),c=o([f(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{a.color=e.toUnitRGBA(),a.isDraped=t},p),t.on(`committed`,()=>{a.geometry=i()}),s(a)]);return a.attached=!0,c}_applyEdgeOffsetStep(e){return t=>this.destroyed||t.operation==null||!this._operations?t:(this._updateEventState(2),t.signedDistance==null?this._resetTooltip():((t.mapDeltaX||t.mapDeltaY||t.mapDeltaZ)&&(this._offsetEdge(e,t.operation,t.signedDistance),this.events.emit(`reshape`,{type:`reshape`,object:this.object})),this._updateEdgeOffsetTooltip(t)),t)}_cleanEdgeOffsetCollapsedEdges(e,t){let n=e.handle.leftVertex.leftSegment?.leftVertex,r=e.handle.leftVertex,i=e.handle.rightVertex.rightSegment?.rightVertex,a=e.handle.rightVertex,o=t.data.coordinateHelper,s=this.view.pixelSizeAt(o.vectorToDehydratedPoint(r.pos),o.spatialReference),c=[];if(n&&o.distance(n.pos,r.pos)<Le){let e=this._getManipulatorInfoFromHandle(r);e!=null&&c.push(e)}if(o.distance(r.pos,a.pos)<s||i&&o.distance(i.pos,a.pos)<Le){let e=this._getManipulatorInfoFromHandle(a);e!=null&&c.push(e)}c.length&&this._removeVertices(c)}_enterInputModeDuringEdgeOffset(e){let t=this._findActiveEdgeOffsetManipulatorInfo();return t&&H(e,this.tooltip)?t.manipulator.dragging?(this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`drag`},!0):(this._clearSelection(),this._pendingEdgeOffsetInfo={manipulatorInfo:t,mode:`hover`},this._connectEdgeOffsetTooltipOnHover(t),!0):!1}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Y).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){let{_operations:t,object:n}=this;if(!t)return;let{elevationInfo:r}=n,i=j(t.data.coordinateHelper,e.handle,r);this._selectEdgeOffsetArrow(e,i),this.addHandles([this._initializeEdgeOffsetVisualElement(e,n,r,t),this._connectEdgeOffsetTooltip(e,i,t,()=>{this.removeHandles(i),this._exitEdgeOffsetInputMode()})],i)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){let t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);t!=null&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){let t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);t!=null&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){let n=e.grabMapPoint??k(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);n&&t.selectArrowFromStartPoint(n)}_connectEdgeOffsetTooltip(e,t,n,r){let i=()=>this.tooltipInfos.edgeOffset.distance.actual,a=i=>{r(),queueMicrotask(()=>{this.view.focus();let r=n.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,Ee(i,e.manipulator.location,t,n)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,n),r.remove()})},s=()=>{let e=i();e==null?r():a(e)};return o([m(()=>this.tooltip&&!this.tooltip.focused,()=>s(),h),this.tooltip.on(`discard`,r),this.tooltip.on(`commit`,e=>{e.type===`commit-and-exit`&&s()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,n=!1){let r=this.view,i=this._operations;if(!i)return null;let a=i.data.type,s=i.data.spatialReference;if(e.type===`line`){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(this._vertexManipulatorGeometry==null||this._vertexManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=w(e),this._vertexManipulatorOutlineGeometry=w(t)}if(this._edgeManipulatorGeometry==null||this._edgeManipulatorOutlineGeometry==null){let{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=w(e),this._edgeManipulatorOutlineGeometry=w(t)}let c=this._vertexManipulatorGeometry,u=this._vertexManipulatorOutlineGeometry,d=[];if(a!==`point`&&a!==`mesh`){d.push(new T(c.instantiate(),Q|4),new T(u.instantiate(),Q|5),new T(u.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),Q|6));{let{material:e,outlineMaterial:t,focusedMaterial:n}=this._selectedManipulatorMaterials;d.push(new T(c.instantiate({material:e}),8),new T(u.instantiate({material:t}),9),new T(u.instantiate({material:n}),10))}}if(this.enableMidpoints){let{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,n=this._edgeManipulatorGeometry,r=this._edgeManipulatorOutlineGeometry,i=$|6,a=$|5;d.push(new T(n.instantiate({material:e}),i),new T(r.instantiate({material:t}),i),new T(n.instantiate(),a),new T(r.instantiate(),a))}let f=e.type===`vertex`,p=new S({view:r,renderObjects:d,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:a===`point`||a===`mesh`,available:this.object.visible,metadata:{deleting:!1},location:J(s),...me});p.selected=n,this._setTypeSpecificManipulatorSettings(p,e,t);let m=f?{manipulator:p,handle:e,type:`vertex`,selectedIndex:0}:{manipulator:p,handle:e,locationUpdateHandle:null,type:`edge`,selectedIndex:0};if(this._manipulatorInfos.push(m),this.manipulators.add(p),this._updateManipulatorPosition(m),m.type===`edge`){let e=[];for(let t of[m.handle.leftVertex,m.handle.rightVertex]){let n=this._getManipulatorInfoFromHandle(t);n!=null&&e.push(n.manipulator.events.on(`location-update`,()=>this._updateManipulatorPosition(m)))}m.locationUpdateHandle=o(e),this._manipulatorHandles.add(m.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);let h=R(p,(e,n,a,o)=>{let c=null,{snappingStep:u,cancelSnapping:d}=V({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new B({editGeometryOperations:i,elevationInfo:t,pointer:o,excludeFeature:this.object.graphic,visualizer:new ge}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});a.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>c=l(c)),t)).next(d);let{elevationAlignedLocation:f}=e,p=this.object.graphic??void 0,h=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,i,p):E(r,f,t,s,p);n.next(e=>this._trackNumDragging(e)).next(e=>{if(e.action===`start`&&i&&(c=i.createUndoGroup()),m.type===`edge`){let t=this._splitEdgeManipulator(m);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:m,snapOrigin:m.handle.pos}}).next(z(r,f)).next(h).next(I(r,t,p)).next(...u).next(L()).next(e=>{this._perVertexManipulatorDragAction(e),e.action===`end`&&(c=l(c)),this._resetTooltip()})});return this._manipulatorHandles.add([h,p.events.on(`immediate-click`,e=>this._manipulatorClickCallback(e,m)),p.events.on(`select-changed`,()=>{m.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),p.events.on(`focus-changed`,()=>{this._resetTooltip()})],p),this.events.emit(`manipulators-changed`),m}_screenToSceneMapForVertexDrag(e,t,n){let{view:r}=this,{coordinateHelper:i,spatialReference:a}=t.data,o=null;return t=>{if(t.action===`start`&&(o=i.vectorToPoint(t.snapOrigin)),o==null)return null;let s=r.toMap(t.screenEnd,{exclude:n,excludeLabels:!0});return s==null||(s.z=de(s,r,e),!ce(s,s,a))?null:{...t,mapStart:o,mapEnd:s}}}_trackNumDragging(e){switch(e.action){case`start`:this._numDragging++;break;case`end`:this._numDragging--}return e}_onDragCancel(e=!0,t){switch(this._numDragging--,e&&this.undo(),this.tool.snappingManager?.doneSnapping(),this._showReshapeControls(),this._resetTooltip(),this._reshapeEventState){case 0:break;case 1:this.events.emit(`move`,{type:`move`,dx:0,dy:0,object:this.object});break;case 2:this.events.emit(`reshape`,{type:`reshape`,object:this.object})}t?.(),!this.destroyed&&this._updateEventState(0)}_setTypeSpecificManipulatorSettings(e,t,n){let r=this._settings;switch(t.type){case`vertex`:{e.selectable=!0,e.cursor=`move`,e.collisionPriority=2,e.elevationInfo=n;let t=this._operations?.data.type;e.interactive=t!=null&&t!==`point`&&t!==`mesh`;let{size:i,collisionPadding:a}=r.manipulators.vertex;e.radius=i/2+a,e.state=Q;break}case`line`:{e.state=$,e.selectable=!1,e.cursor=`copy`,e.collisionPriority=2;let{size:t,collisionPadding:i}=r.manipulators.edge;e.radius=t/2+i,e.elevationInfo=n.mode===`on-the-ground`&&!fe(this.object.graphic?.symbol)?n:{mode:`absolute-height`,offset:0};break}}}_watchAndUpdateGrabState(e,t){return e.events.on(`grab-changed`,n=>{this._onGrabStateChanged(e,t,n.action,n.pointerType)})}_onGrabStateChanged(e,t,n,r=`mouse`){if(!this._recreatingManipulators){if(n===`start`)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(W),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,(r!==`touch`||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{let{manipulator:t}=e,n=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&n!=null&&n!==`point`&&n!==`mesh`,Y(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(let e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1);this._pendingEdgeOffsetInfo=null}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.events.emit(`manipulators-changed`))}_removeManipulator(e){e!=null&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),n(this._manipulatorInfos,e),this.events.emit(`manipulators-changed`),this._resetTooltip())}_getManipulatorInfoFromHandle(e){return this._manipulatorInfos.find(t=>t.handle===e)}_updateManipulatorPositions(e){if(!this._movingManipulatorsHidden)for(let t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){let t=this._operations;if(e!=null&&t){if(e.type===`vertex`)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,X),e.manipulator.grabbing&&this._vertexLaserLineVisualElement!=null&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if(e.type===`edge`){let n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(n==null||r==null)return;let i=n.manipulator,a=r.manipulator;if(e.manipulator.elevationInfo?.mode===`on-the-ground`){let n=i.location,r=a.location,o=.5,s=n.x+o*(r.x-n.x),c=n.y+o*(r.y-n.y),l=n.hasZ&&r.hasZ?0:void 0;e.manipulator.location=ue(s,c,l,t.data.spatialReference)}else x(Z,i.renderLocation,a.renderLocation,.5),e.manipulator.renderLocation=Z}}}_splitEdgeManipulator(e,t=.5){let n=this._operations,r=n.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=l(e.locationUpdateHandle);let i=this.object.elevationInfo,a;this.enableEdgeOffset?(this._removeManipulator(e),a=this._createVertexOrEdgeManipulator(r)):(a=e,a.handle=r,a.type=`vertex`,this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,i)),r.leftSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.leftSegment),r.rightSegment?.type===`line`&&this._createVertexOrEdgeManipulator(r.rightSegment),this._updateManipulatorPosition(a),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);let o=this._updateEventState(2),s=n.data.coordinateHelper.vectorToArray(a.handle.pos),c=n.data.parts.indexOf(r.part);return this.events.emit(`vertex-add`,{type:`vertex-add`,object:this.object,vertices:[{coordinates:s,componentIndex:c,vertexIndex:r.index}],added:s}),o&&this._updateEventState(0),a}_updateMoveManipulationPosition(){let e=ee(Z,0,0,0),t=0,n=!1,r=null,i=null;for(let a of this._manipulatorInfos)if(a.type===`vertex`){if(!a.manipulator.selected){n=!0;continue}t++,te(e,e,a.manipulator.renderLocation),r==null||a.selectedIndex>r.selectedIndex?(i=r,r=a):(i==null||a.selectedIndex>i.selectedIndex)&&(i=a)}let a=this.object,o=this._operations?.data.geometry;if(t===0){let e=a.visible&&this.enableMoveObject;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&D(this._operations,a.elevationInfo),this._moveManipulation.angle=ye(o),this._moveManipulation.radius=O.radiusForSymbol(a.graphic?.symbol)}else{let e=a.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&D(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&t!==1;let n=0;if(r!=null){let e=r.handle.pos,t=i==null?r.handle.leftSegment?.leftVertex?r.handle.leftSegment.leftVertex.pos:null:i.handle.pos,a=i==null&&r.handle.rightSegment?.rightVertex?r.handle.rightSegment.rightVertex.pos:null;t&&a?this._moveManipulation.xyAxisManipulation.available=!1:t?n=q(t,e):a&&(n=q(e,a))}this._moveManipulation.angle=n,this._moveManipulation.radius=Se}t!==0&&n?(ne(e,e,1/t),X.spatialReference=this._operations.data.spatialReference,X.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,X),this._moveManipulation.elevationAlignedLocation=X):this._outlineVisualElement!=null&&!this.object.isDraped&&this._outlineVisualElement.attachmentOrigin!=null?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:pe(this._moveManipulation,this.object)}_removeVertices(e){let t=[],n=this._operations;if(!n)return;let r=e.filter(e=>e.type===`vertex`&&n.canRemoveVertex(e.handle.part));if(r.length>0){let e=this._createBeforeVertexRemoveEvent(r);if(this.events.emit(`before-vertex-remove`,e),e.defaultPrevented)return}for(let e of r){let r=e.handle.part;if(n.canRemoveVertex(r)){t.push(e.handle),this._removeManipulator(e),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(e.handle.rightSegment));let i=n.removeVertices([e.handle]).removedVertices?.[0].createdSegment;i&&i.type===`line`?this._createVertexOrEdgeManipulator(i):this.enableEdgeOffset&&r.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(r.segments[0]))}}if(t.length>0){let e=t.map(e=>{let t=n.data.parts.indexOf(e.part);return{coordinates:n.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),r=this._updateEventState(2);if(this.destroyed||(this.events.emit(`vertex-remove`,{type:`vertex-remove`,object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)||r&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){let t=this._operations,n=e.map(e=>{let n=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:n,vertexIndex:e.handle.index}}),r=!1;return{type:`before-vertex-remove`,object:this.object,removed:n.map(e=>e.coordinates),vertices:n,get defaultPrevented(){return r},preventDefault(){r=!0}}}_moveVertices(e,t,n=t.action===`start`?0:1){let r=this._operations;if(r&&(e.length>0&&r.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,n),!this._movingManipulatorsHidden))for(let t of e)this._updateManipulatorPosition(t)}_offsetEdge(e,t,n){if(!this._operations)return;let r=t.clone();r.distance=n,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],r),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),t.type===`vertex`&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===F.Right&&this._removeVertices([t])),t.type===`edge`&&e.button===F.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){this._defaultTooltipInfo==null?this._updateTranslateObjectTooltip(e,t):this._resetTooltip()}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=ke(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=M(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){let e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&e?.type===`reshape-edge-offset`)return;let t=null;t=this._pendingEdgeOffsetInfo||this._findActiveEdgeOffsetManipulatorInfo()!=null?M(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(e==null||t==null||this.tooltip.mode!==`input`)&&(this.activeTooltipInfo=t)}get _defaultTooltipInfo(){switch(this._operations?.data.type){case`polyline`:case`polygon`:return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case`point`:case`mesh`:return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){let e=this._manipulatorInfos.filter(e=>e.type===`vertex`&&e.manipulator.selected);return e.length===1?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>e.type===`vertex`&&e.manipulator.selected)}_forEachVertex(e){for(let t of this._manipulatorInfos)t.type===`vertex`&&e(t)}get _tooltipsContext(){let{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};e([g()],K.prototype,`_numGrabbing`,void 0),e([g()],K.prototype,`_numDragging`,void 0),e([g()],K.prototype,`_pendingEdgeOffsetInfo`,void 0),e([g()],K.prototype,`_operations`,null),e([g()],K.prototype,`_segmentLabels`,void 0),e([g({constructOnly:!0})],K.prototype,`tool`,void 0),e([g()],K.prototype,`tooltip`,void 0),e([g()],K.prototype,`activeTooltipInfo`,void 0),e([g({readOnly:!0})],K.prototype,`updating`,null),e([g()],K.prototype,`manipulators`,null),e([g()],K.prototype,`view`,null),e([g()],K.prototype,`object`,null),e([g()],K.prototype,`enableZShape`,null),e([g()],K.prototype,`enableDeleteVertices`,null),e([g()],K.prototype,`enableZVertex`,null),e([g()],K.prototype,`autoHideManipulators`,null),e([g()],K.prototype,`enableMoveObject`,null),e([g()],K.prototype,`enableMidpoints`,null),e([g()],K.prototype,`enableEdgeOffset`,null),e([g()],K.prototype,`_toolOptions`,null),e([g()],K.prototype,`_accentColor`,null),e([g()],K.prototype,`_tooltipsContext`,null),K=e([_(`esri.views.3d.interactive.editingTools.reshape.ReshapeOperation`)],K);function Ie(){return e=>{let{operation:t,mapEnd:n}=e;return t==null||n==null?e:{...e,signedDistance:t.signedDistanceToPoint(n)}}}function q(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function J(e){return new oe({x:0,y:0,z:0,spatialReference:e})}function Y(e){return e.type===`edge`&&`edgeManipulator`in e}const X=ue(0,0,void 0,le.WGS84),Z=ie(),Le=1e-6,Q=16,$=32;export{K as ReshapeOperation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{watch as e,initial as t}from"../../../../core/reactiveUtils.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{resizeHandleCornerWidth as r,resizeHandleEdgeWidth as i,displayFocusMultiplier as a,resizeHandleCornerInputRadius as o,resizeHandleEdgeInputRadius as s}from"../../analysis/Slice/sliceToolConfig.js";import{isDiagonalResizeHandle as c,resizeNormal as l,resizeOutlineOnly as u}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as d}from"../Manipulator3D.js";import{worldScaledManipulatorSettings as f}from"../manipulatorUtils.js";import{RenderObject as p}from"../RenderObject.js";import{createPolylineGeometry as m}from"../../webgl-engine/lib/GeometryUtil.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class g extends d{constructor(n,o){let s=c(o),l=s?r:i,u=l*a,d=i,p={renderOccluded:4,isDecoration:!0},m=new h({...p,width:l},n
|
|
2
|
+
import{watch as e,initial as t}from"../../../../core/reactiveUtils.js";import{fromValues as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{resizeHandleCornerWidth as r,resizeHandleEdgeWidth as i,displayFocusMultiplier as a,resizeHandleCornerInputRadius as o,resizeHandleEdgeInputRadius as s}from"../../analysis/Slice/sliceToolConfig.js";import{isDiagonalResizeHandle as c,resizeNormal as l,resizeOutlineOnly as u}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as d}from"../Manipulator3D.js";import{worldScaledManipulatorSettings as f}from"../manipulatorUtils.js";import{RenderObject as p}from"../RenderObject.js";import{createPolylineGeometry as m}from"../../webgl-engine/lib/GeometryUtil.js";import{RibbonLineMaterial as h}from"../../webgl-engine/materials/RibbonLineMaterial.js";class g extends d{constructor(n,o){let s=c(o),l=s?r:i,u=l*a,d=i,p={renderOccluded:4,isDecoration:!0},m=new h({...p,width:l},n),g=new h({...p,width:u},n),v=new h({...p,width:d},n);super({view:n,...f,..._({isCorner:s,unfocusedMaterial:m,focusedMaterial:g,outlineMaterial:v})}),this._themeHandle=e(()=>n.effectiveTheme.accentColor,e=>{let t=e.toUnitRGBA();m.setParameters({color:t}),g.setParameters({color:t}),v.setParameters({color:t})},t)}destroy(){this._themeHandle.remove(),super.destroy()}}function _({isCorner:e,unfocusedMaterial:t,focusedMaterial:r,outlineMaterial:i}){let a=e?[n(1,0,0),n(0,0,0),n(0,1,0)]:[n(1,0,0),n(-1,0,0)];return{renderObjects:[new p(m(t,a),1|l),new p(m(r,a),2|l),new p(m(i,a),u)],collisionType:{type:`line`,paths:[a]},radius:e?o:s,state:l}}export{g as ResizeManipulator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{multiplyOpacity as e,getContrast as t}from"../../../../core/colorUtils.js";import{releaseMaybe as n}from"../../../../core/maybe.js";import{watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as a}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as o}from"../Manipulator3D.js";import{rotateManipulatorDefaults as s}from"../manipulatorUtils.js";import{RenderObject as c}from"../RenderObject.js";import{Attribute as l}from"../../webgl-engine/lib/Attribute.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as d}from"../../webgl-engine/lib/GeometryUtil.js";import{Parameters as f,ImageMaterial as p}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as m}from"../../webgl-engine/materials/RibbonLineMaterial.js";class h extends o{constructor(n,a){let o=a(e(n.effectiveTheme.accentColor,.5),t(n.effectiveTheme.accentColor)),c=new f(o.managedTexture,!1);c.renderOccluded=16,c.isDecoration=!0;let l=new p(c),u=s.calloutWidth,d=new m({width:u,renderOccluded:4,isDecoration:!0},n
|
|
2
|
+
import{multiplyOpacity as e,getContrast as t}from"../../../../core/colorUtils.js";import{releaseMaybe as n}from"../../../../core/maybe.js";import{watch as r,initial as i}from"../../../../core/reactiveUtils.js";import{DidPointerMoveRecentlyFlag as a}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as o}from"../Manipulator3D.js";import{rotateManipulatorDefaults as s}from"../manipulatorUtils.js";import{RenderObject as c}from"../RenderObject.js";import{Attribute as l}from"../../webgl-engine/lib/Attribute.js";import{Geometry as u}from"../../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as d}from"../../webgl-engine/lib/GeometryUtil.js";import{Parameters as f,ImageMaterial as p}from"../../webgl-engine/materials/ImageMaterial.js";import{RibbonLineMaterial as m}from"../../webgl-engine/materials/RibbonLineMaterial.js";class h extends o{constructor(n,a){let o=a(e(n.effectiveTheme.accentColor,.5),t(n.effectiveTheme.accentColor)),c=new f(o.managedTexture,!1);c.renderOccluded=16,c.isDecoration=!0;let l=new p(c),u=s.calloutWidth,d=new m({width:u,renderOccluded:4,isDecoration:!0},n);super({view:n,...g({imageMaterial:l,calloutMaterial:d})}),this._textureHandle=o,this._themeHandle=r(()=>n.effectiveTheme.accentColor,n=>{let r=e(n,.5),i=t(n),o=this._textureHandle;this._textureHandle=a(r,i),l.setParameters({managedTexture:this._textureHandle.managedTexture}),o?.release(),d.setParameters({color:n.toUnitRGBA()})},i)}destroy(){this._textureHandle=n(this._textureHandle),this._themeHandle.remove(),super.destroy()}}function g({imageMaterial:e,calloutMaterial:t}){let{focusMultiplier:n,calloutLength:r,discRadius:i}=s,o=i*n,f=(e,t)=>{let n=[0,1,2,2,3,0];return new u(t,[[`position`,new l([r-e,-e,0,r+e,-e,0,r+e,e,0,r-e,e,0],n,3,!0)],[`uv0`,new l([0,0,1,0,1,1,0,1],n,2,!0)]])},p=d(t,[[0,0,0],[r-i,0,0]]),m=d(t,[[0,0,0],[r-o,0,0]]),h=a;return{autoScaleRenderObjects:!1,collisionPriority:1,collisionType:{type:`disc`,direction:[0,0,1],offset:[r,0,0]},focusMultiplier:n,radius:i,renderObjects:[new c(f(i,e),1|h),new c(p,1|h),new c(f(o,e),2|h),new c(m,2|h)],state:h}}export{h as RotateManipulator};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as n,initial as r}from"../../../../core/reactiveUtils.js";import{identity as i,translate as a,scale as o,fromQuat as s,multiply as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{rotationTo as u}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{subtract as d,normalize as f,scale as p,add as m,set as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as v,sm4d as y,sq4d as b}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as x,shiftRestartTipRadius as S,shiftRestartTipLength as C,shiftRestartArrowOutlineWidth as w,shiftRestartArrowLength as T,shiftRestartTubeRadius as E,shiftRestartTubeFocusMultiplier as D,shiftRestartTipFocusMultiplier as O}from"../../analysis/Slice/sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as k,IsShiftEdgeOnScreenFlag as A}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as j}from"../Manipulator3D.js";import{RenderObject as M}from"../RenderObject.js";import{createPolylineGeometry as N,createConeGeometry as P,createPathExtrusionGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as I}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as L}from"../../webgl-engine/materials/RibbonLineMaterial.js";class R extends j{constructor(i,a,o=4){let s=new L({width:1,renderOccluded:o,isDecoration:!0},i
|
|
2
|
+
import e from"../../../../Color.js";import{getContrast as t}from"../../../../core/colorUtils.js";import{watch as n,initial as r}from"../../../../core/reactiveUtils.js";import{identity as i,translate as a,scale as o,fromQuat as s,multiply as c}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{rotationTo as u}from"../../../../core/libs/gl-matrix-2/math/quat.js";import{subtract as d,normalize as f,scale as p,add as m,set as h}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g,fromValues as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{sv3d as v,sm4d as y,sq4d as b}from"../../../../geometry/support/vectorStacks.js";import{shiftRestartOffsetDistance as x,shiftRestartTipRadius as S,shiftRestartTipLength as C,shiftRestartArrowOutlineWidth as w,shiftRestartArrowLength as T,shiftRestartTubeRadius as E,shiftRestartTubeFocusMultiplier as D,shiftRestartTipFocusMultiplier as O}from"../../analysis/Slice/sliceToolConfig.js";import{DidPointerMoveRecentlyFlag as k,IsShiftEdgeOnScreenFlag as A}from"../../analysis/Slice/sliceToolUtils.js";import{Manipulator3D as j}from"../Manipulator3D.js";import{RenderObject as M}from"../RenderObject.js";import{createPolylineGeometry as N,createConeGeometry as P,createPathExtrusionGeometry as F}from"../../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as I}from"../../webgl-engine/materials/ColorMaterial.js";import{RibbonLineMaterial as L}from"../../webgl-engine/materials/RibbonLineMaterial.js";class R extends j{constructor(i,a,o=4){let s=new L({width:1,renderOccluded:o,isDecoration:!0},i),c=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),l=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),u=new I({cullFace:2,renderOccluded:16,isDecoration:!0}),d=new I({writeDepth:!1,cullFace:1,renderOccluded:2,isDecoration:!0});super({view:i,...z({offsetMode:a,tubeMaterial:c,tipMaterial:l,capMaterial:u,outlineMaterial:d,calloutMaterial:s})}),this._themeHandle=n(()=>i.effectiveTheme.accentColor,n=>{let r=t(n),i=n.toUnitRGBA(),a=r.toUnitRGBA(),o=e.blendColors(r,n,.4).toUnitRGBA(),f=e.blendColors(r,n,.14).toUnitRGBA();s.setParameters({color:i}),c.setParameters({color:f}),l.setParameters({color:a}),u.setParameters({color:o}),d.setParameters({color:i})},r)}destroy(){this._themeHandle.remove(),super.destroy()}}function z({offsetMode:e,tubeMaterial:t,tipMaterial:n,capMaterial:r,outlineMaterial:i,calloutMaterial:a}){let o=e===0?x:0,s=[_(o,0,-T/2),_(o,0,T/2)],c=H(s),l=B({vertices:s,padding:0,materials:{tube:t,tip:n,cap:r}}),u=B({vertices:s,padding:w,materials:{tube:i,tip:i,cap:i}}),d=N(a,[[o,0,0],[o-x,0,0]]),f=N(a,[[o,0,0],[o-x,0,0]]);return{renderObjects:[...l.normal.map(e=>new M(e,1|k)),...u.normal.map(e=>new M(e,1|k)),new M(d,1|k|A),...l.focused.map(e=>new M(e,2|k)),...u.focused.map(e=>new M(e,2|k)),new M(f,2|k|A)],autoScaleRenderObjects:!1,collisionType:{type:`line`,paths:[c]},collisionPriority:1,radius:S,state:k}}function B({vertices:e,padding:t,materials:n}){let r=r=>{let x=e.slice(),w=d(v.get(),x[0],x[1]);f(w,w);let T=d(v.get(),x[x.length-1],x[x.length-2]);if(f(T,T),t>0){let e=p(g(),T,-t);x[x.length-1]=m(e,e,x[x.length-1]);let n=p(g(),w,-t);x[0]=m(n,n,x[0])}let k=r?O:1,A=C*k,j=S*k,M=i(y.get());if(t>0){let e=A/4,n=h(v.get(),0,e,0),r=1+t/e;a(M,M,n),o(M,M,h(v.get(),r,r,r)),a(M,M,p(n,n,-1/r))}let N=i(l()),F=_(0,1,0),I=s(l(),u(b.get(),F,T));I[12]=x[x.length-1][0],I[13]=x[x.length-1][1],I[14]=x[x.length-1][2],c(I,I,M);let L=n.tube,R=V(E*(r?D:1)+t,x,L);R.transformation=N;let z=[R],B=n.tip,H=P(B,A,j,24,!1,!1,!0);H.transformation=I,z.push(H);let U=n.cap,W=P(U,A,j,24,!1,!0,!1);W.transformation=I,z.push(W);let G=s(l(),u(b.get(),F,w));return G[12]=x[0][0],G[13]=x[0][1],G[14]=x[0][2],c(G,G,M),z.push(H.instantiate({transformation:G})),z.push(W.instantiate({transformation:G})),z};return{normal:r(!1),focused:r(!0)}}function V(e,t,n){let r=[];for(let t=0;t<12;t++){let n=t/12*2*Math.PI;r.push([Math.cos(n)*e,Math.sin(n)*e])}return F(n,r,t,[],[],!1)}function H(e,t){let n=d(g(),e[e.length-1],e[e.length-2]);f(n,n),p(n,n,C),m(n,n,e[e.length-1]);{let t=d(g(),e[0],e[1]);return f(t,t),p(t,t,C),m(t,t,e[0]),[t,...e,n]}}export{R as ShiftManipulator};
|