@arcgis/core 5.2.0-next.74 → 5.2.0-next.75
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0502641d9a214b37ff29.js +1 -0
- package/assets/esri/core/workers/chunks/0d3b2d9a19383bb63f0a.js +1 -0
- package/assets/esri/core/workers/chunks/0d9fe49812554e7d7ba7.js +1 -0
- package/assets/esri/core/workers/chunks/0daaa89de339e8ea4b81.js +1 -0
- package/assets/esri/core/workers/chunks/{1ca04ecf010e68863014.js → 0eb35e09765fd74eb698.js} +1 -1
- package/assets/esri/core/workers/chunks/12234a63d3fa4bc25e7e.js +1 -0
- package/assets/esri/core/workers/chunks/18e0e993c0c39c962e61.js +1 -0
- package/assets/esri/core/workers/chunks/{859dd86c921053bf03a1.js → 1c49c9472167a2e0c923.js} +1 -1
- package/assets/esri/core/workers/chunks/{cf360767310fb45660a8.js → 1cf8fb704c48ac3d3b15.js} +1 -1
- package/assets/esri/core/workers/chunks/{2e44978ee677aa23163d.js → 2435ef7d11f8dbb920b7.js} +1 -1
- package/assets/esri/core/workers/chunks/2501d9459f6d14c797e5.js +1 -0
- package/assets/esri/core/workers/chunks/2740f755c3a322cbd477.js +1 -0
- package/assets/esri/core/workers/chunks/27f574acf52f2c8bc2c9.js +1 -0
- package/assets/esri/core/workers/chunks/2b93888e61ca638490cf.js +1 -0
- package/assets/esri/core/workers/chunks/2f4ed8a63d57636a4ebe.js +1 -0
- package/assets/esri/core/workers/chunks/{31d19bb72a9e79b30070.js → 30818b5ff0ce51b25d6f.js} +1 -1
- package/assets/esri/core/workers/chunks/3235e14fedb19dd94807.js +1 -0
- package/assets/esri/core/workers/chunks/36ec5b84e551ab08b24a.js +1 -0
- package/assets/esri/core/workers/chunks/3c28e2040cb4fb716eaa.js +1 -0
- package/assets/esri/core/workers/chunks/3c32471785bc8570e41c.js +1 -0
- package/assets/esri/core/workers/chunks/4046bd65d7d0677f4600.js +1 -0
- package/assets/esri/core/workers/chunks/4295822fa6ef743c76f1.js +1 -0
- package/assets/esri/core/workers/chunks/{35fd2f765d2cb3f59a22.js → 42d5ed44111bea77ec71.js} +115 -115
- package/assets/esri/core/workers/chunks/43713bc6f7eea07259d0.js +1 -0
- package/assets/esri/core/workers/chunks/{a0a1f0bd3648738354a6.js → 43a65cab888d43954564.js} +1 -1
- package/assets/esri/core/workers/chunks/44a786aba84918f2b247.js +1 -0
- package/assets/esri/core/workers/chunks/46873badbd6ce8ff4e1e.js +1 -0
- package/assets/esri/core/workers/chunks/4d7a3b3aaf876da0891b.js +1 -0
- package/assets/esri/core/workers/chunks/{509aecafbc629bee1c15.js → 4fe2cca405180af23364.js} +1 -1
- package/assets/esri/core/workers/chunks/50b08415e072a49bc572.js +1 -0
- package/assets/esri/core/workers/chunks/519af918050b47f93516.js +1 -0
- package/assets/esri/core/workers/chunks/{bd311c85437743cf7d2f.js → 53d165b4f30fd64e5d8a.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a3afee3ecd806b4aa81.js → 552d6aecc7d88d16227b.js} +1 -1
- package/assets/esri/core/workers/chunks/{bff75cc7413bf0d319db.js → 5627f562dea8bae2f346.js} +1 -1
- package/assets/esri/core/workers/chunks/5ba3a30b7cbfa9e3aa62.js +1 -0
- package/assets/esri/core/workers/chunks/{0e81c6d4f1c81f9b0a1b.js → 5e1d84e97de0e662aaa9.js} +1 -1
- package/assets/esri/core/workers/chunks/{2baa16ec8559e77c226f.js → 64a1ffc221e5b63b43fb.js} +1 -1
- package/assets/esri/core/workers/chunks/{9ca59077712e45ef4d56.js → 6743d726e45e7b660505.js} +1 -1
- package/assets/esri/core/workers/chunks/69b0dcd7bcd8ec42e2c3.js +1 -0
- package/assets/esri/core/workers/chunks/6b783f440c4a5d36e879.js +1 -0
- package/assets/esri/core/workers/chunks/6dddd3df31961b9fda12.js +1 -0
- package/assets/esri/core/workers/chunks/6fc3553c52af6ace926d.js +1 -0
- package/assets/esri/core/workers/chunks/702b2381acf4d1f90094.js +1 -0
- package/assets/esri/core/workers/chunks/{9e25f715cda59c686a4c.js → 792303e4090c0c70c4ff.js} +1 -1
- package/assets/esri/core/workers/chunks/7a24cc0f3b4eff2bdb8e.js +1 -0
- package/assets/esri/core/workers/chunks/7dc5aedc964eacd1be5a.js +1 -0
- package/assets/esri/core/workers/chunks/841c81c280114412c95b.js +1 -0
- package/assets/esri/core/workers/chunks/8a36b999cbd65dd2f16c.js +1 -0
- package/assets/esri/core/workers/chunks/8ae3a6ddc87bf8315583.js +1 -0
- package/assets/esri/core/workers/chunks/9cff18e6f751d1b3085e.js +1 -0
- package/assets/esri/core/workers/chunks/{b6d26d9738c0787acc38.js → a6a2a4a2bae0d327d7ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{c1a4d499a30f3d80567b.js → a7a7d3289d4ca95f545f.js} +1 -1
- package/assets/esri/core/workers/chunks/abb6c76d5dba3559a68e.js +1 -0
- package/assets/esri/core/workers/chunks/b14961a9f1f40028f141.js +1 -0
- package/assets/esri/core/workers/chunks/b6cd165d0e58598f28a5.js +1 -0
- package/assets/esri/core/workers/chunks/{f1727b4a32cb6f36a5e6.js → b78f509fd8e95f728178.js} +1 -1
- package/assets/esri/core/workers/chunks/b9d1bb106737a05290e1.js +1 -0
- package/assets/esri/core/workers/chunks/{faa55265020591fd2224.js → bc0395777c5c1adb1ddb.js} +1 -1
- package/assets/esri/core/workers/chunks/{94368a097e6190ce3c7a.js → c37b28f200b704ae6002.js} +1 -1
- package/assets/esri/core/workers/chunks/cff6390b863361eaeeed.js +1 -0
- package/assets/esri/core/workers/chunks/d1c7c877edc6948f3801.js +1 -0
- package/assets/esri/core/workers/chunks/d2172583ee6e481a66aa.js +1 -0
- package/assets/esri/core/workers/chunks/{193aed69de2dec4f36b6.js → d633e98b0dfa0490e4de.js} +1 -1
- package/assets/esri/core/workers/chunks/d8eca13c127b443141b7.js +1 -0
- package/assets/esri/core/workers/chunks/ddd8f6154e265dbb6f9f.js +1 -0
- package/assets/esri/core/workers/chunks/de601f0d5a2a282d2efd.js +1 -0
- package/assets/esri/core/workers/chunks/{fdca9873914b9dbd9244.js → e59101f1d060d0a30a65.js} +1 -1
- package/assets/esri/core/workers/chunks/eb1a86159dbc098f06fe.js +1 -0
- package/assets/esri/core/workers/chunks/{b3b53cf0a3a30164d337.js → ee9eb381e675d2d01260.js} +1 -1
- package/assets/esri/core/workers/chunks/{264fd750691d517ab1f3.js → f43a0edf58941e2ac78e.js} +1 -1
- package/assets/esri/core/workers/chunks/{4abd54518e35050feb90.js → f78acff510ca615d42e4.js} +1 -1
- package/assets/esri/core/workers/chunks/{01c92e68fb17cf2d0e08.js → f7a5c4d22a24e1ac433c.js} +1 -1
- package/chunks/GaussianSplat.glsl.js +8 -8
- package/chunks/GaussianSplatShadow.glsl.js +4 -5
- package/chunks/OccludedGeometryDepth.glsl.js +5 -0
- package/chunks/ShadowCastVisualize.glsl.js +2 -2
- package/config.js +1 -1
- package/core/importUtils.js +2 -0
- package/geometry/operators/importUtils.js +2 -0
- package/geometry/support/curves/densifyCurvedGeometry.js +1 -1
- package/geometry/support/normalizeUtils.d.ts +17 -15
- package/geometry/support/normalizeUtils.js +1 -1
- package/kernel.js +1 -1
- package/layers/FeatureLayer.d.ts +1 -1
- package/layers/graphics/data/QueryEngine.js +1 -1
- package/layers/graphics/data/queryUtils.js +1 -1
- package/layers/graphics/hydratedFeatures.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/geoprocessor/utils.js +1 -1
- package/rest/identify.js +1 -1
- package/rest/imageService.js +1 -1
- package/rest/query/operations/query.js +1 -1
- package/rest/query/operations/queryAttributeBins.js +1 -1
- package/rest/query/operations/queryPivot.js +1 -1
- package/rest/query/operations/queryTopFeatures.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/CIMEffects.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/layers/support/RouteLayerInteraction.js +1 -1
- package/views/2d/viewpointUtils.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/ReshapeOperation.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/interactive/visualElements/VerticesVisualElement.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatCovariance.glsl.js +8 -3
- package/views/3d/webgl-engine/core/shaderLibrary/util/GaussianSplatEvaluation.glsl.js +8 -2
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowAccumulator.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulate.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastAccumulateTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClear.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastClearTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastMaskTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastRenderer.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualize.glsl.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechnique.js +2 -0
- package/views/3d/webgl-engine/effects/shadowAccumulation/ShadowCastVisualizeTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/lib/CutFillVisualization.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/GaussianSplatPass.glsl.js +28 -21
- package/views/3d/webgl-engine/shaders/OccludedGeometryDepth.glsl.js +2 -0
- package/views/3d/webgl-engine/shaders/OccludedGeometryDepthTechnique.js +2 -0
- package/views/selection/SelectionOperation.js +1 -1
- package/widgets/Feature/FeatureRelationship/FeatureRelationshipViewModel.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +8 -1
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/LayerItem.d.ts +8 -1
- package/widgets/support/SelectionList/LayerItem.js +1 -1
- package/widgets/support/SelectionList/SelectionListViewModel.d.ts +29 -1
- package/widgets/support/SelectionList/SelectionListViewModel.js +1 -1
- package/widgets/support/SelectionList.js +1 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/assets/esri/core/workers/chunks/0dbf31a663b5220a3136.js +0 -1
- package/assets/esri/core/workers/chunks/0df660dfd941cff3ea1d.js +0 -1
- package/assets/esri/core/workers/chunks/1418c03c4ab87f7ab5f4.js +0 -1
- package/assets/esri/core/workers/chunks/160b204cbf5bda2a29e9.js +0 -1
- package/assets/esri/core/workers/chunks/1cc063aa2ddf44bbd515.js +0 -1
- package/assets/esri/core/workers/chunks/2a2ed7bd44010f24c2dd.js +0 -1
- package/assets/esri/core/workers/chunks/2bdb9b5365869081c936.js +0 -1
- package/assets/esri/core/workers/chunks/3d6b2d5ae647e140abaf.js +0 -1
- package/assets/esri/core/workers/chunks/44e8cd4b3dad777ab0c9.js +0 -1
- package/assets/esri/core/workers/chunks/45ccca01db0027b9dc16.js +0 -1
- package/assets/esri/core/workers/chunks/4cf2b0558a4acc141429.js +0 -1
- package/assets/esri/core/workers/chunks/4e129b9f5772a06e580c.js +0 -1
- package/assets/esri/core/workers/chunks/5441f96cdd0660229efe.js +0 -1
- package/assets/esri/core/workers/chunks/553be2bd69bd311477ea.js +0 -1
- package/assets/esri/core/workers/chunks/56bbde1dff96b423fbb9.js +0 -1
- package/assets/esri/core/workers/chunks/613e799377bdb767c955.js +0 -1
- package/assets/esri/core/workers/chunks/623d5518bca227f643bd.js +0 -1
- package/assets/esri/core/workers/chunks/62811bca7ad2100c023c.js +0 -1
- package/assets/esri/core/workers/chunks/64176f7ae719289a2f79.js +0 -1
- package/assets/esri/core/workers/chunks/73f77f5a6907cb8d9a35.js +0 -1
- package/assets/esri/core/workers/chunks/76b573143d1a65fdbcb6.js +0 -1
- package/assets/esri/core/workers/chunks/7b5b66ae79e0287e3ade.js +0 -1
- package/assets/esri/core/workers/chunks/7e373d9c98ce910db9d2.js +0 -1
- package/assets/esri/core/workers/chunks/86a4057572755b403548.js +0 -1
- package/assets/esri/core/workers/chunks/877594b6db08da98acd7.js +0 -1
- package/assets/esri/core/workers/chunks/98e6c1d035755a074d24.js +0 -1
- package/assets/esri/core/workers/chunks/a27cdf4c29dd50a6dab1.js +0 -1
- package/assets/esri/core/workers/chunks/a294dd12b5c708ce04af.js +0 -1
- package/assets/esri/core/workers/chunks/a9053ad0f4e8c4705665.js +0 -1
- package/assets/esri/core/workers/chunks/b33d870cbfa238762c5e.js +0 -1
- package/assets/esri/core/workers/chunks/b599b7dadce8b8bc88f6.js +0 -1
- package/assets/esri/core/workers/chunks/b984b808d383974ca3d8.js +0 -1
- package/assets/esri/core/workers/chunks/c25dc9073e73d6b44d88.js +0 -1
- package/assets/esri/core/workers/chunks/c45a5bcf26659daf02a1.js +0 -1
- package/assets/esri/core/workers/chunks/c46f79d5b7712adbbd1c.js +0 -1
- package/assets/esri/core/workers/chunks/c866b66ba72d96453899.js +0 -1
- package/assets/esri/core/workers/chunks/c873383e7dae35dc1a61.js +0 -1
- package/assets/esri/core/workers/chunks/d08f81d545930a79fb2e.js +0 -1
- package/assets/esri/core/workers/chunks/d607cf154218d20e4114.js +0 -1
- package/assets/esri/core/workers/chunks/da6134c7883531f21afe.js +0 -1
- package/assets/esri/core/workers/chunks/e4a2eefffe16cd5bb20f.js +0 -1
- package/assets/esri/core/workers/chunks/e602b91d8fdc36a92530.js +0 -1
- package/assets/esri/core/workers/chunks/ebfb3cdc0df15eb05d75.js +0 -1
- package/assets/esri/core/workers/chunks/f721756a6c1593f96409.js +0 -1
- package/assets/esri/core/workers/chunks/fb51f823b25c827c6b29.js +0 -1
- package/views/3d/webgl-engine/lib/ShadowAccumulator.js +0 -2
- package/views/3d/webgl-engine/lib/ShadowCastRenderer.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulate.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastAccumulateTechniqueConfiguration.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastClear.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastClearTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastMaskTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualize.glsl.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechnique.js +0 -2
- package/views/3d/webgl-engine/shaders/ShadowCastVisualizeTechniqueConfiguration.js +0 -2
|
@@ -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 i}from"../../../../../core/arrayUtils.js";import{EventEmitter as a}from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{makeHandle as o,handlesGroup as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{initial as d,on as h,watch as u,syncAndInitial as c,when as m,sync as f}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 M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import H from"../../../../../geometry/Polyline.js";import{projectPoint as V}from"../../../../../geometry/projectionUtils.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as A}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as C}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterials as R,placeAtObject as P}from"../../manipulatorUtils.js";import{RenderObject as U}from"../../RenderObject.js";import{SegmentLabels3D as k}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as L}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as z,screenToRenderPlaneFromEvent as F,convertToMapCoordinates as B}from"../dragEventPipeline3D.js";import{orientation as Z}from"../geometryUtils.js";import{canMoveZOperations as W}from"../manipulatorUtils.js";import{Settings as N}from"../settings.js";import{createVisualElements as q}from"../visualElementUtils.js";import{discRadiusSmall as X}from"../manipulations/config.js";import{MoveManipulation as Y}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as K}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as J,createEdgeOffsetIntersectionPlane as Q,createEdgeOffsetOperation as $,edgeOffsetRotationMatrix as ee,screenEdgeLengthSquared as te,getDistanceInGeometrySR as ie}from"./edgeOffsetUtils.js";import{createTooltipInfos as ae,connectTooltipToManipulatedObject as ne,getUpdatedTranslateObjectTooltipInfo as oe,getUpdatedEdgeOffsetTooltipInfo as se}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as re}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as le}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as pe,createSphereGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as he}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as ue,addMapDelta as ce,createManipulatorDragEventPipeline as me,dragAtLocation as fe,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as _e}from"../../../../interactive/keybindings.js";import{SnappingContext as ve}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Me}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as be,enterInputModeIfAvailable as xe}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as ye}from"../../../../support/GeometryWorkerHandle.js";const Oe=Symbol(),Ee=Symbol(),je=Symbol(),Ie=Symbol();let Se=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(Ie)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new N({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._measurementWorker=new ye({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(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=ae(this._toolOptions,e),this._vertexManipulatorMaterials=R({color:i.color.toUnitRGBA(),outlineColor:i.outlineColor.toUnitRGBA(),focusedOutlineColor:i.focusedOutlineColor.toUnitRGBA(),renderOccluded:i.renderOccluded});const a=t.edge;this._edgeManipulatorMaterials=R({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),renderOccluded:a.renderOccluded});const n=t.edgeOffset;this._edgeOffsetManipulatorMaterials=R({color:n.color.toUnitRGBA(),focusedColor:n.focusedColor.toUnitRGBA(),renderOccluded:n.renderOccluded,shaded:!1});const o=t.selected;this._selectedManipulatorMaterials=R({color:o.color.toUnitRGBA(),outlineColor:o.outlineColor.toUnitRGBA(),focusedOutlineColor:o.focusedOutlineColor.toUnitRGBA(),renderOccluded:o.renderOccluded}),this.tooltip=be(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{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),i.applyColor(this._edgeOffsetManipulatorMaterials.material),i.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),a.applyColor(this._selectedManipulatorMaterials.material),a.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),a.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Te(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:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},d),ne(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),h(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),h(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(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"key-down"===e.type&&e.key===_e.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!xe(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}clearSelection(){let e=!1;for(const t of this._manipulatorInfos)if(t.manipulator.selected){e=!0;break}e&&(this._clearSelection(),this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed"))}selectManipulator(e){if(null==this._manipulatorInfos.find(t=>t.manipulator===e)||!e.selectable)return!1;let t=e.selected;for(const i of this._manipulatorInfos)if(i.manipulator!==e&&i.manipulator.selected){t=!1;break}return t||(this._clearSelection(),e.selected=!0,this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed")),!0}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(Ee),this.removeHandles(Ie),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&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=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._toolOptions.labels;this._segmentLabels=new k({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=1===e&&this._someVerticesSelected;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.grabbing||n&&!o.manipulator.selected||a.push(o),i++);if(a.length===i){if(n||this._hideReshapeControls(),this._moveVertices(a,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(a,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(),o(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],Ie)}_showReshapeControls(){this.removeHandles(Ie)}_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){const t=this._manipulatorInfos.filter(Te).find(t=>t.manipulator===e||t.edgeManipulator===e);null!=t&&(this.removeHandles(Ee),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],Ee))}_hideReshapeManipulators(e){return s(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Te(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(Oe):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,Oe)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];this._forEachVertex(t=>{const{selected:i,grabbing:a}=t.manipulator;(i&&!a||t===e.info)&&n.push(t)}),this._moveVertices(n,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&&(0!==this._numGrabbing||0!==this._numDragging))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;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new K({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._showReshapeControls(),this._resetTooltip(),e=p(e))}),n.next(()=>this._onDragCancel(!0,()=>e=p(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){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new Y({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&W(t.operations,t.elevationInfo),snapToScene:!1,radius:Y.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)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=Me({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new ve({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(d),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(ue(this.view,e,t.graphic??void 0)).next(...p).next(ce()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>("end"===e.action&&this._showReshapeControls(),this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),d),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(je),e&&this.addHandles(le({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),je)},d)])}_createVisualElements(){const{object:e,view:t}=this,i=q({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof re?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(h(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=o,{material:m,focusedMaterial:f}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){const e=pe(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=pe(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new U(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new U(this._edgeOffsetManipulatorGeometryInside.instantiate({material:f}),2),new U(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new U(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:f}),2)],_=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:De(n)}),v=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:De(n)}),M={manipulator:_,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(M,o.minSquaredEdgeLength);const b=()=>this._updateEdgeOffsetManipulator(M);b(),M.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",b)}));const 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([M.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),me(_,this._createEdgeOffsetPipeline(M,t,a)),me(v,this._createEdgePipeline(M,t,a)),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})=>{M.grabMapPoint="start"===t?J(e,this.view,this.object,M):null})],_),this._manipulatorInfos.push(M),this.manipulators.addMany([_,v]),this.events.emit("manipulators-changed"),M}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=r&&te(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),o(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),o(()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=Q(this.view,e.manipulator.elevationAlignedLocation,$(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ee(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(Ce,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(fe(this.view,r)).next(z(this.view,r,t,s,e)).next(ge()).next(ce()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&(this._showReshapeControls(),this._resetTooltip())}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(fe(this.view,a.elevationAlignedLocation)).next(r).next(F(this.view)).next(B(this.view,i.data.spatialReference)).next(ce()).next(we()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:o}=this,r=$(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),d=Q(n,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=p(h)},c=this.events.on("undo",u);return h=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==d?(u(),null):{...e,operation:r,plane:d},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const n=()=>new H({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),o=new re({view:this.view,isDraped:t.isDraped,geometry:n(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=s([u(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{o.color=e.toUnitRGBA(),o.isDraped=t},c),t.on("committed",()=>{o.geometry=n()}),r(o)]);return o.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?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){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<Ge){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<Ge){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!xe(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)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Te).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=$(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??J(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,o=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ie(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?o(e):a()};return s([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations,o=this._settings;if(!n)return null;const r=n.data.type,l=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{size:e,outlineSize:t}=He(o.manipulators.vertex),{material:i,outlineMaterial:a}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=de(i,e,16,16),this._vertexManipulatorOutlineGeometry=de(a,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=He(o.manipulators.edge),{material:i,outlineMaterial:a}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=de(i,e,16,16),this._edgeManipulatorOutlineGeometry=de(a,t,16,16)}const d=this._vertexManipulatorGeometry,h=this._vertexManipulatorOutlineGeometry,u=[];if("point"!==r&&"mesh"!==r){u.push(new U(d.instantiate(),4|Re),new U(h.instantiate(),5|Re),new U(h.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),6|Re));{const{material:e,outlineMaterial:t,focusedMaterial:i}=this._selectedManipulatorMaterials;u.push(new U(d.instantiate({material:e}),8),new U(h.instantiate({material:t}),9),new U(h.instantiate({material:i}),10))}}if(this.enableMidpoints){const{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,i=this._edgeManipulatorGeometry,a=this._edgeManipulatorOutlineGeometry,n=6|Pe,o=5|Pe;u.push(new U(i.instantiate({material:e}),n),new U(a.instantiate({material:t}),n),new U(i.instantiate(),o),new U(a.instantiate(),o))}const c="vertex"===e.type,m=()=>new G({view:a,renderObjects:u,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:"point"===r||"mesh"===r,available:this.object.visible,metadata:{deleting:!1},location:De(l)});let f=null;c&&(f=this.object.createReshapeManipulator?.({vertex:e,defaultCreate:m,elevationInfo:t,selected:i})??null),f??=m(),f.selected=i,this._setTypeSpecificManipulatorSettings(f,e,t);const g=c?{manipulator:f,handle:e,type:"vertex",selectedIndex:0}:{manipulator:f,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(g),this.manipulators.add(f),this._updateManipulatorPosition(g),"edge"===g.type){const e=[];for(const t of[g.handle.leftVertex,g.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(g)))}g.locationUpdateHandle=s(e),this._manipulatorHandles.add(g.locationUpdateHandle,f)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(f,!0),f);const _=me(f,(e,i,o,s)=>{let r=null;const{snappingStep:d,cancelSnapping:h}=Me({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new ve({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new L}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>r=p(r)),t)).next(h);const{elevationAlignedLocation:u}=e,c=this.object.graphic??void 0,m=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,n,c):z(a,u,t,l,c);i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(r=n.createUndoGroup()),"edge"===g.type){const t=this._splitEdgeManipulator(g);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:g,snapOrigin:g.handle.pos}}).next(fe(a,u)).next(m).next(ue(a,t,c)).next(...d).next(ce()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(r=p(r)),this._resetTooltip()})});return this._manipulatorHandles.add([_,f.events.on("immediate-click",e=>this._manipulatorClickCallback(e,g)),f.events.on("select-changed",()=>{g.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),f.events.on("focus-changed",()=>{this._resetTooltip()})],f),this.events.emit("manipulators-changed"),g}_screenToSceneMapForVertexDrag(e,t,i){const{view:a}=this,{coordinateHelper:n,spatialReference:o}=t.data;let s=null;return t=>{if("start"===t.action&&(s=n.vectorToPoint(t.snapOrigin)),null==s)return null;const r=a.toMap(t.screenEnd,{exclude:i,excludeLabels:!0});return null==r?null:(r.z=A(r,a,e),V(r,r,o)?{...t,mapStart:s,mapEnd:r}:null)}}_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,i){const a=this._settings;switch(t.type){case"vertex":{e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.elevationInfo=i;const t=this._operations?.data.type;if(e.interactive=null!=t&&"point"!==t&&"mesh"!==t,null==this.object.createReshapeManipulator){const{size:t,collisionPadding:i}=a.manipulators.vertex;e.radius=t/2+i,e.state=Re}break}case"line":{e.state=Pe,e.selectable=!1,e.cursor="copy",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(Ee),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Te(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const 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){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(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(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ae),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=T(r,l,p,t.data.spatialReference)}else x(Ce,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),"line"===a.leftSegment?.type&&this._createVertexOrEdgeManipulator(a.leftSegment),"line"===a.rightSegment?.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(Ce,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.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&&W(this._operations,o.elevationInfo),this._moveManipulation.angle=Z(s),this._moveManipulation.radius=Y.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&W(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ve(t,e):o&&(i=Ve(e,o))}const s=a?.handle,r=s?o.getReshapeMoveConfig?.({vertex:s,numSelected:t})??null:null;switch(r?.xyAxisMode){case"all":this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e;break;case"hidden":this._moveManipulation.xyAxisManipulation.available=!1,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=!1}this._moveManipulation.angle=r?.angle??i,this._moveManipulation.radius=X}0!==t&&i?(E(e,e,1/t),Ae.spatialReference=this._operations.data.spatialReference,Ae.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ae),this._moveManipulation.elevationAlignedLocation=Ae):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?P(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(!i)return;const a=e.filter(e=>"vertex"===e.type&&i.canRemoveVertex(e.handle.part));if(a.length>0){const e=this._createBeforeVertexRemoveEvent(a);if(this.events.emit("before-vertex-remove",e),e.defaultPrevented)return}for(const n of a){const e=n.handle.part;if(i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){const t=this._operations,i=e.map(e=>{const i=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:i,vertexIndex:e.handle.index}});let a=!1;return{type:"before-vertex-remove",object:this.object,removed:i.map(e=>e.coordinates),vertices:i,get defaultPrevented(){return a},preventDefault(){a=!0}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a&&(e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),!this._movingManipulatorsHidden))for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===he.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===he.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=oe(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=se(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?se(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"multipoint":case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected)}_forEachVertex(e){for(const t of this._manipulatorInfos)"vertex"===t.type&&e(t)}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function we(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function He(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}function Ve(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function De(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Te(e){return"edge"===e.type&&"edgeManipulator"in e}e([g()],Se.prototype,"_numGrabbing",void 0),e([g()],Se.prototype,"_numDragging",void 0),e([g()],Se.prototype,"_pendingEdgeOffsetInfo",void 0),e([g()],Se.prototype,"_operations",null),e([g()],Se.prototype,"_segmentLabels",void 0),e([g({constructOnly:!0})],Se.prototype,"tool",void 0),e([g()],Se.prototype,"tooltip",void 0),e([g()],Se.prototype,"activeTooltipInfo",void 0),e([g({readOnly:!0})],Se.prototype,"updating",null),e([g()],Se.prototype,"manipulators",null),e([g()],Se.prototype,"view",null),e([g()],Se.prototype,"object",null),e([g()],Se.prototype,"enableZShape",null),e([g()],Se.prototype,"enableDeleteVertices",null),e([g()],Se.prototype,"enableZVertex",null),e([g()],Se.prototype,"autoHideManipulators",null),e([g()],Se.prototype,"enableMoveObject",null),e([g()],Se.prototype,"enableMidpoints",null),e([g()],Se.prototype,"enableEdgeOffset",null),e([g()],Se.prototype,"_toolOptions",null),e([g()],Se.prototype,"_accentColor",null),e([g()],Se.prototype,"_tooltipsContext",null),Se=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],Se);const Ae=T(0,0,void 0,D.WGS84),Ce=I(),Ge=1e-6,Re=16,Pe=32;export{Se as ReshapeOperation};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{EventEmitter as a}from"../../../../../core/Evented.js";import n from"../../../../../core/Handles.js";import{makeHandle as o,handlesGroup as s,destroyHandle as r}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as l,removeMaybe as p}from"../../../../../core/maybe.js";import{initial as d,on as h,watch as u,syncAndInitial as c,when as m,sync as f}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 M,subtract as b,lerp as x,set as y,add as O,scale as E}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as j,create as I}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as S}from"../../../../../core/support/UpdatingHandles.js";import w from"../../../../../geometry/Point.js";import H from"../../../../../geometry/Polyline.js";import{projectPoint as V}from"../../../../../geometry/projectionUtils.js";import D from"../../../../../geometry/SpatialReference.js";import{makeDehydratedPoint as T}from"../../../../../layers/graphics/dehydratedPoint.js";import{getZForElevationMode as A}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as C}from"../../../../../symbols/support/utils.js";import{Manipulator3D as G}from"../../Manipulator3D.js";import{createManipulatorMaterials as R,createSphereGeometryAsOffsets as P,placeAtObject as U,screenSizeManipulatorSettings as k}from"../../manipulatorUtils.js";import{RenderObject as L}from"../../RenderObject.js";import{SegmentLabels3D as F}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as z}from"../../SnappingVisualizer3D.js";import{screenToMapXYAtLocation as B,screenToRenderPlaneFromEvent as Z,convertToMapCoordinates as W}from"../dragEventPipeline3D.js";import{orientation as N}from"../geometryUtils.js";import{canMoveZOperations as q}from"../manipulatorUtils.js";import{Settings as X}from"../settings.js";import{createVisualElements as Y}from"../visualElementUtils.js";import{discRadiusSmall as K}from"../manipulations/config.js";import{MoveManipulation as J}from"../manipulations/MoveManipulation.js";import{MoveXYObjectManipulation as Q}from"../manipulations/MoveXYObjectManipulation.js";import{getMapPointAtEdgeOffsetManipulatorElevation as $,createEdgeOffsetIntersectionPlane as ee,createEdgeOffsetOperation as te,edgeOffsetRotationMatrix as ie,screenEdgeLengthSquared as ae,getDistanceInGeometrySR as ne}from"./edgeOffsetUtils.js";import{createTooltipInfos as oe,connectTooltipToManipulatedObject as se,getUpdatedTranslateObjectTooltipInfo as re,getUpdatedEdgeOffsetTooltipInfo as le}from"./reshapeTooltipUtils3D.js";import{OutlineVisualElement as pe}from"../../visualElements/OutlineVisualElement.js";import{createElevationUpdateHandle as de}from"../../../support/elevationUpdateUtils.js";import{createExtrudedTriangle as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{mouseButtons as ue}from"../../../../input/mouseButtons.js";import{sceneSnappingAtLocation as ce,addMapDelta as me,createManipulatorDragEventPipeline as fe,dragAtLocation as ge,addScreenDelta as _e}from"../../../../interactive/dragEventPipeline.js";import{tooltipKeys as ve}from"../../../../interactive/keybindings.js";import{SnappingContext as Me}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as be}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{makeTooltip as xe,enterInputModeIfAvailable as ye}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{GeometryWorkerHandle as Oe}from"../../../../support/GeometryWorkerHandle.js";const Ee=Symbol(),je=Symbol(),Ie=Symbol(),Se=Symbol();let we=class extends t{get _movingManipulatorsHidden(){return this.hasHandles(Se)}get _operations(){return this.object.operations}constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new n,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=0,this._pendingEdgeOffsetInfo=null,this._updatingHandles=new S,this._recreatingManipulators=!1,this._settings=new X({getTheme:()=>this.view.effectiveTheme}),this.events=new a,this.activeTooltipInfo=null,this._measurementWorker=new Oe({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(){const{view:e}=this,t=this._settings.manipulators,i=t.vertex;this.tooltipInfos=oe(this._toolOptions,e),this._vertexManipulatorMaterials=R({color:i.color.toUnitRGBA(),outlineColor:i.outlineColor.toUnitRGBA(),focusedOutlineColor:i.focusedOutlineColor.toUnitRGBA(),screenSize:i,renderOccluded:i.renderOccluded});const a=t.edge;this._edgeManipulatorMaterials=R({color:a.color.toUnitRGBA(),outlineColor:a.outlineColor.toUnitRGBA(),screenSize:a,renderOccluded:a.renderOccluded});const n=t.edgeOffset;this._edgeOffsetManipulatorMaterials=R({color:n.color.toUnitRGBA(),focusedColor:n.focusedColor.toUnitRGBA(),renderOccluded:n.renderOccluded,shaded:!1});const o=t.selected;this._selectedManipulatorMaterials=R({color:o.color.toUnitRGBA(),outlineColor:o.outlineColor.toUnitRGBA(),focusedOutlineColor:o.focusedOutlineColor.toUnitRGBA(),screenSize:o,renderOccluded:o.renderOccluded}),this.tooltip=xe(()=>({view:e,options:this._toolOptions.tooltips})),this.addHandles([this._updatingHandles.add(()=>{const e=this._settings.manipulators;return{vertexSettings:e.vertex,edgeSettings:e.edge,edgeOffsetSettings:e.edgeOffset,selectedSettings:e.selected}},({vertexSettings:e,edgeSettings:t,edgeOffsetSettings:i,selectedSettings:a})=>{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),i.applyColor(this._edgeOffsetManipulatorMaterials.material),i.applyFocused(this._edgeOffsetManipulatorMaterials.focusedMaterial),a.applyColor(this._selectedManipulatorMaterials.material),a.applyOutline(this._selectedManipulatorMaterials.outlineMaterial),a.applyFocusedOutline(this._selectedManipulatorMaterials.focusedMaterial)}),this._updatingHandles.add(()=>this.object.visible,e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e,Te(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:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")},d),se(this.tooltip,this.object,()=>this._tooltipsContext,this._updatingHandles),this._updatingHandles.add(()=>this.tooltip.mode,(e,t)=>{"input"===t&&"input"!==e&&this._resetTooltip()}),h(()=>this._operations,"vertex-update",e=>this._updateManipulatorPositions(e.vertices),{onListenerAdd:()=>this._recreateManipulators()}),h(()=>this._operations?.data,"change",e=>{"undo"!==e.operation&&"redo"!==e.operation||this._recreateManipulators()})])}destroy(){this._removeManipulators(),this._updatingHandles.destroy(),this._segmentLabels=l(this._segmentLabels),this.tooltip=l(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"key-down"===e.type&&e.key===ve.enterInputMode&&("reshape-edge-offset"===this.activeTooltipInfo?.type?this._enterInputModeDuringEdgeOffset(e):!!ye(e,this.tooltip)&&(this.tool.endDrag(),!0))}removeSelectedVertices(){const e=this._manipulatorInfos.filter(e=>e.manipulator.selected&&"vertex"===e.type);return this._removeVertices(e),e.length}onManipulatorSelectionChanged(){this.events.emit("manipulators-changed")}clearSelection(){let e=!1;for(const t of this._manipulatorInfos)if(t.manipulator.selected){e=!0;break}e&&(this._clearSelection(),this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed"))}selectManipulator(e){if(null==this._manipulatorInfos.find(t=>t.manipulator===e)||!e.selectable)return!1;let t=e.selected;for(const i of this._manipulatorInfos)if(i.manipulator!==e&&i.manipulator.selected){t=!1;break}return t||(this._clearSelection(),e.selected=!0,this._updateMoveManipulationPosition(),this.events.emit("manipulators-changed")),!0}_removeManipulators(){this._manipulatorHandles.removeAll(),this.removeHandles(je),this.removeHandles(Se),this._moveManipulation=l(this._moveManipulation),this._objectMoveManipulation=l(this._objectMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._operations)return;const t=this.object.elevationInfo;for(const{vertices:i,segments:a,index:n}of this._operations.data.parts){const o=e?.byPartIndex.get(n);for(const e of i){const i=o?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of a)"line"===e.type&&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=l(this._segmentLabels)),this._createManipulators(),!this._segmentLabels&&this._operations){const e=this._toolOptions.labels;this._segmentLabels=new F({context:{view:this.view,editGeometryOperations:this._operations,elevationInfo:this.object.elevationInfo,labelOptions:e},visible:e.enabled})}this._recreatingManipulators=!1}}_perObjectManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=1===e&&this._someVerticesSelected;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.grabbing||n&&!o.manipulator.selected||a.push(o),i++);if(a.length===i){if(n||this._hideReshapeControls(),this._moveVertices(a,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(a,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(),o(()=>this._forEachVertex(e=>this._updateManipulatorPosition(e)))],Se)}_showReshapeControls(){this.removeHandles(Se)}_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){const t=this._manipulatorInfos.filter(Te).find(t=>t.manipulator===e||t.edgeManipulator===e);null!=t&&(this.removeHandles(je),this.addHandles([this._moveManipulation.hideManipulators(),this._hideReshapeManipulators(t)],je))}_hideReshapeManipulators(e){return s(this._manipulatorInfos.flatMap(t=>t===e?null:[t.manipulator.disableDisplay(),Te(t)?t.edgeManipulator.disableDisplay():null]))}_toggleAutoHideManipulators(e){this.autoHideManipulators&&(e?this.removeHandles(Ee):this.tool.manipulators.forEach(({manipulator:e})=>{const t=e.disableDisplay?.();t&&this.addHandles(t,Ee)}))}_isMultiVertexSelection(){return this._manipulatorInfos.reduce((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e,0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(2),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];this._forEachVertex(t=>{const{selected:i,grabbing:a}=t.manipulator;(i&&!a||t===e.info)&&n.push(t)}),this._moveVertices(n,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&&(0!==this._numGrabbing||0!==this._numDragging))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;const i=this._reshapeEventState!==e;return this._reshapeEventState=e,i}_createObjectMoveManipulation(){const{tool:e,view:t,object:i,_operations:a}=this;if(a){if(this._objectMoveManipulation=new Q({tool:e,view:t,object:i}),this.enableMoveObject){let e=null;this._manipulatorHandles.add(this._objectMoveManipulation.createDragPipeline((t,i,n)=>{i.next(e=>this._trackNumDragging(e)).next(t=>("start"===t.action&&(e=a.createUndoGroup()),t)).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(t=>{"end"===t.action&&(this._showReshapeControls(),this._resetTooltip(),e=p(e))}),n.next(()=>this._onDragCancel(!0,()=>e=p(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){const{object:t,tool:i,view:a,_operations:n}=this;if(!n)return;this._moveManipulation=new J({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t.operations,t.elevationInfo),snapToScene:!1,radius:J.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)]));const o=e=>t=>{this.addHandles([t.events.on("focus-changed",({action:t})=>{"focus"===t?this._updateTranslateTooltip(e):this._resetTooltip()})])};this._moveManipulation.xyManipulation.forEachManipulator(o(0)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(1)),this._moveManipulation.zManipulation.forEachManipulator(o(2)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=n.data.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline((a,o,s,r,l)=>{const{snappingStep:p,cancelSnapping:d}=be({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new Me({editGeometryOperations:n,elevationInfo:e,pointer:l,excludeFeature:t.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next(e=>(this._onDragCancel(),e)).next(d),{steps:s=s.next(e=>this._trackNumDragging(e)).next(e=>{const t=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.manipulatorType&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e}).next(ce(this.view,e,t.graphic??void 0)).next(...p).next(me()).next(e=>this._perObjectManipulatorDragAction(1,e)).next(e=>("end"===e.action&&this._showReshapeControls(),this._updateTranslateTooltip(a,e),e)),cancel:r}},e,s,t.graphic),this._updatingHandles.add(()=>t.visible,()=>this._updateMoveManipulationPosition(),d),t.on("committed",()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()}),this._updatingHandles.add(()=>t.isDraped,e=>{this._updateMoveManipulationPosition(),this.removeHandles(Ie),e&&this.addHandles(de({view:this.view,geometry:t.graphic?.geometry,elevationInfo:t.elevationInfo,onElevationChanges:()=>this._updateMoveManipulationPosition()}),Ie)},d)])}_createVisualElements(){const{object:e,view:t}=this,i=Y({view:t,object:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._objectMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,1)}},onManipulatorsChanged:e=>this.events.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof pe?i.visualElement:null);const a=this._outlineVisualElement;if(null!=a){const t=()=>{e.isDraped||this._updateMoveManipulationPosition()};this._manipulatorHandles.add(h(()=>a.events,"attachment-origin-changed",t,{onListenerAdd:t}))}this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=this.object.elevationInfo){const i=this.view,a=this._operations;if(e.part.vertices.length<=2||!a)return null;const n=a.data.spatialReference,o=this._settings.manipulators.edgeOffset,r=o.size/2,l=r+o.collisionPadding,p=r/l,d=p/2,h=p*Math.sqrt(3)/2,{height:u,offset:c}=o,{material:m,focusedMaterial:f}=this._edgeOffsetManipulatorMaterials;if(!this._edgeOffsetManipulatorGeometryInside){const e=he(m,h,d,d,u,c);this._edgeOffsetManipulatorGeometryInside=e}if(!this._edgeOffsetManipulatorGeometryOutside){const e=he(m,-h,d,d,u,-c);this._edgeOffsetManipulatorGeometryOutside=e}const g=[new L(this._edgeOffsetManipulatorGeometryInside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryInside.instantiate({material:f}),2),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate(),1),new L(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:f}),2)],_=new G({view:i,renderObjects:g,elevationInfo:"on-the-ground"!==t.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:l,available:this.object.visible,collisionType:{type:"disc",direction:j(0,0,1)},collisionPriority:1,metadata:{deleting:!1},location:De(n)}),v=new G({view:i,worldSized:!0,worldOriented:!1,available:this.object.visible,collisionPriority:-10,cursor:this.enableMoveObject?"move":"default",metadata:{deleting:!1},location:De(n)}),M={manipulator:_,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:v,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(M,o.minSquaredEdgeLength);const b=()=>this._updateEdgeOffsetManipulator(M);b(),M.locationUpdateHandle=s([e.leftVertex,e.rightVertex].map(e=>{const t=this._getManipulatorInfoFromHandle(e);return t?.manipulator.events.on("location-update",b)}));const 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([M.locationUpdateHandle,this._watchAndUpdateGrabState(_,!0),this._watchAndUpdateGrabState(v,!0),fe(_,this._createEdgeOffsetPipeline(M,t,a)),fe(v,this._createEdgePipeline(M,t,a)),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})=>{M.grabMapPoint="start"===t?$(e,this.view,this.object,M):null})],_),this._manipulatorInfos.push(M),this.manipulators.addMany([_,v]),this.events.emit("manipulators-changed"),M}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=p(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=r&&ae(n.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=s([i.disableDisplay(),o(()=>{i.grabbable=!0,a.grabbable=this.enableMoveObject})]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),o(()=>{p(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)})],i),n()}_updateEdgeOffsetManipulator(e){if(!this._operations)return;this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._operations.data,i=ee(this.view,e.manipulator.elevationAlignedLocation,te(t,e.handle,e.manipulator.elevationInfo)),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),n=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==a||null==n)return;const o=a.manipulator.renderLocation,s=n.manipulator.renderLocation,r=null!=i?ie(i,o,s):v;e.manipulator.modelTransform=r,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=r;const l=M(b(Ce,o,s))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgePipeline(e,t,i){return(a,n,o,s)=>{if("touch"===s){this._createEdgeOffsetPipeline(e,t,i)(a,n,o)}else if(this.enableMoveObject){const e=this.object.graphic,s=i.data.spatialReference,{elevationAlignedLocation:r}=a;n.next(e=>this._trackNumDragging(e)).next(ge(this.view,r)).next(B(this.view,r,t,s,e)).next(_e()).next(me()).next(e=>this._perObjectManipulatorDragAction(0,e)).next(e=>(this._updateTranslateObjectTooltip(0,e),e)).next(e=>{"end"===e.action&&(this._showReshapeControls(),this._resetTooltip())}),o.next(()=>this._onDragCancel(!a.metadata.deleting))}}}_createEdgeOffsetPipeline(e,t,i){return(a,n,o)=>{const s=this._pendingEdgeOffsetInfo;if(s?.manipulatorInfo===e&&"drag"!==s.mode)return void o.execute({action:"cancel"});this._clearSelection();const{initializeStep:r,cleanup:l}=this._initializeEdgeOffset(e,t,i,o),p=this._applyEdgeOffsetStep(e);n.next(e=>this._trackNumDragging(e)).next(ge(this.view,a.elevationAlignedLocation)).next(r).next(Z(this.view)).next(W(this.view,i.data.spatialReference)).next(me()).next(He()).next(e=>this._pendingEdgeOffsetInfo?e:p(e)).next(e=>{"end"!==e.action||this._pendingEdgeOffsetInfo||l()}),o.next(()=>{this._exitEdgeOffsetInputMode(),a.metadata.deleting||(l(),this._onDragCancel())})}}_initializeEdgeOffset(e,t,i,a){const{view:n,object:o}=this,r=te(i.data.coordinateHelper,e.handle,t),l=i.createUndoGroup(),d=ee(n,e.manipulator.elevationAlignedLocation,r);let h;this._splitEdgesBeforeEdgeOffset(e,r),this._selectEdgeOffsetArrow(e,r);const u=()=>{this._cleanEdgeOffsetCollapsedEdges(e,i),h=p(h)},c=this.events.on("undo",u);return h=s([this._initializeEdgeOffsetVisualElement(e,o,t,i),l,c,this._connectEdgeOffsetTooltip(e,r,i,()=>{a.execute({action:"cancel"})})]),{initializeStep:e=>null==r||null==d?(u(),null):{...e,operation:r,plane:d},cleanup:u}}_initializeEdgeOffsetVisualElement(e,t,i,a){const n=()=>new H({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:a.data.spatialReference}),o=new pe({view:this.view,isDraped:t.isDraped,geometry:n(),elevationInfo:i,width:this._settings.visualElements.lineObjects.outline.width,attached:!1,isDecoration:!0}),l=s([u(()=>({color:this._accentColor,draped:t.isDraped}),({color:e,draped:t})=>{o.color=e.toUnitRGBA(),o.isDraped=t},c),t.on("committed",()=>{o.geometry=n()}),r(o)]);return o.attached=!0,l}_applyEdgeOffsetStep(e){return t=>(this.destroyed||null==t.operation||!this._operations||(this._updateEventState(2),null==t.signedDistance?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){const i=e.handle.leftVertex.leftSegment?.leftVertex,a=e.handle.leftVertex,n=e.handle.rightVertex.rightSegment?.rightVertex,o=e.handle.rightVertex,s=t.data.coordinateHelper,r=this.view.pixelSizeAt(s.vectorToDehydratedPoint(a.pos),s.spatialReference),l=[];if(i&&s.distance(i.pos,a.pos)<Ge){const e=this._getManipulatorInfoFromHandle(a);null!=e&&l.push(e)}if(s.distance(a.pos,o.pos)<r||n&&s.distance(n.pos,o.pos)<Ge){const e=this._getManipulatorInfoFromHandle(o);null!=e&&l.push(e)}l.length&&this._removeVertices(l)}_enterInputModeDuringEdgeOffset(e){const t=this._findActiveEdgeOffsetManipulatorInfo();return!!t&&(!!ye(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)))}_exitEdgeOffsetInputMode(){this.tooltip&&(this._pendingEdgeOffsetInfo=null,this._resetTooltip(),this.tooltip.exitInputMode())}_findActiveEdgeOffsetManipulatorInfo(){return this._manipulatorInfos.filter(Te).find(({manipulator:e})=>e.hovering||e.grabbing||e.dragging)}_connectEdgeOffsetTooltipOnHover(e){const{_operations:t,object:i}=this;if(!t)return;const{elevationInfo:a}=i,n=te(t.data.coordinateHelper,e.handle,a);this._selectEdgeOffsetArrow(e,n),this.addHandles([this._initializeEdgeOffsetVisualElement(e,i,a,t),this._connectEdgeOffsetTooltip(e,n,t,()=>{this.removeHandles(n),this._exitEdgeOffsetInputMode()})],n)}_splitEdgesBeforeEdgeOffset(e,t){if(t.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftSegment);null!=t&&this._splitEdgeManipulator(t,1)}if(t.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightSegment);null!=t&&this._splitEdgeManipulator(t,0)}}_selectEdgeOffsetArrow(e,t){const i=e.grabMapPoint??$(this.view.inputManager?.latestPointerInfo?.location,this.view,this.object,e);i&&t.selectArrowFromStartPoint(i)}_connectEdgeOffsetTooltip(e,t,i,a){const n=()=>this.tooltipInfos.edgeOffset.distance.actual,o=n=>{a(),queueMicrotask(()=>{this.view.focus();const a=i.createUndoGroup();this._tooltipCallbacks.onReshapeStart?.(),this._splitEdgesBeforeEdgeOffset(e,t),this._offsetEdge(e,t,ne(n,e.manipulator.location,t,i)),this._tooltipCallbacks.onReshape?.(),this._tooltipCallbacks.onReshapeStop?.(),this._cleanEdgeOffsetCollapsedEdges(e,i),a.remove()})},r=()=>{const e=n();null!=e?o(e):a()};return s([m(()=>this.tooltip&&!this.tooltip.focused,()=>r(),f),this.tooltip.on("discard",a),this.tooltip.on("commit",e=>{"commit-and-exit"===e.type&&r()})])}_createVertexOrEdgeManipulator(e,t=this.object.elevationInfo,i=!1){const a=this.view,n=this._operations;if(!n)return null;const o=n.data.type,r=n.data.spatialReference;if("line"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(null==this._vertexManipulatorGeometry||null==this._vertexManipulatorOutlineGeometry){const{material:e,outlineMaterial:t}=this._vertexManipulatorMaterials;this._vertexManipulatorGeometry=P(e),this._vertexManipulatorOutlineGeometry=P(t)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{material:e,outlineMaterial:t}=this._edgeManipulatorMaterials;this._edgeManipulatorGeometry=P(e),this._edgeManipulatorOutlineGeometry=P(t)}const l=this._vertexManipulatorGeometry,d=this._vertexManipulatorOutlineGeometry,h=[];if("point"!==o&&"mesh"!==o){h.push(new L(l.instantiate(),4|Re),new L(d.instantiate(),5|Re),new L(d.instantiate({material:this._vertexManipulatorMaterials.focusedMaterial}),6|Re));{const{material:e,outlineMaterial:t,focusedMaterial:i}=this._selectedManipulatorMaterials;h.push(new L(l.instantiate({material:e}),8),new L(d.instantiate({material:t}),9),new L(d.instantiate({material:i}),10))}}if(this.enableMidpoints){const{material:e,focusedMaterial:t}=this._vertexManipulatorMaterials,i=this._edgeManipulatorGeometry,a=this._edgeManipulatorOutlineGeometry,n=6|Pe,o=5|Pe;h.push(new L(i.instantiate({material:e}),n),new L(a.instantiate({material:t}),n),new L(i.instantiate(),o),new L(a.instantiate(),o))}const u="vertex"===e.type,c=()=>new G({view:a,renderObjects:h,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,usePreciseLocalOrigin:"point"===o||"mesh"===o,available:this.object.visible,metadata:{deleting:!1},location:De(r),...k});let m=null;u&&(m=this.object.createReshapeManipulator?.({vertex:e,defaultCreate:c,elevationInfo:t,selected:i})??null),m??=c(),m.selected=i,this._setTypeSpecificManipulatorSettings(m,e,t);const f=u?{manipulator:m,handle:e,type:"vertex",selectedIndex:0}:{manipulator:m,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0};if(this._manipulatorInfos.push(f),this.manipulators.add(m),this._updateManipulatorPosition(f),"edge"===f.type){const e=[];for(const t of[f.handle.leftVertex,f.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",()=>this._updateManipulatorPosition(f)))}f.locationUpdateHandle=s(e),this._manipulatorHandles.add(f.locationUpdateHandle,m)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(m,!0),m);const g=fe(m,(e,i,o,s)=>{let l=null;const{snappingStep:d,cancelSnapping:h}=be({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new Me({editGeometryOperations:n,elevationInfo:t,pointer:s,excludeFeature:this.object.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:this.tool.snapToScene});o.next(t=>(this._onDragCancel(!e.metadata.deleting,()=>l=p(l)),t)).next(h);const{elevationAlignedLocation:u}=e,c=this.object.graphic??void 0,m=this.tool.snapToScene?this._screenToSceneMapForVertexDrag(t,n,c):B(a,u,t,r,c);i.next(e=>this._trackNumDragging(e)).next(e=>{if("start"===e.action&&n&&(l=n.createUndoGroup()),"edge"===f.type){const t=this._splitEdgeManipulator(f);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:f,snapOrigin:f.handle.pos}}).next(ge(a,u)).next(m).next(ce(a,t,c)).next(...d).next(me()).next(e=>{this._perVertexManipulatorDragAction(e),"end"===e.action&&(l=p(l)),this._resetTooltip()})});return this._manipulatorHandles.add([g,m.events.on("immediate-click",e=>this._manipulatorClickCallback(e,f)),m.events.on("select-changed",()=>{f.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition(),this._resetTooltip()}),m.events.on("focus-changed",()=>{this._resetTooltip()})],m),this.events.emit("manipulators-changed"),f}_screenToSceneMapForVertexDrag(e,t,i){const{view:a}=this,{coordinateHelper:n,spatialReference:o}=t.data;let s=null;return t=>{if("start"===t.action&&(s=n.vectorToPoint(t.snapOrigin)),null==s)return null;const r=a.toMap(t.screenEnd,{exclude:i,excludeLabels:!0});return null==r?null:(r.z=A(r,a,e),V(r,r,o)?{...t,mapStart:s,mapEnd:r}:null)}}_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,i){const a=this._settings;switch(t.type){case"vertex":{e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.elevationInfo=i;const t=this._operations?.data.type;if(e.interactive=null!=t&&"point"!==t&&"mesh"!==t,null==this.object.createReshapeManipulator){const{size:t,collisionPadding:i}=a.manipulators.vertex;e.radius=t/2+i,e.state=Re}break}case"line":{e.state=Pe,e.selectable=!1,e.cursor="copy",e.collisionPriority=2;const{size:t,collisionPadding:n}=a.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||C(this.object.graphic?.symbol)?{mode:"absolute-height",offset:0}:i;break}}}_watchAndUpdateGrabState(e,t){return e.events.on("grab-changed",i=>{this._onGrabStateChanged(e,t,i.action,i.pointerType)})}_onGrabStateChanged(e,t,i,a="mouse"){if(!this._recreatingManipulators){if("start"===i)t&&this._updateSelection(e),this._numGrabbing++,this._shouldHideReshapeControlsOnGrab(e)&&this._hideReshapeControls(),this._hideManipulatorsForEdgeOffset(e);else if(this._numGrabbing--,this.removeHandles(je),this._updateEventState(0),this._canShowReshapeControls&&this._showReshapeControls(),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach(e=>{const{manipulator:t}=e,i=this._operations?.data.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=i&&"point"!==i&&"mesh"!==i,Te(e)&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)}),this._objectMoveManipulation.forEachManipulator(e=>{e.interactive=e.grabbing||!this._numGrabbing}))}}_clearSelection(){for(const 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){null!=e&&(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),i(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(const t of e)this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(t))}_updateManipulatorPosition(e){const t=this._operations;if(null!=e&&t)if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ae),e.manipulator.grabbing&&null!=this._vertexLaserLineVisualElement&&(this._vertexLaserLineVisualElement.visualElement.intersectsWorldUpAtLocation=e.manipulator.renderLocation);else if("edge"===e.type){const i=this._getManipulatorInfoFromHandle(e.handle.leftVertex),a=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(null==i||null==a)return;const n=i.manipulator,o=a.manipulator;if("on-the-ground"===e.manipulator.elevationInfo?.mode){const i=n.location,a=o.location,s=.5,r=i.x+s*(a.x-i.x),l=i.y+s*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=T(r,l,p,t.data.spatialReference)}else x(Ce,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=this._operations,a=i.splitSegment(e.handle,t).createdVertex;e.locationUpdateHandle=p(e.locationUpdateHandle);const n=this.object.elevationInfo;let o;this.enableEdgeOffset?(this._removeManipulator(e),o=this._createVertexOrEdgeManipulator(a)):(o=e,o.handle=a,o.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,n)),"line"===a.leftSegment?.type&&this._createVertexOrEdgeManipulator(a.leftSegment),"line"===a.rightSegment?.type&&this._createVertexOrEdgeManipulator(a.rightSegment),this._updateManipulatorPosition(o),this.enableEdgeOffset||this._resetTooltip(),this._updateSelection(e.manipulator);const s=this._updateEventState(2),r=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.parts.indexOf(a.part);return this.events.emit("vertex-add",{type:"vertex-add",object:this.object,vertices:[{coordinates:r,componentIndex:l,vertexIndex:a.index}],added:r}),s&&this._updateEventState(0),o}_updateMoveManipulationPosition(){const e=y(Ce,0,0,0);let t=0,i=!1,a=null,n=null;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.selected?(t++,O(e,e,r.manipulator.renderLocation),null==a||r.selectedIndex>a.selectedIndex?(n=a,a=r):(null==n||r.selectedIndex>n.selectedIndex)&&(n=r)):i=!0);const o=this.object,s=this._operations?.data.geometry;if(0===t){const e=o.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&&q(this._operations,o.elevationInfo),this._moveManipulation.angle=N(s),this._moveManipulation.radius=J.radiusForSymbol(o.graphic?.symbol)}else{const e=o.visible;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&q(this._operations,this.object.elevationInfo),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t;let i=0;if(null!=a){const e=a.handle.pos,t=null!=n?n.handle.pos:a.handle.leftSegment?.leftVertex?a.handle.leftSegment.leftVertex.pos:null,o=null==n&&a.handle.rightSegment?.rightVertex?a.handle.rightSegment.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Ve(t,e):o&&(i=Ve(e,o))}const s=a?.handle,r=s?o.getReshapeMoveConfig?.({vertex:s,numSelected:t})??null:null;switch(r?.xyAxisMode){case"all":this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e;break;case"hidden":this._moveManipulation.xyAxisManipulation.available=!1,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=!1}this._moveManipulation.angle=r?.angle??i,this._moveManipulation.radius=K}0!==t&&i?(E(e,e,1/t),Ae.spatialReference=this._operations.data.spatialReference,Ae.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ae),this._moveManipulation.elevationAlignedLocation=Ae):null==this._outlineVisualElement||this.object.isDraped||null==this._outlineVisualElement.attachmentOrigin?U(this._moveManipulation,this.object):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._operations;if(!i)return;const a=e.filter(e=>"vertex"===e.type&&i.canRemoveVertex(e.handle.part));if(a.length>0){const e=this._createBeforeVertexRemoveEvent(a);if(this.events.emit("before-vertex-remove",e),e.defaultPrevented)return}for(const n of a){const e=n.handle.part;if(i.canRemoveVertex(e)){t.push(n.handle),this._removeManipulator(n),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.leftSegment)),this._removeManipulator(this._getManipulatorInfoFromHandle(n.handle.rightSegment));const a=i.removeVertices([n.handle]),o=a.removedVertices?.[0].createdSegment;o&&"line"===o.type?this._createVertexOrEdgeManipulator(o):this.enableEdgeOffset&&e.vertices.length<=2&&this._removeManipulator(this._getManipulatorInfoFromHandle(e.segments[0]))}}if(t.length>0){const e=t.map(e=>{const t=i.data.parts.indexOf(e.part);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}),a=this._updateEventState(2);if(this.destroyed)return;if(this.events.emit("vertex-remove",{type:"vertex-remove",object:this.object,removed:e.map(e=>e.coordinates),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(0),this.destroyed))return;this._updateMoveManipulationPosition()}}_createBeforeVertexRemoveEvent(e){const t=this._operations,i=e.map(e=>{const i=t.data.parts.indexOf(e.handle.part);return{coordinates:t.data.coordinateHelper.vectorToArray(e.handle.pos),componentIndex:i,vertexIndex:e.handle.index}});let a=!1;return{type:"before-vertex-remove",object:this.object,removed:i.map(e=>e.coordinates),vertices:i,get defaultPrevented(){return a},preventDefault(){a=!0}}}_moveVertices(e,t,i=("start"===t.action?0:1)){const a=this._operations;if(a&&(e.length>0&&a.moveVertices(e.map(e=>e.handle),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),!this._movingManipulatorsHidden))for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t,i){if(!this._operations)return;const a=t.clone();a.distance=i,this._operations.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.leftVertex)),this._updateManipulatorPosition(this._getManipulatorInfoFromHandle(e.handle.rightVertex))}_manipulatorClickCallback(e,t){e.shiftKey||this._clearSelection(),"vertex"===t.type&&(t.manipulator.selected=!t.manipulator.selected,this.enableDeleteVertices&&e.button===ue.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===ue.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){null!=this._defaultTooltipInfo?this._resetTooltip():this._updateTranslateObjectTooltip(e,t)}_updateTranslateObjectTooltip(e,t){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=re(e,t,this._tooltipsContext,this._updatingHandles))}_updateEdgeOffsetTooltip(e){this._pendingEdgeOffsetInfo||(this.activeTooltipInfo=le(this.object,e,this._tooltipsContext,this._updatingHandles))}_resetTooltip(){const e=this.activeTooltipInfo;if(this._pendingEdgeOffsetInfo&&"reshape-edge-offset"===e?.type)return;let t=null;t=this._pendingEdgeOffsetInfo||null!=this._findActiveEdgeOffsetManipulatorInfo()?le(this.object,null,this._tooltipsContext,this._updatingHandles):this._defaultTooltipInfo,t!==e&&(null!=e&&null!=t&&"input"===this.tooltip.mode||(this.activeTooltipInfo=t))}get _defaultTooltipInfo(){const e=this._operations?.data.type;switch(e){case"multipoint":case"polyline":case"polygon":return this._selectedVertexManipulatorInfo?this.tooltipInfos.selectedVertex:null;case"point":case"mesh":return this.tooltipInfos.movePoint;default:return null}}get _selectedVertexManipulatorInfo(){const e=this._manipulatorInfos.filter(e=>"vertex"===e.type&&e.manipulator.selected);return 1===e.length?e[0]:null}get _someVerticesSelected(){return this._manipulatorInfos.some(e=>"vertex"===e.type&&e.manipulator.selected)}_forEachVertex(e){for(const t of this._manipulatorInfos)"vertex"===t.type&&e(t)}get _tooltipsContext(){const{tooltipInfos:e,activeTooltipInfo:t}=this;return{toolOptions:this._toolOptions,tooltipInfos:e,activeTooltipInfo:t,selectedVertexManipulatorInfo:this._selectedVertexManipulatorInfo,callbacks:this._tooltipCallbacks,measurementWorker:this._measurementWorker}}get test(){}};function He(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:{...e,signedDistance:t.signedDistanceToPoint(i)}}}function Ve(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function De(e){return new w({x:0,y:0,z:0,spatialReference:e})}function Te(e){return"edge"===e.type&&"edgeManipulator"in e}e([g()],we.prototype,"_numGrabbing",void 0),e([g()],we.prototype,"_numDragging",void 0),e([g()],we.prototype,"_pendingEdgeOffsetInfo",void 0),e([g()],we.prototype,"_operations",null),e([g()],we.prototype,"_segmentLabels",void 0),e([g({constructOnly:!0})],we.prototype,"tool",void 0),e([g()],we.prototype,"tooltip",void 0),e([g()],we.prototype,"activeTooltipInfo",void 0),e([g({readOnly:!0})],we.prototype,"updating",null),e([g()],we.prototype,"manipulators",null),e([g()],we.prototype,"view",null),e([g()],we.prototype,"object",null),e([g()],we.prototype,"enableZShape",null),e([g()],we.prototype,"enableDeleteVertices",null),e([g()],we.prototype,"enableZVertex",null),e([g()],we.prototype,"autoHideManipulators",null),e([g()],we.prototype,"enableMoveObject",null),e([g()],we.prototype,"enableMidpoints",null),e([g()],we.prototype,"enableEdgeOffset",null),e([g()],we.prototype,"_toolOptions",null),e([g()],we.prototype,"_accentColor",null),e([g()],we.prototype,"_tooltipsContext",null),we=e([_("esri.views.3d.interactive.editingTools.reshape.ReshapeOperation")],we);const Ae=T(0,0,void 0,D.WGS84),Ce=I(),Ge=1e-6,Re=16,Pe=32;export{we as ReshapeOperation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{invert as t}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as
|
|
2
|
+
import{colorVectorToColorAndOpacity as e}from"../../../core/colorUtils.js";import{invert as t}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{subtract as r,cross as o,transformMat4 as n,normalize as i}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{sv3d as l,sm4d as c}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as s}from"../../../layers/graphics/hydratedFeatures.js";import{manipulatedObjectGeometry as a}from"./editingTools/manipulatedObjectUtils.js";import{computeCentroid as u}from"../layers/graphics/graphicUtils.js";import{createSphereGeometry as d}from"../webgl-engine/lib/GeometryUtil.js";import{ColorMaterial as m}from"../webgl-engine/materials/ColorMaterial.js";function f(t,r=4,o=!0,n){const i=e(t),l=t[3]<1;return new m({color:i,writeDepth:!l,cullFace:2,renderOccluded:r,isDecoration:!0,shadingEnabled:o,screenSizeScale:n,screenSizeEnabled:null!=n})}function g({color:e,focusedColor:t,outlineColor:r,focusedOutlineColor:o,screenSize:n,renderOccluded:i=4,shaded:l=!0}){const c=f(e,i,l,n?.size);let s,a;if(null!=r){const e=o??r,t=null==n?void 0:n.size+2*n.outlineSize;s=p(e,i,t),a=p(r,i,t)}else{s=f(t??e,i,l,n?.size),a=c}return{material:c,focusedMaterial:s,outlineMaterial:a}}function p(t,r=4,o){return new m({color:e(t),writeDepth:!0,cullFace:1,renderOccluded:r,isDecoration:!0,forceTransparentMode:!0,shadingEnabled:!1,...null==o?{}:{screenSizeEnabled:!0,screenSizeScale:o}})}function h(e,t=.5,r=[0,0,0]){return d(e,t,16,16,{offset:r})}const b=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0}),j=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1}),z=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function S(e,i,s,a){const u=r(l.get(),e,s),d=O(u,o(l.get(),a,u),s,c.get());t(d,d);const m=n(l.get(),i,d);return Math.atan2(m[1],m[0])}function O(e,t,r,n){const c=i(l.get(),e),s=i(l.get(),t),a=o(l.get(),c,s);return n[0]=c[0],n[1]=c[1],n[2]=c[2],n[3]=0,n[4]=s[0],n[5]=s[1],n[6]=s[2],n[7]=0,n[8]=a[0],n[9]=a[1],n[10]=a[2],n[11]=0,n[12]=r[0],n[13]=r[1],n[14]=r[2],n[15]=1,n}function w(e,t){const r=e.getViewForGraphic(t);return null!=r&&"computeAttachmentOrigin"in r?r.computeAttachmentOrigin(t,e.spatialReference):null}function y(e,t){const r=t.origin;null==r?M(e,a(t)):e.elevationAlignedLocation=r}function M(e,t){if(null==t)return;const r="mesh"===t.type?t.origin:u(t);null!=r&&(e.location=s(r))}export{S as calculateInputRotationTransform,O as calculateTranslateRotateFromBases,f as createManipulatorMaterial,g as createManipulatorMaterials,h as createSphereGeometryAsOffsets,w as getGraphicAttachmentOrigin,y as placeAtObject,j as rotateManipulatorDefaults,b as screenSizeManipulatorSettings,z as worldScaledManipulatorSettings};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromArray as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{
|
|
2
|
+
import{set as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as t}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{exactEquals as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromArray as s}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{createSphereGeometryAsOffsets as a}from"../manipulatorUtils.js";import{Object3DVisualElement as l}from"./Object3DVisualElement.js";import{ElevationContext as o}from"../../layers/graphics/ElevationContext.js";import{geometryToRenderInfo as n}from"../../support/renderInfoUtils/point.js";import{ColorMaterial as c}from"../../webgl-engine/materials/ColorMaterial.js";class h extends l{constructor(e){super(e),this.view=null,this._renderOccluded=4,this._vertices=null,this._spatialReference=null,this._color=s([1,127/255,0,1]),this._size=11,this._outlineColor=s([0,0,0,.5]),this._outlineSize=1,this._elevationInfo=null,this.applyProperties(e)}get renderOccluded(){return this._renderOccluded}set renderOccluded(e){e!==this._renderOccluded&&(this._renderOccluded=e,this._updateMaterial(),this._updateOutlineMaterial())}get vertices(){return this._vertices}set vertices(e){this._vertices=e,this.recreateGeometry()}get spatialReference(){return this._spatialReference}set spatialReference(e){this._spatialReference=e,this.recreateGeometry()}get color(){return this._color}set color(e){r(e,this._color)||(i(this._color,e),this._updateMaterial())}get size(){return this._size}set size(e){e!==this._size&&(this._size=e,this._updateMaterial())}get outlineColor(){return this._outlineColor}set outlineColor(e){r(e,this._outlineColor)||(i(this._outlineColor,e),this._updateOutlineMaterial())}get outlineSize(){return this._outlineSize}set outlineSize(e){e!==this._outlineSize&&(this._outlineSize=e,this._updateOutlineMaterial())}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this.recreateGeometry()}get _vertexMaterialParameters(){return{color:this._color,screenSizeScale:this.size,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}get _vertexOutlineMaterialParameters(){return{color:this._outlineColor,screenSizeScale:this.size+2*this.outlineSize,renderOccluded:this._renderOccluded,isDecoration:this.isDecoration}}_updateMaterial(){this.attached&&this._vertexMaterial.setParameters(this._vertexMaterialParameters)}_updateOutlineMaterial(){this.attached&&this._vertexOutlineMaterial.setParameters(this._vertexOutlineMaterialParameters)}_createRenderGeometries(){const t=this.vertices;if(null==t||0===t.length)return[];const r=.5,i=.5,s=n(t,this.spatialReference,this.view.elevationProvider,this.view.renderCoordsHelper,o.fromElevationInfo(this.elevationInfo)),l=[],c=s.numVertices,h=s.position;for(let o=0;o<c;++o){const t=e(u,h[3*o],h[3*o+1],h[3*o+2]),s=a(this._vertexMaterial,r,t),n=a(this._vertexOutlineMaterial,i,t);l.push({vertexGeometry:s,vertexOutlineGeometry:n})}return l}createGeometries(e){const t=this._createRenderGeometries();for(const{vertexGeometry:r,vertexOutlineGeometry:i}of t)e.addGeometry(r),e.addGeometry(i)}createExternalResources(){this._vertexMaterial=new c({...this._vertexMaterialParameters,writeDepth:!0,cullFace:2,screenSizeEnabled:!0,shadingEnabled:!0}),this._vertexOutlineMaterial=new c({...this._vertexOutlineMaterialParameters,forceTransparentMode:!0,writeDepth:!0,cullFace:1,screenSizeEnabled:!0,shadingEnabled:!1})}destroyExternalResources(){this._vertexMaterial=null,this._vertexOutlineMaterial=null}forEachMaterial(e){e(this._vertexMaterial),e(this._vertexOutlineMaterial)}}const u=t();export{h as VerticesVisualElement};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import
|
|
2
|
+
import e from"../../../Graphic.js";import{isIterable as n}from"../../../core/iteratorUtils.js";import{screenPointObjectToArray as t,isScreenPolygon as i,isScreenRect as r,createScreenPointArray as s,createScreenPoint as o}from"../../../core/screenUtils.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import a from"../../../geometry/Point.js";import c from"../../../geometry/SpatialReference.js";import{projectVectorToVector as u}from"../../../geometry/projection/projectVectorToVector.js";import{Sphere as d,sphereCSO as p}from"../../../geometry/support/sphere.js";import{fallbackObjectIDAttribute as f}from"../../../layers/LayerConstants.js";import{isIntegratedMeshLayer as m}from"../../../layers/support/layerUtils.js";import{debugFlags as g}from"./debugFlags.js";import{getElevationAtPoint as y}from"./ElevationProvider.js";import{getGraphicHitDedupeKey as h,resolveOrderedIntersectionHits as w}from"./intersectionHitUtils.js";import{Intersector as b}from"../webgl-engine/lib/Intersector.js";import{isValidIntersectorResultRay as S}from"../webgl-engine/lib/IntersectorResult.js";import{toHit as x,toOwner as E}from"../webgl-engine/lib/intersectorUtilsConversions.js";import{terrainId as U}from"../webgl-engine/lib/verticalOffsetUtils.js";async function j(e,n,t,o){const l=t?C(e,t):o;if(i(n))return I(e,n,l,t?.excludeLabels);if(r(n))return I(e,V(n),l,t?.excludeLabels);const a=n,c=s(a.x,a.y);l.requiresGroundFeedback=!0,l.enableDraped=!0;const u=new b(e.state.viewingMode);u.options.selectionMode=!0,u.options.store=2,u.options.excludeLabels=t?.excludeLabels??!1,e.sceneIntersectionHelper.intersectIntersectorScreen(c,u,l);const d=await Array.fromAsync(M(e,u.results.all,l.graphics,{getDistance:e=>e.distanceInRenderSpace,getMapPoint:n=>L(e,n),stopAtSupportSurface:!0})),p=u.results.ground,f=E(p,e),y=null!=f&&"type"in f&&m(f)?f:null,h={screenPoint:a,results:d,ground:{mapPoint:L(e,p),distance:S(p)?p.distanceInRenderSpace:0,layer:y}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(h.intersector=u),h}async function I(e,n,i,r){i.enableDraped=!0;const s=new b(e.state.viewingMode);s.options.selectionMode=!0,s.options.store=2,s.options.excludeLabels=r??!1,await e.sceneIntersectionHelper.intersectIntersectorScreenPolygon(n.map(e=>t(e)),s,i);const o=new Array;await e.sceneIntersectionHelper.screenPolygonIntersectionTask.scheduleGenerator(async function*(n){for await(const t of M(e,R(e,s.polygonResults.all),i.graphics,{getDistance:e=>e.distance,getMapPoint:()=>null}))o.push(t),n.madeProgress()&&(n=yield)});const l={screenPoint:null,results:o,ground:{mapPoint:null,distance:0,layer:null}};return g.SCENEVIEW_HITTEST_RETURN_INTERSECTOR&&(l.intersector=s),l}function*R(e,n){const t=T(e);if(null!=t)for(const i of n)null!=i.distance&&i.distance<=t&&(yield i);else yield*n}function T(e){const n=e.basemapTerrain,t=e.state.camera;if(1!==e.state.viewingMode||!t.aboveGround||!n?.opaque)return null;z.radius=n.getLowerBoundRadius();return p.distanceToSilhouette(z,t.eye)*F}function V(e){return[o(e.x,e.y),o(e.x+e.width,e.y),o(e.x+e.width,e.y+e.height),o(e.x,e.y+e.height)]}function P(e,n,i,r){const s=i?C(e,i):r,o=!(!s.graphics?.include&&!s.graphics?.exclude),l=!(!s.mediaElements?.include&&!s.mediaElements?.exclude),a=t(n);s.enableDraped=s.include&&!s.include.has(U)||s.exclude?.has(U);const c=e.sceneIntersectionHelper,u=new b(e.state.viewingMode);if(u.options.selectionMode=!0,u.options.store=o||l?2:0,u.options.excludeLabels=i?.excludeLabels??!1,c.intersectIntersectorScreen(a,u,s),o||l){for(const n of u.results.all){const t=x(n,e);if(null==t)return L(e,n);if(o&&("graphic"!==t.type||G(s.graphics,t.graphic)))return L(e,n);if(l&&("media"!==t.type||H(s.mediaElements,t.element)))return L(e,n)}return null}return L(e,u.results.min)}async function*M(e,n,t,i){const r=w(e,i.stopAtSupportSurface?function*(){for(const t of n){yield t;const n=E(t,e);if(null!=n&&(n===e.map.ground||"type"in n&&m(n)))break}}():n,{getDedupeKey:e=>"graphic"===e.type?v(e.graphic):null,filterHit:e=>"graphic"!==e.type||G(t,e.graphic)});for await(const{input:s,hit:o}of r){const e=i.getMapPoint(s),n=i.getDistance(s);if("media"===o.type){const t=e?o.element.toSource(e):null;yield{...o,mapPoint:e,distance:n,sourcePoint:t}}else yield{...o,mapPoint:e,distance:n}}}function L(e,n,t){return n.getIntersectionPoint(q)?(t=D(e,q,t),7===n.intersector&&e.basemapTerrain&&(t.z=y(e.basemapTerrain,t)??0),t):null}function v(e){const n=e.getObjectId()??e.attributes?.[f];return e.origin&&null!=n?`o-${e.origin.id}-${n}`:`u-${h(e)}`}function G(e,n){return H(e,v(n))}function H(e,n){return null==e||(null==e.include||e.include.has(n))&&(null==e.exclude||!e.exclude.has(n))}function D(e,n,t){let i=e.spatialReference||c.WGS84;return u(n,e.renderSpatialReference,q,i)?n=q:(i=c.WGS84,u(n,e.renderSpatialReference,q,i)&&(n=q)),t?(t.x=n[0],t.y=n[1],t.z=n[2],t.spatialReference=i):t=new a(n,i),t}function C(e,n){const t=N(e,n.include,0),i=N(e,n.exclude,1);return{include:t.layerViewUids,exclude:i.layerViewUids,graphics:{include:t.graphicUids,exclude:i.graphicUids},mediaElements:{include:t.mediaElements,exclude:i.mediaElements}}}function N(t,i,r,s=new _){if(!i)return s;if(i instanceof e)k(s,v(i)),0===r&&(null!=t.graphicsView&&i.layer===t?O(s,t.graphicsView.uid):i.layer&&A(s,t,i.layer.uid));else if("layer"in i&&"element"in i)$(s,i.element),0===r&&A(s,t,i.layer.uid);else if(n(i))for(const e of i)e===t.graphics&&null!=t.graphicsView?O(s,t.graphicsView.uid):e===t.map.ground?(O(s,U),t.map.ground.integratedMeshGround&&A(s,t,t.map.ground.integratedMeshGround.uid)):N(t,e,r,s);else"layer"in i&&W(s,t,i),"uid"in i&&A(s,t,i.uid);return s}class _{constructor(){this.layerViewUids=null,this.graphicUids=null,this.mediaElements=null}}function A(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t);i&&O(e,i.uid)}function O(e,n){e.layerViewUids??=new Map,e.layerViewUids.set(n,!0)}function W(e,n,t){const i=n.allLayerViews.find(e=>e.layer.uid===t.layer.uid);if(!i)return;e.layerViewUids??=new Map;const r=e.layerViewUids.get(i.uid);!0!==r&&(r?r.add(t.id):e.layerViewUids.set(i.uid,new Set([t.id])))}function k(e,n){e.graphicUids??=new Set,e.graphicUids.add(n)}function $(e,n){e.mediaElements??=new Set,e.mediaElements.add(n)}const q=l(),z=new d,F=1.2;export{D as computeMapPointFromVec3d,C as externalToInternalIntersectOptions,j as hitTest,L as intersectResultToMapPoint,G as testGraphicUidFilter,P as toMap};
|
|
@@ -10,6 +10,14 @@ mat3 covariance3D = transpose(scaledRotation) * scaledRotation;
|
|
|
10
10
|
covarianceA = vec3(covariance3D[0][0], covariance3D[0][1], covariance3D[0][2]);
|
|
11
11
|
covarianceB = vec3(covariance3D[1][1], covariance3D[1][2], covariance3D[2][2]);
|
|
12
12
|
}
|
|
13
|
+
float regularizeGaussianCovariance(inout vec3 covariance2D) {
|
|
14
|
+
float originalDeterminant = covariance2D.x * covariance2D.z - covariance2D.y * covariance2D.y;
|
|
15
|
+
const float covarianceRegularization = 0.3;
|
|
16
|
+
covariance2D.x += covarianceRegularization;
|
|
17
|
+
covariance2D.z += covarianceRegularization;
|
|
18
|
+
float regularizedDeterminant = covariance2D.x * covariance2D.z - covariance2D.y * covariance2D.y;
|
|
19
|
+
return sqrt(max(0.0, originalDeterminant / regularizedDeterminant));
|
|
20
|
+
}
|
|
13
21
|
vec3 computeGaussianCovariance2D(vec3 viewSpaceCenter, float focalLength, vec2 tanFov, float[6] cov3D, mat4 view) {
|
|
14
22
|
vec4 viewSpacePoint = vec4(viewSpaceCenter, 1);
|
|
15
23
|
vec2 clampLimit = 1.3 * tanFov;
|
|
@@ -30,9 +38,6 @@ cov3D[1], cov3D[3], cov3D[4],
|
|
|
30
38
|
cov3D[2], cov3D[4], cov3D[5]
|
|
31
39
|
);
|
|
32
40
|
mat3 covariance2D = transpose(covarianceProjection) * transpose(covariance3D) * covarianceProjection;
|
|
33
|
-
const float regularization = 0.3;
|
|
34
|
-
covariance2D[0][0] += regularization;
|
|
35
|
-
covariance2D[1][1] += regularization;
|
|
36
41
|
return vec3(covariance2D[0][0], covariance2D[0][1], covariance2D[1][1]);
|
|
37
42
|
}
|
|
38
43
|
void computePackedGaussianCovariance3D(uvec4 packedGaussian, out vec3 covarianceA, out vec3 covarianceB) {
|
|
@@ -16,11 +16,17 @@ return max(0.0, -2.0 * gaussianLogAlphaCutoff);
|
|
|
16
16
|
bool rejectGaussianByMinimumRadius(float maxRadius, float opacity, float minSplatRadius) {
|
|
17
17
|
return minSplatRadius > 0.0 && maxRadius * opacity < minSplatRadius;
|
|
18
18
|
}
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
vec2 computeGaussianScreenRadii(vec3 covariance2D, float gaussianEllipseThreshold) {
|
|
20
|
+
return ceil(sqrt(covariance2D.xz * gaussianEllipseThreshold));
|
|
21
|
+
}
|
|
22
|
+
bool rejectGaussianByScreenBounds(vec2 ndcPosition, vec2 screenRadii, vec2 clipSpacePixelScale) {
|
|
23
|
+
vec2 radiusNDC = screenRadii * clipSpacePixelScale;
|
|
21
24
|
return any(greaterThan(abs(ndcPosition) - radiusNDC, vec2(1.0)));
|
|
22
25
|
}
|
|
23
26
|
vec2 computeGaussianMajorAxisDirection(vec3 covariance2D, float majorEigenvalue) {
|
|
27
|
+
if (covariance2D.y == 0.0) {
|
|
28
|
+
return covariance2D.x >= covariance2D.z ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
29
|
+
}
|
|
24
30
|
return normalize(vec2(covariance2D.y, majorEigenvalue - covariance2D.x));
|
|
25
31
|
}
|
|
26
32
|
vec2 computeGaussianUnitQuadCorner(int vertexID) {
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{sliceEquals as t}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{disposeMaybe as i}from"../../../../../core/maybe.js";import{watch as s,sync as r}from"../../../../../core/reactiveUtils.js";import{signal as a}from"../../../../../core/signal.js";import{property as o,subclass as n}from"../../../../../core/accessorSupport/decorators.js";import{copy as u,equals as h}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{InternalRenderCategory as l}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{ReadShadowMapPassParameters as d}from"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{volumeToVao as _}from"../focusArea/focusAreaMaskUtils.js";import{S as p}from"../../../../../chunks/ShadowCastAccumulate.glsl.js";import{ShadowCastAccumulateTechnique as f}from"./ShadowCastAccumulateTechnique.js";import{ShadowCastAccumulateTechniqueConfiguration as g}from"./ShadowCastAccumulateTechniqueConfiguration.js";import{ShadowCastClearTechnique as b}from"./ShadowCastClearTechnique.js";import{ShadowCastMaskTechnique as v}from"./ShadowCastMaskTechnique.js";import{BindParameters as y}from"../../lib/BindParameters.js";import{DepthRange as S}from"../../lib/DepthRange.js";import{createQuadVAO as w}from"../../lib/glUtil3D.js";import{ShadowMap as A}from"../../lib/ShadowMap.js";import{V as C}from"../../../../../chunks/VolumeMask.glsl.js";import{PrimitiveType as x,DepthStencilAttachment as R,PixelType as V}from"../../../../webgl/enums.js";import{DisposableFramebufferObject as F}from"../../../../webgl/FramebufferObject.js";import{noParameters as P}from"../../../../webgl/NoParameters.js";let H=class extends m{constructor(e){super(e),this.consumes={required:[]},this.produces=l.SHADOW_ACCUMULATION,this._fullyRecompute=!1,this._analysisVolumeGeometry=null,this._primarySet=new D(new g(0),()=>this._requestRenderIfEnabled()),this._contextSet=new D(new g(1),()=>this._requestRenderIfEnabled()),this._passParameters=new d,this._maskParameters=new C,this._volumeVao=null,this._volumeVertexCount=0,this._depthRange=S.Zero,this._didAccumulate=!1,this._enabled=!1,this._previewing=!1,this.accumulationRenderer=null,this._shadowAccumulatorKey=Symbol("shadowAccumulator");const{view:t}=e,i=t.stage.renderer.fboCache;this._accumulationBindParameters=new y(i.rctx,new A(i,t.stage.viewingMode)),this._accumulationBindParameters.shadowMap.enabled=!0,this._vao=w(i.rctx),this._tmpReadFbo=new F(i.rctx),this.addHandles([s(()=>this._previewing,e=>{e?this._invalidateAccumulationSets():this._requestRenderIfEnabled()},r),s(()=>this._numActive,()=>this._numActiveChanged(),r)],this._shadowAccumulatorKey)}destroy(){this._disable(),this.removeHandles(this._shadowAccumulatorKey),this.accumulationRenderer=null,this._fboHandle=i(this._fboHandle),this._vao=i(this._vao),this._volumeVao=i(this._volumeVao),this._tmpReadFbo=i(this._tmpReadFbo),this._accumulationBindParameters.destroy();for(const e of this._accumulationSets())e.destroy();this._contextSet=null,this._primarySet=null}*_accumulationSets(){yield this._primarySet,yield this._contextSet}get computedSamples(){return[this._primarySet.progress,this._contextSet.progress]}get shadowCastTexture(){return this._fboHandle?.getTexture()}get accumulating(){return this.active&&(this._previewing||this._refining||this._fullyRecompute)}get _refining(){return this.active&&!this._doneAccumulating&&!this._previewing}get active(){return this._enabled&&this._accumulationSets().some(e=>e.active)}get canAccumulate(){return null!=this._accumulationBindParameters.depth&&this._depthRange!==S.Zero&&null!=this.accumulationRenderer&&this.accumulationRenderer.isAboveElevationThreshold}get _doneAccumulating(){return this._accumulationSets().every(e=>e.doneAccumulating)}get _numActive(){return this._accumulationSets().reduce((e,t)=>e+(t.active?1:0),0)}get _colorFormat(){return 2===this._numActive?2:0}get _analysisVolume(){return this._analysisVolumeGeometry}set _analysisVolume(e){if(this._analysisVolumeGeometry===e)return;this._invalidateAccumulationSets(),this._analysisVolumeGeometry=e,this._volumeVao=i(this._volumeVao),this._volumeVertexCount=0;const t=null!=e;for(const i of this._accumulationSets())i.configuration.useMask=t;if(!t)return;const s=e.geometryVolume,{vao:r,vertexCount:a}=_(this._rctx,s);this._volumeVao=r,this._volumeVertexCount=a}get requireGeometryDepth(){return this.accumulating||null!=this._volumeVao}precompile(){if(this.active&&(this._fullyRecompute=0!==this.bindParameters.frameRendererTarget,this.accumulating)){for(const e of this._accumulationSets())this.techniques.precompile(f,e.configuration),this.techniques.precompile(b,e.configuration);this.techniques.precompile(v)}}get didAccumulate(){return this._didAccumulate}render(){this._updateCamera(),this._didAccumulate=this._renderAccumulation(),this._updateMask();const e=this._fboHandle;return e?.retain(),e}_renderAccumulation(){if(!this.active)return!1;if(this._accumulationBindParameters.contentCamera=this.bindParameters.contentCamera,this._accumulationBindParameters.depth=this.bindParameters.depth,this._passParameters.origin=this._accumulationBindParameters.camera.center,!this.canAccumulate)return this._accumulationBindParameters.depth=null,!1;if(this._renderAreaMask(),!this.accumulating)return this._accumulationBindParameters.depth=null,!1;(this._previewing||this._fullyRecompute)&&this._reset(),this._clearBuffersOnAccumulationStart(this._accumulationBindParameters);const e=this._accumulateSetsForRenderFrame(this._previewing&&!this._fullyRecompute,this._accumulationBindParameters);return this._accumulationBindParameters.depth=null,e}_renderAreaMask(){const e=this.techniques.getCompiled(v),t=this._volumeVao,i=this._volumeVertexCount,s=this._fboHandle,r=this._analysisVolume;if(s?.detachDepth(),!e||!t||i<1||!s||!r)return;s.acquireDepth(14);const a=this._rctx,o=this._accumulationBindParameters,n=o.depth,u=this._tmpReadFbo;u.attachDepthStencil(n?.attachment),a.blitFramebuffer(u,s.fbo,256),u.detachDepthStencilTexture(),a.bindFramebuffer(s.fbo),a.setClearStencil(0),a.clear(1024),a.setViewport(0,0,o.camera.width,o.camera.height);const h=a.bindTechnique(e,o,P);this._maskParameters.origin=r.origin,h.bindDraw(o,P,this._maskParameters),a.bindVAO(t),a.drawArrays(x.TRIANGLES,0,i)}_clearBuffersOnAccumulationStart(e){if(this._accumulationSets().every(e=>0===e.progress))this._clearFramebuffer();else for(const t of this._accumulationSets())0===t.progress&&this._clearFramebufferForSet(this._fboHandle,t,e)}_accumulateSetsForRenderFrame(e,t){let i=!1;for(const s of this._accumulationSets())this._accumulateSet(s,e,t),i=!0;return i&&this.requestRender(1),i}_accumulateSet(e,t,i){const s=t?Math.min(q,e.sampleCount)-e.progress:e.sampleCount-e.progress;for(let r=0;r<s;++r)this._accumulateShadow(e,i)}_updateMask(){this.accumulationRenderer?.setStencilMask(this._fboHandle?.getAttachment(R))}setParameters(e){void 0!==e.previewing&&(this._previewing=e.previewing),void 0!==e.lightDirections&&(this._primarySet.lightDirections=e.lightDirections),void 0!==e.lightDirectionsContext&&(this._contextSet.lightDirections=e.lightDirectionsContext),!0===e.enabled?this._enable():!1===e.enabled&&this._disable(),void 0!==e.analysisVolume&&(this._analysisVolume=e.analysisVolume),this.accumulationRenderer?.setOptions(e)}readAccumulatedShadow(e,t){const i=this._primarySet.progress;return!this.active||!this._fboHandle||i<1||e<0||e>=this._fboHandle.fbo.width||t<0||t>=this._fboHandle.fbo.height?0:(this._fboHandle.fbo.readPixels(e,t,1,1,6408,V.UNSIGNED_BYTE,j),j[0]/i)}_updateCamera(){if(!this.active)return;const e=this.bindParameters.camera,t=this._accumulationBindParameters.camera;e.equals(t)||t.copyFrom(e),this._isAccumulationValid(e)||(this._fboHandle?.release(),this._fboHandle=this._createFBO(e.fullWidth,e.fullHeight),this._reset()),this.accumulationRenderer?.setOpacityFromElevation(e.relativeElevation)}_numActiveChanged(){if(!this._enabled||!this._fboHandle)return;const e=2===this._numActive,{width:t,height:i}=this._fboHandle.fbo,s=this._createFBO(t,i);e&&(this._clearFramebuffer(s),this._contextSet.reset()),this._rctx.blitFramebuffer(this._fboHandle.fbo,s.fbo),this._fboHandle.dispose(),this._fboHandle=s,this.requestRender(1)}_enable(){this._enabled||(this._enabled=!0,this._invalidateAccumulationSets())}_disable(){this._enabled&&(this._fboHandle=i(this._fboHandle),this._enabled=!1,this.requestRender(1))}_createFBO(e,t){return this.fboCache.acquire(e,t,this.produces,this._colorFormat)}_invalidateAccumulationSets(){for(const e of this._accumulationSets())e.reset();this._requestRenderIfEnabled()}_reset(){for(const e of this._accumulationSets())e.reset()}_clearFramebuffer(e=this._fboHandle){e&&(this._rctx.bindFramebuffer(e.fbo),this._rctx.setClearColor(0,0,0,0),this._rctx.clear(16384))}_clearFramebufferForSet(e,t,i){if(!e)return;const s=this.techniques.get(b,t.configuration);this._rctx.bindFramebuffer(e.fbo),this._rctx.bindTechnique(s,i,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(s.primitiveType,0,this._vao.vertexCount("geometry"))}_accumulateShadow(e,t){this.view.stage.renderer.renderShadowAccumulationShadowMap(t.camera,t.contentCamera,this._accumulationBindParameters.shadowMap,e.lightDirections[e.progress++],this._depthRange);const i=this.techniques.get(f,e.configuration);this._rctx.bindFramebuffer(this._fboHandle?.fbo),this._rctx.bindTechnique(i,t,this._passParameters),this._rctx.bindVAO(this._vao),this._rctx.drawArrays(i.primitiveType,0,this._vao.vertexCount("geometry"))}_isAccumulationValid(e){return this._fboHandle?.fbo.width===e.fullWidth&&this._fboHandle?.fbo.height===e.fullHeight}_requestRenderIfEnabled(){this._enabled&&this.requestRender(1)}get _rctx(){return this.renderingContext}updateDepthRange(e){this._depthRange.equals(e)||(this._depthRange=e,this._invalidateAccumulationSets())}get test(){}};e([o()],H.prototype,"consumes",void 0),e([o()],H.prototype,"produces",void 0),e([o()],H.prototype,"_refining",null),e([o()],H.prototype,"active",null),e([o()],H.prototype,"_doneAccumulating",null),e([o()],H.prototype,"_numActive",null),e([o()],H.prototype,"_colorFormat",null),e([o()],H.prototype,"_depthRange",void 0),e([o()],H.prototype,"_enabled",void 0),e([o()],H.prototype,"_previewing",void 0),e([o()],H.prototype,"accumulationRenderer",void 0),H=e([n("esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowAccumulator")],H);const q=6,j=new Uint8Array(4);class D{constructor(e,t){this.configuration=e,this._notifyChange=t,this._cachedLightDirections=[],this._progress=a(0),this._sampleCount=a(0)}get progress(){return this._progress.value}set progress(e){this._progress.value=e}get sampleCount(){return this._sampleCount.value}get doneAccumulating(){return this.progress>=this.sampleCount}get running(){return this.progress>0}get active(){return this.sampleCount>0}get lightDirections(){return this._cachedLightDirections}set lightDirections(e){const i=this._cachedLightDirections,s=Math.min(p,e.length);if(!t(i,0,i.length,e,0,s,h)){i.length=s,this._sampleCount.value=s;for(let t=0;t<s;++t)i[t]=u(i[t]??c(),e[t]);this.reset(),this._notifyChange()}}destroy(){this._cachedLightDirections.length=0,this._sampleCount.value=0}reset(){this.progress=0}}export{H as ShadowAccumulator};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/shading/calculateUVZShadowFromDepth.glsl.js";import"../../core/shaderLibrary/shading/ReadShadowMap.glsl.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/Texture2DBindUniform.js";import"../../../../webgl/ShaderBuilder.js";export{S as ShadowCastMaxSamples,b as build}from"../../../../../chunks/ShadowCastAccumulate.glsl.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as t}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as i}from"../../../../../chunks/ShadowCastAccumulate.glsl.js";import{PrimitiveType as o}from"../../../../webgl/enums.js";import{makePipelineState as a,add as l,simpleStencilTestParams as c}from"../../../../webgl/renderState.js";let n=class extends t{constructor(){super(...arguments),this.shader=new s(i,()=>import("./ShadowCastAccumulate.glsl.js")),this.ignoreUnused=!0,this.primitiveType=o.TRIANGLE_STRIP}initializePipeline(e){const r={r:0===e.index,g:1===e.index,b:!1,a:!1};return a({blending:l,colorWrite:r,depthTest:null,depthWrite:null,stencilTest:e.useMask?c(0,255,{compare:517,fail:7680,zFail:7680,zPass:7680}):null})}};n=e([r("esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowCastAccumulateTechnique")],n);export{n as ShadowCastAccumulateTechnique};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{parameter as o,ShaderTechniqueConfiguration as t}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class i extends t{constructor(e){super(),this.index=0,this.useMask=!1,this.index=e}}e([o({count:2})],i.prototype,"index",void 0),e([o()],i.prototype,"useMask",void 0);export{i as ShadowCastAccumulateTechniqueConfiguration};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as r}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as s}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as i}from"../../core/shaderTechnique/ShaderTechnique.js";import{S as o}from"../../../../../chunks/ShadowCastClear.glsl.js";import{PrimitiveType as t}from"../../../../webgl/enums.js";import{makePipelineState as l}from"../../../../webgl/renderState.js";let n=class extends i{constructor(){super(...arguments),this.shader=new s(o,()=>import("./ShadowCastClear.glsl.js")),this.ignoreUnused=!0,this.primitiveType=t.TRIANGLE_STRIP}initializePipeline(e){const r={r:0===e.index,g:1===e.index,b:!1,a:!1};return l({blending:null,colorWrite:r,depthTest:null,depthWrite:null})}};n=e([r("esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowCastClearTechnique")],n);export{n as ShadowCastClearTechnique};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{VolumeMaskTechnique as i}from"../../shaders/VolumeMaskTechnique.js";import{PrimitiveType as r}from"../../../../webgl/enums.js";import{makePipelineState as t,separateStencilTestParams as o}from"../../../../webgl/renderState.js";let a=class extends i{constructor(){super(...arguments),this.ignoreUnused=!0,this.primitiveType=r.TRIANGLE_STRIP}initializePipeline(){return t({depthTest:{func:513},stencilTest:o(0,255,{compare:519,fail:7680,zFail:34055,zPass:7680},{compare:519,fail:7680,zFail:34056,zPass:7680}),stencilWrite:{mask:255}})}};a=e([s("esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowCastMaskTechnique")],a);export{a as ShadowCastMaskTechnique};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{equals as s}from"../../../../../core/arrayUtils.js";import{smoothstep as t}from"../../../../../core/mathUtils.js";import{watch as i,syncAndInitial as a}from"../../../../../core/reactiveUtils.js";import{property as r,subclass as o}from"../../../../../core/accessorSupport/decorators.js";import{exactEquals as n,copy as l,equals as d}from"../../../../../core/libs/gl-matrix-2/math/vec4.js";import{InternalRenderCategory as h}from"../../../webgl.js";import m from"../../../webgl/RenderNode.js";import{S as u}from"../../../../../chunks/ShadowCastVisualize.glsl.js";import{ShadowCastVisualizeTechnique as p}from"./ShadowCastVisualizeTechnique.js";import{ShadowCastVisualizeTechniqueConfiguration as c}from"./ShadowCastVisualizeTechniqueConfiguration.js";import{vvColorNumber as b}from"../../materials/VisualVariablePassParameters.js";import{ColorAttachment0 as f}from"../../../../webgl/enums.js";let _=class extends m{constructor(e){super(e),this.produces=h.TRANSPARENT_NO_DEPTH,this.consumes={required:[h.TRANSPARENT_NO_DEPTH]},this.enabled=!1,this._configuration=new c,this._stencilMask=null,this._disableElevation={min:4e4,max:5e4,threshold:1/512},this._passParameters=new u(e.data)}initialize(){this.addHandles([i(()=>this.enabled,e=>{this.produces=e?h.TRANSPARENT_NO_DEPTH:"disabled",this.requestRender(1)},a)])}precompile(){this._showVisualization&&this.techniques.precompile(p,this._configuration)}render(){const e=this.input;if(!this._showVisualization)return e;const[s,t]=this.data.computedSamples;this._passParameters.sampleScale=[s?1/s:0,t?1/t:0];const i=this.techniques.get(p,this._configuration),a=null!=this._stencilMask,r=this.renderingContext,o=this.bindParameters,n=r.boundFramebuffer;let l=null;return a&&(l=this.fboCache.acquire(o.camera.width,o.camera.height,"shadow cast masked draw"),l.attachDepth(this._stencilMask),r.bindFramebuffer(l.fbo),r.blitFramebuffer(n,l.fbo,16384)),r.bindTechnique(i,o,this._passParameters),r.setDrawBuffers([f]),r.screen.draw(),null!=l&&(r.bindFramebuffer(n),r.blitFramebuffer(l.fbo,n,16384),l.detachDepth(),l.release()),e}setStencilMask(e){this._stencilMask=e}setOptions(e){void 0!==e.enabled&&(this.enabled=e.enabled),void 0!==e.thresholdColor&&(n(this._passParameters.thresholdColor,e.thresholdColor)||(l(this._passParameters.thresholdColor,e.thresholdColor),this._requestRenderIfEnabled())),void 0!==e.gradientColorRamp&&this._modifyGradientColorRamp(e.gradientColorRamp),void 0!==e.bandedGradientColorRamp&&this._modifyGradientColorRamp(e.bandedGradientColorRamp,!0),void 0!==e.threshold&&this._passParameters.threshold!==e.threshold&&(this._passParameters.threshold=e.threshold,this._requestRenderIfEnabled()),void 0!==e.rendersSunlight&&this._configuration.rendersSunlight!==e.rendersSunlight&&(this._configuration.rendersSunlight=e.rendersSunlight,this._requestRenderIfEnabled()),void 0!==e.visualization&&this._configuration.visualization!==e.visualization&&(this._configuration.visualization=e.visualization,this._requestRenderIfEnabled()),void 0!==e.bandSize&&this._passParameters.bandSize!==e.bandSize&&(this._passParameters.bandSize=e.bandSize,this._requestRenderIfEnabled()),void 0!==e.analysisVolume&&(this._configuration.useMask=null!==e.analysisVolume)}get isAboveElevationThreshold(){return this._passParameters.opacityFromElevation>this._disableElevation.threshold}setOpacityFromElevation(e){this._passParameters.opacityFromElevation=1-t(this._disableElevation.min,this._disableElevation.max,e)}get _showVisualization(){return this.enabled&&(this.data.computedSamples[0]>0||this.data.computedSamples[1]>0)&&this.isAboveElevationThreshold}_modifyGradientColorRamp(e,s=!1){e.length>b&&(e=e.slice(0,b)),v(s?this._passParameters.bandedGradientColorRamp:this._passParameters.gradientColorRamp,e)||(s?this._passParameters.bandedGradientColorRamp=e:this._passParameters.gradientColorRamp=e,this._requestRenderIfEnabled())}_requestRenderIfEnabled(){this.enabled&&this.requestRender(1)}};function v(e,t){return s(e,t,([e,s],[t,i])=>e===t&&d(s,i))}e([r()],_.prototype,"produces",void 0),e([r()],_.prototype,"consumes",void 0),e([r()],_.prototype,"enabled",void 0),e([r({constructOnly:!0})],_.prototype,"data",void 0),_=e([o("esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowCastRenderer")],_);export{_ as ShadowCastRenderer};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import"../../core/shaderLibrary/ScreenSpacePass.glsl.js";import"../../core/shaderLibrary/util/BlendColorsPremultiplied.glsl.js";import"../../core/shaderLibrary/util/CameraSpace.glsl.js";import"../../core/shaderModules/Float2PassUniform.js";import"../../core/shaderModules/Float4PassUniform.js";import"../../core/shaderModules/Float4sPassUniform.js";import"../../core/shaderModules/FloatPassUniform.js";import"../../core/shaderModules/FloatsPassUniform.js";import"../../core/shaderModules/glsl.js";import"../../core/shaderModules/IntegerPassUniform.js";import"../../core/shaderModules/Texture2DPassUniform.js";import"../../../../../chunks/ShadowCastAccumulate.glsl.js";import"../../shaders/colorRampParameters.js";import"../../../../webgl/NoParameters.js";import"../../../../webgl/ShaderBuilder.js";export{S as ShadowCastVisualizePassParameters,b as build}from"../../../../../chunks/ShadowCastVisualize.glsl.js";
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{subclass as s}from"../../../../../core/accessorSupport/decorators.js";import{ReloadableShader as i}from"../../core/shaderTechnique/ReloadableShader.js";import{ShaderTechnique as r}from"../../core/shaderTechnique/ShaderTechnique.js";import{a as t}from"../../../../../chunks/ShadowCastVisualize.glsl.js";import{PrimitiveType as o}from"../../../../webgl/enums.js";import{makePipelineState as a,defaultColorWrite as l,premultipliedAlpha as n,simpleStencilTestParams as c}from"../../../../webgl/renderState.js";let u=class extends r{constructor(){super(...arguments),this.shader=new i(t,()=>import("./ShadowCastVisualize.glsl.js")),this.primitiveType=o.TRIANGLE_STRIP}initializePipeline(){return a({blending:n,colorWrite:l,depthTest:null,depthWrite:null,stencilTest:this._configuration.useMask?c(0,255,{compare:517,fail:7680,zFail:7680,zPass:7680}):null})}};u=e([s("esri.views.3d.webgl-engine.effects.shadowAccumulation.ShadowCastVisualizeTechnique")],u);export{u as ShadowCastVisualizeTechnique};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as o}from"tslib";import{parameter as t,ShaderTechniqueConfiguration as i}from"../../core/shaderTechnique/ShaderTechniqueConfiguration.js";class e extends i{constructor(){super(...arguments),this.visualization=0,this.rendersSunlight=!1,this.useMask=!1}}o([t({count:4})],e.prototype,"visualization",void 0),o([t()],e.prototype,"rendersSunlight",void 0),o([t()],e.prototype,"useMask",void 0);export{e as ShadowCastVisualizeTechniqueConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as
|
|
2
|
+
import{__decorate as e}from"tslib";import{disposeMaybe as t}from"../../../../core/maybe.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as r}from"../../../../core/accessorSupport/decorators.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{InternalRenderCategory as l}from"../../webgl.js";import{glLayout as u}from"../../support/buffer/glUtil.js";import{newLayout as n}from"../../support/buffer/InterleavedLayout.js";import h from"../../webgl/RenderNode.js";import{VertexArrayObject as c}from"./VertexArrayObject.js";import{C as m}from"../../../../chunks/CutFillComposition.glsl.js";import{CutFillCompositionTechnique as d}from"../shaders/CutFillCompositionTechnique.js";import{DefaultMaterialPassParameters as p,DefaultMaterialDrawParameters as f,DefaultMaterialTechnique as _}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{EmissiveTechniqueConfiguration as b}from"../shaders/EmissiveTechniqueConfiguration.js";import{O as g}from"../../../../chunks/OccludedGeometryDepth.glsl.js";import{OccludedGeometryDepthTechnique as V}from"../shaders/OccludedGeometryDepthTechnique.js";import{V as v}from"../../../../chunks/VolumeMask.glsl.js";import{VolumeMaskTechnique as T}from"../shaders/VolumeMaskTechnique.js";import{DepthStencilAttachment as w,PrimitiveType as P}from"../../../webgl/enums.js";import{noParameters as q}from"../../../webgl/NoParameters.js";import{VertexBuffer as y}from"../../../webgl/VertexBuffer.js";let D=class extends h{constructor(e){super(e),this.consumes={required:[l.CUTFILL_COLOR,l.GROUND_DEPTH]},this.produces=l.CUTFILL_COLOR,this.measureType="cut-fill",this._vaoCut=null,this._vaoFill=null,this._compositeConfiguration=new b,this._maskParameters=new v,this._occludedGeometryDepthParameters=new g,this._cutVolumeParameters=new p,this._fillVolumeParameters=new p,this._compositeParameters=new m,this._drawParameters=new f;const t=1===e.view.state.viewingMode;this._cutVolumeConfiguration=new C(t),this._cutVolumeConfiguration.customDepthTest=3,this._cutVolumeConfiguration.writeDepth=!1,this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2,this._fillVolumeConfiguration=new C(t),this._fillVolumeConfiguration.customDepthTest=1,this._fillVolumeConfiguration.cullFace=2}initialize(){this.addHandles([i(()=>[this.cutColor,this.fillColor],()=>this._updateColors(),s),i(()=>this.measureType,()=>this.requestRender(1),s)])}destroy(){this._disposeVaos()}precompile(){this._vaoCut&&this._vaoFill&&("cut-fill"===this.measureType?(this._cutVolumeConfiguration.cullFace=1,this._cutVolumeConfiguration.doubleSidedMode=2):(this._cutVolumeConfiguration.cullFace=0,this._cutVolumeConfiguration.doubleSidedMode=0),this._compositeConfiguration.hasEmissive=0!==this.bindParameters.emissions,this.techniques.precompile(T),this.techniques.precompile(V),this.techniques.precompile(_,this._cutVolumeConfiguration),this.techniques.precompile(_,this._fillVolumeConfiguration),this.techniques.precompile(d,this._compositeConfiguration))}render(e){const t=this.input;if(!this._vaoCut||!this._vaoFill)return t;const i=this._vaoCut.vertexCount("geometry"),s=this._vaoFill.vertexCount("geometry"),o=this.bindParameters,r=o.camera,a=r.fullViewport[2],u=r.fullViewport[3],n=this.renderingContext,h=this.fboCache,c=e.find(({name:e})=>e===l.GROUND_DEPTH),m=h.acquire(a,u,"cutfill color mask",2).attachDepth(c.getAttachment(w));n.bindFramebuffer(m.fbo),n.setClearColor(0,0,0,1),n.clear(17408),n.setViewport(0,0,a,u);const p=this.techniques.get(T);n.bindTechnique(p,o,q,this._maskParameters),n.setFaceCullingEnabled(!1),n.setStencilTestEnabled(!0),n.setStencilOpSeparate(1028,7680,34055,7680),n.setStencilOpSeparate(1029,7680,34056,7680),n.setDepthWriteEnabled(!1),n.bindVAO(this._vaoCut),n.setDepthTestEnabled(!0),n.setStencilWriteMask(255),n.setStencilFunction(519,0,255),n.setColorMask(!1,!1,!1,!1),n.drawArrays(P.TRIANGLES,0,i),n.setDepthTestEnabled(!1),n.setStencilWriteMask(0),n.setStencilFunction(517,0,255),n.setColorMask(!0,!1,!1,!1),n.drawArrays(P.TRIANGLES,0,i),n.bindVAO(this._vaoFill),n.setDepthTestEnabled(!0),n.setStencilWriteMask(255),n.setStencilFunction(519,0,255),n.setColorMask(!1,!0,!1,!1),n.drawArrays(P.TRIANGLES,0,s);const f=h.acquire(a,u,"cutfill color cut volume",5).acquireDepth(14);n.bindFramebuffer(f.fbo),n.setClearColor(0,0,0,0),n.setClearDepth(1),n.setColorMask(!0,!0,!0,!0),n.setDepthWriteEnabled(!0),n.clear(16640);const C=this.techniques.get(V);this._occludedGeometryDepthParameters.depthTexture=c.getTexture(w),this._occludedGeometryDepthParameters.cullFace=this._cutVolumeConfiguration.cullFace,n.bindTechnique(C,o,this._occludedGeometryDepthParameters,this._drawParameters),n.bindVAO(this._vaoCut),n.drawArrays(P.TRIANGLES,0,i);const b=this.techniques.get(_,this._cutVolumeConfiguration);n.bindTechnique(b,this.bindParameters,this._cutVolumeParameters,this._drawParameters),n.bindVAO(this._vaoCut),n.drawArrays(P.TRIANGLES,0,i),f.detachDepth();const g=h.acquire(a,u,"cutfill color fill volume",5).acquireDepth(14);n.blitFramebuffer(t.fbo,g.fbo,256),n.bindFramebuffer(g.fbo),n.clear(16384),n.setColorMask(!0,!0,!0,!0);const v=this.techniques.get(_,this._fillVolumeConfiguration);n.bindTechnique(v,this.bindParameters,this._fillVolumeParameters,this._drawParameters),n.bindVAO(this._vaoFill),n.drawArrays(P.TRIANGLES,0,s),g.detachDepth();const y=t.obtainDepthTexture();n.bindFramebuffer(t.fbo),this._compositeParameters.cutVolume=f.getTexture(),this._compositeParameters.fillVolume=g.getTexture(),this._compositeParameters.mask=m.getTexture(),this._compositeParameters.sceneDepth=y?.attachment,this._compositeParameters.groundDepth=c.getTexture(w),this.borderColor.toUnitRGBA(this._compositeParameters.borderColor);const D=this.techniques.get(d,this._compositeConfiguration);return n.bindTechnique(D,o,this._compositeParameters),n.screen.draw(),t.attachDepth(y),y?.release(),m.release(),f.release(),g.release(),t}enable(){this.produces=l.CUTFILL_COLOR,this.requestRender(1)}disable(){this.produces="disabled",this.requestRender(1)}updateGeometries(e,t,i){this._disposeVaos(),this._vaoCut=this._createVao(e),this._vaoFill=this._createVao(t),this._maskParameters.origin=i,a(this._drawParameters.origin,i),this.requestRender(1)}_updateColors(){this._cutVolumeParameters.diffuse=this.cutColor.toUnitRGB(),this._cutVolumeParameters.opacity=this.cutColor.a,this._fillVolumeParameters.diffuse=this.fillColor.toUnitRGB(),this._fillVolumeParameters.opacity=this.fillColor.a,this.requestRender(1)}_createVao(e){const{vertices:t,normals:i,indicesBottom:s,indicesExtruded:o}=e,r=s.length+o.length,a=this.renderingContext,l=F.createBuffer(r),{position:n,normal:h}=l;let m=0;for(let u=0;u<s.length;u++){const e=3*s[u];n.set(m,0,t[e]),n.set(m,1,t[e+1]),n.set(m,2,t[e+2]),h.set(m,0,i[e]),h.set(m,1,i[e+1]),h.set(m,2,i[e+2]),m++}for(let u=0;u<o.length;u++){const e=3*o[u];n.set(m,0,t[e]),n.set(m,1,t[e+1]),n.set(m,2,t[e+2]),h.set(m,0,i[e]),h.set(m,1,i[e+1]),h.set(m,2,i[e+2]),m++}const d=new y(a,u(F),l.buffer);return new c(a,d)}_disposeVaos(){this._vaoCut=t(this._vaoCut),this._vaoFill=t(this._vaoFill)}};e([o()],D.prototype,"consumes",void 0),e([o()],D.prototype,"produces",void 0),e([o()],D.prototype,"cutColor",void 0),e([o()],D.prototype,"fillColor",void 0),e([o()],D.prototype,"borderColor",void 0),e([o()],D.prototype,"measureType",void 0),D=e([r("esri.views.3d.webgl-engine.lib.CutFillVisualization")],D);const F=n().vec3f("position").vec3f("normal").freeze();class j{constructor(e,t,i,s){this.vertices=e,this.indicesBottom=t,this.indicesExtruded=i,this.normals=s}}export{D as CutFillVisualization,j as VolumeGeometry};
|