@arcgis/core 4.25.0-next.20221020 → 4.25.0-next.20221021
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/WebMap.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/0b0f3e93f658a012d5f0.js +1 -0
- package/assets/esri/core/workers/chunks/2ebba71cbbfa62ddf46a.js +1 -0
- package/assets/esri/core/workers/chunks/6dfb2ddfd72009564a34.js +1 -0
- package/assets/esri/core/workers/chunks/883cfe319b15ebabf71e.js +1 -0
- package/assets/esri/core/workers/chunks/925f53f4ef097c5ce204.js +1 -0
- package/assets/esri/core/workers/chunks/9d410721f42259efe666.js +1 -0
- package/assets/esri/core/workers/chunks/b5e6a868256c5aae6d5e.js +1 -0
- package/assets/esri/core/workers/chunks/{a9b77bea0b8d7a2e5f65.js → c8c0f091aab41e4effa5.js} +1 -1
- package/assets/esri/core/workers/chunks/d573ec98401fbae26383.js +1 -0
- package/layers/MapNotesLayer.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/Dimension/lengthDimensionManipulatorUtils.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/SliceVisualization.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/interactive/editingTools/reshapeGraphic/ReshapeOperation.js +1 -1
- package/views/3d/interactive/editingTools/transformGraphic/ExtentTransformTool.js +1 -1
- package/views/3d/interactive/manipulatorUtils.js +1 -1
- package/views/3d/terrain/Tile.js +1 -1
- package/views/draw/DrawOperation.js +1 -1
- package/views/draw/drawSurfaces.js +1 -1
- package/views/interactive/dragEventPipeline.js +1 -1
- package/views/interactive/snapping/SnappingDragPipelineStep.js +1 -1
- package/views/interactive/snapping/SnappingOperation.js +1 -1
- package/assets/esri/core/workers/chunks/09255015e57bdfa5337f.js +0 -1
- package/assets/esri/core/workers/chunks/24ffd7180bb947bc8aec.js +0 -1
- package/assets/esri/core/workers/chunks/5f1c474a0e2dd8da6f2f.js +0 -1
- package/assets/esri/core/workers/chunks/6a2358861b3d3007ad26.js +0 -1
- package/assets/esri/core/workers/chunks/bf248b08e18a50878f38.js +0 -1
- package/assets/esri/core/workers/chunks/c9399a106dc167368a39.js +0 -1
- package/assets/esri/core/workers/chunks/cdfa8b788bde5334672a.js +0 -1
- package/assets/esri/core/workers/chunks/dbf72099949febfae5a1.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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../geometry.js";import t from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{rad2deg as i,deg2rad as n}from"../../../../core/mathUtils.js";import{isNone as r,isSome as s}from"../../../../core/maybe.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{o as a,b as c,k as l,m as u,r as d,i as m,v as p,D as g}from"../../../../chunks/mat4.js";import{c as f}from"../../../../chunks/mat4f64.js";import{r as b}from"../../../../chunks/quat.js";import{g as h,c as T,e as E,f as O,n as I,a as R,l as w,b as A,s as j,p as y,y as M}from"../../../../chunks/vec3.js";import{a as L,c as _,f as k}from"../../../../chunks/vec3f64.js";import{tryProjectWithZConversion as C}from"../../../../geometry/projection.js";import{Axis as N}from"../../../../geometry/support/Axis.js";import{r as P,f as v,i as U,a as V,n as S,u as F}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as H,fromPositionAndNormal as x}from"../../../../geometry/support/plane.js";import{create as G}from"../../../../geometry/support/ray.js";import{angleAroundAxis as D}from"../../../../geometry/support/vector.js";import{sv3d as X,sm4d as Y,sq4d as Z}from"../../../../geometry/support/vectorStacks.js";import{VERTICAL_DOT_THRESHOLD as W,SMALL_ANGLE_DOT_THRESHOLD as B,PLANE_MIN_BASIS_SCREEN_LEN2 as q,INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION as z,SHIFT_RESTART_OFFSET_DISTANCE as $,RESIZE_HANDLE_EDGE_PADDING_FRAC as J,SHIFT_RESTART_ARROW_TIP_COLOR as K,SHIFT_RESTART_ARROW_CAP_COLOR as Q,SHIFT_RESTART_TUBE_COLOR as tt,SHIFT_RESTART_OUTLINE_COLOR as et,SHIFT_RESTART_CALLOUT_COLOR as it,SHIFT_RESTART_TIP_RADIUS as nt,PLANE_OUTLINE_COLOR as rt,PLANE_OUTLINE_WIDTH as st,PLANE_BACKGROUND_COLOR as ot,GRID_COLOR as at,RESIZE_HANDLE_CORNER_INPUT_RADIUS as ct,RESIZE_HANDLE_EDGE_INPUT_RADIUS as lt,SHIFT_RESTART_TIP_LENGTH as ut,SHIFT_RESTART_ARROW_LENGTH as dt,SHIFT_RESTART_TUBE_RADIUS as mt,SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER as pt,SHIFT_RESTART_TIP_FOCUS_MULTIPLIER as gt,SHIFT_RESTART_ARROW_OUTLINE_WIDTH as ft,RESIZE_HANDLE_CORNER_WIDTH as bt,RESIZE_HANDLE_EDGE_WIDTH as ht,DISPLAY_FOCUS_MULTIPLIER as Tt,RESIZE_HANDLE_COLOR as Et}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as Ot}from"../support/projectionUtils.js";import{Manipulator3D as It}from"../../interactive/Manipulator3D.js";import{calculateTranslateRotateFromBases as Rt,createRotateManipulator as wt,worldScaledManipulatorSettings as At}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as jt}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as yt}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Mt}from"../../support/RenderCoordsHelper.js";import{fromRender as Lt}from"../../support/geometryUtils/ray.js";import{CullFaceOptions as _t}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as kt,createExtrudedTriangle as Ct,createConeGeometry as Nt,createPathExtrusionGeometry as Pt}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as vt}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as Ut}from"../../webgl-engine/materials/ColorMaterial.js";import{NativeLineMaterial as Vt}from"../../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as St}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateCustomFlags as Ft,ManipulatorStateFlags as Ht}from"../../../interactive/interfaces.js";import xt from"../../../../geometry/Extent.js";function Gt(t,e,i,n,r,s,o,a){return Dt(e,o.worldUpAtPosition(t,X.get()),r,s,a.basis1,a.basis2),h(a.basis1,a.basis1,i),h(a.basis2,a.basis2,n),T(a.origin,t),H(a.basis2,a.basis1,a.origin,a.plane),a}function Dt(t,e,i,n,r,s){const o=E(t,e),a=X.get(),c=X.get();switch(n===we.HORIZONTAL_OR_VERTICAL?Math.abs(o)>W?we.HORIZONTAL:we.VERTICAL:n){case we.VERTICAL:{const n=Math.abs(o)<=B?t:i.viewUp;O(a,n,e),T(c,e);break}case we.HORIZONTAL:O(a,i.viewUp,e),O(c,e,a);break;case we.TILTED:{const n=Math.abs(o)<=B?e:i.viewUp;O(a,n,t),O(c,t,a);break}}const l=O(X.get(),a,c);E(l,i.viewForward)>0&&h(c,c,-1),I(r,a),I(s,c)}function Xt(t,e,i){const n=e.worldUpAtPosition(t.origin,X.get()),r=t.basis1,s=be(t,n),o=Math.round(s/ye)*ye;return P(t,o-s,r,i)}function Yt(t,e,i,n,r,s){const o=T(X.get(),r.origin);R(o,o,h(X.get(),r.basis1,t.direction[0]<0?1:-1)),R(o,o,h(X.get(),r.basis2,t.direction[1]<0?1:-1));const a=w(r.basis1),c=w(r.basis2),l=A(X.get(),i,o),u=A(X.get(),e,o);let d=0,m=0;if(se(t)){const e=re(r),i=re(s);d=a-.5*t.direction[0]*E(r.basis1,u)/a,m=c-.5*t.direction[1]*E(r.basis2,u)/c;const n=i/e;d*=n,m*=n}const p=d+.5*t.direction[0]*E(r.basis1,l)/a,g=m+.5*t.direction[1]*E(r.basis2,l)/c,f=h(X.get(),r.basis1,p/a),b=h(X.get(),r.basis2,g/c);(p<=0||ie(s.origin,f,n)<=q)&&T(f,s.basis1),(g<=0||ie(s.origin,b,n)<=q)&&T(b,s.basis2);const O=T(X.get(),o);return R(O,O,h(X.get(),f,t.direction[0]<0?-1:1)),R(O,O,h(X.get(),b,t.direction[1]<0?-1:1)),v(O,f,b,s)}function Zt(t,e){return z*Math.min(e.width,e.height)*e.computeRenderPixelSizeAt(t)}function Wt(t,e,i,n){const r=O(X.get(),e,i);return O(r,r,e),x(t,r,n)}function Bt(t,e){return Rt(t.basis1,t.basis2,t.origin,e)}function qt(t,e,i,n){const r=e.worldUpAtPosition(t.origin,X.get()),s=X.get();switch(i){case Re.HEADING:T(s,r);break;case Re.TILT:T(s,t.basis1)}return x(t.origin,s,n)}function zt(t,e,i,n){const r=ee(i,te.NEGATIVE_X),s=Y.get();a(s,e,r.edge*Math.PI/2);const c=I(X.get(),r.basis);let l=h(X.get(),c,r.direction*n.computeScreenPixelSizeAt(r.position)*$);R(l,l,r.position);const u=n.projectToRenderScreen(l,o(X.get())),d=$t(n,u);Lt(n,u,je),I(je.direction,je.direction);const m=X.get();!d&&U(i,je,m)&&(l=m),s[12]=0,s[13]=0,s[14]=0,t.modelTransform=s,t.renderLocation=L(l),d?t.state|=Ae:t.state&=~Ae}function $t(t,e){const[i,n,r,s]=t.viewport,o=Math.min(r,s)/16;let a=!0;return e[0]<i+o?(e[0]=i+o,a=!1):e[0]>i+r-o&&(e[0]=i+r-o,a=!1),e[1]<n+o?(e[1]=n+o,a=!1):e[1]>n+s-o&&(e[1]=n+s-o,a=!1),a}function Jt(t,e,i,n){const r=w(n.basis1),s=w(n.basis2),o=ne(n),a=re(n),d=j(X.get(),0,0,0);R(d,h(X.get(),n.basis1,e.direction[0]),h(X.get(),n.basis2,e.direction[1])),R(d,n.origin,d);let m=0,p=1;if(se(e))1===e.direction[0]&&-1===e.direction[1]?m=ye:1===e.direction[0]&&1===e.direction[1]?m=Math.PI:-1===e.direction[0]&&1===e.direction[1]&&(m=3*Math.PI/2),p=a;else{const t=0!==e.direction[0]?1:2;m=1===t?ye:0,p=(1===t?s:r)-o}const g=c(Y.get(),m);l(g,g,j(X.get(),p,p,p)),u(g,i,g),g[12]=0,g[13]=0,g[14]=0,t.modelTransform=g,t.renderLocation=d}function Kt(t,e,i,n){const r=n.worldUpAtPosition(i.origin,X.get()),s=ee(i,te.POSITIVE_X),o=c(Y.get(),s.edge*Math.PI/2);d(o,o,-be(i,r)),u(o,e,o),o[12]=0,o[13]=0,o[14]=0,t.modelTransform=o,t.renderLocation=s.position}function Qt(t,e,i){const n=ee(i,te.POSITIVE_Y),r=c(Y.get(),n.edge*Math.PI/2);d(r,r,ye),u(r,e,r),r[12]=0,r[13]=0,r[14]=0,t.modelTransform=r,t.renderLocation=n.position}var te;function ee(t,e){switch(e){case te.POSITIVE_X:return{basis:t.basis1,direction:1,position:R(X.get(),t.origin,t.basis1),edge:e};case te.POSITIVE_Y:return{basis:t.basis2,direction:1,position:R(X.get(),t.origin,t.basis2),edge:e};case te.NEGATIVE_X:return{basis:t.basis1,direction:-1,position:A(X.get(),t.origin,t.basis1),edge:e};case te.NEGATIVE_Y:return{basis:t.basis2,direction:-1,position:A(X.get(),t.origin,t.basis2),edge:e}}}function ie(t,e,i){const n=i.projectToRenderScreen(R(X.get(),t,e),o(X.get())),r=i.projectToRenderScreen(A(X.get(),t,e),o(X.get()));return y(A(n,n,r))}function ne(t){const e=w(t.basis1),i=w(t.basis2);return J*Math.min(e,i)}function re(t){return ne(t)}function se(t){return 0!==t.direction[0]&&0!==t.direction[1]}function oe(t,e=_e.CENTER_ON_ARROW){const i=e===_e.CENTER_ON_CALLOUT?$:0,n=[k(i,0,-dt/2),k(i,0,dt/2)],r=pe(n,!0),s=(t,e)=>de(n,n,{tubeRadius:mt,tipRadius:nt,tipLength:ut,tubeFocusMultiplier:pt,tipFocusMultiplier:gt,padding:t,bothEnds:!0,flat:null,focusTipLength:!0,addCap:e}),o=s(0,!1),a=s(ft,!0),c=new Ut({color:K,cullFace:_t.Back,renderOccluded:vt.Opaque}),l=new Ut({color:Q,cullFace:_t.Back,renderOccluded:vt.Opaque}),u=new Ut({color:tt,cullFace:_t.Back,renderOccluded:vt.Opaque}),d=new Ut({color:et,transparent:!0,writeDepth:!1,cullFace:_t.Front,renderOccluded:vt.Transparent}),m=kt([[i,0,0],[i-$,0,0]]),p=kt([[i,0,0],[i-$,0,0]]),g=new Vt({color:it,renderOccluded:vt.OccludeAndTransparent});return new It({view:t,renderObjects:[...o.normal.map((({part:t,geometry:e,transform:i})=>({geometry:e,material:"tip"===t?c:"cap"===t?l:u,transform:i,stateMask:Ht.Unfocused|Ie}))),...a.normal.map((({geometry:t,transform:e})=>({geometry:t,material:d,transform:e,stateMask:Ht.Unfocused|Ie}))),{geometry:m,material:g,stateMask:Ht.Unfocused|Ie|Ae},...o.focused.map((({part:t,geometry:e,transform:i})=>({geometry:e,material:"tip"===t?c:"cap"===t?l:u,transform:i,stateMask:Ht.Focused|Ie}))),...a.focused.map((({geometry:t,transform:e})=>({geometry:t,material:d,transform:e,stateMask:Ht.Focused|Ie}))),{geometry:p,material:g,stateMask:Ht.Focused|Ie|Ae}],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[r]},collisionPriority:1,radius:nt,state:Ie})}function ae(t,e){const{manipulator:i}=wt(t,e,{customStateMask:Ie});return i.state=Ie,i}function ce(t){const e=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new jt({view:t,attached:!0,color:rt,width:st,writeDepthEnabled:!1,renderOccluded:vt.OccludeAndTransparent,geometry:[e]})}function le(t){return new yt({view:t,attached:!0,backgroundColor:[...ot],gridColor:at,gridWidth:4,renderOccluded:vt.OccludeAndTransparent})}function ue(t,e){const i=se(e),n=i?[k(1,0,0),k(0,0,0),k(0,1,0)]:[k(1,0,0),k(-1,0,0)],r=kt(n),s=Et,o=t=>new St({color:s,width:t,renderOccluded:vt.OccludeAndTransparent}),a=()=>new Vt({color:s,renderOccluded:vt.OccludeAndTransparent}),c=i?bt:ht,l=c*Tt,u=ht,d=t=>t>1?o(t):a(),m=[{geometry:r,material:d(c),stateMask:Ht.Unfocused|Me},{geometry:r,material:d(l),stateMask:Ht.Focused|Me},{geometry:r,material:d(u),stateMask:Le}],p=new It({view:t,renderObjects:m,collisionType:{type:"line",paths:[n]},radius:i?ct:lt,...At});return p.state=Me,p}function de(t,e,i){const n=n=>{const r=(n?e:t).slice(0),o=A(X.get(),r[0],r[1]);I(o,o);const a=A(X.get(),r[r.length-1],r[r.length-2]);if(I(a,a),i.padding>0){const t=h(_(),a,-i.padding);if(r[r.length-1]=R(t,t,r[r.length-1]),i.bothEnds){const t=h(_(),o,-i.padding);r[0]=R(t,t,r[0])}}const c=n?i.tipFocusMultiplier:1,d=i.tipLength*(i.focusTipLength?c:1),T=i.tipRadius*c,E=m(Y.get());if(i.padding>0){const t=d/4,e=j(X.get(),0,t,0),n=1+i.padding/t;p(E,E,e),l(E,E,j(X.get(),n,n,n)),p(E,E,h(e,e,-1/n))}const O=m(f()),w=k(0,1,0),y=g(f(),b(Z.get(),w,a));y[12]=r[r.length-1][0],y[13]=r[r.length-1][1],y[14]=r[r.length-1][2],u(y,y,E);const M=[{part:"tube",geometry:me(i.tubeRadius*(n?i.tubeFocusMultiplier:1)+i.padding,i.flat,r),transform:O}];let L,C;if(s(i.flat)?L=Ct(d,T,T,i.flat.thickness):(L=Nt(d,T,24,!1,!1,!0),C=Nt(d,T,24,!1,!0,!1)),M.push({part:"tip",geometry:L,transform:y}),C&&M.push({part:"cap",geometry:C,transform:y}),i.bothEnds){const t=g(f(),b(Z.get(),w,o));t[12]=r[0][0],t[13]=r[0][1],t[14]=r[0][2],u(t,t,E),M.push({part:"tip",geometry:L,transform:t}),C&&M.push({part:"cap",geometry:C,transform:t})}return M};return{normal:n(!1),focused:n(!0)}}function me(t,e,i){const n=[];if(s(e))n.push([t,e.thickness/2],[-t,e.thickness/2],[-t,-e.thickness/2],[t,-e.thickness/2]);else{const e=12;for(let i=0;i<e;i++){const r=i/e*2*Math.PI;n.push([Math.cos(r)*t,Math.sin(r)*t])}}return Pt(n,i,[],[],!1)}function pe(t,e){const i=A(_(),t[t.length-1],t[t.length-2]);if(I(i,i),h(i,i,ut),R(i,i,t[t.length-1]),e){const e=A(_(),t[0],t[1]);return I(e,e),h(e,e,ut),R(e,e,t[0]),[e,...t,i]}return[...t,i]}function ge(e,n,s,o=new t){if(r(e))return null;const{renderCoordsHelper:a}=n,c=a.fromRenderCoords(e.origin,n.spatialReference);if(r(c))return null;const l=C(c,s);if(r(l))return null;o.position=l;const u=2*w(e.basis1),d=2*w(e.basis2),m=Mt.renderUnitScaleFactor(n.spatialReference,s);o.width=u*m,o.height=d*m;const p=a.worldUpAtPosition(e.origin,X.get());return o.tilt=i(be(e,p)),o.heading=a.headingAtPosition(e.origin,e.basis1)-90,o}function fe(t,e,i){if(r(t))return null;const n=t.origin,s=X.get(),o=X.get(),a=X.get(),c=X.get();let l,u,d,m,p,g;R(s,n,t.basis1),R(s,s,t.basis2),R(o,n,t.basis1),M(o,o,t.basis2),M(a,n,t.basis1),M(a,a,t.basis2),M(c,n,t.basis1),R(c,c,t.basis2);for(const f of[s,o,a,c]){const t=e.fromRenderCoords(f,f,i);if(r(t))return null;l=null==l?t[0]:Math.min(l,t[0]),u=null==u?t[0]:Math.max(u,t[0]),d=null==d?t[1]:Math.min(d,t[1]),m=null==m?t[1]:Math.max(m,t[1]),p=null==p?t[2]:Math.min(p,t[2]),g=null==g?t[2]:Math.max(g,t[2])}return new xt({xmin:l,xmax:u,ymin:d,ymax:m,zmin:p,zmax:g,spatialReference:i})}function be(t,e){return D(e,t.basis2,t.basis1)+ye}function he(t,i,r,s,o,a,c=V()){return a.toRenderCoords(t,c.origin)?(a.worldBasisAtPosition(c.origin,N.X,c.basis1),a.worldBasisAtPosition(c.origin,N.Y,c.basis2),H(c.basis2,c.basis1,c.origin,c.plane),P(c,-n(i),S(c),c),P(c,n(r),c.basis1,c),h(c.basis1,c.basis1,s/2),h(c.basis2,c.basis2,o/2),F(c),c):(e.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${t.spatialReference.wkid} is not supported`),null)}function Te(t,e){if(r(t)||r(t.position))return null;const i=Ot(t.position,e.spatialReference,e.elevationProvider);if(r(i))return null;const n=Mt.renderUnitScaleFactor(t.position.spatialReference,e.spatialReference),s=t.width*n,o=t.height*n;return{position:i,heading:t.heading,tilt:t.tilt,renderWidth:s,renderHeight:o}}function Ee(t,e,i,n=V()){const s=Te(t,e);return r(s)?null:Oe(s,e,i,n)}function Oe(t,e,i,n=V()){if(r(t))return null;const o=he(t.position,t.heading,t.tilt,t.renderWidth,t.renderHeight,e.renderCoordsHelper,n);return!i.tiltEnabled&&s(o)&&Xt(o,e.renderCoordsHelper,o),o}!function(t){t[t.POSITIVE_X=0]="POSITIVE_X",t[t.POSITIVE_Y=1]="POSITIVE_Y",t[t.NEGATIVE_X=2]="NEGATIVE_X",t[t.NEGATIVE_Y=3]="NEGATIVE_Y"}(te||(te={}));const Ie=Ft.Custom1;var Re,we;!function(t){t[t.HEADING=1]="HEADING",t[t.TILT=2]="TILT"}(Re||(Re={})),function(t){t[t.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.TILTED=3]="TILTED"}(we||(we={}));const Ae=Ft.Custom2,je=G(),ye=Math.PI/2,Me=Ft.Custom1,Le=Ft.Custom2;var _e;function ke(t){const e="building-scene-3d"===t.type?t:null;return s(e)}!function(t){t[t.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",t[t.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(_e||(_e={}));export{Ie as DidPointerMoveRecentlyFlag,Ae as IsShiftEdgeOnScreenFlag,_e as OffsetMode,Re as RotationAxis,we as SliceOrientation,pe as addArrowTips,Bt as calculateBoundedPlaneTranslateRotate,re as calculateDiagonalResizeHandleScale,Zt as calculatePlaneHalfSize,ne as calculateResizeHandlePadding,ie as calculateScreenSpaceBasisLength2,de as createArrowGeometry,le as createGridVisualElement,ce as createOutlineVisualElement,Gt as createPlane,ue as createResizeManipulator,ae as createRotateManipulator,qt as createRotatePlane,oe as createShiftManipulator,Wt as createShiftPlane,Xt as forceHorizontalOrVertical,se as isDiagonalResizeHandle,ke as isIBuildingSceneLayerView3D,Dt as normalToBases,fe as planeToExtent,ge as planeToShape,Te as projectAndElevationAlignShape,Oe as projectedShapeToPlane,Me as resizeNormal,Le as resizeOutlineOnly,Yt as resizePlane,Ee as shapeToPlane,Jt as updateResizeHandle,Kt as updateRotateHeadingHandle,Qt as updateRotateTiltHandle,zt as updateShiftRestartHandle};
|
|
5
|
+
import"../../../../geometry.js";import t from"../../../../analysis/SlicePlane.js";import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{rad2deg as i,deg2rad as n}from"../../../../core/mathUtils.js";import{isNone as r,isSome as s}from"../../../../core/maybe.js";import{castRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import{o as a,b as c,k as l,m as u,r as d,i as m,v as p,D as g}from"../../../../chunks/mat4.js";import{c as f}from"../../../../chunks/mat4f64.js";import{r as b}from"../../../../chunks/quat.js";import{g as h,c as T,e as E,f as O,n as I,a as R,l as w,b as A,s as j,p as y,y as M}from"../../../../chunks/vec3.js";import{a as L,c as _,f as k}from"../../../../chunks/vec3f64.js";import{tryProjectWithZConversion as C}from"../../../../geometry/projection.js";import{Axis as N}from"../../../../geometry/support/Axis.js";import{r as P,f as v,i as U,a as V,n as S,u as F}from"../../../../chunks/boundedPlane.js";import{fromVectorsAndPoint as H,fromPositionAndNormal as x}from"../../../../geometry/support/plane.js";import{create as G}from"../../../../geometry/support/ray.js";import{angleAroundAxis as D}from"../../../../geometry/support/vector.js";import{sv3d as X,sm4d as Y,sq4d as Z}from"../../../../geometry/support/vectorStacks.js";import{VERTICAL_DOT_THRESHOLD as W,SMALL_ANGLE_DOT_THRESHOLD as B,PLANE_MIN_BASIS_SCREEN_LEN2 as q,INITIAL_PLANE_HALF_SIZE_VIEW_PROPORTION as z,SHIFT_RESTART_OFFSET_DISTANCE as $,RESIZE_HANDLE_EDGE_PADDING_FRAC as J,SHIFT_RESTART_ARROW_TIP_COLOR as K,SHIFT_RESTART_ARROW_CAP_COLOR as Q,SHIFT_RESTART_TUBE_COLOR as tt,SHIFT_RESTART_OUTLINE_COLOR as et,SHIFT_RESTART_CALLOUT_COLOR as it,SHIFT_RESTART_TIP_RADIUS as nt,PLANE_OUTLINE_COLOR as rt,PLANE_OUTLINE_WIDTH as st,PLANE_BACKGROUND_COLOR as ot,GRID_COLOR as at,RESIZE_HANDLE_CORNER_INPUT_RADIUS as ct,RESIZE_HANDLE_EDGE_INPUT_RADIUS as lt,SHIFT_RESTART_TIP_LENGTH as ut,SHIFT_RESTART_ARROW_LENGTH as dt,SHIFT_RESTART_TUBE_RADIUS as mt,SHIFT_RESTART_TUBE_FOCUS_MULTIPLIER as pt,SHIFT_RESTART_TIP_FOCUS_MULTIPLIER as gt,SHIFT_RESTART_ARROW_OUTLINE_WIDTH as ft,RESIZE_HANDLE_CORNER_WIDTH as bt,RESIZE_HANDLE_EDGE_WIDTH as ht,DISPLAY_FOCUS_MULTIPLIER as Tt,RESIZE_HANDLE_COLOR as Et}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as Ot}from"../support/projectionUtils.js";import{Manipulator3D as It}from"../../interactive/Manipulator3D.js";import{calculateTranslateRotateFromBases as Rt,createRotateManipulator as wt,worldScaledManipulatorSettings as At}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as jt}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as yt}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as Mt}from"../../support/RenderCoordsHelper.js";import{fromRender as Lt}from"../../support/geometryUtils/ray.js";import{CullFaceOptions as _t}from"../../webgl-engine/lib/basicInterfaces.js";import{createPolylineGeometry as kt,createExtrudedTriangle as Ct,createConeGeometry as Nt,createPathExtrusionGeometry as Pt}from"../../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as vt}from"../../webgl-engine/lib/Material.js";import{ColorMaterial as Ut}from"../../webgl-engine/materials/ColorMaterial.js";import{NativeLineMaterial as Vt}from"../../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as St}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{ManipulatorStateCustomFlags as Ft,ManipulatorStateFlags as Ht}from"../../../interactive/interfaces.js";import xt from"../../../../geometry/Extent.js";function Gt(t,e,i,n,r,s,o,a){return Dt(e,o.worldUpAtPosition(t,X.get()),r,s,a.basis1,a.basis2),h(a.basis1,a.basis1,i),h(a.basis2,a.basis2,n),T(a.origin,t),H(a.basis2,a.basis1,a.origin,a.plane),a}function Dt(t,e,i,n,r,s){const o=E(t,e),a=X.get(),c=X.get();switch(n===we.HORIZONTAL_OR_VERTICAL?Math.abs(o)>W?we.HORIZONTAL:we.VERTICAL:n){case we.VERTICAL:{const n=Math.abs(o)<=B?t:i.viewUp;O(a,n,e),T(c,e);break}case we.HORIZONTAL:O(a,i.viewUp,e),O(c,e,a);break;case we.TILTED:{const n=Math.abs(o)<=B?e:i.viewUp;O(a,n,t),O(c,t,a);break}}const l=O(X.get(),a,c);E(l,i.viewForward)>0&&h(c,c,-1),I(r,a),I(s,c)}function Xt(t,e,i){const n=e.worldUpAtPosition(t.origin,X.get()),r=t.basis1,s=be(t,n),o=Math.round(s/ye)*ye;return P(t,o-s,r,i)}function Yt(t,e,i,n,r,s){const o=T(X.get(),r.origin);R(o,o,h(X.get(),r.basis1,t.direction[0]<0?1:-1)),R(o,o,h(X.get(),r.basis2,t.direction[1]<0?1:-1));const a=w(r.basis1),c=w(r.basis2),l=A(X.get(),i,o),u=A(X.get(),e,o);let d=0,m=0;if(se(t)){const e=re(r),i=re(s);d=a-.5*t.direction[0]*E(r.basis1,u)/a,m=c-.5*t.direction[1]*E(r.basis2,u)/c;const n=i/e;d*=n,m*=n}const p=d+.5*t.direction[0]*E(r.basis1,l)/a,g=m+.5*t.direction[1]*E(r.basis2,l)/c,f=h(X.get(),r.basis1,p/a),b=h(X.get(),r.basis2,g/c);(p<=0||ie(s.origin,f,n)<=q)&&T(f,s.basis1),(g<=0||ie(s.origin,b,n)<=q)&&T(b,s.basis2);const O=T(X.get(),o);return R(O,O,h(X.get(),f,t.direction[0]<0?-1:1)),R(O,O,h(X.get(),b,t.direction[1]<0?-1:1)),v(O,f,b,s)}function Zt(t,e){return z*Math.min(e.width,e.height)*e.computeRenderPixelSizeAt(t)}function Wt(t,e,i,n){const r=O(X.get(),e,i);return O(r,r,e),x(t,r,n)}function Bt(t,e){return Rt(t.basis1,t.basis2,t.origin,e)}function qt(t,e,i,n){const r=e.worldUpAtPosition(t.origin,X.get()),s=X.get();switch(i){case Re.HEADING:T(s,r);break;case Re.TILT:T(s,t.basis1)}return x(t.origin,s,n)}function zt(t,e,i,n){const r=ee(i,te.NEGATIVE_X),s=Y.get();a(s,e,r.edge*Math.PI/2);const c=I(X.get(),r.basis);let l=h(X.get(),c,r.direction*n.computeScreenPixelSizeAt(r.position)*$);R(l,l,r.position);const u=n.projectToRenderScreen(l,o(X.get())),d=$t(n,u);Lt(n,u,je),I(je.direction,je.direction);const m=X.get();!d&&U(i,je,m)&&(l=m),s[12]=0,s[13]=0,s[14]=0,t.modelTransform=s,t.renderLocation=L(l),d?t.state|=Ae:t.state&=~Ae}function $t(t,e){const[i,n,r,s]=t.viewport,o=Math.min(r,s)/16;let a=!0;return e[0]<i+o?(e[0]=i+o,a=!1):e[0]>i+r-o&&(e[0]=i+r-o,a=!1),e[1]<n+o?(e[1]=n+o,a=!1):e[1]>n+s-o&&(e[1]=n+s-o,a=!1),a}function Jt(t,e,i,n){const r=w(n.basis1),s=w(n.basis2),o=ne(n),a=re(n),d=j(X.get(),0,0,0);R(d,h(X.get(),n.basis1,e.direction[0]),h(X.get(),n.basis2,e.direction[1])),R(d,n.origin,d);let m=0,p=1;if(se(e))1===e.direction[0]&&-1===e.direction[1]?m=ye:1===e.direction[0]&&1===e.direction[1]?m=Math.PI:-1===e.direction[0]&&1===e.direction[1]&&(m=3*Math.PI/2),p=a;else{const t=0!==e.direction[0]?1:2;m=1===t?ye:0,p=(1===t?s:r)-o}const g=c(Y.get(),m);l(g,g,j(X.get(),p,p,p)),u(g,i,g),g[12]=0,g[13]=0,g[14]=0,t.modelTransform=g,t.renderLocation=d}function Kt(t,e,i,n){const r=n.worldUpAtPosition(i.origin,X.get()),s=ee(i,te.POSITIVE_X),o=c(Y.get(),s.edge*Math.PI/2);d(o,o,-be(i,r)),u(o,e,o),o[12]=0,o[13]=0,o[14]=0,t.modelTransform=o,t.renderLocation=s.position}function Qt(t,e,i){const n=ee(i,te.POSITIVE_Y),r=c(Y.get(),n.edge*Math.PI/2);d(r,r,ye),u(r,e,r),r[12]=0,r[13]=0,r[14]=0,t.modelTransform=r,t.renderLocation=n.position}var te;function ee(t,e){switch(e){case te.POSITIVE_X:return{basis:t.basis1,direction:1,position:R(X.get(),t.origin,t.basis1),edge:e};case te.POSITIVE_Y:return{basis:t.basis2,direction:1,position:R(X.get(),t.origin,t.basis2),edge:e};case te.NEGATIVE_X:return{basis:t.basis1,direction:-1,position:A(X.get(),t.origin,t.basis1),edge:e};case te.NEGATIVE_Y:return{basis:t.basis2,direction:-1,position:A(X.get(),t.origin,t.basis2),edge:e}}}function ie(t,e,i){const n=i.projectToRenderScreen(R(X.get(),t,e),o(X.get())),r=i.projectToRenderScreen(A(X.get(),t,e),o(X.get()));return y(A(n,n,r))}function ne(t){const e=w(t.basis1),i=w(t.basis2);return J*Math.min(e,i)}function re(t){return ne(t)}function se(t){return 0!==t.direction[0]&&0!==t.direction[1]}function oe(t,e=_e.CENTER_ON_ARROW){const i=e===_e.CENTER_ON_CALLOUT?$:0,n=[k(i,0,-dt/2),k(i,0,dt/2)],r=pe(n,!0),s=(t,e)=>de(n,n,{tubeRadius:mt,tipRadius:nt,tipLength:ut,tubeFocusMultiplier:pt,tipFocusMultiplier:gt,padding:t,bothEnds:!0,flat:null,focusTipLength:!0,addCap:e}),o=s(0,!1),a=s(ft,!0),c=new Ut({color:K,cullFace:_t.Back,renderOccluded:vt.Opaque}),l=new Ut({color:Q,cullFace:_t.Back,renderOccluded:vt.Opaque}),u=new Ut({color:tt,cullFace:_t.Back,renderOccluded:vt.Opaque}),d=new Ut({color:et,transparent:!0,writeDepth:!1,cullFace:_t.Front,renderOccluded:vt.Transparent}),m=kt([[i,0,0],[i-$,0,0]]),p=kt([[i,0,0],[i-$,0,0]]),g=new Vt({color:it,renderOccluded:vt.OccludeAndTransparent});return new It({view:t,renderObjects:[...o.normal.map((({part:t,geometry:e,transform:i})=>({geometry:e,material:"tip"===t?c:"cap"===t?l:u,transform:i,stateMask:Ht.Unfocused|Ie}))),...a.normal.map((({geometry:t,transform:e})=>({geometry:t,material:d,transform:e,stateMask:Ht.Unfocused|Ie}))),{geometry:m,material:g,stateMask:Ht.Unfocused|Ie|Ae},...o.focused.map((({part:t,geometry:e,transform:i})=>({geometry:e,material:"tip"===t?c:"cap"===t?l:u,transform:i,stateMask:Ht.Focused|Ie}))),...a.focused.map((({geometry:t,transform:e})=>({geometry:t,material:d,transform:e,stateMask:Ht.Focused|Ie}))),{geometry:p,material:g,stateMask:Ht.Focused|Ie|Ae}],autoScaleRenderObjects:!1,collisionType:{type:"line",paths:[r]},collisionPriority:1,radius:nt,state:Ie})}function ae(t,e){const i=wt(t,{customStateMask:Ie,texture:e});return i.state=Ie,i}function ce(t){const e=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]];return new jt({view:t,attached:!1,color:rt,width:st,writeDepthEnabled:!1,renderOccluded:vt.OccludeAndTransparent,geometry:[e]})}function le(t){return new yt({view:t,attached:!1,backgroundColor:[...ot],gridColor:at,gridWidth:4,renderOccluded:vt.OccludeAndTransparent})}function ue(t,e){const i=se(e),n=i?[k(1,0,0),k(0,0,0),k(0,1,0)]:[k(1,0,0),k(-1,0,0)],r=kt(n),s=Et,o=t=>new St({color:s,width:t,renderOccluded:vt.OccludeAndTransparent}),a=()=>new Vt({color:s,renderOccluded:vt.OccludeAndTransparent}),c=i?bt:ht,l=c*Tt,u=ht,d=t=>t>1?o(t):a(),m=[{geometry:r,material:d(c),stateMask:Ht.Unfocused|Me},{geometry:r,material:d(l),stateMask:Ht.Focused|Me},{geometry:r,material:d(u),stateMask:Le}],p=new It({view:t,renderObjects:m,collisionType:{type:"line",paths:[n]},radius:i?ct:lt,...At});return p.state=Me,p}function de(t,e,i){const n=n=>{const r=(n?e:t).slice(0),o=A(X.get(),r[0],r[1]);I(o,o);const a=A(X.get(),r[r.length-1],r[r.length-2]);if(I(a,a),i.padding>0){const t=h(_(),a,-i.padding);if(r[r.length-1]=R(t,t,r[r.length-1]),i.bothEnds){const t=h(_(),o,-i.padding);r[0]=R(t,t,r[0])}}const c=n?i.tipFocusMultiplier:1,d=i.tipLength*(i.focusTipLength?c:1),T=i.tipRadius*c,E=m(Y.get());if(i.padding>0){const t=d/4,e=j(X.get(),0,t,0),n=1+i.padding/t;p(E,E,e),l(E,E,j(X.get(),n,n,n)),p(E,E,h(e,e,-1/n))}const O=m(f()),w=k(0,1,0),y=g(f(),b(Z.get(),w,a));y[12]=r[r.length-1][0],y[13]=r[r.length-1][1],y[14]=r[r.length-1][2],u(y,y,E);const M=[{part:"tube",geometry:me(i.tubeRadius*(n?i.tubeFocusMultiplier:1)+i.padding,i.flat,r),transform:O}];let L,C;if(s(i.flat)?L=Ct(d,T,T,i.flat.thickness):(L=Nt(d,T,24,!1,!1,!0),C=Nt(d,T,24,!1,!0,!1)),M.push({part:"tip",geometry:L,transform:y}),C&&M.push({part:"cap",geometry:C,transform:y}),i.bothEnds){const t=g(f(),b(Z.get(),w,o));t[12]=r[0][0],t[13]=r[0][1],t[14]=r[0][2],u(t,t,E),M.push({part:"tip",geometry:L,transform:t}),C&&M.push({part:"cap",geometry:C,transform:t})}return M};return{normal:n(!1),focused:n(!0)}}function me(t,e,i){const n=[];if(s(e))n.push([t,e.thickness/2],[-t,e.thickness/2],[-t,-e.thickness/2],[t,-e.thickness/2]);else{const e=12;for(let i=0;i<e;i++){const r=i/e*2*Math.PI;n.push([Math.cos(r)*t,Math.sin(r)*t])}}return Pt(n,i,[],[],!1)}function pe(t,e){const i=A(_(),t[t.length-1],t[t.length-2]);if(I(i,i),h(i,i,ut),R(i,i,t[t.length-1]),e){const e=A(_(),t[0],t[1]);return I(e,e),h(e,e,ut),R(e,e,t[0]),[e,...t,i]}return[...t,i]}function ge(e,n,s,o=new t){if(r(e))return null;const{renderCoordsHelper:a}=n,c=a.fromRenderCoords(e.origin,n.spatialReference);if(r(c))return null;const l=C(c,s);if(r(l))return null;o.position=l;const u=2*w(e.basis1),d=2*w(e.basis2),m=Mt.renderUnitScaleFactor(n.spatialReference,s);o.width=u*m,o.height=d*m;const p=a.worldUpAtPosition(e.origin,X.get());return o.tilt=i(be(e,p)),o.heading=a.headingAtPosition(e.origin,e.basis1)-90,o}function fe(t,e,i){if(r(t))return null;const n=t.origin,s=X.get(),o=X.get(),a=X.get(),c=X.get();let l,u,d,m,p,g;R(s,n,t.basis1),R(s,s,t.basis2),R(o,n,t.basis1),M(o,o,t.basis2),M(a,n,t.basis1),M(a,a,t.basis2),M(c,n,t.basis1),R(c,c,t.basis2);for(const f of[s,o,a,c]){const t=e.fromRenderCoords(f,f,i);if(r(t))return null;l=null==l?t[0]:Math.min(l,t[0]),u=null==u?t[0]:Math.max(u,t[0]),d=null==d?t[1]:Math.min(d,t[1]),m=null==m?t[1]:Math.max(m,t[1]),p=null==p?t[2]:Math.min(p,t[2]),g=null==g?t[2]:Math.max(g,t[2])}return new xt({xmin:l,xmax:u,ymin:d,ymax:m,zmin:p,zmax:g,spatialReference:i})}function be(t,e){return D(e,t.basis2,t.basis1)+ye}function he(t,i,r,s,o,a,c=V()){return a.toRenderCoords(t,c.origin)?(a.worldBasisAtPosition(c.origin,N.X,c.basis1),a.worldBasisAtPosition(c.origin,N.Y,c.basis2),H(c.basis2,c.basis1,c.origin,c.plane),P(c,-n(i),S(c),c),P(c,n(r),c.basis1,c),h(c.basis1,c.basis1,s/2),h(c.basis2,c.basis2,o/2),F(c),c):(e.getLogger("esri.views.3d.analysis.Slice.sliceToolUtils").error(`Failed to project slice plane position, projection from ${t.spatialReference.wkid} is not supported`),null)}function Te(t,e){if(r(t)||r(t.position))return null;const i=Ot(t.position,e.spatialReference,e.elevationProvider);if(r(i))return null;const n=Mt.renderUnitScaleFactor(t.position.spatialReference,e.spatialReference),s=t.width*n,o=t.height*n;return{position:i,heading:t.heading,tilt:t.tilt,renderWidth:s,renderHeight:o}}function Ee(t,e,i,n=V()){const s=Te(t,e);return r(s)?null:Oe(s,e,i,n)}function Oe(t,e,i,n=V()){if(r(t))return null;const o=he(t.position,t.heading,t.tilt,t.renderWidth,t.renderHeight,e.renderCoordsHelper,n);return!i.tiltEnabled&&s(o)&&Xt(o,e.renderCoordsHelper,o),o}!function(t){t[t.POSITIVE_X=0]="POSITIVE_X",t[t.POSITIVE_Y=1]="POSITIVE_Y",t[t.NEGATIVE_X=2]="NEGATIVE_X",t[t.NEGATIVE_Y=3]="NEGATIVE_Y"}(te||(te={}));const Ie=Ft.Custom1;var Re,we;!function(t){t[t.HEADING=1]="HEADING",t[t.TILT=2]="TILT"}(Re||(Re={})),function(t){t[t.HORIZONTAL_OR_VERTICAL=0]="HORIZONTAL_OR_VERTICAL",t[t.HORIZONTAL=1]="HORIZONTAL",t[t.VERTICAL=2]="VERTICAL",t[t.TILTED=3]="TILTED"}(we||(we={}));const Ae=Ft.Custom2,je=G(),ye=Math.PI/2,Me=Ft.Custom1,Le=Ft.Custom2;var _e;function ke(t){const e="building-scene-3d"===t.type?t:null;return s(e)}!function(t){t[t.CENTER_ON_CALLOUT=0]="CENTER_ON_CALLOUT",t[t.CENTER_ON_ARROW=1]="CENTER_ON_ARROW"}(_e||(_e={}));export{Ie as DidPointerMoveRecentlyFlag,Ae as IsShiftEdgeOnScreenFlag,_e as OffsetMode,Re as RotationAxis,we as SliceOrientation,pe as addArrowTips,Bt as calculateBoundedPlaneTranslateRotate,re as calculateDiagonalResizeHandleScale,Zt as calculatePlaneHalfSize,ne as calculateResizeHandlePadding,ie as calculateScreenSpaceBasisLength2,de as createArrowGeometry,le as createGridVisualElement,ce as createOutlineVisualElement,Gt as createPlane,ue as createResizeManipulator,ae as createRotateManipulator,qt as createRotatePlane,oe as createShiftManipulator,Wt as createShiftPlane,Xt as forceHorizontalOrVertical,se as isDiagonalResizeHandle,ke as isIBuildingSceneLayerView3D,Dt as normalToBases,fe as planeToExtent,ge as planeToShape,Te as projectAndElevationAlignShape,Oe as projectedShapeToPlane,Me as resizeNormal,Le as resizeOutlineOnly,Yt as resizePlane,Ee as shapeToPlane,Jt as updateResizeHandle,Kt as updateRotateHeadingHandle,Qt as updateRotateTiltHandle,zt as updateShiftRestartHandle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Handles.js";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{releaseMaybe as i,disposeMaybe as r,destroyMaybe as a,isNone as o}from"../../../core/maybe.js";import{watch as n}from"../../../core/reactiveUtils.js";import{s as h}from"../../../chunks/vec2.js";import{l as d}from"../../../chunks/vec3.js";import{s as u}from"../../../chunks/vec4.js";import{earth as m}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as p}from"./AtmosphereType.js";import{atmosphereHeight as _,innerAtmosphereDepth as l,computeInnerAltitudeFade as c}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as T,ChapmanAtmosphereTechnique as
|
|
5
|
+
import e from"../../../core/Handles.js";import{lerp as t,smoothstep as s}from"../../../core/mathUtils.js";import{releaseMaybe as i,disposeMaybe as r,destroyMaybe as a,isNone as o}from"../../../core/maybe.js";import{watch as n}from"../../../core/reactiveUtils.js";import{s as h}from"../../../chunks/vec2.js";import{l as d}from"../../../chunks/vec3.js";import{s as u}from"../../../chunks/vec4.js";import{earth as m}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as p}from"./AtmosphereType.js";import{atmosphereHeight as _,innerAtmosphereDepth as l,computeInnerAltitudeFade as c}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as T,ChapmanAtmosphereTechnique as f}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as v}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{Pos2Tex as b}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as R}from"../webgl-engine/lib/glUtil3D.js";import{PrimitiveType as E}from"../../webgl/enums.js";class j{constructor(e){this._view=e,this.type=p.Realistic,this._passParameters=new T,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=m.radius,this._fadeHaze=0,this._updateRadius(m.radius)}destroy(){this._atmosphereTechnique=i(this._atmosphereTechnique),this._atmosphereHazeTechnique=i(this._atmosphereHazeTechnique),this._vao=r(this._vao),this._handles=a(this._handles)}initializeRenderContext(t){const s=t.renderContext.rctx,i=this._handles=new e;this._updateRootTileElevationBounds(),i.add(n((()=>this._view.basemapTerrain.rootTileElevationBounds),(()=>this._updateRootTileElevationBounds()))),i.add(n((()=>this._view.basemapTerrain.visibleElevationBounds),(()=>this._updateVisibleElevationBounds())));const r=new v;r.haze=!1,this._atmosphereTechnique=t.shaderTechniqueRepository.acquire(f,r),r.haze=!0,this._atmosphereHazeTechnique=t.shaderTechniqueRepository.acquire(f,r),this._vao=R(s,b)}render(e){this._render(e,this._atmosphereTechnique,e.offscreenRenderingHelper.depthTexture)}renderHaze(e,t){this._fadeHaze=t,this._render(e,this._atmosphereHazeTechnique,e.offscreenRenderingHelper.linearDepthTexture)}_render(e,t,s){if(o(s))return;this._update(e.bindParameters.camera),this._passParameters.depthTex=s;const i=e.rctx.bindTechnique(t,this._passParameters,e.bindParameters);e.offscreenRenderingHelper.renderDepthDetached((()=>{this._renderCommon(i,e)}))}_renderCommon(e,t){o(this._vao)||(t.rctx.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.rctx.drawArrays(E.TRIANGLE_STRIP,0,4))}_adjustRadiusForTesselation(e){return e*Math.cos(Math.PI/16/16)}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=m.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=this._adjustRadiusForTesselation(m.radius+this._view.basemapTerrain.visibleElevationBounds.min);e<this._lowerBoundEarthRadius&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,h(this._passParameters.radii,e,e+_),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-l)*l)}_update(e){if(o(e))return;const i=d(e.eye),r=i*i,a=r-this._passParameters.radii[1]*this._passParameters.radii[1],n=Math.min(1,Math.max(0,(i-this._passParameters.radii[0])/_));u(this._passParameters.heightParameters,i,r,a,n),this._passParameters.altitudeFade=c(i-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=t(t(.6,1,s(9500,10500,i-m.radius)),1,this._fadeHaze)}static isSupported(e){return e.renderContext.rctx.capabilities.depthTexture}}export{j as ChapmanAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as r}from"../../../core/mathUtils.js";import{destroyMaybe as i,isSome as a,isNone as o}from"../../../core/maybe.js";import{when as n,syncAndInitial as h,watch as p,initial as m}from"../../../core/reactiveUtils.js";import{Milliseconds as d}from"../../../core/time.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as c,c as u,h as g}from"../../../chunks/vec3.js";import{f as w}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../geometry/projectionEllipsoid.js";import{isMoon as y,isEarth as v}from"../../../geometry/support/spatialReferenceUtils.js";import{AtmosphereType as P}from"./AtmosphereType.js";import{ChapmanAtmosphere as b}from"./ChapmanAtmosphere.js";import{CloudsComposition as R}from"./CloudsComposition.js";import{FadeInStages as x,FadeInOutStages as W}from"./CloudsCompositionParameters.js";import{isReadyCloudsData as z}from"./CloudsData.js";import{CloudsGenerator as j}from"./CloudsGenerator.js";import{cloudPresets as E}from"./CloudsPresets.js";import{Fog as N,FogParameters as C}from"./Fog.js";import{PanoramicAtmosphere as A}from"./PanoramicAtmosphere.js";import{Precipitation as T}from"./Precipitation.js";import O from"./SimpleAtmosphere.js";import{SimpleHaze as S,HazeParameters as F}from"./SimpleHaze.js";import{Stars as H}from"./Stars.js";import{weatherHeightLimit as I}from"./weather.js";import{updateWeatherFading as L,weatherfadingNeedsRender as M}from"./weatherUtils.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as q}from"../webgl-engine/lib/RenderSlot.js";import{Update as k}from"../webgl-engine/lib/Update.js";var G;const V=[q.POSTPROCESSING_ENVIRONMENT_OPAQUE,q.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let B=G=class extends t{constructor(e){super(e),this._handles=new s,this._context=null,this._atmosphere=null,this._oldWeatherParameters=new D,this._newWeatherParameters=new D,this._fadedWeatherParameters=new D,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(V,this)}destroy(){null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._handles=i(this._handles),this._set("view",null)}get atmosphereType(){return a(this._atmosphere)?this._atmosphere.type:P.None}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return a(this._atmosphere)&&this._atmosphere.type===P.Realistic}updateAnimation(e){return!!a(this._precipitation)&&this._precipitation.update(e)}get updating(){return a(this._stars)&&this._stars.updating||a(this._clouds)&&this._clouds.running}get weatherVisible(){return c(this.view.state.camera.eye)-f(this.view.spatialReference).radius<=I}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||o(this._context)?(i(s),null):a(s)?s:new H({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||o(this._context))return i(e),null;const t=this.view,s=this._context;return a(e)&&e.context===s?e:(i(e),new T({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||o(this._context))return i(e),null;if(a(e))return e;const t=this.view,s=this._context;return i(e),new j({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||o(this._context))return i(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,r=f(this.view.spatialReference).radius;return a(e)&&e.viewingMode===t&&e.planetRadius===r?e:(i(e),new R({rctx:s,viewingMode:t,planetRadius:r,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||o(this._context))return i(e),null;if(a(e))return e;const t=this.view,s=this._context;return new N({context:s,view:t})}get _simpleHaze(){const e=this._get("_simpleHaze");if(!this.weatherEnabled||o(this._context))return i(e),null;if(a(e))return e;const t=this.view,s=this._context;return new S({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this._handles.add([n((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),h),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),h),p((()=>this._stars),t),p((()=>this._precipitation),t),p((()=>this._clouds),(()=>this._updateWeather()),m),p((()=>this._fog),(()=>this._updateFogHaze()),m),p((()=>this._simpleHaze),(()=>this._updateFogHaze()),m),p((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),h)])}uninitializeRenderContext(){this._context=null,this._atmosphere=i(this._atmosphere),this._set("_stars",i(this._stars)),this._set("_precipitation",i(this._precipitation)),this._set("_clouds",i(this._clouds)),this._set("_cloudsComposition",i(this._cloudsComposition)),this._set("_fog",i(this._fog)),this._set("_simpleHaze",i(this._simpleHaze))}prepareRender(e){e.bindParameters.cloudsFade.data=z(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&(L(e.bindParameters.cloudsFade,e.bindParameters.camera,this.view.state.mode,G.test.time||e.time,this.view.qualitySettings.weatherFadeDuration),this._updateWeatherFading(e.bindParameters))}render(e){if(e.output===U.Color)switch(e.bindParameters.slot){case q.POSTPROCESSING_ENVIRONMENT_OPAQUE:a(this._stars)&&this._stars.render(e),a(this._atmosphere)&&(this._atmosphere.render(e),a(this._cloudsComposition)&&a(e.bindParameters.cloudsFade.data)&&(this.weatherVisible&&a(this._clouds)&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),M(e.bindParameters.cloudsFade)&&a(this._context)&&this._context.requestRender());break;case q.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(a(this._atmosphere)){const t=this.weatherEnabled?this.view.environment.weather.type:"disabled";if(this._atmosphere.renderHaze(e,"rainy"===t),this._weatherParameters.haze.amount>0&&this._selectAtmosphereType()!==P.Realistic&&a(this._simpleHaze)&&this._simpleHaze.render(e,this._weatherParameters.haze),this._weatherParameters.fog.amount>0&&a(this._fog)&&this._fog.render(e,this._weatherParameters.fog),a(this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}}updateLightSources(e,t,s,r){if(a(this._context)){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===k.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return o(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e){if(!e.weatherFading)return;const t=e.cloudsFade;return t.fadeIn.stage===x.FADE_IN?(e.fadeLighting(t.fadeIn.factor),void this._fadeWeather(t.fadeIn.factor)):t.fadeInOut.stage===W.FADE_IN?(e.fadeLighting(t.fadeInOut.factor),void this._fadeWeather(t.fadeInOut.factor)):t.crossFade.enabled?(e.fadeLighting(t.crossFade.factor),void this._fadeWeather(t.crossFade.factor)):(e.fadeLighting(0),void this._fadeWeather(0))}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;o(e)||o(this._clouds)||(this._clouds.applyPreset(E[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){a(this._context)&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(o(this._fog)||o(this._simpleHaze)||o(e)||o(this._context))return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=r(3e-5,.005,e.weatherAdjustment**3),u(this._newWeatherParameters.fog.color,J),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=0,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=r(4e-6,2e-4,e.effect**3),u(this._newWeatherParameters.fog.color,Q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=r(4e-6,2e-4,e.effect**3),u(this._newWeatherParameters.fog.color,J),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=0,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.haze.strength=4e-6,this._newWeatherParameters.haze.amount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(){const e=this._selectAtmosphereType();if(this.atmosphereType===e)return;const t=this._getAtmosphereClass();if(!t)return a(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();a(this._context)&&(i(this._atmosphere),this._atmosphere=new t(this.view),this._atmosphere.initializeRenderContext(this._context),this._setNeedsRender(),this._updateBasemapTerrain())}_getAtmosphereClass(){switch(this._selectAtmosphereType()){case P.None:return null;case P.Realistic:return b;case P.Panoramic:return A;case P.Simple:return O;default:return}}_selectAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||y(this.view.spatialReference)?P.None:"local"===s?P.Panoramic:"high"===t&&a(this._context)&&b.isSupported(this._context)&&v(this.view.spatialReference)?P.Realistic:P.Simple}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=a(this._atmosphere)&&this.atmosphereType===P.Simple)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType(),stubGetAtmosphereClass:e=>{K=G.prototype._getAtmosphereClass,G.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{G.prototype._getAtmosphereClass=K}}}};B.test={time:d(0)},e([l({constructOnly:!0})],B.prototype,"view",void 0),e([l({type:Boolean,readOnly:!0})],B.prototype,"updating",null),e([l({readOnly:!0})],B.prototype,"weatherVisible",null),e([l()],B.prototype,"_context",void 0),e([l({readOnly:!0})],B.prototype,"_stars",null),e([l({readOnly:!0})],B.prototype,"_precipitation",null),e([l({readOnly:!0})],B.prototype,"_clouds",null),e([l({readOnly:!0})],B.prototype,"_cloudsComposition",null),e([l({readOnly:!0})],B.prototype,"_fog",null),e([l({readOnly:!0})],B.prototype,"_simpleHaze",null),e([l({readOnly:!0})],B.prototype,"weatherEnabled",null),e([l({readOnly:!0})],B.prototype,"_precipitationEnabled",null),e([l({readOnly:!0})],B.prototype,"_weatherUpdateParameters",null),B=G=e([_("esri.views.3d.environment.EnvironmentRenderer")],B);class D{constructor(){this.fog=new C,this.haze=new F}copyFrom(e){this.fog.amount=e.fog.amount,this.haze.amount=e.haze.amount,this.fog.strength=e.fog.strength,this.haze.strength=e.haze.strength,u(this.fog.color,e.fog.color)}lerp(e,t,s){this.fog.amount=r(e.fog.amount,t.fog.amount,s),this.haze.amount=r(e.haze.amount,t.haze.amount,s),this.fog.strength=r(e.fog.strength,t.fog.strength,s),this.haze.strength=r(e.haze.strength,t.haze.strength,s),g(this.fog.color,e.fog.color,t.fog.color,s)}}const Q=w(.5,.5,.5),J=w(1.5,1.5,1.5);let K;export{B as EnvironmentRenderer,D as WeatherParameters};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import s from"../../../core/Handles.js";import{lerp as r}from"../../../core/mathUtils.js";import{destroyMaybe as i,isSome as a,isNone as o}from"../../../core/maybe.js";import{when as n,syncAndInitial as h,watch as p,initial as m}from"../../../core/reactiveUtils.js";import{Milliseconds as d}from"../../../core/time.js";import{property as l}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/arrayUtils.js";import"../../../core/accessorSupport/ensureType.js";import{subclass as _}from"../../../core/accessorSupport/decorators/subclass.js";import{l as c,c as u,h as g}from"../../../chunks/vec3.js";import{f as w}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as f}from"../../../geometry/projectionEllipsoid.js";import{isMoon as y,isEarth as v}from"../../../geometry/support/spatialReferenceUtils.js";import{AtmosphereType as P}from"./AtmosphereType.js";import{ChapmanAtmosphere as b}from"./ChapmanAtmosphere.js";import{CloudsComposition as R}from"./CloudsComposition.js";import{FadeInStages as x,FadeInOutStages as z}from"./CloudsCompositionParameters.js";import{isReadyCloudsData as W}from"./CloudsData.js";import{CloudsGenerator as j}from"./CloudsGenerator.js";import{cloudPresets as N}from"./CloudsPresets.js";import{Fog as E,FogParameters as A}from"./Fog.js";import{PanoramicAtmosphere as C}from"./PanoramicAtmosphere.js";import{Precipitation as T}from"./Precipitation.js";import O from"./SimpleAtmosphere.js";import{SimpleHaze as S,HazeParameters as F}from"./SimpleHaze.js";import{Stars as H}from"./Stars.js";import{weatherHeightLimit as I}from"./weather.js";import{updateWeatherFading as L,weatherfadingNeedsRender as M}from"./weatherUtils.js";import{ShaderOutput as U}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as q}from"../webgl-engine/lib/RenderSlot.js";import{Update as k}from"../webgl-engine/lib/Update.js";var G;const V=[q.POSTPROCESSING_ENVIRONMENT_OPAQUE,q.POSTPROCESSING_ENVIRONMENT_TRANSPARENT];let B=G=class extends t{constructor(e){super(e),this._handles=new s,this._context=null,this._atmosphere=null,this._oldWeatherParameters=new D,this._newWeatherParameters=new D,this._fadedWeatherParameters=new D,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(V,this)}destroy(){null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._handles=i(this._handles),this._set("view",null)}get atmosphereType(){return a(this._atmosphere)?this._atmosphere.type:P.None}get canRender(){return!!this.view.basemapTerrain?.renderer.canRender||"global"!==this.view.viewingMode}get needsLinearDepth(){return a(this._atmosphere)&&this._atmosphere.type===P.Realistic}updateAnimation(e){return!!a(this._precipitation)&&this._precipitation.update(e)}get updating(){return a(this._stars)&&this._stars.updating||a(this._clouds)&&this._clouds.running}get weatherVisible(){return c(this.view.state.camera.eye)-f(this.view.spatialReference).radius<=I}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return!t||o(this._context)?(i(s),null):a(s)?s:new H({view:e,requestRender:()=>this._setNeedsRender()})}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||o(this._context))return i(e),null;const t=this.view,s=this._context;return a(e)&&e.context===s?e:(i(e),new T({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||o(this._context))return i(e),null;if(a(e))return e;const t=this.view,s=this._context;return i(e),new j({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||o(this._context))return i(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,r=f(this.view.spatialReference).radius;return a(e)&&e.viewingMode===t&&e.planetRadius===r?e:(i(e),new R({rctx:s,viewingMode:t,planetRadius:r,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||o(this._context))return i(e),null;if(a(e))return e;const t=this.view,s=this._context;return new E({context:s,view:t})}get _simpleHaze(){const e=this._get("_simpleHaze");if(!this.weatherEnabled||o(this._context))return i(e),null;if(a(e))return e;const t=this.view,s=this._context;return new S({context:s,view:t})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this._handles.add([n((()=>this.view?.basemapTerrain),(()=>this._updateBasemapTerrain()),h),p((()=>({viewingMode:this.view.viewingMode,atmosphereEnabled:this.view.environment.atmosphereEnabled,atmosphereQuality:this.view.environment.atmosphere.quality})),(()=>this._updateAtmosphere()),h),p((()=>this._stars),t),p((()=>this._precipitation),t),p((()=>this._clouds),(()=>this._updateWeather()),m),p((()=>this._fog),(()=>this._updateFogHaze()),m),p((()=>this._simpleHaze),(()=>this._updateFogHaze()),m),p((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),h)])}uninitializeRenderContext(){this._context=null,this._atmosphere=i(this._atmosphere),this._set("_stars",i(this._stars)),this._set("_precipitation",i(this._precipitation)),this._set("_clouds",i(this._clouds)),this._set("_cloudsComposition",i(this._cloudsComposition)),this._set("_fog",i(this._fog)),this._set("_simpleHaze",i(this._simpleHaze))}prepareRender(e){e.bindParameters.cloudsFade.data=W(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&(L(e.bindParameters.cloudsFade,e.bindParameters.camera,this.view.state.mode,G.test.time||e.time,this.view.qualitySettings.weatherFadeDuration),this._updateWeatherFading(e.bindParameters))}render(e){if(e.output===U.Color)switch(e.bindParameters.slot){case q.POSTPROCESSING_ENVIRONMENT_OPAQUE:a(this._stars)&&this._stars.render(e),a(this._atmosphere)&&(this._atmosphere.render(e),a(this._cloudsComposition)&&a(e.bindParameters.cloudsFade.data)&&(this.weatherVisible&&a(this._clouds)&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),M(e.bindParameters.cloudsFade)&&a(this._context)&&this._context.requestRender());break;case q.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(a(this._atmosphere)&&(this._atmosphere.renderHaze(e,this._weatherParameters.haze.amount),this._weatherParameters.haze.amount>0&&this._selectAtmosphereType()!==P.Realistic&&a(this._simpleHaze)&&this._simpleHaze.render(e,this._weatherParameters.haze),this._weatherParameters.fog.amount>0&&a(this._fog)&&this._fog.render(e,this._weatherParameters.fog),a(this._precipitation))){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(a(this._context)){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===k.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return o(e)?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e){if(!e.weatherFading)return;const t=e.cloudsFade;return t.fadeIn.stage===x.FADE_IN?(e.fadeLighting(t.fadeIn.factor),void this._fadeWeather(t.fadeIn.factor)):t.fadeInOut.stage===z.FADE_IN?(e.fadeLighting(t.fadeInOut.factor),void this._fadeWeather(t.fadeInOut.factor)):t.crossFade.enabled?(e.fadeLighting(t.crossFade.factor),void this._fadeWeather(t.crossFade.factor)):(e.fadeLighting(0),void this._fadeWeather(0))}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;o(e)||o(this._clouds)||(this._clouds.applyPreset(N[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){a(this._context)&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(o(this._fog)||o(this._simpleHaze)||o(e)||o(this._context))return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=r(3e-5,.005,e.weatherAdjustment**3),u(this._newWeatherParameters.fog.color,J),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._selectAtmosphereType()===P.Realistic?1:0,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=r(4e-6,2e-4,e.effect**3),u(this._newWeatherParameters.fog.color,Q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=r(4e-6,2e-4,e.effect**3),u(this._newWeatherParameters.fog.color,J),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.haze.strength=0,this._newWeatherParameters.haze.amount=this._selectAtmosphereType()===P.Realistic?1:0,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.haze.strength=4e-6,this._newWeatherParameters.haze.amount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(){const e=this._selectAtmosphereType();if(this.atmosphereType===e)return;const t=this._getAtmosphereClass();if(!t)return a(this._atmosphere)&&(this._atmosphere.destroy(),this._atmosphere=null,this._setNeedsRender()),void this._updateBasemapTerrain();a(this._context)&&(i(this._atmosphere),this._atmosphere=new t(this.view),this._atmosphere.initializeRenderContext(this._context),this._setNeedsRender(),this._updateBasemapTerrain())}_getAtmosphereClass(){switch(this._selectAtmosphereType()){case P.None:return null;case P.Realistic:return b;case P.Panoramic:return C;case P.Simple:return O;default:return}}_selectAtmosphereType(){const e=this.view.get("environment.atmosphereEnabled"),t=this.view.get("environment.atmosphere.quality"),s=this.view.viewingMode;return!e||null==t||y(this.view.spatialReference)?P.None:"local"===s?P.Panoramic:"high"===t&&a(this._context)&&b.isSupported(this._context)&&v(this.view.spatialReference)?P.Realistic:P.Simple}_updateBasemapTerrain(){this.view.basemapTerrain&&(this.view.basemapTerrain.velvetOverground=a(this._atmosphere)&&this.atmosphereType===P.Simple)}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType(),stubGetAtmosphereClass:e=>{K=G.prototype._getAtmosphereClass,G.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{G.prototype._getAtmosphereClass=K}}}};B.test={time:d(0)},e([l({constructOnly:!0})],B.prototype,"view",void 0),e([l({type:Boolean,readOnly:!0})],B.prototype,"updating",null),e([l({readOnly:!0})],B.prototype,"weatherVisible",null),e([l()],B.prototype,"_context",void 0),e([l({readOnly:!0})],B.prototype,"_stars",null),e([l({readOnly:!0})],B.prototype,"_precipitation",null),e([l({readOnly:!0})],B.prototype,"_clouds",null),e([l({readOnly:!0})],B.prototype,"_cloudsComposition",null),e([l({readOnly:!0})],B.prototype,"_fog",null),e([l({readOnly:!0})],B.prototype,"_simpleHaze",null),e([l({readOnly:!0})],B.prototype,"weatherEnabled",null),e([l({readOnly:!0})],B.prototype,"_precipitationEnabled",null),e([l({readOnly:!0})],B.prototype,"_weatherUpdateParameters",null),B=G=e([_("esri.views.3d.environment.EnvironmentRenderer")],B);class D{constructor(){this.fog=new A,this.haze=new F}copyFrom(e){this.fog.amount=e.fog.amount,this.haze.amount=e.haze.amount,this.fog.strength=e.fog.strength,this.haze.strength=e.haze.strength,u(this.fog.color,e.fog.color)}lerp(e,t,s){this.fog.amount=r(e.fog.amount,t.fog.amount,s),this.haze.amount=r(e.haze.amount,t.haze.amount,s),this.fog.strength=r(e.fog.strength,t.fog.strength,s),this.haze.strength=r(e.haze.strength,t.haze.strength,s),g(this.fog.color,e.fog.color,t.fog.color,s)}}const Q=w(.5,.5,.5),J=w(1.5,1.5,1.5);let K;export{B as EnvironmentRenderer,D as WeatherParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import i from"../../../../../core/Evented.js";import{HandleOwner as a}from"../../../../../core/HandleOwner.js";import o from"../../../../../core/Handles.js";import{handlesGroup as n,destroyHandle as r}from"../../../../../core/handleUtils.js";import{destroyMaybe as s,isSome as l,isNone as p,unwrap as h,removeMaybe as d}from"../../../../../core/maybe.js";import{zeroMeters as u,scale as c,createLength as m}from"../../../../../core/quantityUtils.js";import{watch as g,when as _,initial as f}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as v}from"../../../../../core/unitUtils.js";import{property as M}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as O}from"../../../../../chunks/mat4f64.js";import{l as x,b,h as E,s as G,a as S,g as V}from"../../../../../chunks/vec3.js";import{f as I,c as T}from"../../../../../chunks/vec3f64.js";import w from"../../../../../geometry/Polyline.js";import{projectPoint as H}from"../../../../../geometry/support/plane.js";import{sv3d as A}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as L}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as P}from"../../../../../symbols/support/utils.js";import{Manipulator3D as j}from"../../Manipulator3D.js";import{createManipulatorMaterial as U,createManipulatorOutlineMaterial as k,placeAtGraphic as N}from"../../manipulatorUtils.js";import{SegmentLabels3D as C}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as R}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as F,convertToMapCoordinates as z,screenToMapXYAtLocation as X,screenToMapXYForGraphicAtLocation as Z}from"../dragEventPipeline3D.js";import{ManipulatorType as Y}from"../ManipulatorType.js";import{canMoveZ as q}from"../manipulatorUtils.js";import{settings as W,colors as K}from"../settings.js";import{createVisualElements as B}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as J}from"../manipulations/config.js";import{ManipulationType as Q,MoveManipulation as $}from"../manipulations/MoveManipulation.js";import{shapeOrientation as ee,axisConstrainedDragSign as te}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as ie}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ae,createEdgeOffsetOperation as oe,edgeOffsetRotationMatrix as ne,screenEdgeLengthSquared as re}from"./edgeOffsetUtils.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as le}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as pe,createSphereGeometry as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as de}from"../../../../input/IViewEvents.js";import{addMapDelta as ue,createManipulatorDragEventPipeline as ce,dragAtLocation as me,addScreenDelta as ge}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as _e,ManipulatorStateCustomFlags as fe}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as ve}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as Me}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as ye}from"../../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as Oe}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as xe}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as be}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Ee,TranslateGraphicXYTooltipInfo as Ge,TranslateGraphicTooltipInfo as Se,TranslateVertexZTooltipInfo as Ve,TranslateVertexXYTooltipInfo as Ie,TranslateVertexTooltipInfo as Te}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoAreaByElevationMode as we}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as He,autoLengthByElevationMode as Ae}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as De,elevationOfPoint as Le}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as Pe}from"../../../../support/geodesicLengthMeasurementUtils.js";let je=class extends(i.EventedMixin(a)){constructor(e){super(e),this._vertexManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.vertex.color),W.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.vertex.outlineColor),W.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.vertex.hoverOutlineColor),W.reshapeManipulators.vertex.renderOccluded),this._edgeManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.edge.color),W.reshapeManipulators.edge.renderOccluded),this._edgeManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.edge.outlineColor),W.reshapeManipulators.edge.renderOccluded),this._edgeOffsetManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.edgeOffset.color),W.reshapeManipulators.edgeOffset.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=U(W.colorToVec4(W.reshapeManipulators.edgeOffset.hoverColor),W.reshapeManipulators.edgeOffset.renderOccluded,!1),this._selectedManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.selected.color),W.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.selected.outlineColor),W.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.selected.hoverOutlineColor),W.reshapeManipulators.selected.renderOccluded),this._selectedIndex=0,this._vertexManipulatorGeometry=null,this._vertexManipulatorOutlineGeometry=null,this._edgeManipulatorGeometry=null,this._edgeManipulatorOutlineGeometry=null,this._edgeOffsetManipulatorGeometryInside=null,this._edgeOffsetManipulatorGeometryOutside=null,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._editGeometryOperations=null,this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=ze.NONE,this._outlineVisualElement=null,this._segmentLabels=null,this.outputGeometry=null,this._snappingPipeline=new Oe,this._snappingPipelineHandle=new Oe,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new le({graphic:e});this._tooltip=new be({view:t}),this.addHandles([g((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),g((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{l(e)&&(e.visible=t,e.edgeDistance=i?"far":"default")}),f),_((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),f),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=s(this._segmentLabels),this._tooltip=s(this._tooltip),this._removeManipulators()}get inputGeometry(){return l(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=s(this._moveManipulation),this._graphicMoveManipulation=s(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(){if(p(this._editGeometryOperations))return;const e=L(this.graphic);for(const t of this._editGeometryOperations.data.components){for(const i of t.vertices)this._createVertexOrEdgeManipulator(i,e);for(const i of t.edges)this._createVertexOrEdgeManipulator(i,e)}this._createGraphicMoveManipulation(),this._createMoveManipulation(e),this._createVisualElements()}get canRedo(){return l(this._editGeometryOperations)&&this._editGeometryOperations.canRedo}get canUndo(){return l(this._editGeometryOperations)&&this._editGeometryOperations.canUndo}redo(){if(p(this._editGeometryOperations))return null;const e=this._editGeometryOperations.redo();return l(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(p(this._editGeometryOperations))return null;this.emit("undo");const e=this._editGeometryOperations.undo();return l(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._removeManipulators(),this._tooltip.clear(),this._createManipulators()}_recreateEditGeometryAndManipulators(e=this.inputGeometry){this._removeManipulators(),this._tooltip.clear(),p(e)||(s(this._editGeometryOperations),this._editGeometryOperations=ve.fromGeometry(e,this.view.state.viewingMode),this._createManipulators(),s(this._segmentLabels),this._segmentLabels=new C({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:L(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}))}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],o=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),n=e===Xe.SELECTED_OR_ALL&&o;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||n&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(ze.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(ze.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){let e=0;for(const t of this._manipulatorInfos)"vertex"===t.type&&t.manipulator.selected&&e++;return e>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(ze.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const o=[];for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected&&!n.manipulator.grabbing||n===e.info)&&o.push(n);this._moveVertices(o,e,Me.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case ze.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case ze.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case ze.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case ze.MOVING:switch(this._reshapeEventState){case ze.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case ze.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 ze.RESHAPING:switch(this._reshapeEventState){case ze.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case ze.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 ie({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=h(this._editGeometryOperations).createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(Xe.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=d(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=d(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,handles:i,tool:a,view:o}=this,n=this._graphicState;this._moveManipulation=new $({tool:a,view:o,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t),snapToScene:!1,radius:$.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>i.add([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 r=e=>t=>{i.add(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(r(Q.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(r(Q.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(r(Q.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=h(t.geometry).spatialReference;i.add([this._moveManipulation.createDragPipeline(((i,o,n,r,s)=>{const l=n.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===Y.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e})).next(this._snappingPipelineHandle.createSnapDragEventPipelineStep({predicate:e=>!!e.info,cancel:r,snappingManager:a.snappingManager,snappingContext:new ye({editGeometryOperations:h(this._editGeometryOperations),elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new R}),updatingHandles:this.updatingHandles,useZ:!1}),this._snappingPipelineHandle.next).next(ue()).next((e=>this._perGraphicManipulatorDragAction(Xe.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(i,e),e)));return r.next((()=>this._onDragCancel())),l}),e,s,t),g((()=>n.displaying),(()=>{this._updateMoveManipulationPosition()}),f),n.on("changed",(()=>this._updateMoveManipulationPosition())),g((()=>n.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?i.add(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):i.remove(t)}),f)])}_createVisualElements(){const{graphic:e,view:t}=this,i=B({view:t,graphic:e,forEachManipulator:e=>{if(!this.destroyed){this._graphicMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,Y.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});l(i)&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null),l(this._outlineVisualElement)&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=L(this.graphic)){const i=W.reshapeManipulators.edgeOffset,a=i.size/2,o=a+i.collisionPadding;if(p(this._edgeOffsetManipulatorGeometryInside)||p(this._edgeOffsetManipulatorGeometryOutside)){const e=a/o,t=e*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside=pe(t,e/2,e/2,i.height,i.offset),this._edgeOffsetManipulatorGeometryOutside=pe(-t,e/2,e/2,i.height,-i.offset)}const r=[{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorMaterial,stateMask:_e.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:_e.Focused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorMaterial,stateMask:_e.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:_e.Focused}],s=new j({view:this.view,renderObjects:r,elevationInfo:"on-the-ground"!==t.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:o,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new j({view:this.view,renderObjects:[],worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:s,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 n of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(n);l(e)&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=n(u),this._manipulatorHandles.add(d.locationUpdateHandle,s),this._manipulatorHandles.add([this._watchAndUpdateGrabState(s,!0),this._watchAndUpdateGrabState(h,!0)],s),this._manipulatorHandles.add(ce(s,this._createEdgeOffsetPipeline(d,t)),s),this._manipulatorHandles.add(ce(h,((e,i,a,o)=>{if("touch"===o){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const o=this.graphic,n=l(o.geometry)?o.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(me(this.view,e.elevationAlignedLocation)).next(X(this.view,e.elevationAlignedLocation,t,n,o)).next(ge()).next(ue()).next((e=>this._perGraphicManipulatorDragAction(Xe.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next((()=>this._onDragCancel(!e.metadata.deleting)))}})),s);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([s.events.on("immediate-click",c),h.events.on("immediate-click",c),s.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;if("focus"===e&&t.enabled){const e=this._tooltip.info=new xe({tooltipOptions:t});this._updateTooltipAreaOrTotalLength(e)}else this._tooltip.clear()}))],s),this._manipulatorInfos.push(d),this.manipulators.add(s),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,o=()=>{e.visibilityHandle=d(e.visibilityHandle);const o=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),s=l(o)&&l(r)&&re(o.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||s)&&(i.grabbable=!s,a.grabbable=!s,e.visibilityHandle=n([i.disableDisplay(),{remove:()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}}]))};this._manipulatorHandles.add([i.events.on("focus-changed",o),a.events.on("focus-changed",o),{remove:()=>{d(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}}],i),o()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const{coordinateHelper:t}=h(this._editGeometryOperations).data,i=ae(this.view,e.manipulator.elevationAlignedLocation,oe(t,e.handle,h(e.manipulator.elevationInfo))),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(p(a)||p(o))return;const n=a.manipulator.renderLocation,r=o.manipulator.renderLocation,s=l(i)?ne(i,n,r):O;e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;const d=x(b(Ce,n,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-d,0,0],[d,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,o)=>{this._clearSelection();const{step:n,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(me(this.view,i.elevationAlignedLocation)).next(n).next(F(this.view)).next(z(this.view,h(this._editGeometryOperations).data.spatialReference)).next(ue()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),o.next((()=>{i.metadata.deleting||(r(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t){const i=h(this._editGeometryOperations),a=oe(i.data.coordinateHelper,e.handle,t),o=i.createUndoGroup(),s=ae(this.view,e.manipulator.elevationAlignedLocation,a);if(a.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);l(t)&&this._splitEdgeManipulator(t,1)}if(a.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);l(t)&&this._splitEdgeManipulator(t,0)}const u=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:i.data.spatialReference}),c=new se({view:this.view,isDraped:this._graphicState.isDraped,geometry:u(),elevationInfo:e.elevationInfo,width:W.visualElements.lineGraphics.outline.width,color:W.colorToVec4(K.main),attached:!0});let m;const _=()=>{this._cleanEdgeOffsetCollapsedEdges(e),m=d(m)},f=this.on("undo",_);return m=n([r(c),g((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=u())),o,f]),{step:e=>p(a)||p(s)?(_(),null):{...e,operation:a,plane:s},cleanup:_}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||p(t.operation))return t;this._updateEventState(ze.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:o}=t;return(i||a||o)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return p(t)||p(i)?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,o=this._tooltip,n=this._tooltipOptions;if(!n.enabled||p(i))return o.clear(),e;let r=o.info;(p(r)||"reshape-edge-offset"!==r.type)&&(r=o.info=new xe({tooltipOptions:n}));const{coordinateHelper:s}=h(this._editGeometryOperations).data;return r.distance="end"===e.action?u:ke(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,o=e.handle.rightVertex,n=h(this._editGeometryOperations).data.coordinateHelper,r=[];if(t&&n.distance(t.pos,i.pos)<Re){const e=this._getManipulatorInfoFromHandle(i);l(e)&&r.push(e)}if(n.distance(i.pos,o.pos)<Re||a&&n.distance(a.pos,o.pos)<Re){const e=this._getManipulatorInfoFromHandle(o);l(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=L(this.graphic)){if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(p(this._vertexManipulatorGeometry)||p(this._vertexManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(W.reshapeManipulators.vertex);this._vertexManipulatorGeometry=he(e,16,16),this._vertexManipulatorOutlineGeometry=he(t,16,16)}if(p(this._edgeManipulatorGeometry)||p(this._edgeManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(W.reshapeManipulators.edge);this._edgeManipulatorGeometry=he(e,16,16),this._edgeManipulatorOutlineGeometry=he(t,16,16)}const i=l(this.graphic.geometry)&&"point"===this.graphic.geometry.type?[]:[{geometry:this._vertexManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Fe.Vertex|_e.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorOutlineMaterial,stateMask:Fe.Vertex|_e.Unfocused|_e.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Fe.Vertex|_e.Focused|_e.Unselected},{geometry:this._vertexManipulatorGeometry,material:this._selectedManipulatorMaterial,stateMask:_e.Selected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorOutlineMaterial,stateMask:_e.Selected|_e.Unfocused},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorHoverOutlineMaterial,stateMask:_e.Selected|_e.Focused}];this.enableMidpoints&&i.push({geometry:this._edgeManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:Fe.Edge|_e.Focused|_e.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:Fe.Edge|_e.Focused|_e.Unselected},{geometry:this._edgeManipulatorGeometry,material:this._edgeManipulatorMaterial,stateMask:Fe.Edge|_e.Unfocused|_e.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._edgeManipulatorOutlineMaterial,stateMask:Fe.Edge|_e.Unfocused|_e.Unselected});const a=new j({view:this.view,renderObjects:i,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer.visible),metadata:{deleting:!1}});this._setTypeSpecificManipulatorSettings(a,e,t);const o="edge"===e.type?{manipulator:a,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:a,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(o),this.manipulators.add(a),this._updateManipulatorPosition(o),"edge"===o.type){const e=[];for(const t of[o.handle.leftVertex,o.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);l(i)&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(o))))}o.locationUpdateHandle=n(e),this._manipulatorHandles.add(o.locationUpdateHandle,a)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(a,!0),a);const r=ce(a,((e,i,a,n)=>{let r=null;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(r=h(this._editGeometryOperations).createUndoGroup()),"edge"===o.type){const t=this._splitEdgeManipulator(o);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:o,snapOrigin:o.handle.pos}})).next(me(this.view,e.elevationAlignedLocation)).next(Z(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>!this._isMultiVertexSelection(),cancel:a,snappingManager:this.tool.snappingManager,snappingContext:new ye({editGeometryOperations:h(this._editGeometryOperations),elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new R}),updatingHandles:this.updatingHandles,useZ:!1}),this._snappingPipeline.next).next(ue()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(r=d(r)),this._updateTranslateVertexTooltip(e,Q.XY,t)})),a.next((()=>this._onDragCancel(!e.metadata.deleting,(()=>r=d(r)))))}));return this._manipulatorHandles.add([r,a.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,o))),a.events.on("select-changed",(()=>{o.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),a.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==o.type?this._updateTranslateVertexTooltip(a,Q.XY):this._tooltip.clear()}))],a),this.emit("manipulators-changed"),o}_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=l(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null),l(this.tool.snappingManager)&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case ze.NONE:break;case ze.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case ze.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}t&&t(),this.destroyed||this._updateEventState(ze.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){switch(t.type){case"vertex":e.state=Fe.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.radius=W.reshapeManipulators.vertex.size/2+W.reshapeManipulators.vertex.collisionPadding,e.elevationInfo=i,e.interactive=l(this.graphic.geometry)&&"point"!==this.graphic.geometry.type;break;case"edge":e.state=Fe.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1,e.radius=W.reshapeManipulators.edge.size/2+W.reshapeManipulators.edge.collisionPadding,e.elevationInfo="on-the-ground"!==i.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:i}}_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("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(ze.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{e.manipulator.interactive=e.manipulator.grabbing||!this._numGrabbing&&l(this.graphic.geometry)&&"point"!==this.graphic.geometry.type,"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){p(e)||(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),t(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(p(e))return;const t=h(this._editGeometryOperations);if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ne),e.manipulator.grabbing&&l(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(p(i)||p(a))return;const o=i.manipulator,n=a.manipulator;if(l(e.manipulator.elevationInfo)&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=o.location,a=n.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=D(s,l,p,t.data.spatialReference)}else E(Ce,o.renderLocation,n.renderLocation,.5),e.manipulator.renderLocation=Ce}}_splitEdgeManipulator(e,t=.5){const i=h(this._editGeometryOperations),a=h(i.splitEdge(e.handle,t).createdVertex);e.locationUpdateHandle.remove(),e.locationUpdateHandle=void 0;const o=L(this.graphic);let n;this.enableEdgeOffset?(this._removeManipulator(e),n=this._createVertexOrEdgeManipulator(a)):(n=e,n.handle=a,n.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,o)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(n),this.enableEdgeOffset||this._updateTranslateVertexTooltip(n.manipulator,Q.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(ze.RESHAPING),s=i.data.coordinateHelper.vectorToArray(n.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:h(a.index)}],added:s}),r&&this._updateEventState(ze.NONE),n}_updateMoveManipulationPosition(){const e=G(Ce,0,0,0);let t=0,i=!1,a=null,o=null;for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected?(t++,S(e,e,n.manipulator.renderLocation),p(a)||n.selectedIndex>a.selectedIndex?(o=a,a=n):(p(o)||n.selectedIndex>o.selectedIndex)&&(o=n)):i=!0);if(0!==t){const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&q(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t}else{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&&q(this.graphic)}if(0!==t){let e=0;if(l(a)){const t=a.handle.pos,i=l(o)?o.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,n=p(o)&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;i&&n?this._moveManipulation.xyAxisManipulation.available=!1:i?e=Ue(i,t):n&&(e=Ue(t,n))}this._moveManipulation.angle=e,this._moveManipulation.radius=J}else this._moveManipulation.angle=ee(h(this.graphic.geometry)),this._moveManipulation.radius=$.radiusForSymbol(this.graphic.symbol);0!==t&&i?(V(e,e,1/t),Ne.spatialReference=h(this._editGeometryOperations).data.spatialReference,Ne.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ne),this._moveManipulation.elevationAlignedLocation=Ne):l(this._outlineVisualElement)&&!this._graphicState.isDraped&&l(this._outlineVisualElement.attachmentOrigin)?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:N(this.view,this._moveManipulation,this.graphic)}_removeVertices(e){const t=[],i=h(this._editGeometryOperations);for(const a of e)if("vertex"===a.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=h(i.removeVertices([a.handle]).removedVertices[0].createdEdge);e&&this._createVertexOrEdgeManipulator(e)}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:h(e.index)}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(ze.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(ze.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?Me.NEW_STEP:Me.ACCUMULATE_STEPS)){const a=h(this._editGeometryOperations);a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const o of e)this._updateManipulatorPosition(o)}_offsetEdge(e,t){if(p(t.operation)||p(t.signedDistance))return;const i=h(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===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.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 Q.XY:this._tooltip.info=new Se({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>He(e,t,a)));break;case Q.XY_AXIS:this._tooltip.info=new Ge({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const o=He(e,i,a);return c(o,te(t))}));break;case Q.Z:this._tooltip.info=new Ee({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,De)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let o;const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case Q.XY:o=new Te({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>He(e,t,n))),this._updateTooltipAreaOrTotalLength(o);break;case Q.XY_AXIS:o=new Ie({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>{const a=He(e,t,n);return c(a,te(i))})),this._updateTooltipAreaOrTotalLength(o);break;case Q.Z:o=new Ve({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,De)}const r=Le(e.elevationAlignedLocation);l(r)&&(o.elevation={mode:"absolute-height",...r}),this._tooltip.info=o}_updateTranslateTooltipDistance(e,t,i){if(l(t)&&"end"!==t.action){const{mapStart:a,mapEnd:o}=t,n=i(a,o);e.distance=l(n)?n:u}}_updateTooltipAreaOrTotalLength(e){const{geometry:t}=this.graphic;if(p(t))return;const i=this._graphicState.isDraped?"on-the-ground":"absolute-height";e.area="polygon"===t.type?we(t,i):null,e.totalLength="polyline"===t.type?Ae(t,i):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function Ue(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function ke(e,t,i,a,o){if(e){const e=o.toXYZ(o.pointToVector(i)),n=H(a,e,A.get()),r=Pe(n,e,o.spatialReference);if(l(r))return m(r.value*Math.sign(t),r.unit)}return m(t*v(i.spatialReference),"meters")}e([M()],je.prototype,"_segmentLabels",void 0),e([M({constructOnly:!0})],je.prototype,"tool",void 0),e([M()],je.prototype,"_tooltip",void 0),e([M()],je.prototype,"inputGeometry",null),e([M()],je.prototype,"outputGeometry",void 0),e([M({readOnly:!0})],je.prototype,"updating",null),e([M()],je.prototype,"manipulators",null),e([M()],je.prototype,"view",null),e([M()],je.prototype,"graphic",null),e([M()],je.prototype,"enableZShape",null),e([M()],je.prototype,"enableZVertex",null),e([M()],je.prototype,"enableMoveGraphic",null),e([M()],je.prototype,"enableMidpoints",null),e([M()],je.prototype,"enableEdgeOffset",null),e([M()],je.prototype,"_labelOptions",null),e([M()],je.prototype,"_tooltipOptions",null),je=e([y("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],je);const Ne=D(0,0,null,null),Ce=T(),Re=1e-6;var Fe,ze,Xe;!function(e){e.Vertex=fe.Custom1,e.Edge=fe.Custom2}(Fe||(Fe={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(ze||(ze={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Xe||(Xe={}));export{je as ReshapeOperation};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{removeUnordered as t}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import i from"../../../../../core/Evented.js";import{HandleOwner as a}from"../../../../../core/HandleOwner.js";import o from"../../../../../core/Handles.js";import{handlesGroup as n,destroyHandle as r}from"../../../../../core/handleUtils.js";import{destroyMaybe as s,isSome as l,isNone as p,unwrap as h,removeMaybe as d}from"../../../../../core/maybe.js";import{zeroMeters as u,scale as c,createLength as m}from"../../../../../core/quantityUtils.js";import{watch as g,when as _,initial as f}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as v}from"../../../../../core/unitUtils.js";import{property as M}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as y}from"../../../../../core/accessorSupport/decorators/subclass.js";import{I as x}from"../../../../../chunks/mat4f64.js";import{l as O,b,h as E,s as G,a as S,g as V}from"../../../../../chunks/vec3.js";import{f as I,c as T}from"../../../../../chunks/vec3f64.js";import w from"../../../../../geometry/Polyline.js";import{projectPoint as H}from"../../../../../geometry/support/plane.js";import{sv3d as A}from"../../../../../geometry/support/vectorStacks.js";import{makeDehydratedPoint as D}from"../../../../../layers/graphics/dehydratedFeatures.js";import{getGraphicEffectiveElevationInfo as L}from"../../../../../support/elevationInfoUtils.js";import{isVolumetricSymbol as P}from"../../../../../symbols/support/utils.js";import{Manipulator3D as j}from"../../Manipulator3D.js";import{createManipulatorMaterial as U,createManipulatorOutlineMaterial as k,placeAtGraphic as N}from"../../manipulatorUtils.js";import{SegmentLabels3D as C}from"../../SegmentLabels3D.js";import{SnappingVisualizer3D as R}from"../../SnappingVisualizer3D.js";import{screenToRenderPlaneFromEvent as F,convertToMapCoordinates as z,screenToMapXYAtLocation as X,screenToMapXYForGraphicAtLocation as Z}from"../dragEventPipeline3D.js";import{ManipulatorType as Y}from"../ManipulatorType.js";import{canMoveZ as q}from"../manipulatorUtils.js";import{settings as W,colors as K}from"../settings.js";import{createVisualElements as B}from"../visualElementUtils.js";import{DISC_RADIUS_SMALL as J}from"../manipulations/config.js";import{ManipulationType as Q,MoveManipulation as $}from"../manipulations/MoveManipulation.js";import{shapeOrientation as ee,axisConstrainedDragSign as te}from"../manipulations/moveUtils.js";import{MoveXYGraphicManipulation as ie}from"../manipulations/MoveXYGraphicManipulation.js";import{createEdgeOffsetIntersectionPlane as ae,createEdgeOffsetOperation as oe,edgeOffsetRotationMatrix as ne,screenEdgeLengthSquared as re}from"./edgeOffsetUtils.js";import{OutlineVisualElement as se}from"../../visualElements/OutlineVisualElement.js";import{GraphicState as le}from"../../../layers/graphics/GraphicState.js";import{createExtrudedTriangle as pe,createSphereGeometry as he}from"../../../webgl-engine/lib/GeometryUtil.js";import{MouseButton as de}from"../../../../input/IViewEvents.js";import{sceneSnappingAtLocation as ue,addMapDelta as ce,createManipulatorDragEventPipeline as me,dragAtLocation as ge,addScreenDelta as _e}from"../../../../interactive/dragEventPipeline.js";import{ManipulatorStateFlags as fe,ManipulatorStateCustomFlags as ve}from"../../../../interactive/interfaces.js";import{EditGeometryOperations as Me}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as ye}from"../../../../interactive/editGeometry/interfaces.js";import{SnappingContext as xe}from"../../../../interactive/snapping/SnappingContext.js";import{SnappingPipeline as Oe}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{ReshapeEdgeOffsetTooltipInfo as be}from"../../../../interactive/tooltip/ReshapeTooltipInfos.js";import{Tooltip as Ee}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicZTooltipInfo as Ge,TranslateGraphicXYTooltipInfo as Se,TranslateGraphicTooltipInfo as Ve,TranslateVertexZTooltipInfo as Ie,TranslateVertexXYTooltipInfo as Te,TranslateVertexTooltipInfo as we}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoAreaByElevationMode as He}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as Ae,autoLengthByElevationMode as De}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as Le,elevationOfPoint as Pe}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as je}from"../../../../support/geodesicLengthMeasurementUtils.js";let Ue=class extends(i.EventedMixin(a)){constructor(e){super(e),this._vertexManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.vertex.color),W.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.vertex.outlineColor),W.reshapeManipulators.vertex.renderOccluded),this._vertexManipulatorHoverOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.vertex.hoverOutlineColor),W.reshapeManipulators.vertex.renderOccluded),this._edgeManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.edge.color),W.reshapeManipulators.edge.renderOccluded),this._edgeManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.edge.outlineColor),W.reshapeManipulators.edge.renderOccluded),this._edgeOffsetManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.edgeOffset.color),W.reshapeManipulators.edgeOffset.renderOccluded,!1),this._edgeOffsetManipulatorHoverMaterial=U(W.colorToVec4(W.reshapeManipulators.edgeOffset.hoverColor),W.reshapeManipulators.edgeOffset.renderOccluded,!1),this._selectedManipulatorMaterial=U(W.colorToVec4(W.reshapeManipulators.selected.color),W.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.selected.outlineColor),W.reshapeManipulators.selected.renderOccluded),this._selectedManipulatorHoverOutlineMaterial=k(W.colorToVec4(W.reshapeManipulators.selected.hoverOutlineColor),W.reshapeManipulators.selected.renderOccluded),this._selectedIndex=0,this._vertexManipulatorGeometry=null,this._vertexManipulatorOutlineGeometry=null,this._edgeManipulatorGeometry=null,this._edgeManipulatorOutlineGeometry=null,this._edgeOffsetManipulatorGeometryInside=null,this._edgeOffsetManipulatorGeometryOutside=null,this._manipulatorHandles=new o,this._manipulatorInfos=[],this._editGeometryOperations=null,this._numGrabbing=0,this._numDragging=0,this._reshapeEventState=Xe.NONE,this._outlineVisualElement=null,this._segmentLabels=null,this.outputGeometry=null,this._snappingPipeline=new Oe,this._snappingPipelineHandle=new Oe,this._vertexLaserLineVisualElement=null}initialize(){const{graphic:e,view:t}=this,i=this._graphicState=new le({graphic:e});this._tooltip=new Ee({view:t}),this.addHandles([g((()=>i.displaying),(e=>{for(const t of this._manipulatorInfos)t.manipulator.available=e})),g((()=>({labels:this._segmentLabels,enabled:this._labelOptions.enabled,edgeOffsetEnabled:this.enableEdgeOffset})),(({labels:e,enabled:t,edgeOffsetEnabled:i})=>{l(e)&&(e.visible=t,e.edgeDistance=i?"far":"default")}),f),_((()=>!this._tooltipOptions.enabled),(()=>this._tooltip.clear()),f),this.view.trackGraphicState(i)])}destroy(){this._segmentLabels=s(this._segmentLabels),this._tooltip=s(this._tooltip),this._removeManipulators()}get inputGeometry(){return l(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=s(this._moveManipulation),this._graphicMoveManipulation=s(this._graphicMoveManipulation),this.manipulators.removeAll(),this._manipulatorInfos=[],this._numGrabbing=0,this._numDragging=0}_createManipulators(){if(p(this._editGeometryOperations))return;const e=L(this.graphic);for(const t of this._editGeometryOperations.data.components){for(const i of t.vertices)this._createVertexOrEdgeManipulator(i,e);for(const i of t.edges)this._createVertexOrEdgeManipulator(i,e)}this._createGraphicMoveManipulation(),this._createMoveManipulation(e),this._createVisualElements()}get canRedo(){return l(this._editGeometryOperations)&&this._editGeometryOperations.canRedo}get canUndo(){return l(this._editGeometryOperations)&&this._editGeometryOperations.canUndo}redo(){if(p(this._editGeometryOperations))return null;const e=this._editGeometryOperations.redo();return l(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}undo(){if(p(this._editGeometryOperations))return null;this.emit("undo");const e=this._editGeometryOperations.undo();return l(e)&&(this.outputGeometry=this._editGeometryOperations.data.geometry,this._recreateManipulators()),e}_recreateManipulators(){this._removeManipulators(),this._tooltip.clear(),this._createManipulators()}_recreateEditGeometryAndManipulators(e=this.inputGeometry){this._removeManipulators(),this._tooltip.clear(),p(e)||(s(this._editGeometryOperations),this._editGeometryOperations=Me.fromGeometry(e,this.view.state.viewingMode),this._createManipulators(),s(this._segmentLabels),this._segmentLabels=new C({context:{view:this.view,editGeometryOperations:this._editGeometryOperations,elevationInfo:L(this.graphic),labelOptions:this._labelOptions,graphic:this.graphic,graphicState:this._graphicState},visible:this._labelOptions.enabled}))}_perGraphicManipulatorDragAction(e,t){if("end"===t.action)return t;let i=0;const a=[],o=this._manipulatorInfos.some((e=>"vertex"===e.type&&e.manipulator.selected)),n=e===Ze.SELECTED_OR_ALL&&o;for(const r of this._manipulatorInfos)"vertex"===r.type&&(r.manipulator.grabbing||n&&!r.manipulator.selected||a.push(r),i++);if(0===a.length)return t;this._moveVertices(a,t);if(a.length===i){if(this._updateEventState(Xe.MOVING),this.destroyed)return t;this.emit("move",{type:"move",dx:t.screenDeltaX,dy:t.screenDeltaY,mover:this.graphic})}else{if(this._updateEventState(Xe.RESHAPING),this.destroyed)return t;this.emit("reshape",{type:"reshape",mover:this.graphic})}return t}_isMultiVertexSelection(){let e=0;for(const t of this._manipulatorInfos)"vertex"===t.type&&t.manipulator.selected&&e++;return e>1}_perVertexManipulatorDragAction(e){if(this._updateEventState(Xe.RESHAPING),this.destroyed)return;const{mapDeltaX:t,mapDeltaY:i,mapDeltaZ:a}=e;if(!t&&!i&&!a)return;const o=[];for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected&&!n.manipulator.grabbing||n===e.info)&&o.push(n);this._moveVertices(o,e,ye.ACCUMULATE_STEPS),this.emit("reshape",{type:"reshape",mover:this.graphic})}_updateEventState(e){if(e===this._reshapeEventState)return!1;switch(e){case Xe.NONE:if(0!==this._numGrabbing||0!==this._numDragging)return!1;switch(this._reshapeEventState){case Xe.MOVING:this.emit("move",{type:"move-stop",dx:0,dy:0,mover:this.graphic});break;case Xe.RESHAPING:this.emit("reshape",{type:"reshape-stop",mover:this.graphic})}break;case Xe.MOVING:switch(this._reshapeEventState){case Xe.NONE:this.emit("move",{type:"move-start",dx:0,dy:0,mover:this.graphic});break;case Xe.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 Xe.RESHAPING:switch(this._reshapeEventState){case Xe.NONE:this.emit("reshape",{type:"reshape-start",mover:this.graphic});break;case Xe.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 ie({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=h(this._editGeometryOperations).createUndoGroup()),t))).next((e=>this._perGraphicManipulatorDragAction(Ze.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((t=>{"end"===t.action&&(this._tooltip.clear(),e=d(e))})),a.next((()=>this._onDragCancel(!0,(()=>e=d(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,handles:i,tool:a,view:o}=this,n=this._graphicState;this._moveManipulation=new $({tool:a,view:o,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZShape&&q(t),snapToScene:!1,radius:$.radiusForSymbol(t.symbol)}),this._moveManipulation.forEachManipulator((e=>i.add([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 r=e=>t=>{i.add(t.events.on("focus-changed",(({action:t})=>{"focus"===t&&this._tooltipOptions.enabled?this._updateTranslateTooltip(e):this._tooltip.clear()})))};this._moveManipulation.xyManipulation.forEachManipulator(r(Q.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(r(Q.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(r(Q.Z)),this._moveManipulation.elevationInfo={mode:"absolute-height",offset:0};const s=h(t.geometry).spatialReference;i.add([this._moveManipulation.createDragPipeline(((i,o,n,r,s)=>{const l=n.next((e=>this._trackNumDragging(e))).next((e=>{const t=this._manipulatorInfos.filter((e=>"vertex"===e.type&&e.manipulator.selected));return e.manipulatorType===Y.TRANSLATE_XY&&1===t.length?{...e,info:t[0],snapOrigin:t[0].handle.pos}:e})).next(ue(this.view,e)).next(this._snappingPipelineHandle.createSnapDragEventPipelineStep({predicate:e=>!!e.info,cancel:r,snappingManager:a.snappingManager,snappingContext:new xe({editGeometryOperations:h(this._editGeometryOperations),elevationInfo:e,pointer:s,excludeFeature:t,visualizer:new R}),updatingHandles:this.updatingHandles,useZ:!1}),this._snappingPipelineHandle.next).next(ce()).next((e=>this._perGraphicManipulatorDragAction(Ze.SELECTED_OR_ALL,e))).next((e=>(this._updateTranslateTooltip(i,e),e)));return r.next((()=>this._onDragCancel())),l}),e,s,t),g((()=>n.displaying),(()=>{this._updateMoveManipulationPosition()}),f),n.on("changed",(()=>this._updateMoveManipulationPosition())),g((()=>n.isDraped),(e=>{this._updateMoveManipulationPosition();const t="align-move-manipulation";e?i.add(this.view.elevationProvider.on("elevation-change",(()=>this._updateMoveManipulationPosition())),t):i.remove(t)}),f)])}_createVisualElements(){const{graphic:e,view:t}=this,i=B({view:t,graphic:e,forEachManipulator:e=>{if(!this.destroyed){this._graphicMoveManipulation.forEachManipulator(e),this._moveManipulation.forEachManipulator(e);for(const t of this._manipulatorInfos)e(t.manipulator,Y.TRANSLATE_XY)}},onManipulatorsChanged:e=>this.on("manipulators-changed",e)});l(i)&&(this._outlineVisualElement=i.visualElement instanceof se?i.visualElement:null),l(this._outlineVisualElement)&&this._manipulatorHandles.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>{this._graphicState.isDraped||this._updateMoveManipulationPosition()}))),this._manipulatorHandles.add(i)}_createEdgeOffsetManipulator(e,t=L(this.graphic)){const i=W.reshapeManipulators.edgeOffset,a=i.size/2,o=a+i.collisionPadding;if(p(this._edgeOffsetManipulatorGeometryInside)||p(this._edgeOffsetManipulatorGeometryOutside)){const e=a/o,t=e*Math.sqrt(3)/2;this._edgeOffsetManipulatorGeometryInside=pe(t,e/2,e/2,i.height,i.offset),this._edgeOffsetManipulatorGeometryOutside=pe(-t,e/2,e/2,i.height,-i.offset)}const r=[{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorMaterial,stateMask:fe.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryInside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:fe.Focused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorMaterial,stateMask:fe.Unfocused},{geometry:this._edgeOffsetManipulatorGeometryOutside,material:this._edgeOffsetManipulatorHoverMaterial,stateMask:fe.Focused}],s=new j({view:this.view,renderObjects:r,elevationInfo:"on-the-ground"!==t.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:t,worldOriented:!1,focusMultiplier:1,radius:o,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionType:{type:"disc",direction:I(0,0,1)},collisionPriority:1,metadata:{deleting:!1}}),h=new j({view:this.view,renderObjects:[],worldSized:!0,worldOriented:!1,available:!(!this.graphic.visible||!this.graphic.layer.visible),collisionPriority:-10,cursor:this.enableMoveGraphic?"move":"default",metadata:{deleting:!1}}),d={manipulator:s,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 n of[d.handle.leftVertex,d.handle.rightVertex]){const e=this._getManipulatorInfoFromHandle(n);l(e)&&u.push(e.manipulator.events.on("location-update",(()=>this._updateEdgeOffsetManipulator(d))))}d.locationUpdateHandle=n(u),this._manipulatorHandles.add(d.locationUpdateHandle,s),this._manipulatorHandles.add([this._watchAndUpdateGrabState(s,!0),this._watchAndUpdateGrabState(h,!0)],s),this._manipulatorHandles.add(me(s,this._createEdgeOffsetPipeline(d,t)),s),this._manipulatorHandles.add(me(h,((e,i,a,o)=>{if("touch"===o){this._createEdgeOffsetPipeline(d,t)(e,i,a)}else if(this.enableMoveGraphic){const o=this.graphic,n=l(o.geometry)?o.geometry.spatialReference:null;i.next((e=>this._trackNumDragging(e))).next(ge(this.view,e.elevationAlignedLocation)).next(X(this.view,e.elevationAlignedLocation,t,n,o)).next(_e()).next(ce()).next((e=>this._perGraphicManipulatorDragAction(Ze.ALL,e))).next((e=>(this._updateTranslateGraphicTooltip(Q.XY,e),e))).next((e=>{"end"===e.action&&this._tooltip.clear()})),a.next((()=>this._onDragCancel(!e.metadata.deleting)))}})),s);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([s.events.on("immediate-click",c),h.events.on("immediate-click",c),s.events.on("focus-changed",(({action:e})=>{const t=this._tooltipOptions;if("focus"===e&&t.enabled){const e=this._tooltip.info=new be({tooltipOptions:t});this._updateTooltipAreaOrTotalLength(e)}else this._tooltip.clear()}))],s),this._manipulatorInfos.push(d),this.manipulators.add(s),this.manipulators.add(h),this.emit("manipulators-changed"),d}_autoHideEdgeOffsetManipulator(e,t){const i=e.manipulator,a=e.edgeManipulator,o=()=>{e.visibilityHandle=d(e.visibilityHandle);const o=this._getManipulatorInfoFromHandle(e.handle.leftVertex),r=this._getManipulatorInfoFromHandle(e.handle.rightVertex),s=l(o)&&l(r)&&re(o.manipulator.renderLocation,r.manipulator.renderLocation,this.view.state.camera)<t;(!i.focused&&!a.focused||s)&&(i.grabbable=!s,a.grabbable=!s,e.visibilityHandle=n([i.disableDisplay(),{remove:()=>{i.grabbable=!0,a.grabbable=this.enableMoveGraphic}}]))};this._manipulatorHandles.add([i.events.on("focus-changed",o),a.events.on("focus-changed",o),{remove:()=>{d(e.visibilityHandle),a.metadata.deleting=!0,this.manipulators.remove(a)}}],i),o()}_updateEdgeOffsetManipulator(e){this._updateManipulatorPosition(e);const{coordinateHelper:t}=h(this._editGeometryOperations).data,i=ae(this.view,e.manipulator.elevationAlignedLocation,oe(t,e.handle,h(e.manipulator.elevationInfo))),a=this._getManipulatorInfoFromHandle(e.handle.leftVertex),o=this._getManipulatorInfoFromHandle(e.handle.rightVertex);if(p(a)||p(o))return;const n=a.manipulator.renderLocation,r=o.manipulator.renderLocation,s=l(i)?ne(i,n,r):x;e.manipulator.modelTransform=s,e.edgeManipulator.elevationAlignedLocation=e.manipulator.elevationAlignedLocation,e.edgeManipulator.modelTransform=s;const d=O(b(Re,n,r))/2;e.edgeManipulator.collisionType={type:"line",paths:[[[-d,0,0],[d,0,0]]]}}_createEdgeOffsetPipeline(e,t){return(i,a,o)=>{this._clearSelection();const{step:n,cleanup:r}=this._initializeEdgeOffset(e,t);a.next((e=>this._trackNumDragging(e))).next(ge(this.view,i.elevationAlignedLocation)).next(n).next(F(this.view)).next(z(this.view,h(this._editGeometryOperations).data.spatialReference)).next(ce()).next(this._applyComputeEdgeOffsetDistanceStep()).next(this._applyEdgeOffsetStep(e)).next(this._showEdgeOffsetTooltip()).next((e=>{"end"===e.action&&r()})),o.next((()=>{i.metadata.deleting||(r(),this._onDragCancel())}))}}_initializeEdgeOffset(e,t){const i=h(this._editGeometryOperations),a=oe(i.data.coordinateHelper,e.handle,t),o=i.createUndoGroup(),s=ae(this.view,e.manipulator.elevationAlignedLocation,a);if(a.requiresSplitEdgeLeft){const t=this._getManipulatorInfoFromHandle(e.handle.leftVertex.leftEdge);l(t)&&this._splitEdgeManipulator(t,1)}if(a.requiresSplitEdgeRight){const t=this._getManipulatorInfoFromHandle(e.handle.rightVertex.rightEdge);l(t)&&this._splitEdgeManipulator(t,0)}const u=()=>new w({paths:[[e.handle.leftVertex.pos,e.handle.rightVertex.pos]],spatialReference:i.data.spatialReference}),c=new se({view:this.view,isDraped:this._graphicState.isDraped,geometry:u(),elevationInfo:e.elevationInfo,width:W.visualElements.lineGraphics.outline.width,color:W.colorToVec4(K.main),attached:!0});let m;const _=()=>{this._cleanEdgeOffsetCollapsedEdges(e),m=d(m)},f=this.on("undo",_);return m=n([r(c),g((()=>this._graphicState.isDraped),(e=>c.isDraped=e)),this._graphicState.on("changed",(()=>c.geometry=u())),o,f]),{step:e=>p(a)||p(s)?(_(),null):{...e,operation:a,plane:s},cleanup:_}}_applyEdgeOffsetStep(e){return t=>{if(this.destroyed||p(t.operation))return t;this._updateEventState(Xe.RESHAPING);const{mapDeltaX:i,mapDeltaY:a,mapDeltaZ:o}=t;return(i||a||o)&&(this._offsetEdge(e,t),this.emit("reshape",{type:"reshape",mover:this.graphic})),t}}_applyComputeEdgeOffsetDistanceStep(){return e=>{const{operation:t,mapEnd:i}=e;return p(t)||p(i)?e:("start"===e.action&&t.selectArrowFromStartPoint(i),{...e,signedDistance:t.signedDistanceToPoint(i)})}}_showEdgeOffsetTooltip(){return e=>{const{mapEnd:t,signedDistance:i,operation:a}=e,o=this._tooltip,n=this._tooltipOptions;if(!n.enabled||p(i))return o.clear(),e;let r=o.info;(p(r)||"reshape-edge-offset"!==r.type)&&(r=o.info=new be({tooltipOptions:n}));const{coordinateHelper:s}=h(this._editGeometryOperations).data;return r.distance="end"===e.action?u:Ne(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,o=e.handle.rightVertex,n=h(this._editGeometryOperations).data.coordinateHelper,r=[];if(t&&n.distance(t.pos,i.pos)<Fe){const e=this._getManipulatorInfoFromHandle(i);l(e)&&r.push(e)}if(n.distance(i.pos,o.pos)<Fe||a&&n.distance(a.pos,o.pos)<Fe){const e=this._getManipulatorInfoFromHandle(o);l(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=L(this.graphic)){if("edge"===e.type){if(this.enableEdgeOffset)return this._createEdgeOffsetManipulator(e,t);if(!this.enableMidpoints)return null}if(p(this._vertexManipulatorGeometry)||p(this._vertexManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(W.reshapeManipulators.vertex);this._vertexManipulatorGeometry=he(e,16,16),this._vertexManipulatorOutlineGeometry=he(t,16,16)}if(p(this._edgeManipulatorGeometry)||p(this._edgeManipulatorOutlineGeometry)){const{size:e,outlineSize:t}=this._computeVertexManipulatorSizeAndOutline(W.reshapeManipulators.edge);this._edgeManipulatorGeometry=he(e,16,16),this._edgeManipulatorOutlineGeometry=he(t,16,16)}const i=l(this.graphic.geometry)&&"point"===this.graphic.geometry.type?[]:[{geometry:this._vertexManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:ze.Vertex|fe.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorOutlineMaterial,stateMask:ze.Vertex|fe.Unfocused|fe.Unselected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:ze.Vertex|fe.Focused|fe.Unselected},{geometry:this._vertexManipulatorGeometry,material:this._selectedManipulatorMaterial,stateMask:fe.Selected},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorOutlineMaterial,stateMask:fe.Selected|fe.Unfocused},{geometry:this._vertexManipulatorOutlineGeometry,material:this._selectedManipulatorHoverOutlineMaterial,stateMask:fe.Selected|fe.Focused}];this.enableMidpoints&&i.push({geometry:this._edgeManipulatorGeometry,material:this._vertexManipulatorMaterial,stateMask:ze.Edge|fe.Focused|fe.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._vertexManipulatorHoverOutlineMaterial,stateMask:ze.Edge|fe.Focused|fe.Unselected},{geometry:this._edgeManipulatorGeometry,material:this._edgeManipulatorMaterial,stateMask:ze.Edge|fe.Unfocused|fe.Unselected},{geometry:this._edgeManipulatorOutlineGeometry,material:this._edgeManipulatorOutlineMaterial,stateMask:ze.Edge|fe.Unfocused|fe.Unselected});const a=new j({view:this.view,renderObjects:i,elevationInfo:t,focusMultiplier:1,touchMultiplier:1,available:!(!this.graphic.visible||!this.graphic.layer.visible),metadata:{deleting:!1}});this._setTypeSpecificManipulatorSettings(a,e,t);const o="edge"===e.type?{manipulator:a,handle:e,locationUpdateHandle:null,type:"edge",selectedIndex:0}:{manipulator:a,handle:e,type:"vertex",selectedIndex:0};if(this._manipulatorInfos.push(o),this.manipulators.add(a),this._updateManipulatorPosition(o),"edge"===o.type){const e=[];for(const t of[o.handle.leftVertex,o.handle.rightVertex]){const i=this._getManipulatorInfoFromHandle(t);l(i)&&e.push(i.manipulator.events.on("location-update",(()=>this._updateManipulatorPosition(o))))}o.locationUpdateHandle=n(e),this._manipulatorHandles.add(o.locationUpdateHandle,a)}this._manipulatorHandles.add(this._watchAndUpdateGrabState(a,!0),a);const r=me(a,((e,i,a,n)=>{let r=null;i.next((e=>this._trackNumDragging(e))).next((e=>{if("start"===e.action&&(r=h(this._editGeometryOperations).createUndoGroup()),"edge"===o.type){const t=this._splitEdgeManipulator(o);return{...e,info:t,snapOrigin:t.handle.pos}}return{...e,info:o,snapOrigin:o.handle.pos}})).next(ge(this.view,e.elevationAlignedLocation)).next(Z(this.view,this.graphic,e.elevationAlignedLocation,e.location.spatialReference,this.graphic)).next(ue(this.view,t)).next(this._snappingPipeline.createSnapDragEventPipelineStep({predicate:()=>!this._isMultiVertexSelection(),cancel:a,snappingManager:this.tool.snappingManager,snappingContext:new xe({editGeometryOperations:h(this._editGeometryOperations),elevationInfo:t,pointer:n,excludeFeature:this.graphic,visualizer:new R}),updatingHandles:this.updatingHandles,useZ:!1}),this._snappingPipeline.next).next(ce()).next((t=>{this._perVertexManipulatorDragAction(t),"end"===t.action&&(r=d(r)),this._updateTranslateVertexTooltip(e,Q.XY,t)})),a.next((()=>this._onDragCancel(!e.metadata.deleting,(()=>r=d(r)))))}));return this._manipulatorHandles.add([r,a.events.on("immediate-click",(e=>this._manipulatorClickCallback(e,o))),a.events.on("select-changed",(()=>{o.selectedIndex=++this._selectedIndex,this._updateMoveManipulationPosition()})),a.events.on("focus-changed",(({action:e})=>{"focus"===e&&"edge"!==o.type?this._updateTranslateVertexTooltip(a,Q.XY):this._tooltip.clear()}))],a),this.emit("manipulators-changed"),o}_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=l(this._editGeometryOperations)?this._editGeometryOperations.data.geometry:null),l(this.tool.snappingManager)&&this.tool.snappingManager.doneSnapping(),this._tooltip.clear(),this._reshapeEventState){case Xe.NONE:break;case Xe.MOVING:this.emit("move",{type:"move",dx:0,dy:0,mover:this.graphic});break;case Xe.RESHAPING:this.emit("reshape",{type:"reshape",mover:this.graphic})}t&&t(),this.destroyed||this._updateEventState(Xe.NONE)}_setTypeSpecificManipulatorSettings(e,t,i){switch(t.type){case"vertex":e.state=ze.Vertex,e.selectable=!0,e.cursor="move",e.collisionPriority=2,e.radius=W.reshapeManipulators.vertex.size/2+W.reshapeManipulators.vertex.collisionPadding,e.elevationInfo=i,e.interactive=l(this.graphic.geometry)&&"point"!==this.graphic.geometry.type;break;case"edge":e.state=ze.Edge,e.selectable=!1,e.cursor="copy",e.collisionPriority=-1,e.radius=W.reshapeManipulators.edge.size/2+W.reshapeManipulators.edge.collisionPadding,e.elevationInfo="on-the-ground"!==i.mode||P(this.graphic.symbol)?{mode:"absolute-height",offset:0}:i}}_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("start"===i)t&&this._updateSelection(e),this._numGrabbing++;else if(this._numGrabbing--,this._updateEventState(Xe.NONE),this.destroyed)return;this._moveManipulation.interactive=!this._numGrabbing,("touch"!==a||this.enableEdgeOffset)&&(this._manipulatorInfos.forEach((e=>{e.manipulator.interactive=e.manipulator.grabbing||!this._numGrabbing&&l(this.graphic.geometry)&&"point"!==this.graphic.geometry.type,"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){p(e)||(e.manipulator.metadata.deleting=!0,this.manipulators.remove(e.manipulator),this._manipulatorHandles.remove(e.manipulator),t(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(p(e))return;const t=h(this._editGeometryOperations);if("vertex"===e.type)e.manipulator.location=t.data.coordinateHelper.vectorToDehydratedPoint(e.handle.pos,Ce),e.manipulator.grabbing&&l(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(p(i)||p(a))return;const o=i.manipulator,n=a.manipulator;if(l(e.manipulator.elevationInfo)&&"on-the-ground"===e.manipulator.elevationInfo.mode){const i=o.location,a=n.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=D(s,l,p,t.data.spatialReference)}else E(Re,o.renderLocation,n.renderLocation,.5),e.manipulator.renderLocation=Re}}_splitEdgeManipulator(e,t=.5){const i=h(this._editGeometryOperations),a=h(i.splitEdge(e.handle,t).createdVertex);e.locationUpdateHandle.remove(),e.locationUpdateHandle=void 0;const o=L(this.graphic);let n;this.enableEdgeOffset?(this._removeManipulator(e),n=this._createVertexOrEdgeManipulator(a)):(n=e,n.handle=a,n.type="vertex",this._setTypeSpecificManipulatorSettings(e.manipulator,e.handle,o)),a.leftEdge&&this._createVertexOrEdgeManipulator(a.leftEdge),a.rightEdge&&this._createVertexOrEdgeManipulator(a.rightEdge),this.outputGeometry=i.data.geometry,this._updateManipulatorPosition(n),this.enableEdgeOffset||this._updateTranslateVertexTooltip(n.manipulator,Q.XY),this._updateSelection(e.manipulator);const r=this._updateEventState(Xe.RESHAPING),s=i.data.coordinateHelper.vectorToArray(n.handle.pos),l=i.data.components.indexOf(a.component);return this.emit("vertex-add",{type:"vertex-add",vertices:[{coordinates:s,componentIndex:l,vertexIndex:h(a.index)}],added:s}),r&&this._updateEventState(Xe.NONE),n}_updateMoveManipulationPosition(){const e=G(Re,0,0,0);let t=0,i=!1,a=null,o=null;for(const n of this._manipulatorInfos)"vertex"===n.type&&(n.manipulator.selected?(t++,S(e,e,n.manipulator.renderLocation),p(a)||n.selectedIndex>a.selectedIndex?(o=a,a=n):(p(o)||n.selectedIndex>o.selectedIndex)&&(o=n)):i=!0);if(0!==t){const e=this._graphicState.displaying;this._moveManipulation.xyManipulation.available=e,this._moveManipulation.xyAxisManipulation.available=e,this._moveManipulation.zManipulation.available=e&&this.enableZVertex&&q(this.graphic),this._moveManipulation.xyAxisManipulation.orthogonalAvailable=e&&1!==t}else{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&&q(this.graphic)}if(0!==t){let e=0;if(l(a)){const t=a.handle.pos,i=l(o)?o.handle.pos:a.handle.leftEdge&&a.handle.leftEdge.leftVertex?a.handle.leftEdge.leftVertex.pos:null,n=p(o)&&a.handle.rightEdge&&a.handle.rightEdge.rightVertex?a.handle.rightEdge.rightVertex.pos:null;i&&n?this._moveManipulation.xyAxisManipulation.available=!1:i?e=ke(i,t):n&&(e=ke(t,n))}this._moveManipulation.angle=e,this._moveManipulation.radius=J}else this._moveManipulation.angle=ee(h(this.graphic.geometry)),this._moveManipulation.radius=$.radiusForSymbol(this.graphic.symbol);0!==t&&i?(V(e,e,1/t),Ce.spatialReference=h(this._editGeometryOperations).data.spatialReference,Ce.hasZ=!0,this.view.renderCoordsHelper.fromRenderCoords(e,Ce),this._moveManipulation.elevationAlignedLocation=Ce):l(this._outlineVisualElement)&&!this._graphicState.isDraped&&l(this._outlineVisualElement.attachmentOrigin)?this._moveManipulation.elevationAlignedLocation=this._outlineVisualElement.attachmentOrigin:N(this.view,this._moveManipulation,this.graphic)}_removeVertices(e){const t=[],i=h(this._editGeometryOperations);for(const a of e)if("vertex"===a.type&&i.canRemoveVertex()){t.push(a.handle),this._removeManipulator(a),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.leftEdge)),this._removeManipulator(this._getManipulatorInfoFromHandle(a.handle.rightEdge));const e=h(i.removeVertices([a.handle]).removedVertices[0].createdEdge);e&&this._createVertexOrEdgeManipulator(e)}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:h(e.index)}}));this.outputGeometry=i.data.geometry;const a=this._updateEventState(Xe.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(Xe.NONE),this.destroyed))return;this._updateMoveManipulationPosition()}}_moveVertices(e,t,i=("start"===t.action?ye.NEW_STEP:ye.ACCUMULATE_STEPS)){const a=h(this._editGeometryOperations);a.moveVertices(e.map((e=>e.handle)),t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i),this.outputGeometry=a.data.geometry;for(const o of e)this._updateManipulatorPosition(o)}_offsetEdge(e,t){if(p(t.operation)||p(t.signedDistance))return;const i=h(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===de.Right&&this._removeVertices([t])),"edge"===t.type&&e.button===de.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 Q.XY:this._tooltip.info=new Ve({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,t)=>Ae(e,t,a)));break;case Q.XY_AXIS:this._tooltip.info=new Se({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,((e,i)=>{const o=Ae(e,i,a);return c(o,te(t))}));break;case Q.Z:this._tooltip.info=new Ge({tooltipOptions:i}),this._updateTranslateTooltipDistance(this._tooltip.info,t,Le)}}_updateTranslateVertexTooltip(e,t,i){const a=this._tooltipOptions;if(!a.enabled)return;let o;const n=this._graphicState.isDraped?"on-the-ground":"absolute-height";switch(t){case Q.XY:o=new we({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>Ae(e,t,n))),this._updateTooltipAreaOrTotalLength(o);break;case Q.XY_AXIS:o=new Te({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,((e,t)=>{const a=Ae(e,t,n);return c(a,te(i))})),this._updateTooltipAreaOrTotalLength(o);break;case Q.Z:o=new Ie({tooltipOptions:a}),this._updateTranslateTooltipDistance(o,i,Le)}const r=Pe(e.elevationAlignedLocation);l(r)&&(o.elevation={mode:"absolute-height",...r}),this._tooltip.info=o}_updateTranslateTooltipDistance(e,t,i){if(l(t)&&"end"!==t.action){const{mapStart:a,mapEnd:o}=t,n=i(a,o);e.distance=l(n)?n:u}}_updateTooltipAreaOrTotalLength(e){const{geometry:t}=this.graphic;if(p(t))return;const i=this._graphicState.isDraped?"on-the-ground":"absolute-height";e.area="polygon"===t.type?He(t,i):null,e.totalLength="polyline"===t.type?De(t,i):null}get test(){return{segmentLabels:this._segmentLabels,tooltip:this._tooltip}}};function ke(e,t){return Math.atan2(t[1]-e[1],t[0]-e[0])+Math.PI/2}function Ne(e,t,i,a,o){if(e){const e=o.toXYZ(o.pointToVector(i)),n=H(a,e,A.get()),r=je(n,e,o.spatialReference);if(l(r))return m(r.value*Math.sign(t),r.unit)}return m(t*v(i.spatialReference),"meters")}e([M()],Ue.prototype,"_segmentLabels",void 0),e([M({constructOnly:!0})],Ue.prototype,"tool",void 0),e([M()],Ue.prototype,"_tooltip",void 0),e([M()],Ue.prototype,"inputGeometry",null),e([M()],Ue.prototype,"outputGeometry",void 0),e([M({readOnly:!0})],Ue.prototype,"updating",null),e([M()],Ue.prototype,"manipulators",null),e([M()],Ue.prototype,"view",null),e([M()],Ue.prototype,"graphic",null),e([M()],Ue.prototype,"enableZShape",null),e([M()],Ue.prototype,"enableZVertex",null),e([M()],Ue.prototype,"enableMoveGraphic",null),e([M()],Ue.prototype,"enableMidpoints",null),e([M()],Ue.prototype,"enableEdgeOffset",null),e([M()],Ue.prototype,"_labelOptions",null),e([M()],Ue.prototype,"_tooltipOptions",null),Ue=e([y("esri.views.3d.interactive.editingTools.reshapeGraphic.ReshapeOperation")],Ue);const Ce=D(0,0,null,null),Re=T(),Fe=1e-6;var ze,Xe,Ze;!function(e){e.Vertex=ve.Custom1,e.Edge=ve.Custom2}(ze||(ze={})),function(e){e[e.NONE=0]="NONE",e[e.MOVING=1]="MOVING",e[e.RESHAPING=2]="RESHAPING"}(Xe||(Xe={})),function(e){e[e.ALL=0]="ALL",e[e.SELECTED_OR_ALL=1]="SELECTED_OR_ALL"}(Ze||(Ze={}));export{Ue 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.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{rad2deg as s}from"../../../../../core/mathUtils.js";import{isSome as o,unwrapOr as r,isNone as n,unwrap as p}from"../../../../../core/maybe.js";import{createLength as l}from"../../../../../core/quantityUtils.js";import{watch as h,initial as c}from"../../../../../core/reactiveUtils.js";import{screenPointObjectToArray as d}from"../../../../../core/screenUtils.js";import{lengthUnitFromSpatialReference as u,getMetersPerUnitForSR as m}from"../../../../../core/unitUtils.js";import{property as _}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as g}from"../../../../../core/accessorSupport/decorators/subclass.js";import{o as v}from"../../../../../chunks/mat4.js";import{s as y,a as f,f as S}from"../../../../../chunks/vec2.js";import{a as M}from"../../../../../chunks/vec2f64.js";import{c as b,z as T,b as E,n as x,l as B,e as A}from"../../../../../chunks/vec3.js";import{c as O,a as R}from"../../../../../chunks/vec3f64.js";import{containsXY as j}from"../../../../../geometry/support/aaBoundingRect.js";import{a as G,c as D}from"../../../../../chunks/boundedPlane.js";import{intersectRay as w,create as z,normal as P}from"../../../../../geometry/support/plane.js";import{create as I}from"../../../../../geometry/support/ray.js";import{sv2d as U,sv3d as Z,sm4d as C}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as k}from"../../../../../support/elevationInfoUtils.js";import{createShiftManipulator as X,OffsetMode as Y,IsShiftEdgeOnScreenFlag as L,createResizeManipulator as N,resizeNormal as V,resizeOutlineOnly as H,isDiagonalResizeHandle as F,calculateDiagonalResizeHandleScale as q,createRotatePlane as W,RotationAxis as J,calculateBoundedPlaneTranslateRotate as K,updateRotateHeadingHandle as Q,updateResizeHandle as $}from"../../../analysis/Slice/sliceToolUtils.js";import{getRotateHeadingTexture as tt}from"../../../analysis/Slice/images/Factory.js";import{Manipulator3D as et}from"../../Manipulator3D.js";import{createRotateManipulator as it,getGraphicAttachmentOrigin as at,calculateInputRotationTransform as st}from"../../manipulatorUtils.js";import{screenToZConstrained as ot,screenToRenderPlane as rt}from"../dragEventPipeline3D.js";import{ManipulatorType as nt}from"../ManipulatorType.js";import{canMoveZ as pt}from"../manipulatorUtils.js";import{createVisualElements as lt}from"../visualElementUtils.js";import{ManipulationType as ht}from"../manipulations/MoveManipulation.js";import{MoveXYGraphicManipulation as ct}from"../manipulations/MoveXYGraphicManipulation.js";import{PreserveAspectRatio as dt}from"./PreserveAspectRatio.js";import{OutlineVisualElement as ut}from"../../visualElements/OutlineVisualElement.js";import{evaluateElevationAlignmentAtPoint as mt}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as _t}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as gt}from"../../../layers/graphics/GraphicState.js";import{fromScreen as vt}from"../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as yt,addMapDelta as ft,addScreenDelta as St}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as Mt}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as bt}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as Tt}from"../../../../interactive/editGeometry/interfaces.js";import{AccumulationType as Et}from"../../../../interactive/editGeometry/operations/UpdateVertices.js";import{mapPlaneAutoHorizontalSizeByElevationMode as xt,calculateOrientedBounds as Bt,mapPlaneToRenderPlane as At,apply as Ot,unapply as Rt}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";import jt from"../../../../interactive/sketch/SketchTooltipOptions.js";import{ExtentRotateTooltipInfo as Gt,ExtentScaleTooltipInfo as Dt}from"../../../../interactive/tooltip/ExtentTooltipInfos.js";import{Tooltip as wt}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicTooltipInfo as zt,TranslateGraphicZTooltipInfo as Pt}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as It}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistance as Ut}from"../../../../support/euclideanLengthMeasurementUtils.js";let Zt=class extends(e.EventedMixin(Mt)){constructor(t){super(t),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new jt,this._preserveAspectRatio=new dt,this.grabbing=!1,this.inputState=null,this.type="transform-3d",this._handles=new i,this._moveZManipulator=null,this._resizeManipulators=null,this._rotateManipulator=null,this._attachmentOrigin=null,this._outlineVisualElement=null,this._mapBounds=G(),this._mapBoundsStart=G(),this._zmax=0,this._sizeStart=null,this._displayBounds=G(),this._displayBoundsStart=G(),this._displayBoundsMarginStart=0,this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null,this._rotateTooltipInfo=null,this._scaleTooltipInfo=null,this._startAngle=0,this._endAngle=0,this._startScale=M(),this._endScale=M()}initialize(){const{view:t,graphic:e,manipulators:i,_handles:s}=this,r=this._graphicState=new gt({graphic:e}),n=e.geometry;this._editGeometryOperations=bt.fromGeometry(n,t.state.viewingMode),this._graphicMoveManipulation=new ct({tool:this,view:t,graphicState:r}),this._moveZManipulator=X(t,Y.CENTER_ON_CALLOUT),this._moveZManipulator.state|=L,s.add([this._createMoveXYGraphicDragPipeline(),h((()=>this.enableZ),(()=>this._updateManipulatorAvailability(this._moveZManipulator,nt.TRANSLATE_Z))),this._createMoveZDragPipeline()]),i.add(this._moveZManipulator),this._resizeManipulators=this._resizeHandles.map((e=>{const i=N(t,e);return s.add([h((()=>this.enableScaling),(()=>this._updateManipulatorAvailability(i,nt.SCALE))),i.events.on("grab-changed",(t=>this._onResizeGrab(t))),this._createResizeDragPipeline(i,e)]),i})),i.addMany(this._resizeManipulators),this._rotateManipulatorTexture=tt(t.toolViewManager.textures),this._rotateManipulator=it(t,this._rotateManipulatorTexture.texture).manipulator,s.add([h((()=>this.enableRotation),(()=>this._updateManipulatorAvailability(this._rotateManipulator,nt.ROTATE))),this._rotateManipulator.events.on("grab-changed",(t=>{this._onRotateGrab(t)})),this._createRotateDragPipeline(this._rotateManipulator)]),i.add(this._rotateManipulator),this._calculateMapBounds(),this._updateDisplayBounds();const p=lt({view:t,graphic:e,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()});o(p)&&(this._outlineVisualElement=p.visualElement instanceof ut?p.visualElement:null),o(this._outlineVisualElement)&&s.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>this._updateDisplayBounds()))),s.add(p),s.add([r.on("changed",(()=>this._onGeometryChanged())),h((()=>r.displaying),(()=>this._updateAllManipulatorAvailability())),h((()=>r.isDraped),(()=>this._graphicDrapedChanged()),c),t.trackGraphicState(r)]);const l=t.pointsOfInterest;l&&s.add(h((()=>l.centerOnSurfaceFrequent.location),(()=>this._updateDisplayBounds())));const d=t=>{s.add(t.events.on("grab-changed",(()=>{this.grabbing=t.grabbing,this._updateAllManipulatorAvailability()})))};this._forEachManipulator(d);const u=(t,i)=>{s.add(t.events.on("immediate-click",(t=>{i===nt.TRANSLATE_XY&&this.emit("immediate-click",{...t,graphic:e}),t.stopPropagation()})))};this._forEachManipulator(u),this._onGeometryChanged(),this._updateAllManipulatorAvailability(),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._mapBounds=null,this._displayBounds=null,this._rotateManipulatorTexture.release(),this._handles.destroy(),this._graphicMoveManipulation.destroy(),this._editGeometryOperations.destroy(),this._tooltip.destroy(),this._set("view",null),this._set("graphic",null)}_initializeTooltip(){const{_handles:t,view:e}=this,i=this._tooltip=new wt({view:e}),a=()=>{i.info=this._getUpdatedTooltipInfo()};t.add([this.on("graphic-translate-start",a),this.on("graphic-translate",a),this.on("graphic-translate-stop",(()=>{this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null,this._tooltip.clear()})),this.on("graphic-rotate-start",(t=>{this._startAngle=t.angle,a()})),this.on("graphic-rotate",(t=>{this._endAngle=t.angle,a()})),this.on("graphic-rotate-stop",(()=>{this._startAngle=0,this._endAngle=0,a()})),this.on("graphic-scale-start",(t=>{y(this._startScale,t.xScale,t.yScale),y(this._endScale,t.xScale,t.yScale),a()})),this.on("graphic-scale",(t=>{y(this._endScale,t.xScale,t.yScale),a()})),this.on("graphic-scale-stop",(()=>{y(this._startScale,0,0),y(this._endScale,0,0),a()}))]),this._forEachManipulator((e=>{t.add([e.events.on("focus-changed",a),e.events.on("grab-changed",a),e.events.on("drag",(t=>{"cancel"===t.action?this._tooltip.clear():a()}))])}))}_getUpdatedTooltipInfo(){return this.tooltipOptions.enabled?this._graphicMoveManipulation.grabbing||this._graphicMoveManipulation.dragging?this._computeMoveXYTooltipInfo():this._moveZManipulator.focused?this._computeMoveZTooltipInfo():this._rotateManipulator.focused?this._computeRotateTooltipInfo():this._resizeManipulators.some((t=>t.focused))?this._computeScaleTooltipInfo():null:null}_computeMoveXYTooltipInfo(){return this._moveXYTooltipInfo=r(this._moveXYTooltipInfo,(()=>new zt({tooltipOptions:this.tooltipOptions})))}_computeMoveZTooltipInfo(){const t=this._moveZTooltipInfo=r(this._moveZTooltipInfo,(()=>new Pt({tooltipOptions:this.tooltipOptions}))),e=this._moveUnit;if(this._moveZManipulator.dragging){const e=this._mapBoundsStart.origin,i=this._mapBounds.origin,a=Ut(e,i,this.view.spatialReference);if(n(a))return null;t.distance=a}else t.distance=l(0,e);return t}_computeRotateTooltipInfo(){const t=this._rotateTooltipInfo=r(this._rotateTooltipInfo,(()=>new Gt({tooltipOptions:this.tooltipOptions})));return t.angle=this._startAngle-this._endAngle,t}_computeScaleTooltipInfo(){const t=this.graphic.geometry;if(n(t))return null;const e=this._scaleTooltipInfo=r(this._scaleTooltipInfo,(()=>new Dt({tooltipOptions:this.tooltipOptions}))),i=xt(this._mapBounds,this._zmax,t.spatialReference,this._graphicState.isDraped);return n(i)?null:(e.xSize=i[0],e.ySize=i[1],o(this._sizeStart)&&this._resizeManipulators.some((t=>t.dragging))?(e.xScale=i[0].value/this._sizeStart[0].value,e.yScale=i[1].value/this._sizeStart[1].value):(e.xScale=1,e.yScale=1),e)}_graphicDrapedChanged(){this._handles.remove(Ct),this._updateDisplayBounds(),this._graphicState.isDraped&&this._handles.add(this.view.elevationProvider.on("elevation-change",(t=>{o(this._attachmentOrigin)&&j(t.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._updateDisplayBounds()})),Ct)}_updateAllManipulatorAvailability(){this._forEachManipulator(((t,e)=>this._updateManipulatorAvailability(t,e)))}_updateManipulatorAvailability(t,e){const i=this.grabbing&&!t.grabbing;if(t.interactive=!i,t instanceof et){const a=this._graphicState.displaying,s=this.enableZ&&pt(this.graphic);switch(e){case nt.ROTATE:t.available=a&&this.enableRotation;break;case nt.SCALE:t.available=a&&(this.enableScaling||this.enableRotation||s),t.interactive=!i&&this.enableScaling,t.state=this.enableScaling?V:H;break;case nt.TRANSLATE_Z:t.available=a&&s;break;default:t.available=a}}}_forEachManipulator(t){this._graphicMoveManipulation.forEachManipulator(t),this._resizeManipulators.forEach((e=>t(e,nt.SCALE))),t(this._rotateManipulator,nt.ROTATE),t(this._moveZManipulator,nt.TRANSLATE_Z)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(t){this._preserveAspectRatio.enabled=t,this._set("preserveAspectRatio",t)}get _moveUnit(){return r(u(this.view.spatialReference),"meters")}reset(){}_onGeometryChanged(){this._updateDisplayBounds()}_calculateMapBounds(){const t=this.graphic.geometry,e=this._editGeometryOperations.data,i=e.components[0].edges[0],a=f(U.get(),i.leftVertex.pos,i.rightVertex.pos);S(a,a);const s=r(at(this.view,this.graphic),(()=>t.extent.center));let o=Xt*this.view.pixelSizeAt(s);const n=this.view.spatialReference,p=t.spatialReference;n.equals(p)||(o*=m(n)/m(p)),Bt(a,e,o,this._mapBounds),this._updateZMax()}_updateZMax(){const t=this._editGeometryOperations.data;if(!t.geometry.hasZ)return void(this._zmax=0);const e=t.coordinateHelper;let i=Number.NEGATIVE_INFINITY;for(const a of t.components)for(const t of a.vertices){const a=e.getZ(t.pos);i=Math.max(a,i)}this._zmax=i}_updateDisplayBounds(){const t=this.graphic.geometry;if(n(t))return;const e=o(this._outlineVisualElement)&&!this._graphicState.isDraped&&o(this._outlineVisualElement.attachmentOrigin)?this._outlineVisualElement.attachmentOrigin:at(this.view,this.graphic);this._attachmentOrigin=r(e,t.extent.center);const i=o(e)?e.z:mt(this._mapBounds.origin,this.view.elevationProvider,_t.fromElevationInfo(k(this.graphic)),this.view.renderCoordsHelper),a=D(this._mapBounds);a.origin[2]=i,At(a,this.view.renderCoordsHelper,t.spatialReference,this._displayBoundsMargin,this._displayBounds),this._updateManipulators()}get _displayBoundsMargin(){const t=this.view.pointsOfInterest,e=t?t.centerOnSurfaceFrequent.location:this._editGeometryOperations.data.geometry.extent.center;return kt*this.view.pixelSizeAt(e)}_createMoveXYGraphicDragPipeline(){return this._graphicMoveManipulation.createDragPipeline(((t,e,i)=>this._applyGraphicMoveSteps(e,i,ht.XY)))}_createMoveZDragPipeline(){const t=this.view,e=this._editGeometryOperations.data.spatialReference;return yt(this._moveZManipulator,((i,a,s)=>{const o=R(i.renderLocation),r=a.next(ot(t,o,e)).next(St());this._applyGraphicMoveSteps(r,s,ht.Z)}))}_applyGraphicMoveSteps(t,e,i){const a=t.next((t=>("start"===t.action&&(this.inputState={type:"move"},this._updateOperationStartProperties(),this.emit("graphic-translate-start",{graphic:this.graphic,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY})),t))).next(ft()).next(this._moveDragUpdateGeometry()).next((t=>{const e={graphic:this.graphic,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY};switch(t.action){case"start":case"update":(t.mapEnd.x-t.mapStart.x||t.mapEnd.y-t.mapStart.y||t.mapEnd.z-t.mapStart.z)&&this.emit("graphic-translate",e);break;case"end":this.inputState=null,this.emit("graphic-translate-stop",e)}return t})).next((t=>this._updateMoveTooltip(t,i)));return e.next((()=>{o(this.inputState)&&this.emit("graphic-translate-stop",{graphic:this.graphic,dxScreen:0,dyScreen:0}),this._cancel()})),a}_updateOperationStartProperties(){D(this._displayBounds,this._displayBoundsStart),D(this._mapBounds,this._mapBoundsStart),n(this.graphic.geometry)?this._sizeStart=null:this._sizeStart=xt(this._mapBoundsStart,this._zmax,this.graphic.geometry.spatialReference,this._graphicState.isDraped)}_moveDragUpdateGeometry(){return t=>{if(n(this.inputState)||"move"!==this.inputState.type)return t;const e=[];for(const s of this._editGeometryOperations.data.components)e.push(...s.vertices);const i="start"===t.action?Tt.NEW_STEP:Tt.ACCUMULATE_STEPS,a=this._editGeometryOperations.moveVertices(e,t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);return Ot(a,this._mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry,t}}_updateMoveTooltip(t,e){if(e===ht.XY||e===ht.XY_AXIS){const e=It(t.mapStart,t.mapEnd,this._graphicState.isDraped?"on-the-ground":"absolute-height");o(e)&&o(this._moveXYTooltipInfo)&&(this._moveXYTooltipInfo.distance=e)}return t}_onResizeGrab(t){if("start"!==t.action)return;const e=this._calculatePickRay(t.screenPoint);w(this._displayBounds.plane,e,Z.get())&&(this._updateOperationStartProperties(),this._displayBoundsMarginStart=this._displayBoundsMargin,this.inputState={type:"resize"})}_createResizeDragPipeline(t,e){return yt(t,((t,i,a)=>{n(this.inputState)||(i.next((t=>("start"===t.action&&this.emit("graphic-scale-start",{graphic:this.graphic,xScale:1,yScale:1}),t))).next(rt(this.view,this._displayBoundsStart.plane)).next((t=>({...t,handle:e}))).next(this._resizeDragRenderPlaneToFactors()).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(this._resizeDragUpdateGeometry()).next((t=>{const e={graphic:this.graphic,xScale:t.factor1,yScale:t.factor2};switch(t.action){case"start":case"update":this.emit("graphic-scale",e);break;case"end":this.inputState=null,this.emit("graphic-scale-stop",e)}return t})),a.next((()=>{o(this.inputState)&&this.emit("graphic-scale-stop",{graphic:this.graphic,xScale:1,yScale:1}),this._cancel()})))}))}_resizeDragRenderPlaneToFactors(){return t=>{const e=this._displayBoundsStart,i=t.handle.direction,a=this._displayBoundsMargin,s=this._displayBoundsMarginStart,o=b(Z.get(),e.origin);T(o,o,e.basis1,-i[0]),T(o,o,e.basis2,-i[1]);const r=E(Z.get(),t.renderEnd,o),n=E(Z.get(),t.renderStart,o),p=F(t.handle),l=q(e),h=q(this._displayBounds)/l,c=(t,e)=>{if(0===t)return 1;let i=B(e),o=.5*t*A(e,r)/i;const l=o<0?-1:1;if(p){o+=(i-.5*t*A(e,n)/i)*l*h}const c=i<1.5*s?1:Yt;return i=Math.max(i-s,Yt),l>0&&(o-=a),l*Math.max(l*(o/i),c)};return{...t,factor1:c(i[0],e.basis1),factor2:c(i[1],e.basis2)}}}_resizeDragUpdateGeometry(){return t=>{const e=b(O(),this._mapBoundsStart.origin);T(e,e,this._mapBoundsStart.basis1,-t.handle.direction[0]),T(e,e,this._mapBoundsStart.basis2,-t.handle.direction[1]);const i=y(M(),this._mapBoundsStart.basis1[0],this._mapBoundsStart.basis1[1]);S(i,i);const a=[];for(const r of this._editGeometryOperations.data.components)a.push(...r.vertices);const s="start"===t.action?Tt.NEW_STEP:Tt.ACCUMULATE_STEPS,o=this._editGeometryOperations.scaleVertices(a,e,i,t.factor1,t.factor2,s,Et.REPLACE);return D(this._mapBoundsStart,this._mapBounds),Ot(o,this._mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry,t}}_onRotateGrab(t){if("start"!==t.action)return;const e=W(this._displayBounds,this.view.renderCoordsHelper,J.HEADING,z()),i=this._calculatePickRay(t.screenPoint);w(e,i,Z.get())&&(this._updateOperationStartProperties(),this.inputState={type:"rotate",rotatePlane:e})}_createRotateDragPipeline(t){return yt(t,((t,e,i)=>{const a=this.inputState;n(a)||(e.next((t=>("start"===t.action&&this.emit("graphic-rotate-start",{graphic:this.graphic,angle:0}),t))).next(rt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdateGeometry()).next((t=>{const e={graphic:this.graphic,angle:s(t.rotateAngle)};switch(t.action){case"start":case"update":this.emit("graphic-rotate",e);break;case"end":this.inputState=null,this.emit("graphic-rotate-stop",e)}return t})),i.next((()=>{o(this.inputState)&&this.emit("graphic-rotate-stop",{graphic:this.graphic,angle:0}),this._cancel()})))}))}_rotateDragRenderPlaneToRotate(t){return e=>{const i=P(t.rotatePlane),a=st(e.renderStart,e.renderEnd,this._displayBounds.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdateGeometry(){return t=>{const e=b(O(),this._mapBoundsStart.origin),i=[];for(const o of this._editGeometryOperations.data.components)i.push(...o.vertices);const a="start"===t.action?Tt.NEW_STEP:Tt.ACCUMULATE_STEPS,s=this._editGeometryOperations.rotateVertices(i,e,t.rotateAngle,a,Et.REPLACE);return D(this._mapBoundsStart,this._mapBounds),Ot(s,this._mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry,t}}_calculatePickRay(t){const e=I(),i=d(t);return vt(this.view.state.camera,i,e),x(e.direction,e.direction),e}_updateManipulators(){if(!this.visible)return;const t=K(this._displayBounds,C.get());Q(this._rotateManipulator,t,this._displayBounds,this.view.renderCoordsHelper),this._updateZMoveHandle(this._moveZManipulator,t),this._resizeManipulators.forEach(((e,i)=>{$(e,this._resizeHandles[i],t,this._displayBounds)}))}_updateZMoveHandle(t,e){const i=this._displayBounds,a={basis:i.basis1,direction:-1,position:E(Z.get(),i.origin,i.basis1),edge:2},s=C.get();v(s,e,a.edge*Math.PI/2),s[12]=0,s[13]=0,s[14]=0,t.modelTransform=s,t.renderLocation=a.position}_cancel(){const t=this._editGeometryOperations.lastOperation;n(t)||(this._editGeometryOperations.undo(),this.graphic.geometry=this._editGeometryOperations.data.geometry,Rt(t,this._mapBounds),this._updateDisplayBounds(),this.inputState=null)}get canUndo(){return this._editGeometryOperations.canUndo}undo(){if(o(this.inputState))this.view.activeTool=null;else if(this.canUndo){const t=this._editGeometryOperations.undo();this.graphic.geometry=this._editGeometryOperations.data.geometry,Rt(p(t),this._mapBounds),this._updateDisplayBounds()}}get canRedo(){return this._editGeometryOperations.canRedo}redo(){if(this.canRedo){const t=this._editGeometryOperations.redo();this.graphic.geometry=this._editGeometryOperations.data.geometry,Ot(p(t),this._mapBounds),this._updateDisplayBounds()}}get test(){return{resizeManipulators:this._resizeManipulators,rotateManipulator:this._rotateManipulator,moveZManipulator:this._moveZManipulator,tooltip:this._tooltip}}};t([_({constructOnly:!0,nonNullable:!0})],Zt.prototype,"view",void 0),t([_({constructOnly:!0,nonNullable:!0})],Zt.prototype,"graphic",void 0),t([_({constructOnly:!0,nonNullable:!0})],Zt.prototype,"enableZ",void 0),t([_()],Zt.prototype,"enableRotation",void 0),t([_()],Zt.prototype,"enableScaling",void 0),t([_({constructOnly:!0,type:jt})],Zt.prototype,"tooltipOptions",void 0),t([_()],Zt.prototype,"preserveAspectRatio",null),t([_()],Zt.prototype,"grabbing",void 0),t([_()],Zt.prototype,"inputState",void 0),t([_({readOnly:!0})],Zt.prototype,"type",void 0),t([_()],Zt.prototype,"_moveUnit",null),Zt=t([g("esri.views.3d.interactive.editingTools.graphicTransform3D.ExtentTransformTool")],Zt);const Ct="draped-elevation-changes",kt=10,Xt=80,Yt=1e-6;export{Yt as EPSILON,Zt as ExtentTransformTool};
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import e from"../../../../../core/Evented.js";import i from"../../../../../core/Handles.js";import{makeHandle as a}from"../../../../../core/handleUtils.js";import{rad2deg as s}from"../../../../../core/mathUtils.js";import{isSome as o,unwrapOr as r,isNone as n,unwrap as p}from"../../../../../core/maybe.js";import{createLength as l}from"../../../../../core/quantityUtils.js";import{watch as h,initial as c}from"../../../../../core/reactiveUtils.js";import{screenPointObjectToArray as d}from"../../../../../core/screenUtils.js";import{lengthUnitFromSpatialReference as u,getMetersPerUnitForSR as m}from"../../../../../core/unitUtils.js";import{property as _}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/arrayUtils.js";import"../../../../../core/accessorSupport/ensureType.js";import{subclass as g}from"../../../../../core/accessorSupport/decorators/subclass.js";import{o as v}from"../../../../../chunks/mat4.js";import{s as y,a as f,f as S}from"../../../../../chunks/vec2.js";import{a as M}from"../../../../../chunks/vec2f64.js";import{c as b,z as T,b as x,n as E,l as B,e as A}from"../../../../../chunks/vec3.js";import{c as O,a as R}from"../../../../../chunks/vec3f64.js";import{containsXY as j}from"../../../../../geometry/support/aaBoundingRect.js";import{a as G,c as D}from"../../../../../chunks/boundedPlane.js";import{intersectRay as w,create as z,normal as P}from"../../../../../geometry/support/plane.js";import{create as I}from"../../../../../geometry/support/ray.js";import{sv2d as U,sv3d as Z,sm4d as C}from"../../../../../geometry/support/vectorStacks.js";import{getGraphicEffectiveElevationInfo as k}from"../../../../../support/elevationInfoUtils.js";import{createShiftManipulator as X,OffsetMode as Y,IsShiftEdgeOnScreenFlag as L,createResizeManipulator as N,resizeNormal as V,resizeOutlineOnly as H,isDiagonalResizeHandle as F,calculateDiagonalResizeHandleScale as q,createRotatePlane as W,RotationAxis as J,calculateBoundedPlaneTranslateRotate as K,updateRotateHeadingHandle as Q,updateResizeHandle as $}from"../../../analysis/Slice/sliceToolUtils.js";import{getRotateHeadingTexture as tt}from"../../../analysis/Slice/images/Factory.js";import{Manipulator3D as et}from"../../Manipulator3D.js";import{createRotateManipulator as it,getGraphicAttachmentOrigin as at,calculateInputRotationTransform as st}from"../../manipulatorUtils.js";import{screenToZConstrained as ot,screenToRenderPlane as rt}from"../dragEventPipeline3D.js";import{ManipulatorType as nt}from"../ManipulatorType.js";import{canMoveZ as pt}from"../manipulatorUtils.js";import{createVisualElements as lt}from"../visualElementUtils.js";import{ManipulationType as ht}from"../manipulations/MoveManipulation.js";import{MoveXYGraphicManipulation as ct}from"../manipulations/MoveXYGraphicManipulation.js";import{PreserveAspectRatio as dt}from"./PreserveAspectRatio.js";import{OutlineVisualElement as ut}from"../../visualElements/OutlineVisualElement.js";import{evaluateElevationAlignmentAtPoint as mt}from"../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as _t}from"../../../layers/graphics/ElevationContext.js";import{GraphicState as gt}from"../../../layers/graphics/GraphicState.js";import{fromScreen as vt}from"../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as yt,addMapDelta as ft,addScreenDelta as St}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as Mt}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as bt}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import{AccumulationBehaviour as Tt}from"../../../../interactive/editGeometry/interfaces.js";import{AccumulationType as xt}from"../../../../interactive/editGeometry/operations/UpdateVertices.js";import{mapPlaneAutoHorizontalSizeByElevationMode as Et,calculateOrientedBounds as Bt,mapPlaneToRenderPlane as At,apply as Ot,unapply as Rt}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";import jt from"../../../../interactive/sketch/SketchTooltipOptions.js";import{ExtentRotateTooltipInfo as Gt,ExtentScaleTooltipInfo as Dt}from"../../../../interactive/tooltip/ExtentTooltipInfos.js";import{Tooltip as wt}from"../../../../interactive/tooltip/Tooltip.js";import{TranslateGraphicTooltipInfo as zt,TranslateGraphicZTooltipInfo as Pt}from"../../../../interactive/tooltip/TranslateTooltipInfos.js";import{autoHorizontalDistanceByElevationModeBetweenPoints as It}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistance as Ut}from"../../../../support/euclideanLengthMeasurementUtils.js";let Zt=class extends(e.EventedMixin(Mt)){constructor(t){super(t),this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.tooltipOptions=new jt,this._preserveAspectRatio=new dt,this.grabbing=!1,this.inputState=null,this.type="transform-3d",this._handles=new i,this._moveZManipulator=null,this._resizeManipulators=null,this._rotateManipulator=null,this._attachmentOrigin=null,this._outlineVisualElement=null,this._mapBounds=G(),this._mapBoundsStart=G(),this._zmax=0,this._sizeStart=null,this._displayBounds=G(),this._displayBoundsStart=G(),this._displayBoundsMarginStart=0,this._resizeHandles=[{direction:[1,0]},{direction:[1,1]},{direction:[0,1]},{direction:[-1,1]},{direction:[-1,0]},{direction:[-1,-1]},{direction:[0,-1]},{direction:[1,-1]}],this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null,this._rotateTooltipInfo=null,this._scaleTooltipInfo=null,this._startAngle=0,this._endAngle=0,this._startScale=M(),this._endScale=M()}initialize(){const{view:t,graphic:e,manipulators:i,_handles:s}=this,r=this._graphicState=new gt({graphic:e}),n=e.geometry;this._editGeometryOperations=bt.fromGeometry(n,t.state.viewingMode),this._graphicMoveManipulation=new ct({tool:this,view:t,graphicState:r}),this._moveZManipulator=X(t,Y.CENTER_ON_CALLOUT),this._moveZManipulator.state|=L,s.add([this._createMoveXYGraphicDragPipeline(),h((()=>this.enableZ),(()=>this._updateManipulatorAvailability(this._moveZManipulator,nt.TRANSLATE_Z))),this._createMoveZDragPipeline()]),i.add(this._moveZManipulator),this._resizeManipulators=this._resizeHandles.map((e=>{const i=N(t,e);return s.add([h((()=>this.enableScaling),(()=>this._updateManipulatorAvailability(i,nt.SCALE))),i.events.on("grab-changed",(t=>this._onResizeGrab(t))),this._createResizeDragPipeline(i,e)]),i})),i.addMany(this._resizeManipulators),this._rotateManipulatorTexture=tt(t.toolViewManager.textures),this._rotateManipulator=it(t,{texture:this._rotateManipulatorTexture.texture}),s.add([h((()=>this.enableRotation),(()=>this._updateManipulatorAvailability(this._rotateManipulator,nt.ROTATE))),this._rotateManipulator.events.on("grab-changed",(t=>{this._onRotateGrab(t)})),this._createRotateDragPipeline(this._rotateManipulator)]),i.add(this._rotateManipulator),this._calculateMapBounds(),this._updateDisplayBounds();const p=lt({view:t,graphic:e,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>a()});o(p)&&(this._outlineVisualElement=p.visualElement instanceof ut?p.visualElement:null),o(this._outlineVisualElement)&&s.add(this._outlineVisualElement.events.on("attachment-origin-changed",(()=>this._updateDisplayBounds()))),s.add(p),s.add([r.on("changed",(()=>this._onGeometryChanged())),h((()=>r.displaying),(()=>this._updateAllManipulatorAvailability())),h((()=>r.isDraped),(()=>this._graphicDrapedChanged()),c),t.trackGraphicState(r)]);const l=t.pointsOfInterest;l&&s.add(h((()=>l.centerOnSurfaceFrequent.location),(()=>this._updateDisplayBounds())));const d=t=>{s.add(t.events.on("grab-changed",(()=>{this.grabbing=t.grabbing,this._updateAllManipulatorAvailability()})))};this._forEachManipulator(d);const u=(t,i)=>{s.add(t.events.on("immediate-click",(t=>{i===nt.TRANSLATE_XY&&this.emit("immediate-click",{...t,graphic:e}),t.stopPropagation()})))};this._forEachManipulator(u),this._onGeometryChanged(),this._updateAllManipulatorAvailability(),this._initializeTooltip(),this.finishToolCreation()}destroy(){this._mapBounds=null,this._displayBounds=null,this._rotateManipulatorTexture.release(),this._handles.destroy(),this._graphicMoveManipulation.destroy(),this._editGeometryOperations.destroy(),this._tooltip.destroy(),this._set("view",null),this._set("graphic",null)}_initializeTooltip(){const{_handles:t,view:e}=this,i=this._tooltip=new wt({view:e}),a=()=>{i.info=this._getUpdatedTooltipInfo()};t.add([this.on("graphic-translate-start",a),this.on("graphic-translate",a),this.on("graphic-translate-stop",(()=>{this._moveXYTooltipInfo=null,this._moveZTooltipInfo=null,this._tooltip.clear()})),this.on("graphic-rotate-start",(t=>{this._startAngle=t.angle,a()})),this.on("graphic-rotate",(t=>{this._endAngle=t.angle,a()})),this.on("graphic-rotate-stop",(()=>{this._startAngle=0,this._endAngle=0,a()})),this.on("graphic-scale-start",(t=>{y(this._startScale,t.xScale,t.yScale),y(this._endScale,t.xScale,t.yScale),a()})),this.on("graphic-scale",(t=>{y(this._endScale,t.xScale,t.yScale),a()})),this.on("graphic-scale-stop",(()=>{y(this._startScale,0,0),y(this._endScale,0,0),a()}))]),this._forEachManipulator((e=>{t.add([e.events.on("focus-changed",a),e.events.on("grab-changed",a),e.events.on("drag",(t=>{"cancel"===t.action?this._tooltip.clear():a()}))])}))}_getUpdatedTooltipInfo(){return this.tooltipOptions.enabled?this._graphicMoveManipulation.grabbing||this._graphicMoveManipulation.dragging?this._computeMoveXYTooltipInfo():this._moveZManipulator.focused?this._computeMoveZTooltipInfo():this._rotateManipulator.focused?this._computeRotateTooltipInfo():this._resizeManipulators.some((t=>t.focused))?this._computeScaleTooltipInfo():null:null}_computeMoveXYTooltipInfo(){return this._moveXYTooltipInfo=r(this._moveXYTooltipInfo,(()=>new zt({tooltipOptions:this.tooltipOptions})))}_computeMoveZTooltipInfo(){const t=this._moveZTooltipInfo=r(this._moveZTooltipInfo,(()=>new Pt({tooltipOptions:this.tooltipOptions}))),e=this._moveUnit;if(this._moveZManipulator.dragging){const e=this._mapBoundsStart.origin,i=this._mapBounds.origin,a=Ut(e,i,this.view.spatialReference);if(n(a))return null;t.distance=a}else t.distance=l(0,e);return t}_computeRotateTooltipInfo(){const t=this._rotateTooltipInfo=r(this._rotateTooltipInfo,(()=>new Gt({tooltipOptions:this.tooltipOptions})));return t.angle=this._startAngle-this._endAngle,t}_computeScaleTooltipInfo(){const t=this.graphic.geometry;if(n(t))return null;const e=this._scaleTooltipInfo=r(this._scaleTooltipInfo,(()=>new Dt({tooltipOptions:this.tooltipOptions}))),i=Et(this._mapBounds,this._zmax,t.spatialReference,this._graphicState.isDraped);return n(i)?null:(e.xSize=i[0],e.ySize=i[1],o(this._sizeStart)&&this._resizeManipulators.some((t=>t.dragging))?(e.xScale=i[0].value/this._sizeStart[0].value,e.yScale=i[1].value/this._sizeStart[1].value):(e.xScale=1,e.yScale=1),e)}_graphicDrapedChanged(){this._handles.remove(Ct),this._updateDisplayBounds(),this._graphicState.isDraped&&this._handles.add(this.view.elevationProvider.on("elevation-change",(t=>{o(this._attachmentOrigin)&&j(t.extent,this._attachmentOrigin.x,this._attachmentOrigin.y)&&this._updateDisplayBounds()})),Ct)}_updateAllManipulatorAvailability(){this._forEachManipulator(((t,e)=>this._updateManipulatorAvailability(t,e)))}_updateManipulatorAvailability(t,e){const i=this.grabbing&&!t.grabbing;if(t.interactive=!i,t instanceof et){const a=this._graphicState.displaying,s=this.enableZ&&pt(this.graphic);switch(e){case nt.ROTATE:t.available=a&&this.enableRotation;break;case nt.SCALE:t.available=a&&(this.enableScaling||this.enableRotation||s),t.interactive=!i&&this.enableScaling,t.state=this.enableScaling?V:H;break;case nt.TRANSLATE_Z:t.available=a&&s;break;default:t.available=a}}}_forEachManipulator(t){this._graphicMoveManipulation.forEachManipulator(t),this._resizeManipulators.forEach((e=>t(e,nt.SCALE))),t(this._rotateManipulator,nt.ROTATE),t(this._moveZManipulator,nt.TRANSLATE_Z)}get preserveAspectRatio(){return this._preserveAspectRatio.enabled}set preserveAspectRatio(t){this._preserveAspectRatio.enabled=t,this._set("preserveAspectRatio",t)}get _moveUnit(){return r(u(this.view.spatialReference),"meters")}reset(){}_onGeometryChanged(){this._updateDisplayBounds()}_calculateMapBounds(){const t=this.graphic.geometry,e=this._editGeometryOperations.data,i=e.components[0].edges[0],a=f(U.get(),i.leftVertex.pos,i.rightVertex.pos);S(a,a);const s=r(at(this.view,this.graphic),(()=>t.extent.center));let o=Xt*this.view.pixelSizeAt(s);const n=this.view.spatialReference,p=t.spatialReference;n.equals(p)||(o*=m(n)/m(p)),Bt(a,e,o,this._mapBounds),this._updateZMax()}_updateZMax(){const t=this._editGeometryOperations.data;if(!t.geometry.hasZ)return void(this._zmax=0);const e=t.coordinateHelper;let i=Number.NEGATIVE_INFINITY;for(const a of t.components)for(const t of a.vertices){const a=e.getZ(t.pos);i=Math.max(a,i)}this._zmax=i}_updateDisplayBounds(){const t=this.graphic.geometry;if(n(t))return;const e=o(this._outlineVisualElement)&&!this._graphicState.isDraped&&o(this._outlineVisualElement.attachmentOrigin)?this._outlineVisualElement.attachmentOrigin:at(this.view,this.graphic);this._attachmentOrigin=r(e,t.extent.center);const i=o(e)?e.z:mt(this._mapBounds.origin,this.view.elevationProvider,_t.fromElevationInfo(k(this.graphic)),this.view.renderCoordsHelper),a=D(this._mapBounds);a.origin[2]=i,At(a,this.view.renderCoordsHelper,t.spatialReference,this._displayBoundsMargin,this._displayBounds),this._updateManipulators()}get _displayBoundsMargin(){const t=this.view.pointsOfInterest,e=t?t.centerOnSurfaceFrequent.location:this._editGeometryOperations.data.geometry.extent.center;return kt*this.view.pixelSizeAt(e)}_createMoveXYGraphicDragPipeline(){return this._graphicMoveManipulation.createDragPipeline(((t,e,i)=>this._applyGraphicMoveSteps(e,i,ht.XY)))}_createMoveZDragPipeline(){const t=this.view,e=this._editGeometryOperations.data.spatialReference;return yt(this._moveZManipulator,((i,a,s)=>{const o=R(i.renderLocation),r=a.next(ot(t,o,e)).next(St());this._applyGraphicMoveSteps(r,s,ht.Z)}))}_applyGraphicMoveSteps(t,e,i){const a=t.next((t=>("start"===t.action&&(this.inputState={type:"move"},this._updateOperationStartProperties(),this.emit("graphic-translate-start",{graphic:this.graphic,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY})),t))).next(ft()).next(this._moveDragUpdateGeometry()).next((t=>{const e={graphic:this.graphic,dxScreen:t.screenDeltaX,dyScreen:t.screenDeltaY};switch(t.action){case"start":case"update":(t.mapEnd.x-t.mapStart.x||t.mapEnd.y-t.mapStart.y||t.mapEnd.z-t.mapStart.z)&&this.emit("graphic-translate",e);break;case"end":this.inputState=null,this.emit("graphic-translate-stop",e)}return t})).next((t=>this._updateMoveTooltip(t,i)));return e.next((()=>{o(this.inputState)&&this.emit("graphic-translate-stop",{graphic:this.graphic,dxScreen:0,dyScreen:0}),this._cancel()})),a}_updateOperationStartProperties(){D(this._displayBounds,this._displayBoundsStart),D(this._mapBounds,this._mapBoundsStart),n(this.graphic.geometry)?this._sizeStart=null:this._sizeStart=Et(this._mapBoundsStart,this._zmax,this.graphic.geometry.spatialReference,this._graphicState.isDraped)}_moveDragUpdateGeometry(){return t=>{if(n(this.inputState)||"move"!==this.inputState.type)return t;const e=[];for(const s of this._editGeometryOperations.data.components)e.push(...s.vertices);const i="start"===t.action?Tt.NEW_STEP:Tt.ACCUMULATE_STEPS,a=this._editGeometryOperations.moveVertices(e,t.mapDeltaX,t.mapDeltaY,t.mapDeltaZ,i);return Ot(a,this._mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry,t}}_updateMoveTooltip(t,e){if(e===ht.XY||e===ht.XY_AXIS){const e=It(t.mapStart,t.mapEnd,this._graphicState.isDraped?"on-the-ground":"absolute-height");o(e)&&o(this._moveXYTooltipInfo)&&(this._moveXYTooltipInfo.distance=e)}return t}_onResizeGrab(t){if("start"!==t.action)return;const e=this._calculatePickRay(t.screenPoint);w(this._displayBounds.plane,e,Z.get())&&(this._updateOperationStartProperties(),this._displayBoundsMarginStart=this._displayBoundsMargin,this.inputState={type:"resize"})}_createResizeDragPipeline(t,e){return yt(t,((t,i,a)=>{n(this.inputState)||(i.next((t=>("start"===t.action&&this.emit("graphic-scale-start",{graphic:this.graphic,xScale:1,yScale:1}),t))).next(rt(this.view,this._displayBoundsStart.plane)).next((t=>({...t,handle:e}))).next(this._resizeDragRenderPlaneToFactors()).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(this._resizeDragUpdateGeometry()).next((t=>{const e={graphic:this.graphic,xScale:t.factor1,yScale:t.factor2};switch(t.action){case"start":case"update":this.emit("graphic-scale",e);break;case"end":this.inputState=null,this.emit("graphic-scale-stop",e)}return t})),a.next((()=>{o(this.inputState)&&this.emit("graphic-scale-stop",{graphic:this.graphic,xScale:1,yScale:1}),this._cancel()})))}))}_resizeDragRenderPlaneToFactors(){return t=>{const e=this._displayBoundsStart,i=t.handle.direction,a=this._displayBoundsMargin,s=this._displayBoundsMarginStart,o=b(Z.get(),e.origin);T(o,o,e.basis1,-i[0]),T(o,o,e.basis2,-i[1]);const r=x(Z.get(),t.renderEnd,o),n=x(Z.get(),t.renderStart,o),p=F(t.handle),l=q(e),h=q(this._displayBounds)/l,c=(t,e)=>{if(0===t)return 1;let i=B(e),o=.5*t*A(e,r)/i;const l=o<0?-1:1;if(p){o+=(i-.5*t*A(e,n)/i)*l*h}const c=i<1.5*s?1:Yt;return i=Math.max(i-s,Yt),l>0&&(o-=a),l*Math.max(l*(o/i),c)};return{...t,factor1:c(i[0],e.basis1),factor2:c(i[1],e.basis2)}}}_resizeDragUpdateGeometry(){return t=>{const e=b(O(),this._mapBoundsStart.origin);T(e,e,this._mapBoundsStart.basis1,-t.handle.direction[0]),T(e,e,this._mapBoundsStart.basis2,-t.handle.direction[1]);const i=y(M(),this._mapBoundsStart.basis1[0],this._mapBoundsStart.basis1[1]);S(i,i);const a=[];for(const r of this._editGeometryOperations.data.components)a.push(...r.vertices);const s="start"===t.action?Tt.NEW_STEP:Tt.ACCUMULATE_STEPS,o=this._editGeometryOperations.scaleVertices(a,e,i,t.factor1,t.factor2,s,xt.REPLACE);return D(this._mapBoundsStart,this._mapBounds),Ot(o,this._mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry,t}}_onRotateGrab(t){if("start"!==t.action)return;const e=W(this._displayBounds,this.view.renderCoordsHelper,J.HEADING,z()),i=this._calculatePickRay(t.screenPoint);w(e,i,Z.get())&&(this._updateOperationStartProperties(),this.inputState={type:"rotate",rotatePlane:e})}_createRotateDragPipeline(t){return yt(t,((t,e,i)=>{const a=this.inputState;n(a)||(e.next((t=>("start"===t.action&&this.emit("graphic-rotate-start",{graphic:this.graphic,angle:0}),t))).next(rt(this.view,a.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(a)).next(this._rotateDragUpdateGeometry()).next((t=>{const e={graphic:this.graphic,angle:s(t.rotateAngle)};switch(t.action){case"start":case"update":this.emit("graphic-rotate",e);break;case"end":this.inputState=null,this.emit("graphic-rotate-stop",e)}return t})),i.next((()=>{o(this.inputState)&&this.emit("graphic-rotate-stop",{graphic:this.graphic,angle:0}),this._cancel()})))}))}_rotateDragRenderPlaneToRotate(t){return e=>{const i=P(t.rotatePlane),a=st(e.renderStart,e.renderEnd,this._displayBounds.origin,i);return{...e,rotateAxis:i,rotateAngle:a}}}_rotateDragUpdateGeometry(){return t=>{const e=b(O(),this._mapBoundsStart.origin),i=[];for(const o of this._editGeometryOperations.data.components)i.push(...o.vertices);const a="start"===t.action?Tt.NEW_STEP:Tt.ACCUMULATE_STEPS,s=this._editGeometryOperations.rotateVertices(i,e,t.rotateAngle,a,xt.REPLACE);return D(this._mapBoundsStart,this._mapBounds),Ot(s,this._mapBounds),this.graphic.geometry=this._editGeometryOperations.data.geometry,t}}_calculatePickRay(t){const e=I(),i=d(t);return vt(this.view.state.camera,i,e),E(e.direction,e.direction),e}_updateManipulators(){if(!this.visible)return;const t=K(this._displayBounds,C.get());Q(this._rotateManipulator,t,this._displayBounds,this.view.renderCoordsHelper),this._updateZMoveHandle(this._moveZManipulator,t),this._resizeManipulators.forEach(((e,i)=>{$(e,this._resizeHandles[i],t,this._displayBounds)}))}_updateZMoveHandle(t,e){const i=this._displayBounds,a={basis:i.basis1,direction:-1,position:x(Z.get(),i.origin,i.basis1),edge:2},s=C.get();v(s,e,a.edge*Math.PI/2),s[12]=0,s[13]=0,s[14]=0,t.modelTransform=s,t.renderLocation=a.position}_cancel(){const t=this._editGeometryOperations.lastOperation;n(t)||(this._editGeometryOperations.undo(),this.graphic.geometry=this._editGeometryOperations.data.geometry,Rt(t,this._mapBounds),this._updateDisplayBounds(),this.inputState=null)}get canUndo(){return this._editGeometryOperations.canUndo}undo(){if(o(this.inputState))this.view.activeTool=null;else if(this.canUndo){const t=this._editGeometryOperations.undo();this.graphic.geometry=this._editGeometryOperations.data.geometry,Rt(p(t),this._mapBounds),this._updateDisplayBounds()}}get canRedo(){return this._editGeometryOperations.canRedo}redo(){if(this.canRedo){const t=this._editGeometryOperations.redo();this.graphic.geometry=this._editGeometryOperations.data.geometry,Ot(p(t),this._mapBounds),this._updateDisplayBounds()}}get test(){return{resizeManipulators:this._resizeManipulators,rotateManipulator:this._rotateManipulator,moveZManipulator:this._moveZManipulator,tooltip:this._tooltip}}};t([_({constructOnly:!0,nonNullable:!0})],Zt.prototype,"view",void 0),t([_({constructOnly:!0,nonNullable:!0})],Zt.prototype,"graphic",void 0),t([_({constructOnly:!0,nonNullable:!0})],Zt.prototype,"enableZ",void 0),t([_()],Zt.prototype,"enableRotation",void 0),t([_()],Zt.prototype,"enableScaling",void 0),t([_({constructOnly:!0,type:jt})],Zt.prototype,"tooltipOptions",void 0),t([_()],Zt.prototype,"preserveAspectRatio",null),t([_()],Zt.prototype,"grabbing",void 0),t([_()],Zt.prototype,"inputState",void 0),t([_({readOnly:!0})],Zt.prototype,"type",void 0),t([_()],Zt.prototype,"_moveUnit",null),Zt=t([g("esri.views.3d.interactive.editingTools.graphicTransform3D.ExtentTransformTool")],Zt);const Ct="draped-elevation-changes",kt=10,Xt=80,Yt=1e-6;export{Yt as EPSILON,Zt as ExtentTransformTool};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.25/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e,isNone as t}from"../../../core/maybe.js";import{a as r}from"../../../chunks/mat4.js";import{b as a,f as n,m as o,n as i}from"../../../chunks/vec3.js";import{f as c}from"../../../chunks/vec3f64.js";import{f as s}from"../../../chunks/vec4f64.js";import{sv3d as l,sm4d as m}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as u}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as d}from"./Manipulator3D.js";import{computeCentroid as p}from"../layers/graphics/graphicUtils.js";import{CullFaceOptions as f}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as g}from"../webgl-engine/lib/Geometry.js";import{
|
|
5
|
+
import{isSome as e,isNone as t}from"../../../core/maybe.js";import{a as r}from"../../../chunks/mat4.js";import{b as a,f as n,m as o,n as i}from"../../../chunks/vec3.js";import{f as c}from"../../../chunks/vec3f64.js";import{f as s}from"../../../chunks/vec4f64.js";import{sv3d as l,sm4d as m}from"../../../geometry/support/vectorStacks.js";import{hydrateGeometry as u}from"../../../layers/graphics/hydratedFeatures.js";import{Manipulator3D as d}from"./Manipulator3D.js";import{computeCentroid as p}from"../layers/graphics/graphicUtils.js";import{CullFaceOptions as f}from"../webgl-engine/lib/basicInterfaces.js";import{Geometry as g}from"../webgl-engine/lib/Geometry.js";import{createPolylineGeometry as h,createSphereGeometry as b}from"../webgl-engine/lib/GeometryUtil.js";import{RenderOccludedFlag as w}from"../webgl-engine/lib/Material.js";import{VertexAttribute as j}from"../webgl-engine/lib/VertexAttribute.js";import{ColorMaterial as O}from"../webgl-engine/materials/ColorMaterial.js";import{ImageMaterial as y}from"../webgl-engine/materials/ImageMaterial.js";import{NativeLineMaterial as M}from"../webgl-engine/materials/NativeLineMaterial.js";import{RibbonLineMaterial as k}from"../webgl-engine/materials/RibbonLineMaterial.js";import{ShadedColorMaterial as v}from"../webgl-engine/materials/ShadedColorMaterial.js";import{ManipulatorStateCustomFlags as S,ManipulatorStateFlags as F}from"../../interactive/interfaces.js";function A(e,t=w.OccludeAndTransparent,r=!0){const a=s(e[0],e[1],e[2],e.length>3?e[3]:1),n=e[3]<1;return r?new v({color:a,transparent:n,writeDepth:!0,cullFace:f.Back,renderOccluded:t}):new O({color:a,transparent:n,writeDepth:!0,cullFace:f.Back,renderOccluded:t})}function I(e,t=w.OccludeAndTransparent){const r=s(e[0],e[1],e[2],4===e.length?e[3]:1);return new O({color:r,transparent:!0,writeDepth:!0,cullFace:f.Front,renderOccluded:t})}const L=Object.freeze({calloutLength:40,calloutWidth:1,discRadius:27,focusMultiplier:1.1,calloutColor:c(1,.5,0)});function R(e,t){const r=new d({view:e,autoScaleRenderObjects:!1,collisionPriority:1,metadata:t.metadata});return T(r,t),r}function T(e,t){const r=t.material??new y({transparent:!0,writeDepth:!1,textureId:t.texture?.id,renderOccluded:w.Opaque}),a=t.focusMultiplier??L.focusMultiplier,n=t.calloutLength??L.calloutLength,o=L.discRadius*(t.discScale??1),i=o*a,c=e=>{const t=[0,1,2,2,3,0];return new g([[j.POSITION,{size:3,data:[n-e,-e,0,n+e,-e,0,n+e,e,0,n-e,e,0],exclusive:!0}],[j.UV0,{size:2,data:[0,0,1,0,1,1,0,1]}]],[[j.POSITION,t],[j.UV0,t]])},l=h([[0,0,0],[n-o,0,0]]),m=h([[0,0,0],[n-i,0,0]]),u=L.calloutColor,d=t.calloutWidth??L.calloutWidth,p=new(d>1?k:M)({width:d,color:s(u[0],u[1],u[2],t.calloutOpacity??1),renderOccluded:w.OccludeAndTransparent}),f=t.customStateMask??S.None;e.collisionType={type:"disc",direction:[0,0,1],offset:[n,0,0]},e.focusMultiplier=a,e.metadata=t.metadata,e.radius=o,e.renderObjects=[{geometry:c(o),material:r,stateMask:F.Unfocused|f},{geometry:l,material:p,stateMask:F.Unfocused|f},{geometry:c(i),material:r,stateMask:F.Focused|f},{geometry:m,material:p,stateMask:F.Focused|f}]}function U(e,t,r,a=S.None){return new d({view:e,renderObjects:[{geometry:b(1,32,32),material:A(s(t[0],t[1],t[2],null!=r?r:1)),stateMask:a}]})}const x=Object.freeze({autoScaleRenderObjects:!1,worldSized:!0});function z(e,t,i,c){const s=a(l.get(),e,i),u=D(s,n(l.get(),c,s),i,m.get());r(u,u);const d=o(l.get(),t,u);return Math.atan2(d[1],d[0])}function D(e,t,r,a){const o=i(l.get(),e),c=i(l.get(),t),s=n(l.get(),o,c);return a[0]=o[0],a[1]=o[1],a[2]=o[2],a[3]=0,a[4]=c[0],a[5]=c[1],a[6]=c[2],a[7]=0,a[8]=s[0],a[9]=s[1],a[10]=s[2],a[11]=0,a[12]=r[0],a[13]=r[1],a[14]=r[2],a[15]=1,a}function N(t,r){const a=t.getViewForGraphic(r);return e(a)&&"computeAttachmentOrigin"in a?a.computeAttachmentOrigin(r,t.spatialReference):null}function C(t,r,a){const n=N(t,a);e(n)?r.elevationAlignedLocation=n:V(r,a.geometry)}function V(e,r){if(t(r))return;const a="mesh"===r.type?r.anchor:p(r);t(a)||(e.location=u(a))}export{z as calculateInputRotationTransform,D as calculateTranslateRotateFromBases,A as createManipulatorMaterial,I as createManipulatorOutlineMaterial,R as createRotateManipulator,U as createSphereManipulator,N as getGraphicAttachmentOrigin,C as placeAtGraphic,T as updateRotateManipulator,x as worldScaledManipulatorSettings};
|