@arcgis/core 4.28.0-next.20230911 → 4.28.0-next.20230913
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/arcade/Feature.js +1 -1
- package/arcade/arcadeTimeUtils.js +1 -1
- package/arcade/executionError.js +1 -1
- package/arcade/featureSetUtils.js +1 -1
- package/arcade/featureset/actions/Adapted.js +1 -1
- package/arcade/featureset/actions/GroupBy.js +1 -1
- package/arcade/featureset/support/FeatureSet.js +1 -1
- package/arcade/featureset/support/errorsupport.js +1 -1
- package/arcade/functions/featuresetbase.js +1 -1
- package/arcade/functions/featuresetstats.js +1 -1
- package/arcade/functions/string.js +1 -1
- package/arcade.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0920312e3c7b63c2e253.js +1 -0
- package/assets/esri/core/workers/chunks/0cb007ab5db0a2a598ec.js +1 -0
- package/assets/esri/core/workers/chunks/0cc61f1b2c0473ded5c2.js +1 -0
- package/assets/esri/core/workers/chunks/0f804e3f888cb4998f46.js +1 -0
- package/assets/esri/core/workers/chunks/189dd81cf95bd8417ee3.js +1 -0
- package/assets/esri/core/workers/chunks/1a723bb4a341f645e5fe.js +1 -0
- package/assets/esri/core/workers/chunks/24c717492ea1b35310d8.js +1 -0
- package/assets/esri/core/workers/chunks/{3ce73dd4113dbc7d11de.js → 2eb58dc339b2bb03d9e3.js} +1 -1
- package/assets/esri/core/workers/chunks/{38c07a8574352a7f2f6d.js → 2ff0dbd5eb7ca57bb7fc.js} +1 -1
- package/assets/esri/core/workers/chunks/{768f3db2705fa9e57641.js → 49dfdc0463450491df9d.js} +1 -1
- package/assets/esri/core/workers/chunks/650a317b6dc245a7060f.js +1 -0
- package/assets/esri/core/workers/chunks/{56ed099745360888604e.js → 67f01c71280fa0759742.js} +1 -1
- package/assets/esri/core/workers/chunks/{f62842807744bdfaced7.js → 67fab13f56b340076763.js} +1 -1
- package/assets/esri/core/workers/chunks/6d94b358e8d1cf79bba3.js +1 -0
- package/assets/esri/core/workers/chunks/718607d7a3b33fc33b0a.js +1 -0
- package/assets/esri/core/workers/chunks/{4c63d6b9460aa6ae9843.js → 860417f4138f53d315ba.js} +2 -2
- package/assets/esri/core/workers/chunks/8aa7e994b74f66522c37.js +1 -0
- package/assets/esri/core/workers/chunks/9fa485b04b997b0a5509.js +1 -0
- package/assets/esri/core/workers/chunks/a047fcf3c7307a69b63c.js +1 -0
- package/assets/esri/core/workers/chunks/a753d9874801cd448946.js +1 -0
- package/assets/esri/core/workers/chunks/c51233ad51823cb98c35.js +1 -0
- package/assets/esri/core/workers/chunks/c61f20d91a5c432b07dc.js +1 -0
- package/assets/esri/core/workers/chunks/d3d11242e5af57ba77f4.js +1 -0
- package/assets/esri/core/workers/chunks/dbf343d1fb746f99bb6e.js +1 -0
- package/assets/esri/core/workers/chunks/{271ec1d1666bf6dc3dda.js → dc74b4ec85e8e3de5b27.js} +1 -1
- package/assets/esri/core/workers/chunks/e8a8791d765ab6c450dd.js +1 -0
- package/assets/esri/core/workers/chunks/{5fe7b5665710ec6d3046.js → eb0d1c5c96f735c162d3.js} +1 -1
- package/assets/esri/themes/base/widgets/_Sketch.scss +0 -5
- package/assets/esri/themes/base/widgets/_SketchTooltipControls.scss +0 -5
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/HUDMaterial.glsl.js +38 -45
- package/chunks/languageUtils.js +1 -1
- package/core/promiseUtils.js +1 -1
- package/core/sql/AggregateFunctions.js +1 -1
- package/core/sql/DateOnly.js +1 -1
- package/core/sql/SqlTimestampOffset.js +1 -1
- package/core/sql/TimeOnly.js +1 -1
- package/core/sql/WhereClause.js +1 -1
- package/core/sql/WhereGrammar.js +1 -1
- package/core/sql/sqlCompareUtils.js +1 -1
- package/geometry/GeometryCursor.js +1 -1
- package/geometry/Mesh.js +1 -1
- package/geometry/support/labelPoint.js +1 -1
- package/geometry/support/meshUtils/bounds.js +1 -1
- package/geometry/support/meshUtils/georeference.js +1 -1
- package/interfaces.d.ts +190 -144
- package/layers/ImageryLayer.js +1 -1
- package/layers/SceneLayer.js +1 -1
- package/layers/graphics/controllers/FeatureTileController3D.js +1 -1
- package/layers/graphics/controllers/I3SOnDemandController.js +1 -1
- package/layers/graphics/sources/csv/csv.js +1 -1
- package/layers/support/FetchAssociatedFeatureLayer.js +1 -1
- package/layers/support/TilemapCache.js +1 -1
- package/layers/support/fieldUtils.js +1 -1
- package/layers/support/rasterDatasets/BaseRaster.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +3 -3
- package/smartMapping/heuristics/sizeRange.js +1 -1
- package/smartMapping/labels/bins.js +1 -1
- package/smartMapping/labels/clusters.js +1 -1
- package/smartMapping/labels/support/utils.js +1 -1
- package/smartMapping/popup/support/clusterUtils.js +1 -1
- package/smartMapping/support/clusterUtils.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/DisplayId.js +1 -1
- package/views/2d/engine/webgl/Utils.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/AreaMeasurementVisualization.js +1 -1
- package/views/3d/analysis/AreaMeasurement/support/MeasurementData.js +1 -1
- package/views/3d/analysis/Dimension/DimensionVisualization.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionVisualization.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/analysis/Dimension/settings.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/originGraphicVisualElementUtils.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/measurementTools/areaMeasurement3D/AreaMeasurement3DTool.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/I3SMeshWorkerHandle.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerWorker.js +1 -1
- package/views/3d/layers/i3s/I3SClientNodeLoader.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/lib/OffscreenRendering.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechniqueConfiguration.js +1 -1
- package/views/ToolViewManager.js +1 -1
- package/views/View.js +1 -1
- package/views/animation/easing.js +1 -1
- package/views/webgl/FramebufferObject.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/views/webgl/enums.js +1 -1
- package/views/webgl/renderState.js +1 -1
- package/widgets/BasemapGallery/BasemapGalleryViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Features.js +1 -1
- package/widgets/Search/SearchViewModel.js +1 -1
- package/widgets/support/SketchTooltipControls/SketchTooltipControlsViewModel.js +1 -1
- package/widgets/support/SketchTooltipControls.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/055575ed2ab78be0bdb2.js +0 -1
- package/assets/esri/core/workers/chunks/0ee90a0b4d09a56c0d48.js +0 -1
- package/assets/esri/core/workers/chunks/15056f91d87f11b00bcc.js +0 -1
- package/assets/esri/core/workers/chunks/344e40934c98d6fe66ae.js +0 -1
- package/assets/esri/core/workers/chunks/558049fcac3a82a093fc.js +0 -1
- package/assets/esri/core/workers/chunks/5c41eb67d19b8710118a.js +0 -1
- package/assets/esri/core/workers/chunks/5d183ac1a8b68ba9c656.js +0 -1
- package/assets/esri/core/workers/chunks/610d4a5d2511fa81460e.js +0 -1
- package/assets/esri/core/workers/chunks/6755bb1f2a6575a8e082.js +0 -1
- package/assets/esri/core/workers/chunks/84173936b309712ba9b3.js +0 -1
- package/assets/esri/core/workers/chunks/877302d6e39a0d530aab.js +0 -1
- package/assets/esri/core/workers/chunks/a07dc782e69111e2eeaf.js +0 -1
- package/assets/esri/core/workers/chunks/b825019841247d173072.js +0 -1
- package/assets/esri/core/workers/chunks/bed1bc13b168fae46404.js +0 -1
- package/assets/esri/core/workers/chunks/c8dd21a332559c99815c.js +0 -1
- package/assets/esri/core/workers/chunks/ccc3564e76c0ec5c0228.js +0 -1
- package/assets/esri/core/workers/chunks/d0a81c7ec8a84eeadd31.js +0 -1
- package/assets/esri/core/workers/chunks/e7a852b319c1d89eddc5.js +0 -1
- package/assets/esri/core/workers/chunks/ebde11fdccb437954ce7.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import o from"../../../../Color.js";import{multiplyOpacity as r,getContrast as t}from"../../../../core/colorUtils.js";function n(o){return r(o.accentColor,.5)}function c(o){return t(o.accentColor)}const e=5,i=new o([127,127,127,.5]),l=.8,f=4,m=6,s=.1,u=.5,p=18,C=2,a=.3,j=2,w=.25,x=20,U=5,b=5,d=10,g=2500,h=50,k=2;export{d as constraintThresholdPx,i as disabledPointColor,m as focusedLinePaddingPx,c as getContrastColor,n as getTransparentAccentColor,h as initialOffsetPx,x as labelMarginPx,u as lengthFraction,f as linePaddingPx,l as markerLineSizeFraction,s as minLengthMeters,U as minScreenLengthFontSizeFactor,w as offsetLineSizeFraction,p as orientationCalloutOffsetPx,C as orientationCalloutWidth,a as orientationDiscScale,j as orientationFocusMultiplier,b as orientationSnapThresholdDegrees,e as pointRadius,g as pointerMoveTimeoutMs,k as smallScreenLengthLineSizeFactor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{neverReached as e}from"../../../core/compilerUtils.js";import t from"../../../core/Evented.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{createScreenPointArray as n,createRenderScreenPointArray3 as r,screenPointObjectToArray as a,castRenderScreenPointArray as c}from"../../../core/screenUtils.js";import{f as l}from"../../../chunks/mat3.js";import{a as h}from"../../../chunks/mat3f64.js";import{h as d,s as _,m as u,g}from"../../../chunks/mat4.js";import{a as m}from"../../../chunks/mat4f64.js";import{k as f}from"../../../chunks/vec2.js";import{g as p,t as b,e as v,i as y,c as j,a as L,s as S,f as R}from"../../../chunks/vec3.js";import{c as O,Z as w}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as T}from"../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as A,projectPoint as E}from"../../../geometry/projection.js";import{computeENUToSphericalPCPFLocalRotation as D}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as k}from"../../../geometry/projection/projectors.js";import{containsPointObject as F}from"../../../geometry/support/aaBoundingRect.js";import{create as z,distance2 as C,fromPoints as P,closestRayDistance2 as I}from"../../../geometry/support/lineSegment.js";import{create as M,fromPositionAndNormal as x,intersectRay as U}from"../../../geometry/support/plane.js";import{create as B}from"../../../geometry/support/ray.js";import{sv3d as W}from"../../../geometry/support/vectorStacks.js";import{clonePoint as N,hydratedSpatialReference as H}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationAtPoint as V}from"../support/ElevationProvider.js";import{fromScreen as G}from"../support/geometryUtils/ray.js";import{Camera as Y}from"../webgl-engine/lib/Camera.js";import{Object3D as Z}from"../webgl-engine/lib/Object3D.js";import{UpdatePolicy as q}from"../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as J}from"../webgl-engine/lib/WebGLLayer.js";import{ManipulatorStateCustomFlags as K,ManipulatorStateFlags as Q}from"../../interactive/interfaces.js";import X from"../../../geometry/Point.js";class ${constructor(e){this.metadata=void 0,this._camera=new Y,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=m(),this._worldFrame=null,this._renderLocation=O(),this._renderLocationDirty=!0,this._location=new X({x:0,y:0,z:0}),this._elevationAlignedLocation=new X,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=K.None,this._focused=!1,this.events=new t.EventEmitter,this._screenLocation={screenPointArray:n(),renderScreenPointArray:r(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=e.view.spatialReference,Object.assign(this,e);const i=this.view.state?.camera;i&&this._camera.copyFrom(i)}destroy(){this._applyObjectTransform=fe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){return this.view?._stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),i((()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()}))}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ee(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=m()),te(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){N(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){N(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=H(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ee(this._modelTransform)){const t=this._calculateModelTransformOffset(ge);e=p(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(t,i){if(!this.available)return null;const s=a(t,ie),o=this._getCollisionRadius(i),n=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(f(this.screenLocation.screenPointArray,s)<o*o)return this.screenLocation.renderScreenPointArray[2]+n;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ae),r=o*this.screenLocation.pixelSize,a=G(this._camera,s,oe);if(null==a)return null;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],i);for(let t=1;t<s.length;t++){const o=v(he,s[t],i),l=I(P(e,o,se),a);if(null!=l&&l<r*r){const t=p(W.get(),e,o);y(t,t,.5);const i=c(W.get());return this._camera.projectToRenderScreen(t,i),i[2]+n}j(e,o)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??w,i=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(i,ae),a=o*this.screenLocation.pixelSize,c=G(this._camera,s,oe);if(null==c)return null;const h=l(ne,r),d=b(_e,e,h),_=v(ue,t,r);x(_,d,ce);const u=de;if(U(ce,c,u)&&L(u,_)<a*a)return this.screenLocation.renderScreenPointArray[2]+n;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,i=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(i,ae),a=o*this._camera.computeScreenPixelSizeAt(this.renderLocation),h=G(this._camera,s,oe);if(null==h)return null;const d=l(ne,r),_=b(_e,t,d),u=this._calculateModelTransformPosition(ue);x(u,_,ce);const g=de;if(!U(ce,h,g))break;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],r);for(let t=1;t<s.length;t++){const i=v(he,s[t],r),o=C(P(e,i,se),g);if(null!=o&&o<a*a){const t=p(W.get(),e,i);y(t,t,.5);const s=c(W.get());return this._camera.projectToRenderScreen(t,s),s[2]+n}j(e,i)}}break}default:e(this.collisionType)}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new J(t,{pickable:!1,updatePolicy:q.SYNC}),i.engineLayerId=this._engineLayer.id):t?.getObject&&(this._engineLayer=t.getObject(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._materialIdReferences=i.materialIdReferences,null==this._materialIdReferences&&(this._materialIdReferences=new Map,i.materialIdReferences=this._materialIdReferences),this._camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),A(this._location.spatialReference,this.view.spatialReference)||(this.location=new X({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,o(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._materialIdReferences=null,this._attached=!1}onViewChange(){this._camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){E(this.location,me,e.spatialReference)&&F(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=this.elevationInfo.offset??0;switch(this.elevationInfo.mode){case"on-the-ground":e=V(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(V(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(V(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ae;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?Q.Focused:Q.Unfocused)|(this.selected?Q.Selected:Q.Unselected),o=this._noDisplayCount>0;for(const{stateMask:n,objects:r}of i){if(o){for(const e of r)e.visible=!1;continue}const e=(n&Q.All)!==Q.None,i=(n&K.All)!==K.None,a=!e||(s&n)==(n&Q.All),c=!i||(this.state&n)==(n&K.All);if(a&&c)for(const s of r)s.visible=!0,s.transformation=t;else for(const t of r)t.visible=!1}}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach((({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))}));const s=new Map;this._renderObjects.forEach((e=>{const t=new Z({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)}));const o=[];s.forEach(((e,t)=>o.push({stateMask:t,objects:e}))),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id)||0;0===s&&e.add(t),i.set(t.id,s+1)})),t.forEach((({objects:t})=>{i.addMany(t),e.addMany(t)})),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;t.forEach((({objects:t})=>{i.removeMany(t),e.removeMany(t)})),s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id);1===s?(e.remove(t),i.delete(t.id)):i.set(t.id,s-1)})),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,re);return S(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return R(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return _(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&u(t,t,this._worldFrame),u(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){let e=!1;if(null!=this._engineResources)for(const t in this._engineResources.objectsByState){const i=this._engineResources.objectsByState[t];for(const t of i.objects)if(t.visible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function ee(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function te(e,t,i){switch(e.viewingMode){case"local":return g(i),!0;case"global":{const o=T(e.renderCoordsHelper.spatialReference);return k(t,0,le,0,o.radius),D(s(le[0]),s(le[1]),i),!0}}}const ie=n(),se=z(),oe=B(),ne=h(),re=m(),ae=m(),ce=M(),le=O(),he=O(),de=O(),_e=O(),ue=O(),ge=O(),me=new X({x:0,y:0,z:0,spatialReference:null}),fe=()=>{};export{$ as Manipulator3D};
|
|
5
|
+
import"../../../geometry.js";import{neverReached as e}from"../../../core/compilerUtils.js";import t from"../../../core/Evented.js";import{makeHandle as i}from"../../../core/handleUtils.js";import{deg2rad as s}from"../../../core/mathUtils.js";import{destroyMaybe as o}from"../../../core/maybe.js";import{createScreenPointArray as n,createRenderScreenPointArray3 as r,screenPointObjectToArray as a,castRenderScreenPointArray as c}from"../../../core/screenUtils.js";import{f as l}from"../../../chunks/mat3.js";import{a as h}from"../../../chunks/mat3f64.js";import{h as d,s as _,m as u,g}from"../../../chunks/mat4.js";import{a as m}from"../../../chunks/mat4f64.js";import{k as f}from"../../../chunks/vec2.js";import{g as p,t as b,e as v,i as y,c as j,a as L,s as S,f as R}from"../../../chunks/vec3.js";import{c as O,Z as w}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as T}from"../../../geometry/ellipsoidUtils.js";import{canProjectWithoutEngine as A,projectPoint as E}from"../../../geometry/projection.js";import{computeENUToSphericalPCPFLocalRotation as D}from"../../../geometry/projection/localRotationUtils.js";import{sphericalPCPFtoLonLatElevation as k}from"../../../geometry/projection/projectors.js";import{containsPointObject as F}from"../../../geometry/support/aaBoundingRect.js";import{create as z,distance2 as C,fromPoints as P,closestRayDistance2 as I}from"../../../geometry/support/lineSegment.js";import{create as M,fromPositionAndNormal as x,intersectRay as U}from"../../../geometry/support/plane.js";import{create as W}from"../../../geometry/support/ray.js";import{sv3d as B}from"../../../geometry/support/vectorStacks.js";import{clonePoint as N,hydratedSpatialReference as H}from"../../../layers/graphics/hydratedFeatures.js";import{getElevationAtPoint as V}from"../support/ElevationProvider.js";import{fromScreen as G}from"../support/geometryUtils/ray.js";import{Camera as Y}from"../webgl-engine/lib/Camera.js";import{Object3D as Z}from"../webgl-engine/lib/Object3D.js";import{UpdatePolicy as q}from"../webgl-engine/lib/UpdatePolicy.js";import{WebGLLayer as J}from"../webgl-engine/lib/WebGLLayer.js";import{ManipulatorStateCustomFlags as K,ManipulatorStateFlags as Q}from"../../interactive/interfaces.js";import X from"../../../geometry/Point.js";class ${constructor(e){this.metadata=void 0,this._camera=new Y,this._elevation={offset:0,override:null},this.collisionType={type:"point"},this.collisionPriority=0,this._renderObjects=new Array,this.autoScaleRenderObjects=!0,this._available=!0,this._noDisplayCount=0,this._radius=10,this._worldSized=!1,this.focusMultiplier=2,this.touchMultiplier=2.5,this.worldOriented=!1,this._modelTransform=m(),this._worldFrame=null,this._renderLocation=O(),this._renderLocationDirty=!0,this._location=new X({x:0,y:0,z:0}),this._elevationAlignedLocation=new X,this._elevationAlignedLocationDirty=!0,this.interactive=!0,this.selectable=!1,this.grabbable=!0,this.consumesClicks=!0,this.cursor=null,this.grabCursor=null,this._grabbing=!1,this.dragging=!1,this._hovering=!1,this._selected=!1,this._state=K.None,this._focused=!1,this.events=new t.EventEmitter,this._screenLocation={screenPointArray:n(),renderScreenPointArray:r(),pixelSize:0},this._screenLocationDirty=!0,this._engineResourcesAddedToStage=!1,this._attached=!1,this._location.spatialReference=e.view.spatialReference,Object.assign(this,e);const i=this.view.state?.camera;i&&this._camera.copyFrom(i)}destroy(){this._applyObjectTransform=fe,this._removeResourcesFromStage(),this._engineResources=null,this.view=null,this._camera=null}get _stage(){return this.view?._stage}get elevationInfo(){return this._elevationInfo}set elevationInfo(e){this._elevationInfo=e,this._elevationAlignedLocationDirty=!0,this._renderLocationDirty=!0,this._updateEngineObject()}get renderObjects(){return this._renderObjects}set renderObjects(e){this._removeResourcesFromStage(),this._engineResources=null,this._renderObjects=e.slice(),this._updateEngineObject()}set available(e){e!==this._available&&(this._available=e,this._updateEngineObject())}get available(){return this._available}disableDisplay(){return this._noDisplayCount++,1===this._noDisplayCount&&this._updateEngineObject(),i((()=>{this._noDisplayCount--,0===this._noDisplayCount&&this._updateEngineObject()}))}set radius(e){e!==this._radius&&(this._radius=e,this._updateEngineObject())}get radius(){return this._radius}set worldSized(e){e!==this._worldSized&&(this._worldSized=e,this._updateEngineObject())}get worldSized(){return this._worldSized}get modelTransform(){return this._modelTransform}set modelTransform(e){ee(e)&&(this._screenLocationDirty=!0),d(this._modelTransform,e),this._updateEngineObject()}get renderLocation(){return this._renderLocationDirty&&(this._renderLocationDirty=!1,this.view.renderCoordsHelper.toRenderCoords(this.elevationAlignedLocation,this._renderLocation),this.worldOriented?(this._worldFrame||(this._worldFrame=m()),te(this.view,this._renderLocation,this._worldFrame)):this._worldFrame&&(this._worldFrame=null)),this._renderLocation}set renderLocation(e){this.view.renderCoordsHelper.fromRenderCoords(e,this._location),this.elevationAlignedLocation=this._location}get location(){return this._location}set location(e){N(e,this._location),this._notifyLocationChanged()}_notifyLocationChanged(){this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!0,this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}get elevationAlignedLocation(){return this._elevationAlignedLocationDirty?(this._evaluateElevationAlignment(),this._updateElevationAlignedLocation(),this._elevationAlignedLocation):this._elevationAlignedLocation}set elevationAlignedLocation(e){N(e,this._location),this._evaluateElevationAlignment(),this._location.z-=this._elevation.offset,this._updateElevationAlignedLocation(),this._updateEngineObject(),this.events.emit("location-update",{location:this._location})}_updateElevationAlignedLocation(){const e=null!=this._elevation.override?this._elevation.override:this.location.z||0;this._elevationAlignedLocation.x=this.location.x,this._elevationAlignedLocation.y=this.location.y,this._elevationAlignedLocation.z=e+this._elevation.offset,this._elevationAlignedLocation.spatialReference=H(this.location.spatialReference),this._renderLocationDirty=!0,this._screenLocationDirty=!0,this._elevationAlignedLocationDirty=!1}grabbableForEvent(){return!0}get grabbing(){return this._grabbing}set grabbing(e){e!==this._grabbing&&(this._grabbing=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get hovering(){return this._hovering}set hovering(e){e!==this._hovering&&(this._hovering=e,this._setFocused(this._hovering||this._grabbing),this._updateEngineObject())}get selected(){return this._selected}set selected(e){e!==this._selected&&(this._selected=e,this._updateEngineObject(),this.events.emit("select-changed",{action:e?"select":"deselect"}))}get state(){return this._state}set state(e){e!==this._state&&(this._state=e,this._updateEngineObject())}updateStateEnabled(e,t){t?this.state|=e:this.state&=~e}_setFocused(e){e!==this._focused&&(this._focused=e,this.events.emit("focus-changed",{action:!0===e?"focus":"unfocus"}))}get focused(){return this._focused}get screenLocation(){return this._ensureScreenLocation(),this._screenLocation}_ensureScreenLocation(){if(!this._screenLocationDirty)return;this._screenLocation.pixelSize=this._camera.computeScreenPixelSizeAt(this.renderLocation),this._screenLocationDirty=!1;let e;if(ee(this._modelTransform)){const t=this._calculateModelTransformOffset(ge);e=p(t,t,this.renderLocation)}else e=this.renderLocation;this._camera.projectToRenderScreen(e,this._screenLocation.renderScreenPointArray),this._camera.renderToScreen(this._screenLocation.renderScreenPointArray,this._screenLocation.screenPointArray)}get applyObjectTransform(){return this._applyObjectTransform}set applyObjectTransform(e){this._applyObjectTransform=e,this._screenLocationDirty=!0,this._updateEngineObject()}get attached(){return this._attached}intersectionDistance(t,i){if(!this.available)return null;const s=a(t,ie),o=this._getCollisionRadius(i),n=-1*this.collisionPriority;switch(this.collisionType.type){case"point":if(f(this.screenLocation.screenPointArray,s)<o*o)return this.screenLocation.renderScreenPointArray[2]+n;break;case"line":{const e=this.collisionType.paths,t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,ae),r=o*this.screenLocation.pixelSize,a=G(this._camera,s,oe);if(null==a)return null;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],i);for(let t=1;t<s.length;t++){const o=v(he,s[t],i),l=I(P(e,o,se),a);if(null!=l&&l<r*r){const t=p(B.get(),e,o);y(t,t,.5);const i=c(B.get());return this._camera.projectToRenderScreen(t,i),i[2]+n}j(e,o)}}break}case"disc":{const e=this.collisionType.direction,t=this.collisionType.offset??w,i=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(i,ae),a=o*this.screenLocation.pixelSize,c=G(this._camera,s,oe);if(null==c)return null;const h=l(ne,r),d=b(_e,e,h),_=v(ue,t,r);x(_,d,ce);const u=de;if(U(ce,c,u)&&L(u,_)<a*a)return this.screenLocation.renderScreenPointArray[2]+n;break}case"ribbon":{const{paths:e,direction:t}=this.collisionType,i=this._getWorldToScreenObjectScale(),r=this._calculateObjectTransform(i,ae),a=o*this._camera.computeScreenPixelSizeAt(this.renderLocation),h=G(this._camera,s,oe);if(null==h)return null;const d=l(ne,r),_=b(_e,t,d),u=this._calculateModelTransformPosition(ue);x(u,_,ce);const g=de;if(!U(ce,h,g))break;for(const s of e){if(0===s.length)continue;const e=v(le,s[0],r);for(let t=1;t<s.length;t++){const i=v(he,s[t],r),o=C(P(e,i,se),g);if(null!=o&&o<a*a){const t=p(B.get(),e,i);y(t,t,.5);const s=c(B.get());return this._camera.projectToRenderScreen(t,s),s[2]+n}j(e,i)}}break}default:e(this.collisionType)}return null}attach(e={manipulator3D:{}}){const t=this._stage;if(!t)return;const i=e.manipulator3D;null==i.engineLayerId?(this._engineLayer=new J(t,{pickable:!1,updatePolicy:q.SYNC}),i.engineLayerId=this._engineLayer.id):t?.getObject&&(this._engineLayer=t.getObject(i.engineLayerId)),i.engineLayerReferences=(i.engineLayerReferences||0)+1,this._materialIdReferences=i.materialIdReferences,null==this._materialIdReferences&&(this._materialIdReferences=new Map,i.materialIdReferences=this._materialIdReferences),this._camera.copyFrom(this.view.state.camera),this._attached=!0,this._updateEngineObject(),A(this._location.spatialReference,this.view.spatialReference)||(this.location=new X({x:0,y:0,z:0,spatialReference:this.view.spatialReference}))}detach(e={manipulator3D:{}}){const t=e.manipulator3D;t.engineLayerReferences--;const i=0===t.engineLayerReferences;this._removeResourcesFromStage(),i&&(t.engineLayerId=null,o(this._engineLayer)),this._engineResources=null,this._engineLayer=null,this._materialIdReferences=null,this._attached=!1}onViewChange(){this._camera.copyFrom(this.view.state.camera),this._screenLocationDirty=!0,this._updateEngineObject()}onElevationChange(e){E(this.location,me,e.spatialReference)&&F(e.extent,me)&&this._notifyLocationChanged()}_evaluateElevationAlignment(){if(null==this.elevationInfo)return;let e=null,t=0;const i=this.elevationInfo.offset??0;switch(this.elevationInfo.mode){case"on-the-ground":e=V(this.view.elevationProvider,this.location,"ground")??0;break;case"relative-to-ground":t=(V(this.view.elevationProvider,this.location,"ground")??0)+i;break;case"relative-to-scene":t=(V(this.view.elevationProvider,this.location,"scene")??0)+i;break;case"absolute-height":t=i}return t!==this._elevation.offset||e!==this._elevation.override?(this._elevation.offset=t,void(this._elevation.override=e)):void 0}_updateEngineObject(){if(!this._attached)return;if(!this.available)return void this._removeResourcesFromStage();const e=this._getWorldToScreenObjectScale(),t=ae;if(!0===this.autoScaleRenderObjects){const i=this._getFocusedSize(this._radius,this.focused)*e;this._calculateObjectTransform(i,t)}else this._calculateObjectTransform(e,t);const{objectsByState:i}=this._ensureEngineResources(),s=(this.focused?Q.Focused:Q.Unfocused)|(this.selected?Q.Selected:Q.Unselected),o=this._noDisplayCount>0;for(const{stateMask:n,objects:r}of i){if(o){for(const e of r)e.visible=!1;continue}const e=(n&Q.All)!==Q.None,i=(n&K.All)!==K.None,a=!e||(s&n)==(n&Q.All),c=!i||(this.state&n)==(n&K.All);if(a&&c)for(const s of r)s.visible=!0,s.transformation=t;else for(const t of r)t.visible=!1}}_ensureEngineResources(){if(null==this._engineResources){const e=this._engineLayer,t=[],i=new Set;this.renderObjects.forEach((({geometry:{material:e}})=>{i.has(e)||(t.push(e),i.add(e))}));const s=new Map;this._renderObjects.forEach((e=>{const t=new Z({castShadow:!1,geometries:[e.geometry]}),i=s.get(e.stateMask)||[];i.push(t),s.set(e.stateMask,i)}));const o=[];s.forEach(((e,t)=>o.push({stateMask:t,objects:e}))),this._engineResources={objectsByState:o,layer:e,materials:t}}return this._addResourcesToStage(),this._engineResources}_addResourcesToStage(){const e=this._stage;if(this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id)||0;0===s&&e.add(t),i.set(t.id,s+1)})),t.forEach((({objects:t})=>{i.addMany(t),e.addMany(t)})),this._engineResourcesAddedToStage=!0}_removeResourcesFromStage(){const e=this._stage;if(!this._engineResourcesAddedToStage||null==this._engineResources||!e)return;const{objectsByState:t,layer:i,materials:s}=this._engineResources;t.forEach((({objects:t})=>{i.removeMany(t),e.removeMany(t)})),s.forEach((t=>{const i=this._materialIdReferences,s=i.get(t.id);1===s?(e.remove(t),i.delete(t.id)):i.set(t.id,s-1)})),this._engineResourcesAddedToStage=!1}_getCollisionRadius(e){return this._getFocusedSize(this.radius,!0)*("touch"===e?this.touchMultiplier:1)}_getFocusedSize(e,t){return e*(t?this.focusMultiplier:1)}_getWorldToScreenObjectScale(){return this._worldSized?1:this.screenLocation.pixelSize}_calculateModelTransformPosition(e){const t=this._getWorldToScreenObjectScale(),i=this._calculateObjectTransform(t,re);return S(e,i[12],i[13],i[14])}_calculateModelTransformOffset(e){const t=this._calculateModelTransformPosition(e);return R(e,t,this.renderLocation)}_calculateObjectTransform(e,t){return _(t,e,0,0,0,0,e,0,0,0,0,e,0,0,0,0,1),this._worldFrame&&u(t,t,this._worldFrame),u(t,t,this._modelTransform),t[12]+=this.renderLocation[0],t[13]+=this.renderLocation[1],t[14]+=this.renderLocation[2],t[15]=1,null!=this._applyObjectTransform&&this._applyObjectTransform(t),t}get test(){let e=!1;if(null!=this._engineResources)for(const t of this._engineResources.objectsByState){for(const i of t.objects)if(i.visible){e=!0;break}if(e)break}return{areAnyResourcesVisible:e}}}function ee(e){return 0!==e[12]||0!==e[13]||0!==e[14]}function te(e,t,i){switch(e.viewingMode){case"local":return g(i),!0;case"global":{const o=T(e.renderCoordsHelper.spatialReference);return k(t,0,le,0,o.radius),D(s(le[0]),s(le[1]),i),!0}}}const ie=n(),se=z(),oe=W(),ne=h(),re=m(),ae=m(),ce=M(),le=O(),he=O(),de=O(),_e=O(),ue=O(),ge=O(),me=new X({x:0,y:0,z:0,spatialReference:null}),fe=()=>{};export{$ as Manipulator3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{removeHandles as e,destroyHandle as t,refHandle as n}from"../../../../core/handleUtils.js";import{deg2rad as o}from"../../../../core/mathUtils.js";import{watch as i,initial as r}from"../../../../core/reactiveUtils.js";import{s as a}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as c,empty as m,getMin as u}from"../../../../geometry/support/aaBoundingBox.js";import{containsXY as h}from"../../../../geometry/support/aaBoundingRect.js";import{getGraphicEffectiveElevationInfo as d}from"../../../../support/elevationInfoUtils.js";import{GrabbingState as f}from"./GrabbingState.js";import{ManipulatorState as g}from"./ManipulatorState.js";import{getSettings as v}from"./settings.js";import{ExtendedLineVisualElement as y}from"../visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as j}from"../visualElements/LaserlineVisualElement.js";import{PointVisualElement as E}from"../visualElements/PointVisualElement.js";import{evaluateElevationAlignmentAtPoint as w}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as b}from"../../layers/graphics/ElevationContext.js";import{GraphicState as D}from"../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as S}from"../../webgl-engine/lib/Material.js";function x(t){const{view:n,graphic:o}=t,i=new D({graphic:o}),r=[],a=T(t,i,r);return P(t,i,r,a),r.push(n.trackGraphicState(i)),{visualElement:a,remove:()=>e(r)}}function P(e,n,r,s){const{view:l,graphic:c}=e,h=v(l.effectiveTheme),E=new y({view:l,extensionType:h.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:S.OccludeAndTransparent,isDecoration:!0});h.visualElements.zVerticalLine.apply(E);const D=new j({view:l,intersectsLineInfinite:!0,attached:!1,isDecoration:!0});h.visualElements.pointGraphics.shadowStyle.apply(D);const x=o(h.visualElements.heightPlaneAngleCutoff),P=new j({view:l,attached:!1,angleCutoff:x,isDecoration:!0});h.visualElements.heightPlane.apply(P);const T=d(e.graphic),A=b.fromElevationInfo(T),L="on-the-ground"===T.mode||!T.offset&&"absolute-height"!==T.mode,M=new g;let R=1,U=1;const B=()=>{M.update(e);const t=V(c),o=L&&(n.isDraped||null==t||!t.hasZ);let i=!0;if(o||null==t)i=!1;else{const e=w(t,l.elevationProvider,A,l.renderCoordsHelper);a(C,t.x,t.y,e),p(C,t.spatialReference,C,l.renderCoordsHelper.spatialReference),E.setStartEndFromWorldDownAtLocation(C),D.intersectsWorldUpAtLocation=C}const r=M.grabbingState&f.Z?h.visualElements.laserlineAlphaMultiplier:1;r!==R&&(R=r,h.visualElements.heightPlane.apply(P,r));const d=m(G);!o&&n.displaying&&s.calculateMapBounds(d)&&p(u(d,C),l.spatialReference,C,l.renderCoordsHelper.spatialReference)?(P.heightManifoldTarget=C,P.attached=!0):P.attached=!1;const g=M.grabbingState&f.XY?h.visualElements.laserlineAlphaMultiplier:1;g!==U&&(U=g,h.visualElements.pointGraphics.shadowStyle.apply(D,g));const v=i&&n.displaying&&!o;D.attached=v,E.attached=v};r.push(i((()=>[n.displaying,n.isDraped]),B),n.on("changed",B)),e.forEachManipulator((e=>{r.push(e.events.on("grab-changed",B))})),r.push(t(D)),r.push(t(E)),r.push(t(P)),B()}function T(e,n,o){const{view:i,graphic:r}=e,a=new E({view:i,geometry:V(r),elevationInfo:d(r),isDecoration:!0});return A(e,a,n,o),o.push(t(a)),a}function V(e){const t=e.geometry;return null==t?null:"point"===t.type?t:"mesh"===t.type?t.anchor.clone():null}function A(e,t,n,o){const a=()=>t.attached=n.displaying;L(e,t,n,o),v(e.view.effectiveTheme).visualElements.pointGraphics.outline.apply(t),o.push(i((()=>n.displaying),a,r))}function L(e,t,o,i){const{view:r,graphic:a}=e;let s=null;const l=e=>{null!=s&&(s.remove(),s=null),o.isDraped&&null!=e&&(s=M(r,e,(()=>{t.geometry=e})))},p=()=>{const e=V(a);l(e),t.geometry=e};i.push(o.on("changed",p),n((()=>s))),p()}function M(e,t,n){const o=e.elevationProvider.spatialReference;l(t,C,o);const i=C[0],r=C[1];return e.elevationProvider.on("elevation-change",(e=>{h(e.extent,i,r)&&n()}))}const C=s(),G=c();export{x as createVisualElements};
|
|
5
|
+
import{removeHandles as e,destroyHandle as t,refHandle as n}from"../../../../core/handleUtils.js";import{deg2rad as o}from"../../../../core/mathUtils.js";import{watch as i,initial as r}from"../../../../core/reactiveUtils.js";import{s as a}from"../../../../chunks/vec3.js";import{c as s}from"../../../../chunks/vec3f64.js";import{projectPointToVector as l}from"../../../../geometry/projection/projectPointToVector.js";import{projectVectorToVector as p}from"../../../../geometry/projection/projectVectorToVector.js";import{create as c,empty as m,getMin as u}from"../../../../geometry/support/aaBoundingBox.js";import{containsXY as h}from"../../../../geometry/support/aaBoundingRect.js";import{getGraphicEffectiveElevationInfo as d}from"../../../../support/elevationInfoUtils.js";import{GrabbingState as f}from"./GrabbingState.js";import{ManipulatorState as g}from"./ManipulatorState.js";import{getSettings as v}from"./settings.js";import{ExtendedLineVisualElement as y}from"../visualElements/ExtendedLineVisualElement.js";import{LaserlineVisualElement as j}from"../visualElements/LaserlineVisualElement.js";import{PointVisualElement as E}from"../visualElements/PointVisualElement.js";import{evaluateElevationAlignmentAtPoint as w}from"../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as b}from"../../layers/graphics/ElevationContext.js";import{GraphicState as D}from"../../layers/graphics/GraphicState.js";import{RenderOccludedFlag as S}from"../../webgl-engine/lib/Material.js";function x(t){const{view:n,graphic:o}=t,i=new D({graphic:o}),r=[],a=T(t,i,r);return P(t,i,r,a),r.push(n.trackGraphicState(i)),{visualElement:a,remove:()=>e(r)}}function P(e,n,r,s){const{view:l,graphic:c}=e,h=v(l.effectiveTheme),E=new y({view:l,extensionType:h.visualElements.zVerticalLine.extensionType,innerWidth:1,attached:!1,writeDepthEnabled:!1,renderOccluded:S.OccludeAndTransparent,isDecoration:!0});h.visualElements.zVerticalLine.apply(E);const D=new j({view:l,intersectsLineInfinite:!0,attached:!1,isDecoration:!0});h.visualElements.pointGraphics.shadowStyle.apply(D);const x=o(h.visualElements.heightPlaneAngleCutoff),P=new j({view:l,attached:!1,angleCutoff:x,isDecoration:!0});h.visualElements.heightPlane.apply(P);const T=d(e.graphic),A=b.fromElevationInfo(T),L="on-the-ground"===T.mode||!T.offset&&"absolute-height"!==T.mode,M=new g;let R=1,U=1;const B=()=>{M.update(e);const t=V(c),o=L&&(n.isDraped||null==t||!t.hasZ);let i=!0;if(o||null==t)i=!1;else{const e=w(t,l.elevationProvider,A,l.renderCoordsHelper);a(C,t.x,t.y,e),p(C,t.spatialReference,C,l.renderCoordsHelper.spatialReference),E.setStartEndFromWorldDownAtLocation(C),D.intersectsWorldUpAtLocation=C}const r=M.grabbingState&f.Z?h.visualElements.laserlineAlphaMultiplier:1;r!==R&&(R=r,h.visualElements.heightPlane.apply(P,r));const d=m(G);!o&&n.displaying&&s.calculateMapBounds(d)&&p(u(d,C),l.spatialReference,C,l.renderCoordsHelper.spatialReference)?(P.heightManifoldTarget=C,P.attached=!0):P.attached=!1;const g=M.grabbingState&f.XY?h.visualElements.laserlineAlphaMultiplier:1;g!==U&&(U=g,h.visualElements.pointGraphics.shadowStyle.apply(D,g));const v=i&&n.displaying&&!o;D.attached=v,E.attached=v};r.push(i((()=>[n.displaying,n.isDraped]),B),n.on("changed",B)),e.forEachManipulator((e=>{r.push(e.events.on("grab-changed",B))})),r.push(t(D)),r.push(t(E)),r.push(t(P)),B()}function T(e,n,o){const{view:i,graphic:r}=e,a=new E({view:i,geometry:V(r),elevationInfo:d(r),isDecoration:!0});return A(e,a,n,o),o.push(t(a)),a}function V(e){const t=e.geometry;return null==t?null:"point"===t.type?t:"mesh"===t.type?t.anchor.clone():null}function A(e,t,n,o){const a=()=>{t.attached=n.displaying};L(e,t,n,o),v(e.view.effectiveTheme).visualElements.pointGraphics.outline.apply(t),o.push(i((()=>n.displaying),a,r))}function L(e,t,o,i){const{view:r,graphic:a}=e;let s=null;const l=e=>{null!=s&&(s.remove(),s=null),o.isDraped&&null!=e&&(s=M(r,e,(()=>{t.geometry=e})))},p=()=>{const e=V(a);l(e),t.geometry=e};i.push(o.on("changed",p),n((()=>s))),p()}function M(e,t,n){const o=e.elevationProvider.spatialReference;l(t,C,o);const i=C[0],r=C[1];return e.elevationProvider.on("elevation-change",(e=>{h(e.extent,i,r)&&n()}))}const C=s(),G=c();export{x as createVisualElements};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as r,makeHandle as s,destroyHandle as l}from"../../../../../core/handleUtils.js";import{destroyMaybe as p,removeMaybe as h}from"../../../../../core/maybe.js";import{zeroMeters as d,scale as u,createLength as c}from"../../../../../core/quantityUtils.js";import{watch as m,when as g,initial as _}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as f}from"../../../../../core/unitUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as y}from"../../../../../chunks/mat4f64.js";import{l as x,f as O,p as b,s as E,g as G,i as S}from"../../../../../chunks/vec3.js";import{f as w,c as I}from"../../../../../chunks/vec3f64.js";import{UpdatingHandles as V}from"../../../../../core/support/UpdatingHandles.js";import H from"../../../../../geometry/Polyline.js";import{hasCompatibleTopology as T}from"../../../../../geometry/support/coordsUtils.js";import{projectPoint as A}from"../../../../../geometry/support/plane.js";import{sv3d as D}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as L}from"../../../../../layers/graphics/dehydratedPoint.js";import{getGraphicEffectiveElevationInfo as j}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as P}from"../../../../../symbols/support/utils.js";import{Manipulator3D as U}from"../../Manipulator3D.js";import{createManipulatorMaterial as N,createManipulatorOutlineMaterial as C,placeAtGraphic as k}from"../../manipulatorUtils.js";import{RenderObject as R}from"../../RenderObject.js";import{SegmentLabels3D as F}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as z}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as X,convertToMapCoordinates as Z,screenToMapXYAtLocation as Y,screenToMapXYForGraphicAtLocation as q}from"../dragEventPipeline3D.js";import{orientation as W}from"../geometryUtils.js";import{ManipulatorType as K}from"../ManipulatorType.js";import{canMoveZ as B}from"../manipulatorUtils.js";import{getSettings as J}from"../settings.js";import{createVisualElements as Q}from"../visualElementUtils.js";import{discRadiusSmall as $}from"../manipulations/config.js";import{ManipulationType as ee,MoveManipulation as te}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as ie}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as ae}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ne,createEdgeOffsetOperation as oe,edgeOffsetRotationMatrix as re,screenEdgeLengthSquared as se}from"./edgeOffsetUtils.js";import{OutlineVisualElement as le}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as pe}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as he,createSphereGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as ue}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ce,addMapDelta as me,createManipulatorDragEventPipeline as ge,dragAtLocation as _e,addScreenDelta as fe}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as ve,ManipulatorStateCustomFlags as Me}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as ye}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as xe}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as Oe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as be}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as Ee}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as Ge}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Se,TranslateGraphicXYTooltipInfo as we,TranslateGraphicTooltipInfo as Ie,TranslateVertexZTooltipInfo as Ve,TranslateVertexXYTooltipInfo as He,TranslateVertexTooltipInfo as Te}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{makeElevationField as Ae}from"../../../../interactive/tooltip/fields/fields.js";import{autoAreaByElevationMode as De}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Le,autoLengthByElevationMode as je}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Pe,elevationOfPoint as Ue}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Ne}from"../../../../support/geodesicLengthMeasurementUtils.js";import Ce from"../../../../../geometry/SpatialReference.js";let ke=class extends(n.EventedMixin(t)){constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=qe.NONE,this._updatingHandles=new V,this._recreatingManipulators=!1,this.outputGeometry=null,this._vertexLaserLineVisualElement=null;const t=J(e.tool.view.effectiveTheme).manipulators,i=t.vertex;this._vertexManipulatorMaterial=N(a(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=C(a(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=C(a(i.hoverOutlineColor),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=N(a(n.color),n.renderOccluded),this._edgeManipulatorOutlineMaterial=C(a(n.outlineColor),n.renderOccluded);const r=t.edgeOffset;this._edgeOffsetManipulatorMaterial=N(a(r.color),r.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=N(a(r.hoverColor),r.renderOccluded,!1);const s=t.selected;this._selectedManipulatorMaterial=N(a(s.color),s.renderOccluded),this._selectedManipulatorOutlineMaterial=C(a(s.outlineColor),s.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=C(a(s.hoverOutlineColor),s.renderOccluded)}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new pe({graphic:e});this._tooltip=new Ge({view:t}),this.addHandles([m((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),m((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")}),_),g((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),_),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=p(this._segmentLabels),this._tooltip=p(this._tooltip),this._removeManipulators(),this._updatingHandles.destroy()}get inputGeometry(){return null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));this._removeVertices(e)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._graphicMoveManipulation=p(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._editGeometryOperations)return;const t=j(this.graphic);for(const i of this._editGeometryOperations.data.components){const a=e?.byComponentIndex.get(i.index);for(const e of i.vertices){const i=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of i.edges)this._createVertexOrEdgeManipulator(e,t)}this._createGraphicMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canRedo}get canUndo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canUndo}redo(){if(null==this._editGeometryOperations)return null;const e=this._editGeometryOperations.redo();return null!=e&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(null==this._editGeometryOperations)return null;this.emit("undo");const e=this._editGeometryOperations.undo();return null!=e&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._recreatingManipulators||(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._createManipulators(),this._recreatingManipulators=!1)}_recreateEditGeometryAndManipulators(e){const t={byComponentIndex:new Map};if(null!=e&&null!=this.inputGeometry&&T(e,this.inputGeometry))for(const a of this._manipulatorInfos)if("vertex"===a.type&&a.manipulator.selected){const{index:e,component:{index:i}}=a.handle,{byComponentIndex:n}=t,o=n.get(i)||new Set;o.add(e),n.set(i,o)}if(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._editGeometryOperations=p(this._editGeometryOperations),this._segmentLabels=p(this._segmentLabels),null==e)return void(this._recreatingManipulators=!1);const i="mesh"===e.type?e.anchor:e;this._editGeometryOperations=ye.fromGeometry(i,this.view.state.viewingMode),this._createManipulators(t),this._segmentLabels=new F({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:j(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}),this._recreatingManipulators=!1}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),o=e===We.SELECTED_OR_ALL&&n;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||o&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(qe.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(qe.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){return this._manipulatorInfos.reduce(((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e),0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(qe.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,xe.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case qe.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case qe.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case qe.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case qe.MOVING:switch(this._reshapeEventState){case qe.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case qe.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case qe.RESHAPING:switch(this._reshapeEventState){case qe.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case qe.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulation(){const{tool:e,view:t}=this,i=this._graphicState;if(this._graphicMoveManipulation=new ae({tool:e,view:t,graphicState:i}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=this._editGeometryOperations.createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(We.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(ee.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=h(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=h(e)))))}))),this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1))))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()})))))}_createMoveManipulation(e){const{graphic:t,tool:i,view:a}=this,n=this._graphicState;this._moveManipulation=new te({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&B(t),snapToScene:!1,radius:te.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles([e.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...i,graphic:t}),i.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const o=e=>t=>{this.addHandles(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(o(ee.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(ee.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(o(ee.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const r=t.geometry.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline(((a,n,o,r,s)=>{const{snappingStep:l,cancelSnapping:p}=be({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new Oe({editGeometryOperations:this._editGeometryOperations,elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next((e=>(this._onDragCancel(),e))).next(p),{steps:o=o.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===K.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e})).next(ce(this.view,e,t)).next(...l).next(me()).next((e=>this._perGraphicManipulatorDragAction(We.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(a,e),e))),cancel:r}}),e,r,t),m((()=>n.displaying),(()=>this._updateMoveManipulationPosition()),_),n.on("changed",(()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()})),m((()=>n.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):this.removeHandles(t)}),_)])}_createVisualElements(){const{graphic:e,view:t}=this,i=Q({view:t,graphic:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._graphicMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,K.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof le?i.visualElement:null),null!=this._outlineVisualElement&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=j(this.graphic)){const i=J(this.view.effectiveTheme).manipulators.edgeOffset,a=i.size/2,n=a+i.collisionPadding,o=a/n,s=o*Math.sqrt(3)/2;null==this._edgeOffsetManipulatorGeometryInside&&(this._edgeOffsetManipulatorGeometryInside=he(this._edgeOffsetManipulatorMaterial,s,o/2,o/2,i.height,i.offset)),null==this._edgeOffsetManipulatorGeometryOutside&&(this._edgeOffsetManipulatorGeometryOutside=he(this._edgeOffsetManipulatorMaterial,-s,o/2,o/2,i.height,-i.offset));const l=[new R(this._edgeOffsetManipulatorGeometryInside.instantiate(),ve.Unfocused),new R(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),ve.Focused),new R(this._edgeOffsetManipulatorGeometryOutside.instantiate(),ve.Unfocused),new R(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),ve.Focused)],p=new U({view:this.view,renderObjects:l,elevationInfo:"on-the-ground"!==t.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:n,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionType:{type:"disc",direction:w(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new U({view:this.view,worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=[];for(const r of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(r);null!=e&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=r(u),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(ge(p,this._createEdgeOffsetPipeline(d,t)),p),this._manipulatorHandles.add(ge(h,((e,i,a,n)=>{if("touch"===n){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const n=this.graphic,o=null!=n.geometry?n.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(_e(this.view,e.elevationAlignedLocation)).next(Y(this.view,e.elevationAlignedLocation,t,o,n)).next(fe()).next(me()).next((e=>this._perGraphicManipulatorDragAction(We.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(ee.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next((()=>this._onDragCancel(!e.metadata.deleting)))}})),p);const c=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",c),h.events.on("immediate-click",c),p.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;if("focus"===e&&t.enabled){const e=this._tooltip.info=new Ee({tooltipOptions:t});this._updateTooltipAreaOrTotalLength(e)}else this._tooltip.clear()}))],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=h(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=o&&se(n.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=r([i.disableDisplay(),s((()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}))]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),s((()=>{h(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}))],i),n()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._editGeometryOperations.data,i=ne(this.view,e.manipulator.elevationAlignedLocation,oe(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,r=n.manipulator.renderLocation,s=null!=i?re(i,o,r):y;e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;const l=x(O(Xe,o,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,n)=>{this._clearSelection();const{step:o,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(_e(this.view,i.elevationAlignedLocation)).next(o).next(X(this.view)).next(Z(this.view,this._editGeometryOperations.data.spatialReference)).next(me()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),n.next((()=>{i.metadata.deleting||(r(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t){const{view:i}=this,n=this._editGeometryOperations,o=oe(n.data.coordinateHelper,e.handle,t),s=n.createUndoGroup(),p=ne(i,e.manipulator.elevationAlignedLocation,o);if(o.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);null!=t&&this._splitEdgeManipulator(t,1)}if(o.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);null!=t&&this._splitEdgeManipulator(t,0)}const d=()=>new H({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),u=J(i.effectiveTheme),c=new le({view:i,isDraped:this._graphicState.isDraped,geometry:d(),elevationInfo:e.elevationInfo,width:u.visualElements.lineGraphics.outline.width,color:a(u.colors.accent),attached:!0,isDecoration:!0});let g;const _=()=>{this._cleanEdgeOffsetCollapsedEdges(e),g=h(g)},f=this.on("undo",_);return g=r([l(c),m((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=d())),s,f]),{step:e=>null==o||null==p?(_(),null):{...e,operation:o,plane:p},cleanup:_}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||null==t.operation)return t;this._updateEventState(qe.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:n}=t;return(i||a||n)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,n=this._tooltip,o=this._tooltipOptions;if(!o.enabled||null==i)return n.clear(),e;let r=n.info;null!=r&&"reshape-edge-offset"===r.type||(r=n.info=new Ee({tooltipOptions:o}));const{coordinateHelper:s}=this._editGeometryOperations.data;return r.distance="end"===e.action?d:Fe(this._graphicState.isDraped,i*a.selectedArrow,t,a.plane,s),this._updateTooltipAreaOrTotalLength(r),e}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,n=e.handle.rightVertex,o=this._editGeometryOperations.data.coordinateHelper,r=[];if(t&&o.distance(t.pos,i.pos)<Ze){const e=this._getManipulatorInfoFromHandle(i);null!=e&&r.push(e)}if(o.distance(i.pos,n.pos)<Ze||a&&o.distance(a.pos,n.pos)<Ze){const e=this._getManipulatorInfoFromHandle(n);null!=e&&r.push(e)}r.length&&this._removeVertices(r)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=j(this.graphic),i=!1){const{view:a}=this,n=J(a.effectiveTheme);if("edge"===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}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.vertex);this._vertexManipulatorGeometry=de(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=de(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.edge);this._edgeManipulatorGeometry=de(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=de(this._edgeManipulatorOutlineMaterial,t,16,16)}const{geometry:o}=this.graphic,s=o?.type,l="point"===s||"mesh"===s?[]:[new R(this._vertexManipulatorGeometry.instantiate(),Ye.Vertex|ve.Unselected),new R(this._vertexManipulatorOutlineGeometry.instantiate(),Ye.Vertex|ve.Unfocused|ve.Unselected),new R(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Ye.Vertex|ve.Focused|ve.Unselected),new R(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),ve.Selected),new R(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),ve.Selected|ve.Unfocused),new R(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),ve.Selected|ve.Focused)];this.enableMidpoints&&l.push(new R(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),Ye.Edge|ve.Focused|ve.Unselected),new R(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Ye.Edge|ve.Focused|ve.Unselected),new R(this._edgeManipulatorGeometry.instantiate(),Ye.Edge|ve.Unfocused|ve.Unselected),new R(this._edgeManipulatorOutlineGeometry.instantiate(),Ye.Edge|ve.Unfocused|ve.Unselected));const p=new U({view:a,renderObjects:l,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),metadata:{deleting:!1}});p.selected=i,this._setTypeSpecificManipulatorSettings(p,e,t);const d="edge"===e.type?{manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:p,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(d),this.manipulators.add(p),this._updateManipulatorPosition(d),"edge"===d.type){const e=[];for(const t of[d.handle.leftVertex,d.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(d))))}d.locationUpdateHandle=r(e),this._manipulatorHandles.add(d.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);const u=ge(p,((e,i,a,n)=>{let o=null;const{snappingStep:r,cancelSnapping:s}=be({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new Oe({editGeometryOperations:this._editGeometryOperations,elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});a=a.next((t=>(this._onDragCancel(!e.metadata.deleting,(()=>o=h(o))),t))).next(s),i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(o=this._editGeometryOperations.createUndoGroup()),"edge"===d.type){const t=this._splitEdgeManipulator(d);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:d,snapOrigin:d.handle.pos}})).next(_e(this.view,e.elevationAlignedLocation)).next(q(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(ce(this.view,t,this.graphic)).next(...r).next(me()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(o=h(o)),this._updateTranslateVertexTooltip(e,ee.XY,t)}))}));return this._manipulatorHandles.add([u,p.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,d))),p.events.on("select-changed",(()=>{d.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),p.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==d.type?this._updateTranslateVertexTooltip(p,ee.XY):this._tooltip.clear()}))],p),this.emit("manipulators-changed"),d}_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.outputGeometry=null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null),null!=this.tool.snappingManager&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case qe.NONE:break;case qe.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case qe.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}t&&t(),this.destroyed||this._updateEventState(qe.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){const{graphic:a,view:n}=this,o=J(n.effectiveTheme);switch(t.type){case"vertex":{e.state=Ye.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=o.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const{geometry:r}=a,s=r?.type;e.interactive=null!=s&&"point"!==s&&"mesh"!==s;break}case"edge":{e.state=Ye.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=o.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||P(a.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++;else if(this._numGrabbing--,this._updateEventState(qe.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{const{manipulator:t}=e,{geometry:i}=this.graphic,a=i?.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=a&&"point"!==a&&"mesh"!==a,"edgeManipulator"in e&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),this._graphicMoveManipulation.forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.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.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(null==e)return;const t=this._editGeometryOperations;if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,ze),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(null!=e.manipulator.elevationInfo&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=n.location,a=o.location,r=.5,s=i.x+r*(a.x-i.x),l=i.y+r*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=L(s,l,p,t.data.spatialReference)}else b(Xe,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Xe}}_splitEdgeManipulator(e,t=.5){const i=this._editGeometryOperations,a=i.splitEdge(e.handle,t).createdVertex;e.locationUpdateHandle=h(e.locationUpdateHandle);const n=j(this.graphic);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)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(o),this.enableEdgeOffset||this._updateTranslateVertexTooltip(o.manipulator,ee.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(qe.RESHAPING),s=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:a.index}],added:s}),r&&this._updateEventState(qe.NONE),o}_updateMoveManipulationPosition(){const e=E(Xe,0,0,0);let t=0,i=!1,a=null,n=null;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected?(t++,G(e,e,o.manipulator.renderLocation),null==a||o.selectedIndex>a.selectedIndex?(n=a,a=o):(null==n||o.selectedIndex>n.selectedIndex)&&(n=o)):i=!0);if(0===t){const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&B(this.graphic),this._moveManipulation.angle=W(this.graphic.geometry),this._moveManipulation.radius=te.radiusForSymbol(this.graphic.symbol)}else{const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&B(this.graphic),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.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=null==n&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Re(t,e):o&&(i=Re(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=$}0!==t&&i?(S(e,e,1/t),ze.spatialReference=this._editGeometryOperations.data.spatialReference,ze.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,ze),this._moveManipulation.elevationAlignedLocation=ze):null==this._outlineVisualElement||this._graphicState.isDraped||null==this._outlineVisualElement.attachmentOrigin?k(this.view,this._moveManipulation,this.graphic):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._editGeometryOperations;for(const a of e)if("vertex"===a.type&&i.canRemoveVertex(a.handle.component)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=i.removeVertices([a.handle]),n=e.removedVertices?.[0].createdEdge;n&&this._createVertexOrEdgeManipulator(n)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(qe.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(qe.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?xe.NEW_STEP:xe.ACCUMULATE_STEPS)){const a=this._editGeometryOperations;a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t){if(null==t.operation||null==t.signedDistance)return;const i=this._editGeometryOperations,a=t.operation.clone();a.distance=t.signedDistance,i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,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,e.button===ue.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===ue.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){const i=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,e,t):this._updateTranslateGraphicTooltip(e,t)}_updateTranslateGraphicTooltip(e,t){const i=this._tooltipOptions;if(!i.enabled)return;const a=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case ee.XY:this._tooltip.info=new Ie({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>Le(e,t,a)));break;case ee.XY_AXIS:this._tooltip.info=new we({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const n=Le(e,i,a);return u(n,ie(t))}));break;case ee.Z:this._tooltip.info=new Se({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,Pe)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let n;const o=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case ee.XY:n=new Te({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,((e,t)=>Le(e,t,o))),this._updateTooltipAreaOrTotalLength(n);break;case ee.XY_AXIS:n=new He({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,((e,t)=>{const a=Le(e,t,o);return u(a,ie(i))})),this._updateTooltipAreaOrTotalLength(n);break;case ee.Z:n=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(n,i,Pe)}const r=Ue(e.elevationAlignedLocation);null!=r&&(n.elevation=Ae({actual:r})),this._tooltip.info=n}_updateTranslateTooltipDistance(e,t,i){if(null!=t&&"end"!==t.action){const{mapStart:a,mapEnd:n}=t,o=i(a,n);e.distance=null!=o?o:d}}_updateTooltipAreaOrTotalLength(e){const{geometry:t}=this.graphic;if(null==t)return;const i=this._graphicState.isDraped?"on-the-ground":"absolute-height";e.area="polygon"===t.type?De(t,i):null,e.totalLength="polyline"===t.type?je(t,i):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function Re(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Fe(e,t,i,a,n){if(e){const e=n.toXYZ(n.pointToVector(i)),o=A(a,e,D.get()),r=Ne(o,e,n.spatialReference);if(null!=r)return c(r.value*Math.sign(t),r.unit)}return c(t*f(i.spatialReference),"meters")}e([v()],ke.prototype,"_editGeometryOperations",void 0),e([v()],ke.prototype,"_segmentLabels",void 0),e([v({constructOnly:!0})],ke.prototype,"tool",void 0),e([v()],ke.prototype,"_tooltip",void 0),e([v()],ke.prototype,"inputGeometry",null),e([v()],ke.prototype,"outputGeometry",void 0),e([v({readOnly:!0})],ke.prototype,"updating",null),e([v()],ke.prototype,"manipulators",null),e([v()],ke.prototype,"view",null),e([v()],ke.prototype,"graphic",null),e([v()],ke.prototype,"enableZShape",null),e([v()],ke.prototype,"enableZVertex",null),e([v()],ke.prototype,"enableMoveGraphic",null),e([v()],ke.prototype,"enableMidpoints",null),e([v()],ke.prototype,"enableEdgeOffset",null),e([v()],ke.prototype,"_labelOptions",null),e([v()],ke.prototype,"_tooltipOptions",null),ke=e([M("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],ke);const ze=L(0,0,void 0,Ce.WGS84),Xe=I(),Ze=1e-6;var Ye,qe,We;!function(e){e.Vertex=Me.Custom1,e.Edge=Me.Custom2}(Ye||(Ye={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(qe||(qe={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(We||(We={}));export{ke as ReshapeOperation};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import"../../../../../geometry.js";import t from"../../../../../core/Accessor.js";import{removeUnordered as i}from"../../../../../core/arrayUtils.js";import{unitRGBAFromColor as a}from"../../../../../core/colorUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Evented.js";import o from"../../../../../core/Handles.js";import{handlesGroup as r,makeHandle as s,destroyHandle as l}from"../../../../../core/handleUtils.js";import{destroyMaybe as p,removeMaybe as h}from"../../../../../core/maybe.js";import{zeroMeters as d,scale as u,createLength as c}from"../../../../../core/quantityUtils.js";import{watch as m,when as g,initial as _}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as f}from"../../../../../core/unitUtils.js";import{property as v}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as M}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as y}from"../../../../../chunks/mat4f64.js";import{l as x,f as O,p as b,s as E,g as G,i as S}from"../../../../../chunks/vec3.js";import{f as I,c as w}from"../../../../../chunks/vec3f64.js";import{UpdatingHandles as T}from"../../../../../core/support/UpdatingHandles.js";import V from"../../../../../geometry/Polyline.js";import{hasCompatibleTopology as H}from"../../../../../geometry/support/coordsUtils.js";import{projectPoint as A}from"../../../../../geometry/support/plane.js";import{sv3d as D}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as L}from"../../../../../layers/graphics/dehydratedPoint.js";import{getGraphicEffectiveElevationInfo as j}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as P}from"../../../../../symbols/support/utils.js";import{Manipulator3D as U}from"../../Manipulator3D.js";import{createManipulatorMaterial as N,createManipulatorOutlineMaterial as C,placeAtGraphic as k}from"../../manipulatorUtils.js";import{RenderObject as R}from"../../RenderObject.js";import{SegmentLabels3D as F}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as z}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as X,convertToMapCoordinates as Z,screenToMapXYAtLocation as Y,screenToMapXYForGraphicAtLocation as q}from"../dragEventPipeline3D.js";import{orientation as W}from"../geometryUtils.js";import{ManipulatorType as K}from"../ManipulatorType.js";import{canMoveZ as B}from"../manipulatorUtils.js";import{getSettings as J}from"../settings.js";import{createVisualElements as Q}from"../visualElementUtils.js";import{discRadiusSmall as $}from"../manipulations/config.js";import{ManipulationType as ee,MoveManipulation as te}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as ie}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as ae}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ne,createEdgeOffsetOperation as oe,edgeOffsetRotationMatrix as re,screenEdgeLengthSquared as se}from"./edgeOffsetUtils.js";import{OutlineVisualElement as le}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as pe}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as he,createSphereGeometry as de}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as ue}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ce,addMapDelta as me,createManipulatorDragEventPipeline as ge,dragAtLocation as _e,addScreenDelta as fe}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as ve,ManipulatorStateCustomFlags as Me}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as ye}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as xe}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as Oe}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as be}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as Ee}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as Ge}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Se,TranslateGraphicXYTooltipInfo as Ie,TranslateGraphicTooltipInfo as we,TranslateVertexZTooltipInfo as Te,TranslateVertexXYTooltipInfo as Ve,TranslateVertexTooltipInfo as He}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{makeElevationField as Ae}from"../../../../interactive/tooltip/fields/fields.js";import{autoAreaByElevationMode as De}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Le,autoLengthByElevationMode as je}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Pe,elevationOfPoint as Ue}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Ne}from"../../../../support/geodesicLengthMeasurementUtils.js";import Ce from"../../../../../geometry/SpatialReference.js";let ke=class extends(n.EventedMixin(t)){constructor(e){super(e),this._selectedIndex=0,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=qe.NONE,this._updatingHandles=new T,this._recreatingManipulators=!1,this._translateGraphicTooltipInfo=null,this._translateGraphicXYTooltipInfo=null,this._translateGraphicZTooltipInfo=null,this._translateVertexTooltipInfo=null,this._translateVertexXYTooltipInfo=null,this._translateVertexZTooltipInfo=null,this._edgeOffsetTooltipInfo=null,this.outputGeometry=null,this._vertexLaserLineVisualElement=null;const t=J(e.tool.view.effectiveTheme).manipulators,i=t.vertex;this._vertexManipulatorMaterial=N(a(i.color),i.renderOccluded),this._vertexManipulatorOutlineMaterial=C(a(i.outlineColor),i.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=C(a(i.hoverOutlineColor),i.renderOccluded);const n=t.edge;this._edgeManipulatorMaterial=N(a(n.color),n.renderOccluded),this._edgeManipulatorOutlineMaterial=C(a(n.outlineColor),n.renderOccluded);const r=t.edgeOffset;this._edgeOffsetManipulatorMaterial=N(a(r.color),r.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=N(a(r.hoverColor),r.renderOccluded,!1);const s=t.selected;this._selectedManipulatorMaterial=N(a(s.color),s.renderOccluded),this._selectedManipulatorOutlineMaterial=C(a(s.outlineColor),s.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=C(a(s.hoverOutlineColor),s.renderOccluded)}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new pe({graphic:e});this._tooltip=new Ge({view:t}),this.addHandles([m((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),m((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{null!=e&&(e.visible=t,e.edgeDistance=i?"far":"default")}),_),g((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),_),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=p(this._segmentLabels),this._tooltip=p(this._tooltip),this._removeManipulators(),this._updatingHandles.destroy()}get inputGeometry(){return null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null}set inputGeometry(e){this._recreateEditGeometryAndManipulators(e)}get updating(){return this._updatingHandles.updating}get manipulators(){return this.tool.manipulators}get view(){return this.tool.view}get graphic(){return this.tool.graphic}get enableZShape(){return this.tool.enableZShape}get enableZVertex(){return this.tool.enableZVertex}get enableMoveGraphic(){return this.tool.enableMoveGraphic}get enableMidpoints(){return this.tool.enableMidpoints}get enableEdgeOffset(){return this.tool.enableEdgeOffset}get _labelOptions(){return this.tool.labelOptions}get _tooltipOptions(){return this.tool.tooltipOptions}removeSelectedVertices(){const e=this._manipulatorInfos.filter((e=>e.manipulator.selected&&"vertex"===e.type));this._removeVertices(e)}onManipulatorSelectionChanged(){this.emit("manipulators-changed")}_removeManipulators(){this._manipulatorHandles.removeAll(),this._moveManipulation=p(this._moveManipulation),this._graphicMoveManipulation=p(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(e){if(null==this._editGeometryOperations)return;const t=j(this.graphic);for(const i of this._editGeometryOperations.data.components){const a=e?.byComponentIndex.get(i.index);for(const e of i.vertices){const i=a?.has(e.index);this._createVertexOrEdgeManipulator(e,t,i)}for(const e of i.edges)this._createVertexOrEdgeManipulator(e,t)}this._createGraphicMoveManipulation(),this._createMoveManipulation(t),this._createVisualElements()}get canRedo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canRedo}get canUndo(){return null!=this._editGeometryOperations&&this._editGeometryOperations.canUndo}redo(){if(null==this._editGeometryOperations)return null;const e=this._editGeometryOperations.redo();return null!=e&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(null==this._editGeometryOperations)return null;this.emit("undo");const e=this._editGeometryOperations.undo();return null!=e&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._recreatingManipulators||(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._createManipulators(),this._recreatingManipulators=!1)}_recreateEditGeometryAndManipulators(e){const t={byComponentIndex:new Map};if(null!=e&&null!=this.inputGeometry&&H(e,this.inputGeometry))for(const a of this._manipulatorInfos)if("vertex"===a.type&&a.manipulator.selected){const{index:e,component:{index:i}}=a.handle,{byComponentIndex:n}=t,o=n.get(i)||new Set;o.add(e),n.set(i,o)}if(this._recreatingManipulators=!0,this._removeManipulators(),this._tooltip.clear(),this._editGeometryOperations=p(this._editGeometryOperations),this._segmentLabels=p(this._segmentLabels),null==e)return void(this._recreatingManipulators=!1);const i="mesh"===e.type?e.anchor:e;this._editGeometryOperations=ye.fromGeometry(i,this.view.state.viewingMode),this._createManipulators(t),this._segmentLabels=new F({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:j(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}),this._recreatingManipulators=!1}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],n=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),o=e===We.SELECTED_OR_ALL&&n;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||o&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(qe.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(qe.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){return this._manipulatorInfos.reduce(((e,t)=>"vertex"===t.type&&t.manipulator.selected?e+1:e),0)>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(qe.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const n=[];for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected&&!o.manipulator.grabbing||o===e.info)&&n.push(o);this._moveVertices(n,e,xe.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case qe.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case qe.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case qe.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case qe.MOVING:switch(this._reshapeEventState){case qe.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case qe.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic}),this.destroyed||this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic})}break;case qe.RESHAPING:switch(this._reshapeEventState){case qe.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case qe.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic}),this.destroyed||this.emit("reshape",{type:"reshape-start",mover:this.graphic})}}if(this.destroyed)return!1;const t=this._reshapeEventState!==e;return this._reshapeEventState=e,t}_createGraphicMoveManipulation(){const{tool:e,view:t}=this,i=this._graphicState;if(this._graphicMoveManipulation=new ae({tool:e,view:t,graphicState:i}),this.enableMoveGraphic){let e=null;this._manipulatorHandles.add(this._graphicMoveManipulation.createDragPipeline(((t,i,a)=>{i.next((e=>this._trackNumDragging(e))).next((t=>("start"===t.action&&(e=this._editGeometryOperations.createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(We.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(ee.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=h(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=h(e)))))}))),this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(this._watchAndUpdateGrabState(e,!1))))}else this._graphicMoveManipulation.forEachManipulator((e=>{e.grabbable=!1,e.cursor=null}));this._graphicMoveManipulation.forEachManipulator((e=>this._manipulatorHandles.add(e.events.on("immediate-click",(e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()})))))}_createMoveManipulation(e){const{graphic:t,tool:i,view:a}=this,n=this._graphicState;this._moveManipulation=new te({tool:i,view:a,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&B(t),snapToScene:!1,radius:te.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>this.addHandles([e.events.on("immediate-click",(i=>{this._moveManipulation.zManipulation.hasManipulator(e)||this._manipulatorInfos.some((e=>e.manipulator.selected))||this.emit("immediate-click",{...i,graphic:t}),i.stopPropagation()})),this._watchAndUpdateGrabState(e,!1)])));const o=e=>t=>{this.addHandles(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(o(ee.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(o(ee.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(o(ee.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const r=t.geometry.spatialReference;this.addHandles([this._moveManipulation.createDragPipeline(((a,n,o,r,s)=>{const{snappingStep:l,cancelSnapping:p}=be({predicate:e=>!!e.info,snappingManager:i.snappingManager,snappingContext:new Oe({editGeometryOperations:this._editGeometryOperations,elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});return r=r.next((e=>(this._onDragCancel(),e))).next(p),{steps:o=o.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===K.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e})).next(ce(this.view,e,t)).next(...l).next(me()).next((e=>this._perGraphicManipulatorDragAction(We.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(a,e),e))),cancel:r}}),e,r,t),m((()=>n.displaying),(()=>this._updateMoveManipulationPosition()),_),n.on("changed",(()=>{this._recreatingManipulators||this._updateMoveManipulationPosition()})),m((()=>n.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?this.addHandles(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):this.removeHandles(t)}),_)])}_createVisualElements(){const{graphic:e,view:t}=this,i=Q({view:t,graphic:e,forEachManipulator:e=>{if(!this.destroyed&&!this._recreatingManipulators){this._graphicMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,K.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});null!=i&&(this._outlineVisualElement=i.visualElement instanceof le?i.visualElement:null),null!=this._outlineVisualElement&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=j(this.graphic)){const i=J(this.view.effectiveTheme).manipulators.edgeOffset,a=i.size/2,n=a+i.collisionPadding,o=a/n,s=o*Math.sqrt(3)/2;null==this._edgeOffsetManipulatorGeometryInside&&(this._edgeOffsetManipulatorGeometryInside=he(this._edgeOffsetManipulatorMaterial,s,o/2,o/2,i.height,i.offset)),null==this._edgeOffsetManipulatorGeometryOutside&&(this._edgeOffsetManipulatorGeometryOutside=he(this._edgeOffsetManipulatorMaterial,-s,o/2,o/2,i.height,-i.offset));const l=[new R(this._edgeOffsetManipulatorGeometryInside.instantiate(),ve.Unfocused),new R(this._edgeOffsetManipulatorGeometryInside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),ve.Focused),new R(this._edgeOffsetManipulatorGeometryOutside.instantiate(),ve.Unfocused),new R(this._edgeOffsetManipulatorGeometryOutside.instantiate({material:this._edgeOffsetManipulatorHoverMaterial}),ve.Focused)],p=new U({view:this.view,renderObjects:l,elevationInfo:"on-the-ground"!==t.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:n,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new U({view:this.view,worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0,edgeManipulator:h,elevationInfo:t,visibilityHandle:null};this._autoHideEdgeOffsetManipulator(d,i.minSquaredEdgeLength),this._updateEdgeOffsetManipulator(d);const u=[];for(const r of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(r);null!=e&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=r(u),this._manipulatorHandles.add(d.locationUpdateHandle,p),this._manipulatorHandles.add([this._watchAndUpdateGrabState(p,!0),this._watchAndUpdateGrabState(h,!0)],p),this._manipulatorHandles.add(ge(p,this._createEdgeOffsetPipeline(d,t)),p),this._manipulatorHandles.add(ge(h,((e,i,a,n)=>{if("touch"===n){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const n=this.graphic,o=null!=n.geometry?n.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(_e(this.view,e.elevationAlignedLocation)).next(Y(this.view,e.elevationAlignedLocation,t,o,n)).next(fe()).next(me()).next((e=>this._perGraphicManipulatorDragAction(We.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(ee.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next((()=>this._onDragCancel(!e.metadata.deleting)))}})),p);const c=e=>{this._manipulatorInfos.some((e=>e.manipulator.selected))?this._clearSelection():this.emit("immediate-click",{...e,graphic:this.graphic}),e.stopPropagation()};return this._manipulatorHandles.add([p.events.on("immediate-click",c),h.events.on("immediate-click",c),p.events.on("focus-changed",(({action:e})=>{const{_tooltipOptions:t,_tooltip:i}=this;"focus"===e&&t.enabled?(i.info=this._edgeOffsetTooltipInfo??=new Ee({tooltipOptions:t}),i.info.tooltipOptions=t,this._updateTooltipAreaOrTotalLength(i.info)):i.clear()}))],p),this._manipulatorInfos.push(d),this.manipulators.add(p),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,n=()=>{e.visibilityHandle=h(e.visibilityHandle);const n=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex),l=null!=n&&null!=o&&se(n.manipulator.renderLocation,o.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||l)&&(i.grabbable=!l,a.grabbable=!l,e.visibilityHandle=r([i.disableDisplay(),s((()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}))]))};this._manipulatorHandles.add([i.events.on("focus-changed",n),a.events.on("focus-changed",n),s((()=>{h(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}))],i),n()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const{coordinateHelper:t}=this._editGeometryOperations.data,i=ne(this.view,e.manipulator.elevationAlignedLocation,oe(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,r=n.manipulator.renderLocation,s=null!=i?re(i,o,r):y;e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;const l=x(O(Xe,o,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-l,0,0],[l,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,n)=>{this._clearSelection();const{step:o,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(_e(this.view,i.elevationAlignedLocation)).next(o).next(X(this.view)).next(Z(this.view,this._editGeometryOperations.data.spatialReference)).next(me()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),n.next((()=>{i.metadata.deleting||(r(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t){const{view:i}=this,n=this._editGeometryOperations,o=oe(n.data.coordinateHelper,e.handle,t),s=n.createUndoGroup(),p=ne(i,e.manipulator.elevationAlignedLocation,o);if(o.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);null!=t&&this._splitEdgeManipulator(t,1)}if(o.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);null!=t&&this._splitEdgeManipulator(t,0)}const d=()=>new V({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:n.data.spatialReference}),u=J(i.effectiveTheme),c=new le({view:i,isDraped:this._graphicState.isDraped,geometry:d(),elevationInfo:e.elevationInfo,width:u.visualElements.lineGraphics.outline.width,color:a(u.colors.accent),attached:!0,isDecoration:!0});let g;const _=()=>{this._cleanEdgeOffsetCollapsedEdges(e),g=h(g)},f=this.on("undo",_);return g=r([l(c),m((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=d())),s,f]),{step:e=>null==o||null==p?(_(),null):{...e,operation:o,plane:p},cleanup:_}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||null==t.operation)return t;this._updateEventState(qe.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:n}=t;return(i||a||n)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return null==t||null==i?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,{_tooltip:n,_tooltipOptions:o}=this;return o.enabled&&null!=i?(n.info=this._edgeOffsetTooltipInfo??=new Ee({tooltipOptions:o}),n.info.tooltipOptions=o,n.info.distance="end"===e.action?d:Fe(this._graphicState.isDraped,i*a.selectedArrow,t,a.plane,this._editGeometryOperations.data.coordinateHelper),this._updateTooltipAreaOrTotalLength(n.info),e):(n.clear(),e)}}_cleanEdgeOffsetCollapsedEdges(e){const t=e.handle.leftVertex.leftEdge?.leftVertex,i=e.handle.leftVertex,a=e.handle.rightVertex.rightEdge?.rightVertex,n=e.handle.rightVertex,o=this._editGeometryOperations.data.coordinateHelper,r=[];if(t&&o.distance(t.pos,i.pos)<Ze){const e=this._getManipulatorInfoFromHandle(i);null!=e&&r.push(e)}if(o.distance(i.pos,n.pos)<Ze||a&&o.distance(a.pos,n.pos)<Ze){const e=this._getManipulatorInfoFromHandle(n);null!=e&&r.push(e)}r.length&&this._removeVertices(r)}_computeVertexManipulatorSizeAndOutline(e){const t=e.size/2,i=t+e.collisionPadding;return{size:t/i,outlineSize:(t+e.outlineSize)/i}}_createVertexOrEdgeManipulator(e,t=j(this.graphic),i=!1){const{view:a}=this,n=J(a.effectiveTheme);if("edge"===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}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.vertex);this._vertexManipulatorGeometry=de(this._vertexManipulatorMaterial,e,16,16),this._vertexManipulatorOutlineGeometry=de(this._vertexManipulatorOutlineMaterial,t,16,16)}if(null==this._edgeManipulatorGeometry||null==this._edgeManipulatorOutlineGeometry){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(n.manipulators.edge);this._edgeManipulatorGeometry=de(this._edgeManipulatorMaterial,e,16,16),this._edgeManipulatorOutlineGeometry=de(this._edgeManipulatorOutlineMaterial,t,16,16)}const{geometry:o}=this.graphic,s=o?.type,l="point"===s||"mesh"===s?[]:[new R(this._vertexManipulatorGeometry.instantiate(),Ye.Vertex|ve.Unselected),new R(this._vertexManipulatorOutlineGeometry.instantiate(),Ye.Vertex|ve.Unfocused|ve.Unselected),new R(this._vertexManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Ye.Vertex|ve.Focused|ve.Unselected),new R(this._vertexManipulatorGeometry.instantiate({material:this._selectedManipulatorMaterial}),ve.Selected),new R(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorOutlineMaterial}),ve.Selected|ve.Unfocused),new R(this._vertexManipulatorOutlineGeometry.instantiate({material:this._selectedManipulatorHoverOutlineMaterial}),ve.Selected|ve.Focused)];this.enableMidpoints&&l.push(new R(this._edgeManipulatorGeometry.instantiate({material:this._vertexManipulatorMaterial}),Ye.Edge|ve.Focused|ve.Unselected),new R(this._edgeManipulatorOutlineGeometry.instantiate({material:this._vertexManipulatorHoverOutlineMaterial}),Ye.Edge|ve.Focused|ve.Unselected),new R(this._edgeManipulatorGeometry.instantiate(),Ye.Edge|ve.Unfocused|ve.Unselected),new R(this._edgeManipulatorOutlineGeometry.instantiate(),Ye.Edge|ve.Unfocused|ve.Unselected));const p=new U({view:a,renderObjects:l,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer?.visible),metadata:{deleting:!1}});p.selected=i,this._setTypeSpecificManipulatorSettings(p,e,t);const d="edge"===e.type?{manipulator:p,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:p,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(d),this.manipulators.add(p),this._updateManipulatorPosition(d),"edge"===d.type){const e=[];for(const t of[d.handle.leftVertex,d.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);null!=i&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(d))))}d.locationUpdateHandle=r(e),this._manipulatorHandles.add(d.locationUpdateHandle,p)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(p,!0),p);const u=ge(p,((e,i,a,n)=>{let o=null;const{snappingStep:r,cancelSnapping:s}=be({predicate:()=>!this._isMultiVertexSelection(),snappingManager:this.tool.snappingManager,snappingContext:new Oe({editGeometryOperations:this._editGeometryOperations,elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new z}),updatingHandles:this._updatingHandles,useZ:!1});a=a.next((t=>(this._onDragCancel(!e.metadata.deleting,(()=>o=h(o))),t))).next(s),i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(o=this._editGeometryOperations.createUndoGroup()),"edge"===d.type){const t=this._splitEdgeManipulator(d);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:d,snapOrigin:d.handle.pos}})).next(_e(this.view,e.elevationAlignedLocation)).next(q(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(ce(this.view,t,this.graphic)).next(...r).next(me()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(o=h(o)),this._updateTranslateVertexTooltip(e,ee.XY,t)}))}));return this._manipulatorHandles.add([u,p.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,d))),p.events.on("select-changed",(()=>{d.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),p.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==d.type?this._updateTranslateVertexTooltip(p,ee.XY):this._tooltip.clear()}))],p),this.emit("manipulators-changed"),d}_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.outputGeometry=null!=this._editGeometryOperations?this._editGeometryOperations.data.geometry:null),null!=this.tool.snappingManager&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case qe.NONE:break;case qe.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case qe.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}t&&t(),this.destroyed||this._updateEventState(qe.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){const{graphic:a,view:n}=this,o=J(n.effectiveTheme);switch(t.type){case"vertex":{e.state=Ye.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2;const{size:t,collisionPadding:n}=o.manipulators.vertex;e.radius=t/2+n,e.elevationInfo=i;const{geometry:r}=a,s=r?.type;e.interactive=null!=s&&"point"!==s&&"mesh"!==s;break}case"edge":{e.state=Ye.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1;const{size:t,collisionPadding:n}=o.manipulators.edge;e.radius=t/2+n,e.elevationInfo="on-the-ground"!==i.mode||P(a.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++;else if(this._numGrabbing--,this._updateEventState(qe.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{const{manipulator:t}=e,{geometry:i}=this.graphic,a=i?.type;t.interactive=t.grabbing||!this._numGrabbing&&null!=a&&"point"!==a&&"mesh"!==a,"edgeManipulator"in e&&(e.edgeManipulator.interactive=e.edgeManipulator.grabbing||!this._numGrabbing)})),this._graphicMoveManipulation.forEachManipulator((e=>{e.interactive=e.grabbing||!this._numGrabbing})))}}_clearSelection(){for(const e of this._manipulatorInfos)e.manipulator.grabbing||(e.manipulator.selected=!1)}_updateSelection(e){e.grabbing&&!e.selected&&e.selectable&&(this._clearSelection(),e.selected=!0,this.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.emit("manipulators-changed"))}_getManipulatorInfoFromHandle(e){if(e)for(const t of this._manipulatorInfos)if(e===t.handle)return t;return null}_updateManipulatorPosition(e){if(null==e)return;const t=this._editGeometryOperations;if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,ze),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(null!=e.manipulator.elevationInfo&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=n.location,a=o.location,r=.5,s=i.x+r*(a.x-i.x),l=i.y+r*(a.y-i.y),p=i.hasZ&&a.hasZ?0:void 0;e.manipulator.location=L(s,l,p,t.data.spatialReference)}else b(Xe,n.renderLocation,o.renderLocation,.5),e.manipulator.renderLocation=Xe}}_splitEdgeManipulator(e,t=.5){const i=this._editGeometryOperations,a=i.splitEdge(e.handle,t).createdVertex;e.locationUpdateHandle=h(e.locationUpdateHandle);const n=j(this.graphic);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)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(o),this.enableEdgeOffset||this._updateTranslateVertexTooltip(o.manipulator,ee.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(qe.RESHAPING),s=i.data.coordinateHelper.vectorToArray(o.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:a.index}],added:s}),r&&this._updateEventState(qe.NONE),o}_updateMoveManipulationPosition(){const e=E(Xe,0,0,0);let t=0,i=!1,a=null,n=null;for(const o of this._manipulatorInfos)"vertex"===o.type&&(o.manipulator.selected?(t++,G(e,e,o.manipulator.renderLocation),null==a||o.selectedIndex>a.selectedIndex?(n=a,a=o):(null==n||o.selectedIndex>n.selectedIndex)&&(n=o)):i=!0);if(0===t){const e=this._graphicState.displaying&&this.enableMoveGraphic;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e,this._moveManipulation.zManipulation.available=e&&this.enableZShape&&B(this.graphic),this._moveManipulation.angle=W(this.graphic.geometry),this._moveManipulation.radius=te.radiusForSymbol(this.graphic.symbol)}else{const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&B(this.graphic),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.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,o=null==n&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;t&&o?this._moveManipulation.xyAxisManipulation.available=!1:t?i=Re(t,e):o&&(i=Re(e,o))}this._moveManipulation.angle=i,this._moveManipulation.radius=$}0!==t&&i?(S(e,e,1/t),ze.spatialReference=this._editGeometryOperations.data.spatialReference,ze.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,ze),this._moveManipulation.elevationAlignedLocation=ze):null==this._outlineVisualElement||this._graphicState.isDraped||null==this._outlineVisualElement.attachmentOrigin?k(this.view,this._moveManipulation,this.graphic):this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin}_removeVertices(e){const t=new Array,i=this._editGeometryOperations;for(const a of e)if("vertex"===a.type&&i.canRemoveVertex(a.handle.component)){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=i.removeVertices([a.handle]),n=e.removedVertices?.[0].createdEdge;n&&this._createVertexOrEdgeManipulator(n)}if(t.length>0){const e=t.map((e=>{const t=i.data.components.indexOf(e.component);return{coordinates:i.data.coordinateHelper.vectorToArray(e.pos),componentIndex:t,vertexIndex:e.index}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(qe.RESHAPING);if(this.destroyed)return;if(this.emit("vertex-remove",{type:"vertex-remove",removed:e.map((e=>e.coordinates)),vertices:e}),this.destroyed)return;if(a&&(this._updateEventState(qe.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?xe.NEW_STEP:xe.ACCUMULATE_STEPS)){const a=this._editGeometryOperations;a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const n of e)this._updateManipulatorPosition(n)}_offsetEdge(e,t){if(null==t.operation||null==t.signedDistance)return;const i=this._editGeometryOperations,a=t.operation.clone();a.distance=t.signedDistance,i.updateVertices([e.handle.leftVertex,e.handle.rightVertex],a),this.outputGeometry=i.data.geometry,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,e.button===ue.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===ue.Left&&this._splitEdgeManipulator(t),e.stopPropagation()}_updateTranslateTooltip(e,t){const i=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));1===i.length?this._updateTranslateVertexTooltip(i[0].manipulator,e,t):this._updateTranslateGraphicTooltip(e,t)}_updateTranslateGraphicTooltip(e,t){const{_tooltipOptions:i,_tooltip:a}=this;if(!i.enabled)return;const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(e){case ee.XY:a.info=this._translateGraphicTooltipInfo??=new we({tooltipOptions:i}),this._updateTranslateTooltipDistance(a.info,t,((e,t)=>Le(e,t,n)));break;case ee.XY_AXIS:a.info=this._translateGraphicXYTooltipInfo??=new Ie({tooltipOptions:i}),this._updateTranslateTooltipDistance(a.info,t,((e,i)=>{const a=Le(e,i,n);return u(a,ie(t))}));break;case ee.Z:a.info=this._translateGraphicZTooltipInfo??=new Se({tooltipOptions:i}),this._updateTranslateTooltipDistance(a.info,t,Pe)}a.info.tooltipOptions=i}_updateTranslateVertexTooltip(e,t,i){const{_tooltipOptions:a,_tooltip:n}=this;if(!a.enabled)return;const o=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case ee.XY:n.info=this._translateVertexTooltipInfo??=new He({tooltipOptions:a}),this._updateTranslateTooltipDistance(n.info,i,((e,t)=>Le(e,t,o))),this._updateTooltipAreaOrTotalLength(n.info);break;case ee.XY_AXIS:n.info=this._translateVertexXYTooltipInfo??=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(n.info,i,((e,t)=>{const a=Le(e,t,o);return u(a,ie(i))})),this._updateTooltipAreaOrTotalLength(n.info);break;case ee.Z:n.info=this._translateVertexZTooltipInfo??=new Te({tooltipOptions:a}),this._updateTranslateTooltipDistance(n.info,i,Pe)}const r=Ue(e.elevationAlignedLocation);null!=r&&(n.info.elevation=Ae({actual:r})),n.info.tooltipOptions=a}_updateTranslateTooltipDistance(e,t,i){if(null!=t&&"end"!==t.action){const{mapStart:a,mapEnd:n}=t,o=i(a,n);e.distance=null!=o?o:d}else e.distance=d}_updateTooltipAreaOrTotalLength(e){const{geometry:t}=this.graphic;if(null==t)return;const i=this._graphicState.isDraped?"on-the-ground":"absolute-height";e.area="polygon"===t.type?De(t,i):null,e.totalLength="polyline"===t.type?je(t,i):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function Re(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Fe(e,t,i,a,n){if(e){const e=n.toXYZ(n.pointToVector(i)),o=A(a,e,D.get()),r=Ne(o,e,n.spatialReference);if(null!=r)return c(r.value*Math.sign(t),r.unit)}return c(t*f(i.spatialReference),"meters")}e([v()],ke.prototype,"_editGeometryOperations",void 0),e([v()],ke.prototype,"_segmentLabels",void 0),e([v({constructOnly:!0})],ke.prototype,"tool",void 0),e([v()],ke.prototype,"_tooltip",void 0),e([v()],ke.prototype,"inputGeometry",null),e([v()],ke.prototype,"outputGeometry",void 0),e([v({readOnly:!0})],ke.prototype,"updating",null),e([v()],ke.prototype,"manipulators",null),e([v()],ke.prototype,"view",null),e([v()],ke.prototype,"graphic",null),e([v()],ke.prototype,"enableZShape",null),e([v()],ke.prototype,"enableZVertex",null),e([v()],ke.prototype,"enableMoveGraphic",null),e([v()],ke.prototype,"enableMidpoints",null),e([v()],ke.prototype,"enableEdgeOffset",null),e([v()],ke.prototype,"_labelOptions",null),e([v()],ke.prototype,"_tooltipOptions",null),ke=e([M("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],ke);const ze=L(0,0,void 0,Ce.WGS84),Xe=w(),Ze=1e-6;var Ye,qe,We;!function(e){e.Vertex=Me.Custom1,e.Edge=Me.Custom2}(Ye||(Ye={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(qe||(qe={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(We||(We={}));export{ke as ReshapeOperation};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../../../core/promiseUtils.js";import{syncAndInitial as n,watch as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as g}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as h}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{destroyMaybe as e}from"../../../../../core/maybe.js";import{memoize as i}from"../../../../../core/memoize.js";import{ignoreAbortErrors as a}from"../../../../../core/promiseUtils.js";import{syncAndInitial as n,watch as s}from"../../../../../core/reactiveUtils.js";import{property as o}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as p}from"../../../../../core/support/UpdatingHandles.js";import l from"../../../../../geometry/Point.js";import{clonePoint as g}from"../../../../../layers/graphics/hydratedFeatures.js";import{isPrimaryPointerAction as h}from"../../../analysis/support/measurementUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{screenToMap3D as m,hideManipulatorWhileDragging as u}from"../../editingTools/dragEventPipeline3D.js";import c from"./AreaMeasurement3DView.js";import{PickRequest as y}from"../support/PickRequest.js";import{AnalysisToolBase as w}from"../../../../interactive/AnalysisToolBase.js";import{createCoordinateHelper as _}from"../../../../interactive/coordinateHelper.js";import{createManipulatorDragEventPipeline as f}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorCollection as v}from"../../../../interactive/ManipulatorCollection.js";import{EditGeometry as P}from"../../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as S}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{acquire as V}from"../../../../interactive/snapping/SceneSnappingManagerPool.js";import{SnappingContext as D}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as j}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{SnappingOperation as M}from"../../../../interactive/snapping/SnappingOperation.js";import{setupSnappingToggleHandles as x}from"../../../../interactive/snapping/snappingUtils.js";import{createScreenPointFromEvent as k}from"../../../../support/screenUtils.js";let b=class extends w{constructor(t){super(t),this._updatingHandles=new p,this.polygonState="initial",this.manipulators=new v,this._getSnappingContext=i((t=>new D({elevationInfo:{mode:"absolute-height",offset:0},pointer:t,editGeometryOperations:new S(new P("point",_(!0,!1,this.view.spatialReference))),visualizer:new d})))}initialize(){const{view:t,analysisViewData:e,manipulators:i,visible:o}=this;this.measurementView=new c({view:t,analysisViewData:e,toolState:this,manipulators:i,visible:o});const r=V(t);this._snappingManagerResult=r,this.addHandles(r),this._snappingOperation=new M({view:t}),this._updatingHandles.add((()=>this.stagedPoint),(t=>{this.analysisViewData.stagedPoint=null!=t?g(t,new l):null}),n),x(this,(()=>{const t=this.view.inputManager.latestPointerType??"mouse",e=this._getSnappingContext(t);this._updatingHandles.addPromise(a(this._snappingOperation.resnap(this._snappingManager,e)))})),this._setupManipulators(),this.addHandles([s((()=>this.state),(t=>{"measured"===t&&this.finishToolCreation()}),n),this.analysisViewData.path.on("change",(()=>{const t=this.analysisViewData.path;"initial"!==this.polygonState||t.isEmptyPolygon||(t.isValidPolygon?this.polygonState="measured":this.polygonState="drawing")}))])}destroy(){this.measurementView.destroy(),this._set("measurementView",null),this._updatingHandles=e(this._updatingHandles)}get _snappingManager(){return this._snappingManagerResult.snappingManager}get state(){return 0===this.analysisViewData.path.numVertices?"ready":this.analysisViewData.path.isValidPolygon&&"editing"!==this.polygonState?"measured":"measuring"}get cursor(){return"ready"===this.state||"drawing"===this.polygonState?"crosshair":null}get updating(){return this._updatingHandles.updating||this._snappingManager.updating}get stagedPoint(){return this._snappingOperation.stagedPoint}set stagedPoint(t){this._snappingOperation.stagedPoint=t}get snappingOptions(){return this._snappingManager.options}finishMeasurement(){const{path:t}=this.analysisViewData;t.numVertices<3?(t.clear(),this.polygonState="initial"):(t.close(),this.polygonState="measured"),this._resetSnappingState()}onShow(){this.measurementView.show()}onHide(){this.measurementView.hide()}onDeactivate(){this._resetSnappingState()}onInputEvent(t){switch(t.type){case"immediate-double-click":this._handleImmediateDoubleClick(t);break;case"immediate-click":this._handleImmediateClick(t);break;case"pointer-move":this._handlePointerMove(t);break;case"drag":this._handleDrag(t);break;case"key-down":this._handleKeyDown(t)}}_setupManipulators(){const t=t=>t.events.on("grab-changed",(()=>{if(this.analysisViewData.path.isValidPolygon){const t=this.manipulators.some((t=>t.manipulator.grabbing));this.polygonState=t?"editing":"measured"}})),e=e=>{this.addHandles([f(e,((t,e,i,a)=>{const n=u(t),s=t.metadata,o=this._snappingManager,r=this._getSnappingContext(a),p=this._updatingHandles,{snappingStep:l,cancelSnapping:h}=j({snappingManager:o,snappingContext:r,updatingHandles:p});i=i.next(n).next((e=>(this.analysisViewData.lastDraggedVertex=null,this.analysisViewData.path.setVertexPosition(s,d),t.location=d,e))).next(h),e.next(n).next(m(this.view)).next(...l).next((e=>{t.location=e.mapEnd,this.analysisViewData.lastDraggedVertex="end"===e.action?null:s,this.analysisViewData.path.setVertexPosition(s,g(e.mapEnd))}));const d=g(this.analysisViewData.path.getVertexPositionAsPoint(s))})),t(e)],e)};this.manipulators.forEach((({manipulator:t})=>{e(t)})),this.addHandles([this.manipulators.on("after-add",(({item:{manipulator:t}})=>{e(t)})),this.manipulators.on("after-remove",(({item:{manipulator:t}})=>this.removeHandles(t)))])}_handleImmediateDoubleClick(t){h(t)&&("drawing"===this.polygonState&&this.finishMeasurement(),t.stopPropagation())}_handleDrag(t){"editing"===this.polygonState&&t.stopPropagation()}_handleImmediateClick(t){if(!h(t))return;const e=k(t),{pointerType:i}=t;if(this.active)switch(this.polygonState){case"initial":if(this._addVertexAt(e,i))return this.stagedPoint=null,this.polygonState="drawing",void t.stopPropagation();break;case"drawing":{const a=this.measurementView.vertexHandleAt(e,i);if(null==a){if(this._addVertexAt(e,i))return this.stagedPoint=null,void t.stopPropagation()}else 0===a.index&&(this.finishMeasurement(),t.stopPropagation());break}}"mouse"===t.pointerType&&this._hoverAt(e)}_handlePointerMove(t){if("mouse"===t.pointerType){const e=k(t);this._hoverAt(e)}}_handleKeyDown(t){if("Enter"===t.key&&"drawing"===this.polygonState){if(null!=this.stagedPoint){const t=new l(this.stagedPoint);this.stagedPoint=null,this.analysisViewData.path.add(t)}this.finishMeasurement(),t.stopPropagation()}}_hoverAt(t){const{polygonState:e}=this;if(this.active&&("initial"===e||"drawing"===e)){const e=this._pick(t);if(null!=e&&null!=e.mapPoint){const t=this._getSnappingContext("mouse");this._updatingHandles.addPromise(a(this._snappingOperation.snap({point:e.mapPoint},this._snappingManager,t)))}}else this.stagedPoint=null}_addVertexAt(t,e){const i=this._pick(t);if(null!=i&&null!=i.mapPoint){const{mapPoint:t}=i,a=this._getSnappingContext(e),n=this._snappingOperation.update({point:t},this._snappingManager,a),s=g(n,new l);return this.analysisViewData.path.add(s),!0}return!1}_pick(t){const e=new y(t);return this.measurementView.pick(e)}_resetSnappingState(){this._snappingManager.doneSnapping(),this._snappingOperation.abort(),this._snappingOperation.stagedPoint=null}get test(){return{snappingManager:this._snappingManager}}};t([o({readOnly:!0})],b.prototype,"state",null),t([o()],b.prototype,"polygonState",void 0),t([o({readOnly:!0})],b.prototype,"cursor",null),t([o()],b.prototype,"measurementView",void 0),t([o({constructOnly:!0})],b.prototype,"view",void 0),t([o({constructOnly:!0})],b.prototype,"analysis",void 0),t([o({constructOnly:!0})],b.prototype,"analysisViewData",void 0),t([o({readOnly:!0})],b.prototype,"manipulators",void 0),t([o()],b.prototype,"updating",null),t([o()],b.prototype,"stagedPoint",null),t([o()],b.prototype,"snappingOptions",null),b=t([r("esri.views.3d.interactive.measurementTools.areaMeasurement3D.AreaMeasurement3DTool")],b);const O=b;export{O as default};
|