@arcgis/core 6.0.0-next.31 → 6.0.0-next.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{242a77066ac5cdb5b7d7.js → 14d81280807a3d3c1b7e.js} +1 -1
- package/assets/esri/core/workers/chunks/{f21edbfdcab111d8a6cd.js → 1a8d8274df292d65f82e.js} +1 -1
- package/assets/esri/core/workers/chunks/29cc6b1705418b1be5d7.js +1 -0
- package/assets/esri/core/workers/chunks/2de077c7b971f2c215a6.js +1 -0
- package/assets/esri/core/workers/chunks/{4741fac6b6b4202a97c5.js → 360c944c610efa2051fc.js} +3 -3
- package/assets/esri/core/workers/chunks/{ffaaa388773e60869df0.js → 46453ebfee17b5421d9d.js} +1 -1
- package/assets/esri/core/workers/chunks/{84940d8e14caf5a27e04.js → 487c46d5245cfb35c4bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{f7fb6cb7f08c16384443.js → 4d18b48d4a282a0f341c.js} +1 -1
- package/assets/esri/core/workers/chunks/52a0aa2d19a495e48ab1.js +1 -0
- package/assets/esri/core/workers/chunks/{8a485130781b49dbf608.js → 601e1d020b8115497944.js} +1 -1
- package/assets/esri/core/workers/chunks/{d09d8cd43e846d467827.js → 6bb191b19ce43a27f205.js} +1 -1
- package/assets/esri/core/workers/chunks/6f6d1873753a9c6994aa.js +1 -0
- package/assets/esri/core/workers/chunks/7084dd6e10c6c1393e92.js +1 -0
- package/assets/esri/core/workers/chunks/853563c66ecf58d53d36.js +1 -0
- package/config.js +1 -1
- package/geometry/support/GlobalCoordinateSystem.js +2 -0
- package/geometry/support/LocalCoordinateSystem.js +2 -0
- package/geometry/support/boundedPlane.js +1 -1
- package/geometry/support/coordinateSystem.js +1 -1
- package/geometry/support/ray.js +1 -1
- package/geometry/support/sphere.js +1 -1
- package/kernel.js +1 -1
- package/package.json +2 -2
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/3d/analysis/ShadowCastAnalysisView3D.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedFieldOfViewManipulation.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedScaleOrientManipulation.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/GraphicsDeconflictor.js +1 -1
- package/views/3d/state/ScreenSizePerspective.js +1 -1
- package/views/3d/support/RenderCoordsHelper.js +1 -1
- package/views/3d/support/ViewSlice.js +1 -1
- package/views/3d/support/hitTest.js +1 -1
- package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
- package/views/3d/webgl-engine/lib/intersectorUtils.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/widgets/ShadowCast/ShadowCastViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/00d1c99779bd91b1d10e.js +0 -1
- package/assets/esri/core/workers/chunks/8d13f11d0bcc8d3a4bdf.js +0 -1
- package/assets/esri/core/workers/chunks/90ba0af9690dc32b2958.js +0 -1
- package/assets/esri/core/workers/chunks/ceb2d5b0a23f0ab81f68.js +0 -1
- package/assets/esri/core/workers/chunks/e04fb83ab2634bc15cc7.js +0 -1
- package/assets/esri/core/workers/chunks/e30fdde253e5521473a2.js +0 -1
- package/chunks/boundedPlane.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import{acosClamped as e}from"../../core/mathUtils.js";import{getEpsilon as t}from"../../core/libs/gl-matrix-2/math/common.js";import{fromRotation as n}from"../../core/libs/gl-matrix-2/math/mat4.js";import{copy as r,equals as i,squaredDistance as a,subtract as o,scale as s,length as c,add as l,cross as u,transformMat4 as d,squaredLength as f,distance as p,lerp as m,scaleAndAdd as h}from"../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as g,fromArray as _,clone as v,create as y}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as b}from"../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isVec3 as x}from"../../core/libs/gl-matrix-2/types/vec3.js";import{isVec4 as S}from"../../core/libs/gl-matrix-2/types/vec4.js";import{fromPoints as C}from"./ray.js";import{angle as w}from"./vector.js";import{sv3d as T,sm4d as E}from"./vectorStacks.js";class D{constructor(e=0,t=0,n=0,r=0){this.radius=r,typeof e==`number`?this._center=g(e,t,n):x(e)||S(e)?(this._center=_(e),this.radius=e.length===4?e[3]:t):(this._center=v(e.center),this.radius=e.radius)}get isValid(){return this.radius>=0}invalidate(){this.radius=-1}get center(){return this._center}set center(e){r(this.center,e)}exactEquals(e){return i(this._center,e.center)&&this.radius===e.radius}copyFrom(e){return e!==this&&(r(this._center,e.center),this.radius=e.radius),this}clone(){return new D(this.center,this.radius)}toVec4(){return b(this.center[0],this.center[1],this.center[2],this.radius)}contains(e){return a(this.center,e)<=this.radius**2}intersects(e){let t=this.radius+e.radius;return a(this.center,e.center)<=t*t}intersectRay(e,t){if(e==null||!this._intersect(e,k))return!1;let{t0:n,t1:r}=k;if((n<0||r<n&&r>0)&&(n=r),n<0)return!1;if(t){let{origin:r,direction:i}=e;t[0]=r[0]+i[0]*n,t[1]=r[1]+i[1]*n,t[2]=r[2]+i[2]*n}return!0}intersectLine(e,n){let r=C(e,n);if(!this._intersect(r,k))return[];let{origin:i,direction:a}=r,{t0:o,t1:s}=k,c=e=>{let t=y();return h(t,i,a,e),this.projectPoint(t,t)};return Math.abs(o-s)<t()?[c(o)]:[c(o),c(s)]}_intersect(e,t){let{origin:n,direction:r}=e,i=A;i[0]=n[0]-this.center[0],i[1]=n[1]-this.center[1],i[2]=n[2]-this.center[2];let a=r[0]*r[0]+r[1]*r[1]+r[2]*r[2];if(a===0)return!1;let o=2*(r[0]*i[0]+r[1]*i[1]+r[2]*i[2]),s=i[0]*i[0]+i[1]*i[1]+i[2]*i[2]-this.radius**2,c=o*o-4*a*s;if(c<0)return!1;let l=Math.sqrt(c);return t.t0=(-o-l)/(2*a),t.t1=(-o+l)/(2*a),!0}projectPoint(e,t){let n=o(T.get(),e,this.center),r=s(T.get(),n,this.radius/c(n));return l(t,r,this.center)}closestPointOnSilhouette(e,t){let r=T.get(),i=E.get();u(r,e.origin,e.direction),u(t,r,e.origin),s(t,t,1/c(t)*this.radius);let a=this._angleToSilhouette(e.origin),o=w(e.origin,t);return n(i,o+a,r),d(t,t,i),t}distanceToSilhouette(e){let t=o(T.get(),e,this.center),n=f(t),r=this.radius**2;return Math.sqrt(Math.abs(n-r))}frustumCoverage(e,t,n){let r=this.radius,i=r*r,a=e+.5*Math.PI,o=t*t+i-Math.cos(a)*2*t*r,s=Math.sqrt(o),c=o-i;if(c<=0)return .5;let l=Math.acos(Math.sqrt(c)/s)-Math.asin(r/(s/Math.sin(a)));return Math.min(1,(l+.5*n)/n)}_angleToSilhouette(t){let n=o(T.get(),t,this.center),r=c(n),i=this.radius,a=i+Math.abs(i-r);return e(i/a)}union(e){let t=p(this._center,e.center),n=this.radius,r=e.radius;return t+r<n?this:t+n<r?(this.copyFrom(e),this):(m(this._center,this._center,e.center,(t+r-n)/(2*t)),this.radius=(t+n+r)/2,this)}toJSON(){return{center:this.center,radius:this.radius}}signedDistanceToPlane(e){let{center:t,radius:n}=this,r=e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3];return r<0?Math.min(r+n,0):Math.max(r-n,0)}}const O=new D,k={t0:0,t1:0},A=y();export{O as NullSphere,D as Sphere};
|
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`6.0.0-next.
|
|
2
|
+
import"./core/has.js";import{addQueryParameter as e}from"./core/urlUtils.js";Symbol.dispose??=Symbol(`Symbol.dispose`),Symbol.asyncDispose??=Symbol(`Symbol.asyncDispose`);const t=`5.2`;let n=`5.2`;n=`6.0.0-next.33`;let r;function i(e){r=e}function a(t){let n=r?.findCredential(t);return n?.token?e(t,`token`,n.token):t}globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}});export{a as addTokenParameter,n as fullVersion,r as id,i as setId,t as version};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.33",
|
|
4
4
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@amcharts/amcharts5": "~5.21.5",
|
|
23
|
-
"@arcgis/toolkit": "6.0.0-next.
|
|
23
|
+
"@arcgis/toolkit": "6.0.0-next.33",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.2.0-next.2",
|
|
25
25
|
"@esri/calcite-components": "^5.2.0",
|
|
26
26
|
"@vaadin/grid": "~25.3.5",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{getContrast as n}from"../../../../core/colorUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as a}from"../../../../core/units.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{subtract as c,normalize as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u,UNIT_X as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as f,length as p,normalize as m,add as h,lerp as g,subtract as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import y from"../../../../geometry/Point.js";import b from"../../../../geometry/Polygon.js";import{project as x,initializeProjection as S}from"../../../../geometry/projectionUtils.js";import{c as C,a as w}from"../../../../chunks/boundedPlane.js";import{equals as T}from"../../../../geometry/support/spatialReferenceUtils.js";import E from"../../../../layers/GraphicsLayer.js";import D from"../../../../symbols/SimpleFillSymbol.js";import O from"../../../../symbols/SimpleMarkerSymbol.js";import{DragManipulation as k}from"./manipulations/DragManipulation.js";import{RotateManipulation as A}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as j}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as M,SnapRotation as N}from"./manipulations/utils.js";import{InteractiveToolBase as P}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as F,mediaKeys as I}from"../../../interactive/keybindings.js";import{EditGeometry as L}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as R}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as z}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as B}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as V}from"../../../support/screenUtils.js";const H=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]];let U=class extends P{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=C(),this._displayPlaneCache=C(),this._mainAxisCache=u(),this._rotationHandleCache=v(),this._cornerA=v(),this._cornerB=v(),this._cornerC=v(),this._cornerD=v(),this._avgAB=v(),this._avgBC=v(),this._avgCD=v(),this._avgDA=v(),this._preserveAspectRatio=new M,this._snapRotation=new N,this._graphicsLayer=new E({internal:!0,listMode:`hide`,visible:!1,title:`TransformTool layer`}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null,this.type=`transform`}initialize(){this._initialize()}destroy(){let{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=r(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){let e=this._graphic.geometry;if(e==null)return null;let t=this._editGeometryOperations.data,n=t.parts[0].segments[0],r=c(this._mainAxisCache,n.leftVertex.pos,n.rightVertex.pos);l(r,r);let i=80*this.view.resolution,o=this.view.spatialReference;return T(o,e.spatialReference)&&(i*=a(o)/a(e.spatialReference)),z(r,t,i,this._planeCache)}get _displayPlane(){let e=this._plane;if(!e)return null;let t=this._displayPlaneCache;w(e,t);let n=10*this.view.resolution;return f(t.basis1,t.basis1,1+n/p(t.basis1)),f(t.basis2,t.basis2,1+n/p(t.basis2)),t}get _backgroundGraphicGeometry(){let e=this._displayPlane;if(!e)return null;let t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new b({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){let e=this._plane;if(!e)return null;let t=this._rotationHandleCache;return m(t,e.basis1),f(t,t,30*this.view.resolution),h(t,t,e.origin),h(t,t,e.basis1),new y({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){let e=this._displayPlane;if(!e)return[];let t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);let{_cornerA:n,_cornerB:r,_cornerC:i,_cornerD:a}=this,o=g(this._avgAB,n,r,.5),s=g(this._avgBC,r,i,.5),c=g(this._avgCD,i,a,.5),l=g(this._avgDA,a,n,.5);return[new y({x:n[0],y:n[1],spatialReference:t}),new y({x:r[0],y:r[1],spatialReference:t}),new y({x:i[0],y:i[1],spatialReference:t}),new y({x:a[0],y:a[1],spatialReference:t}),new y({x:o[0],y:o[1],spatialReference:t}),new y({x:s[0],y:s[1],spatialReference:t}),new y({x:c[0],y:c[1],spatialReference:t}),new y({x:l[0],y:l[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){let{view:e,target:t}=this,n=`georeference`in t?t.georeference.coords:t.geometry,r=this._editGeometryOperations,i=r.data.parts[0].vertices,a=L.fromGeometry(x(n,e.spatialReference),2).parts[0].vertices;i.forEach((e,t)=>{r.setVertexPosition(e,a[t].pos)}),this.updateGraphics()}reset(){let{target:e}=this;if(`georeference`in e){let t=e.georeference;t.type===`control-points`&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){let e=this._editGeometryOperations.data.geometry;if(`georeference`in this.target){let t=this.target.georeference;t.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((e,t)=>{this._scaleGraphics[t].geometry=e})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){let{view:e,target:r}=this;if(`georeference`in r){let e=r.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints=e.type===`control-points`?e.controlPoints:null}else this._graphic=r,this._initialGeometry=r.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=R.fromGeometry(x(this._graphic.geometry,e.spatialReference),2),this._backgroundGraphic=new t({symbol:new D({color:`transparent`,outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new O({color:n(e.effectiveTheme.accentColor),outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(r=>new t({symbol:new O({size:6,style:`square`,color:n(e.effectiveTheme.accentColor),outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:1}}),geometry:r})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new k({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new A({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((t,n)=>new j({tool:this,view:e,graphic:t,direction:H[n],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),i(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on(`click`,async t=>{if(e.activeTool!=null&&e.activeTool!==this)return;let n=V(t),i=[];e.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&i.push(e)});let a=await this.view.hitTest(n,{exclude:i}),o=a.results;if(o.length===0)e.activeTool=null;else{let t=B(a.results),n=`georeference`in r,i=o.map(e=>e.type===`media`?e.element:null).filter(Boolean),s=new Set([...this._graphicsLayer.graphics,n?null:r].filter(Boolean));n&&i.includes(r)||t!=null&&s.has(t.graphic)?e.activeTool??=this:e.activeTool=null}})]);let a=e=>{this.addHandles(e.events.on(`grab-changed`,e=>{`georeference`in r&&(e.action===`start`?r.opacity*=.5:e.action===`end`&&(r.opacity*=2))}))};this._dragManipulation.forEachManipulator(a),this._rotateManipulation.forEachManipulator(a),this._scaleManipulations.forEach(e=>e.forEachManipulator(a));let o=new F;o.addToggle(I.preserveAspectRatio,()=>{this.preserveAspectRatio??(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),o.addToggle(I.rotateIncrements,()=>{this.snapRotation??(this._snapRotation.enabled=!this._snapRotation.enabled)}),o.add(I.toggleOpacity,()=>{`georeference`in r&&(r.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),o.addToggle(I.factorModifier,e=>this._factor=e.type===`key-down`?10:1),o.add(I.scaleUp,()=>this._scale(this._factor)),o.add(I.scaleDown,()=>this._scale(-this._factor)),o.add(I.moveUp,()=>this._move(0,this._factor)),o.add(I.moveDown,()=>this._move(0,-this._factor)),o.add(I.moveLeft,()=>this._move(-this._factor,0)),o.add(I.moveRight,()=>this._move(this._factor,0)),this.addHandles([e.on(`key-down`,t=>{e.activeTool===this&&o.dispatch(e.inputManager,t)}),e.on(`key-up`,t=>{e.activeTool===this&&o.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){let e=this._graphic.geometry;return S(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){let{basis1:t,basis2:n,origin:r}=e,i=this._cornerA;h(i,r,t),h(i,i,n);let a=this._cornerB;h(a,r,t),_(a,a,n);let o=this._cornerC;_(o,r,t),_(o,o,n);let s=this._cornerD;_(s,r,t),h(s,s,n)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){e.action===`start`&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){let t=this._editGeometryOperations,n=t.data.geometry.extent?.width,r=(n+e*this.view.resolution)/n,i=t.scale(this._plane.origin,d,r,r,0,1);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){let n=this._editGeometryOperations.move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([o()],U.prototype,`_plane`,null),e([o()],U.prototype,`_backgroundGraphicGeometry`,null),e([o()],U.prototype,`_rotateGraphicGeometry`,null),e([o()],U.prototype,`_scaleGraphicGeometries`,null),e([o()],U.prototype,`preserveAspectRatio`,void 0),e([o()],U.prototype,`snapRotation`,void 0),e([o({constructOnly:!0,nonNullable:!0})],U.prototype,`target`,void 0),e([o({readOnly:!0})],U.prototype,`type`,void 0),e([o({constructOnly:!0})],U.prototype,`view`,void 0),U=e([s(`esri.views.2d.interactive.editingTools.TransformTool`)],U);export{U as TransformTool};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../Graphic.js";import{getContrast as n}from"../../../../core/colorUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as i}from"../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as a}from"../../../../core/units.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{subtract as c,normalize as l}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as u,UNIT_X as d}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{scale as f,length as p,normalize as m,add as h,lerp as g,subtract as _}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import y from"../../../../geometry/Point.js";import b from"../../../../geometry/Polygon.js";import{project as x,initializeProjection as S}from"../../../../geometry/projectionUtils.js";import{create as C,copy as w}from"../../../../geometry/support/boundedPlane.js";import{equals as T}from"../../../../geometry/support/spatialReferenceUtils.js";import E from"../../../../layers/GraphicsLayer.js";import D from"../../../../symbols/SimpleFillSymbol.js";import O from"../../../../symbols/SimpleMarkerSymbol.js";import{DragManipulation as k}from"./manipulations/DragManipulation.js";import{RotateManipulation as A}from"./manipulations/RotateManipulation.js";import{ScaleManipulation as j}from"./manipulations/ScaleManipulation.js";import{PreserveAspectRatio as M,SnapRotation as N}from"./manipulations/utils.js";import{InteractiveToolBase as P}from"../../../interactive/InteractiveToolBase.js";import{KeyBindings as F,mediaKeys as I}from"../../../interactive/keybindings.js";import{EditGeometry as L}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as R}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{calculateOrientedBounds as z}from"../../../interactive/editGeometry/support/editPlaneUtils.js";import{findFirstGraphicHit as B}from"../../../support/hitTestSelectUtils.js";import{createScreenPointFromEvent as V}from"../../../support/screenUtils.js";const H=[[1,1],[1,-1],[-1,-1],[-1,1],[1,0],[0,-1],[-1,0],[0,1]];let U=class extends P{constructor(e){super(e),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._planeCache=C(),this._displayPlaneCache=C(),this._mainAxisCache=u(),this._rotationHandleCache=v(),this._cornerA=v(),this._cornerB=v(),this._cornerC=v(),this._cornerD=v(),this._avgAB=v(),this._avgBC=v(),this._avgCD=v(),this._avgDA=v(),this._preserveAspectRatio=new M,this._snapRotation=new N,this._graphicsLayer=new E({internal:!0,listMode:`hide`,visible:!1,title:`TransformTool layer`}),this._sharedUndoStack=[],this._sharedRedoStack=[],this._isOpacityToggled=!1,this._factor=1,this.preserveAspectRatio=null,this.snapRotation=null,this.type=`transform`}initialize(){this._initialize()}destroy(){let{map:e}=this.view;this._dragManipulation.destroy(),this._rotateManipulation.destroy(),this._scaleManipulations.forEach(e=>e.destroy()),this._editGeometryOperations.destroy(),e.removeMany([this._graphicsLayer]),this._graphicsLayer.removeAll(),this._graphicsLayer=r(this._graphicsLayer),this._initialControlPoints=null,this._initialGeometry=null,this._graphic=null,this._preserveAspectRatio=null,this._snapRotation=null,this._planeCache=null,this._displayPlaneCache=null,this._rotationHandleCache=null,this._mainAxisCache=null,this._cornerA=null,this._cornerB=null,this._cornerC=null,this._cornerD=null,this._avgAB=null,this._avgBC=null,this._avgCD=null,this._avgDA=null,this._sharedUndoStack=null,this._sharedRedoStack=null}get _plane(){let e=this._graphic.geometry;if(e==null)return null;let t=this._editGeometryOperations.data,n=t.parts[0].segments[0],r=c(this._mainAxisCache,n.leftVertex.pos,n.rightVertex.pos);l(r,r);let i=80*this.view.resolution,o=this.view.spatialReference;return T(o,e.spatialReference)&&(i*=a(o)/a(e.spatialReference)),z(r,t,i,this._planeCache)}get _displayPlane(){let e=this._plane;if(!e)return null;let t=this._displayPlaneCache;w(e,t);let n=10*this.view.resolution;return f(t.basis1,t.basis1,1+n/p(t.basis1)),f(t.basis2,t.basis2,1+n/p(t.basis2)),t}get _backgroundGraphicGeometry(){let e=this._displayPlane;if(!e)return null;let t=this.view.spatialReference;return this._updateDisplayPlaneConrers(e),new b({spatialReference:t,rings:[[this._cornerA,this._cornerB,this._cornerC,this._cornerD,this._cornerA]]})}get _rotateGraphicGeometry(){let e=this._plane;if(!e)return null;let t=this._rotationHandleCache;return m(t,e.basis1),f(t,t,30*this.view.resolution),h(t,t,e.origin),h(t,t,e.basis1),new y({x:t[0],y:t[1],spatialReference:this.view.spatialReference})}get _scaleGraphicGeometries(){let e=this._displayPlane;if(!e)return[];let t=this.view.spatialReference;this._updateDisplayPlaneConrers(e);let{_cornerA:n,_cornerB:r,_cornerC:i,_cornerD:a}=this,o=g(this._avgAB,n,r,.5),s=g(this._avgBC,r,i,.5),c=g(this._avgCD,i,a,.5),l=g(this._avgDA,a,n,.5);return[new y({x:n[0],y:n[1],spatialReference:t}),new y({x:r[0],y:r[1],spatialReference:t}),new y({x:i[0],y:i[1],spatialReference:t}),new y({x:a[0],y:a[1],spatialReference:t}),new y({x:o[0],y:o[1],spatialReference:t}),new y({x:s[0],y:s[1],spatialReference:t}),new y({x:c[0],y:c[1],spatialReference:t}),new y({x:l[0],y:l[1],spatialReference:t})]}onActivate(){this.visible=!0}onDeactivate(){this.visible=!1}onShow(){this._graphicsLayer.visible=!0}onHide(){this._graphicsLayer.visible=!1}canUndo(){return this._editGeometryOperations.canUndo}canRedo(){return this._editGeometryOperations.canRedo}undo(){this._editGeometryOperations.undo(),this.updateGraphics()}redo(){this._editGeometryOperations.redo(),this.updateGraphics()}refresh(){let{view:e,target:t}=this,n=`georeference`in t?t.georeference.coords:t.geometry,r=this._editGeometryOperations,i=r.data.parts[0].vertices,a=L.fromGeometry(x(n,e.spatialReference),2).parts[0].vertices;i.forEach((e,t)=>{r.setVertexPosition(e,a[t].pos)}),this.updateGraphics()}reset(){let{target:e}=this;if(`georeference`in e){let t=e.georeference;t.type===`control-points`&&(t.controlPoints=this._initialControlPoints)}else e.geometry=this._initialGeometry;this.refresh(),this._sharedUndoStack.length=0,this._sharedRedoStack.length=0}updateGraphics(){let e=this._editGeometryOperations.data.geometry;if(`georeference`in this.target){let t=this.target.georeference;t.coords=e}this._graphic.geometry=e,this._backgroundGraphic.geometry=this._backgroundGraphicGeometry,this._rotateGraphic.geometry=this._rotateGraphicGeometry,this._scaleGraphicGeometries.forEach((e,t)=>{this._scaleGraphics[t].geometry=e})}setSharedUndoStack(e){this._sharedUndoStack=e}setSharedRedoStack(e){this._sharedRedoStack=e}async _initialize(){let{view:e,target:r}=this;if(`georeference`in r){let e=r.georeference;this._graphic=new t({geometry:e.coords}),this._initialControlPoints=e.type===`control-points`?e.controlPoints:null}else this._graphic=r,this._initialGeometry=r.geometry;e.map.addMany([this._graphicsLayer]),e.focus(),this.visible=!1,this.finishToolCreation(),await this._loadProjectionEngine(),this._editGeometryOperations=R.fromGeometry(x(this._graphic.geometry,e.spatialReference),2),this._backgroundGraphic=new t({symbol:new D({color:`transparent`,outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:2}}),geometry:this._backgroundGraphicGeometry}),this._rotateGraphic=new t({symbol:new O({color:n(e.effectiveTheme.accentColor),outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:1}}),geometry:this._rotateGraphicGeometry}),this._scaleGraphics=this._scaleGraphicGeometries.map(r=>new t({symbol:new O({size:6,style:`square`,color:n(e.effectiveTheme.accentColor),outline:{type:`simple-line`,color:e.effectiveTheme.accentColor,width:1}}),geometry:r})),this._graphicsLayer.graphics.addMany([this._backgroundGraphic,this._rotateGraphic,...this._scaleGraphics]),this._dragManipulation=new k({tool:this,view:e,graphic:this._graphic}),this._rotateManipulation=new A({tool:this,view:e,graphic:this._rotateGraphic,snapRotation:this._snapRotation}),this._scaleManipulations=this._scaleGraphics.map((t,n)=>new j({tool:this,view:e,graphic:t,direction:H[n],preserveAspectRatio:this._preserveAspectRatio})),this.addHandles([this._dragManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),this._rotateManipulation.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this)),...this._scaleManipulations.map(e=>e.createDragPipeline(this._getInfo.bind(this),this._updateGraphics.bind(this))),i(()=>this.view.scale,()=>this.active?this.updateGraphics():null),e.on(`click`,async t=>{if(e.activeTool!=null&&e.activeTool!==this)return;let n=V(t),i=[];e.map.allLayers.forEach(e=>{(e.type===`vector-tile`||e.type===`imagery`)&&i.push(e)});let a=await this.view.hitTest(n,{exclude:i}),o=a.results;if(o.length===0)e.activeTool=null;else{let t=B(a.results),n=`georeference`in r,i=o.map(e=>e.type===`media`?e.element:null).filter(Boolean),s=new Set([...this._graphicsLayer.graphics,n?null:r].filter(Boolean));n&&i.includes(r)||t!=null&&s.has(t.graphic)?e.activeTool??=this:e.activeTool=null}})]);let a=e=>{this.addHandles(e.events.on(`grab-changed`,e=>{`georeference`in r&&(e.action===`start`?r.opacity*=.5:e.action===`end`&&(r.opacity*=2))}))};this._dragManipulation.forEachManipulator(a),this._rotateManipulation.forEachManipulator(a),this._scaleManipulations.forEach(e=>e.forEachManipulator(a));let o=new F;o.addToggle(I.preserveAspectRatio,()=>{this.preserveAspectRatio??(this._preserveAspectRatio.enabled=!this._preserveAspectRatio.enabled)}),o.addToggle(I.rotateIncrements,()=>{this.snapRotation??(this._snapRotation.enabled=!this._snapRotation.enabled)}),o.add(I.toggleOpacity,()=>{`georeference`in r&&(r.opacity*=this._isOpacityToggled?2:.5,this._isOpacityToggled=!this._isOpacityToggled)}),o.addToggle(I.factorModifier,e=>this._factor=e.type===`key-down`?10:1),o.add(I.scaleUp,()=>this._scale(this._factor)),o.add(I.scaleDown,()=>this._scale(-this._factor)),o.add(I.moveUp,()=>this._move(0,this._factor)),o.add(I.moveDown,()=>this._move(0,-this._factor)),o.add(I.moveLeft,()=>this._move(-this._factor,0)),o.add(I.moveRight,()=>this._move(this._factor,0)),this.addHandles([e.on(`key-down`,t=>{e.activeTool===this&&o.dispatch(e.inputManager,t)}),e.on(`key-up`,t=>{e.activeTool===this&&o.dispatch(e.inputManager,t)})])}async _loadProjectionEngine(){let e=this._graphic.geometry;return S(e.spatialReference,this.view.spatialReference)}_updateDisplayPlaneConrers(e){let{basis1:t,basis2:n,origin:r}=e,i=this._cornerA;h(i,r,t),h(i,i,n);let a=this._cornerB;h(a,r,t),_(a,a,n);let o=this._cornerC;_(o,r,t),_(o,o,n);let s=this._cornerD;_(s,r,t),h(s,s,n)}_getInfo(){return{editGeometryOperations:this._editGeometryOperations,plane:this._plane,displayPlane:this._displayPlane}}_updateGraphics(e,t){e.action===`start`&&(this._sharedUndoStack.push({tool:this,operation:t}),this._sharedRedoStack.length=0),this.updateGraphics()}_scale(e){let t=this._editGeometryOperations,n=t.data.geometry.extent?.width,r=(n+e*this.view.resolution)/n,i=t.scale(this._plane.origin,d,r,r,0,1);this._sharedUndoStack.push({tool:this,operation:i}),this._sharedRedoStack.length=0,this.updateGraphics()}_move(e,t){let n=this._editGeometryOperations.move(e*this.view.resolution,t*this.view.resolution,0,0);this._sharedUndoStack.push({tool:this,operation:n}),this._sharedRedoStack.length=0,this.updateGraphics()}};e([o()],U.prototype,`_plane`,null),e([o()],U.prototype,`_backgroundGraphicGeometry`,null),e([o()],U.prototype,`_rotateGraphicGeometry`,null),e([o()],U.prototype,`_scaleGraphicGeometries`,null),e([o()],U.prototype,`preserveAspectRatio`,void 0),e([o()],U.prototype,`snapRotation`,void 0),e([o({constructOnly:!0,nonNullable:!0})],U.prototype,`target`,void 0),e([o({readOnly:!0})],U.prototype,`type`,void 0),e([o({constructOnly:!0})],U.prototype,`view`,void 0),U=e([s(`esri.views.2d.interactive.editingTools.TransformTool`)],U);export{U as TransformTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../../core/Handles.js";import{set as t,normalize as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as i,scaleAndAdd as a,subtract as o,length as s,dot as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import e from"../../../../../core/Handles.js";import{set as t,normalize as n}from"../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as i,scaleAndAdd as a,subtract as o,length as s,dot as c}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,copy as d}from"../../../../../geometry/support/boundedPlane.js";import{getClosestDenormalizedXToReference as f}from"../../../../../geometry/support/normalizeUtils.js";import{getInfo as p}from"../../../../../geometry/support/spatialReferenceUtils.js";import{Manipulation as m}from"./Manipulation.js";import{onGrabChangedHandle as h}from"./utils.js";import{createManipulatorDragEventPipeline as g,screenToMap as _}from"../../../../interactive/dragEventPipeline.js";import{GraphicManipulator as v}from"../../../../interactive/GraphicManipulator.js";import{apply as y}from"../../../../interactive/editGeometry/support/editPlaneUtils.js";const b=1e-6;function x(e){let t=s(e.basis1),n=s(e.basis2);return .3*Math.min(t,n)}class S extends m{constructor(t){super(),this._handles=new e,this._planeStart=u(),this._displayPlaneStart=u(),this._originCache=l(),this._axisCache=r(),this._renderStartCache=l(),this._renderEndCache=l(),this._resizeOriginCache=l(),this._view=t.view,this._tool=t.tool,this._graphic=t.graphic,this._direction=t.direction,this._preserveAspectRatio=t.preserveAspectRatio,this._manipulator=this._createManipulator(),this._handles.add([this._manipulator.events.on(`grab-changed`,e=>h(e,this._manipulator))]),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles.destroy(),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._tool=null,this._view=null,this._graphic=null,this._manipulator=null,this._direction=null,this._handles=null,this._planeStart=null,this._displayPlaneStart=null,this._originCache=null,this._axisCache=null,this._renderStartCache=null,this._renderEndCache=null,this._resizeOriginCache=null,this._preserveAspectRatio=null}forEachManipulator(e){e(this._manipulator,1)}createDragPipeline(e,r){let l=null,u=null,m=null,h=0,v=null,S=null,C=0,w=this._planeStart,T=this._displayPlaneStart,E=this._direction;return g(this._manipulator,(g,D)=>{D.next(t=>{if(t.action===`start`){g.cursor=`grabbing`;let t=e();l=t.plane,u=t.displayPlane,m=t.editGeometryOperations,h=10*this._view.resolution,d(l,w),d(u,T);let n=p(m.data.spatialReference);v=n?n.valid[1]-n.valid[0]-30*this._view.resolution:null}return t}).next(_(this._view)).next(e=>{if(e.action===`start`){let t=T.origin[0]+E[0]*T.basis1[0]+E[1]*T.basis2[0],n=m.data.spatialReference;C=f(e.mapStart.x,t,n)-e.mapStart.x}let t=i(this._renderStartCache,[e.mapStart.x+C,e.mapStart.y,0]),n=i(this._renderEndCache,[e.mapEnd.x+C,e.mapEnd.y,0]),r=i(this._resizeOriginCache,T.origin);a(r,r,T.basis1,-E[0]),a(r,r,T.basis2,-E[1]),o(n,n,r),o(t,t,r);let l=E[0]!==0&&E[1]!==0,d=x(T),p=x(u)/d,g=(e,r)=>{if(e===0)return 1;let i=s(r),a=.5*e*c(r,n)/i,o=a<0?-1:1;if(l){let n=i-.5*e*c(r,t)/i;a+=n*o*p}let u=i<h*1.5?1:b;return i=Math.max(i-h,b),o>0&&(a-=10*this._view.resolution),o*Math.max(a/i*o,u)},_=g(E[0],T.basis1),v=g(E[1],T.basis2);return{...e,direction:E,factor1:_,factor2:v}}).next(this._preserveAspectRatio.createDragEventPipelineStep(),this._preserveAspectRatio.next).next(e=>{let o=i(this._originCache,w.origin);a(o,o,w.basis1,-E[0]),a(o,o,w.basis2,-E[1]);let s=t(this._axisCache,w.basis1[0],w.basis1[1]);n(s,s);let c=m.data.allVerticesUnordered,u=e.action===`start`?0:1,f=m.scaleVertices(c,o,s,e.factor1,e.factor2,u,1);return v&&v<m.data.geometry.extent.width&&S?m.updateVertices(c,S):(d(w,l),y(f,l),S=f.operation,r(e,f)),e}).next(e=>(e.action===`end`&&(g.cursor=`grab`),e))})}_createManipulator(){return new v({view:this._view,graphic:this._graphic,selectable:!0,cursor:`grab`})}}export{S as ScaleManipulation,x as calculateDiagonalResizeHandleScale};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t,equals as n}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as o,destroyMaybe as s}from"../../../core/maybe.js";import{after as c,throwIfAborted as l,isPromiseLike as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as g,createZonedDate as _}from"../../../core/timeUtils.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import{projectAsync as C}from"../../../geometry/projectionUtils.js";import{containsExecute as w}from"../../../geometry/operators/containsOperator.js";import{g as T}from"../../../chunks/boundedPlane.js";import{polygonToVolume as E}from"../focusAreaUtils.js";import D from"./AnalysisView3D.js";import{registerAnalysisView as O,hideOtherAnalysisViews as k}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as A}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as j}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as M}from"../support/earthUtils.js";import{computeDirectionsOverTime as N}from"../support/sunUtils.js";import{maxColorRampSize as P}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as F}from"../../../widgets/support/traversalUtils.js";let I=class extends D{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new S,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([O(this.view,this),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{o(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=r(async e=>{await c(U,e),l(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>V(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&k(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},f),d(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{R(e,n,t)},f),d(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{R(e,r,{lightDirections:t,lightDirectionsContext:n})},f),d(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{R(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),d(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{R(e,t,{analysisVolume:n})},f)]),this.interactive=!0,this._tooltip=new A({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&R(this._renderer,!0,{enabled:!1}),this._tooltip=s(this._tooltip),this._stopPreviewingTask=o(this._stopPreviewingTask),this._updatingHandles=s(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:M(e[0],!1)}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),`minutes`),e=g(e,-this._effectiveUtcOffset,`hours`),e}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t,timeZone:n}=this.analysis;if(n==null)return g(this._dateUTCOffset,e);let r=_({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()},h(e,`milliseconds`,`minutes`),n);if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(W-1)):W}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?G:this._referencePosition;if(n==null)return[];let r=N(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,W),i=r.length;K.length=0;let a=F(0,i,K),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=E(e,this.view,q);return t==null?(this._previousVolume=null,null):u(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new i(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?H/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(B)}get _previewDependencies(){let{view:e}=this,n=e.slice.plane,r=this._shadowLayerViews,i=r.map(e=>e.layer).filter(t),a=r.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(p(e.x,e.y),m()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);l(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await C(i,n.spatialReference,{signal:t});return l(t),a!=null&&w(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>P&&a.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return z(e)}};e([v({readOnly:!0,type:[`shadow-cast-view-3d`]})],I.prototype,`type`,void 0),e([v({constructOnly:!0,nonNullable:!0})],I.prototype,`analysis`,void 0),e([v({readOnly:!0})],I.prototype,`updating`,null),e([v()],I.prototype,`_stopPreviewingTask`,void 0),e([v()],I.prototype,`_updatedRecently`,void 0),e([v()],I.prototype,`_tooltip`,void 0),e([v()],I.prototype,`_sceneUpdating`,null),e([v()],I.prototype,`_effectiveUtcOffset`,null),e([v()],I.prototype,`_utcOffsetAuto`,null),e([v()],I.prototype,`_dateUTCOffset`,null),e([v()],I.prototype,`_startDateTimeUTC`,null),e([v()],I.prototype,`_endDateTimeUTC`,null),e([v()],I.prototype,`_referencePosition`,null),e([v()],I.prototype,`_interval`,null),e([v()],I.prototype,`_intervalContext`,null),e([v()],I.prototype,`_totalDurationSampleCount`,null),e([v()],I.prototype,`_totalDuration`,null),e([v()],I.prototype,`_lightDirections`,null),e([v()],I.prototype,`_lightDirectionsContext`,null),e([v()],I.prototype,`_analysisVolume`,null),e([v()],I.prototype,`_visualizationParameters`,null),e([v()],I.prototype,`_minDurationVisualizationParameters`,null),e([v()],I.prototype,`_minDurationContextVisualizationParameters`,null),e([v()],I.prototype,`_durationVisualizationParameters`,null),e([v()],I.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([v()],I.prototype,`_discreteVisualizationParameters`,null),e([v()],I.prototype,`_shadowLayerViews`,null),e([v()],I.prototype,`_previewDependencies`,null),e([v()],I.prototype,`_renderer`,null),I=e([y(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],I);const L=I;function R(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function z(e){let t=e.toUnitRGBA();return[[0,x(t[0],t[1],t[2],0)],[1,t]]}function B(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:return!1;case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function V(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let r=T(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=n(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=n(e.layerVisibilities,t.layerVisibilities),s=n(e.layerOpacities,t.layerOpacities),c=n(e.filters,t.filters),l=n(e.definitionExpressions,t.definitionExpressions);return r&&i&&a&&o&&s&&c&&l}const H=h(1,`hours`,`milliseconds`),U=500,W=255,G=b(),K=[],q=new j;export{L as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t,equals as n}from"../../../core/arrayUtils.js";import{createTask as r}from"../../../core/asyncUtils.js";import i from"../../../core/Error.js";import"../../../core/has.js";import a from"../../../core/Logger.js";import{abortMaybe as o,destroyMaybe as s}from"../../../core/maybe.js";import{after as c,throwIfAborted as l,isPromiseLike as u}from"../../../core/promiseUtils.js";import{watch as d,syncAndInitial as f}from"../../../core/reactiveUtils.js";import{createScreenPointArray as p,createRenderScreenPointArray as m}from"../../../core/screenUtils.js";import{convertTime as h,offsetDateUTC as g,createZonedDate as _}from"../../../core/timeUtils.js";import{property as v,subclass as y}from"../../../core/accessorSupport/decorators.js";import{create as b}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as S}from"../../../core/support/UpdatingHandles.js";import{projectAsync as C}from"../../../geometry/projectionUtils.js";import{containsExecute as w}from"../../../geometry/operators/containsOperator.js";import{equals as T}from"../../../geometry/support/boundedPlane.js";import{polygonToVolume as E}from"../focusAreaUtils.js";import D from"./AnalysisView3D.js";import{registerAnalysisView as O,hideOtherAnalysisViews as k}from"./ShadowCast/analysisViewRegister.js";import{ShadowCastTooltip as A}from"./ShadowCast/ShadowCastTooltip.js";import{ElevationContext as j}from"../layers/graphics/ElevationContext.js";import{longitudeToTimezone as M}from"../support/earthUtils.js";import{computeDirectionsOverTime as N}from"../support/sunUtils.js";import{maxColorRampSize as P}from"../webgl-engine/shaders/colorRampParameters.js";import{breadthFirstBinaryPartitioning as F}from"../../../widgets/support/traversalUtils.js";let I=class extends D{constructor(e){super(e),this.type=`shadow-cast-view-3d`,this.analysis=null,this._updatingHandles=new S,this._stopPreviewingTask=null,this._updatedRecently=!1,this._tooltip=null,this._previousVolume=null}initialize(){this.addHandles([O(this.view,this),d(()=>({dependencies:this._previewDependencies,sceneUpdating:this._sceneUpdating}),()=>{o(this._stopPreviewingTask),this._updatedRecently=!0,this._stopPreviewingTask=r(async e=>{await c(U,e),l(e),this._updatedRecently=!1})},{sync:!0,initial:!0,equals:(e,t)=>V(e.dependencies,t.dependencies)&&(e.sceneUpdating===t.sceneUpdating||!e.sceneUpdating)}),d(()=>({renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t})=>{t&&k(this.view,this),e?.setParameters({shadowCast:{enabled:t}})},f),d(()=>({renderer:this._renderer,parameters:this._visualizationParameters,visible:this.visible}),({renderer:e,parameters:t,visible:n})=>{R(e,n,t)},f),d(()=>({renderer:this._renderer,lightDirections:this._lightDirections,lightDirectionsContext:this._lightDirectionsContext,visible:this.visible}),({renderer:e,lightDirections:t,lightDirectionsContext:n,visible:r})=>{R(e,r,{lightDirections:t,lightDirectionsContext:n})},f),d(()=>({renderer:this._renderer,previewing:this._previewing,visible:this.visible}),({renderer:e,previewing:t,visible:n})=>{R(e,n,{previewing:t})},{sync:!0,initial:!0,equals:()=>!1}),d(()=>({analysisVolume:this._analysisVolume,renderer:this._renderer,visible:this.visible}),({renderer:e,visible:t,analysisVolume:n})=>{R(e,t,{analysisVolume:n})},f)]),this.interactive=!0,this._tooltip=new A({getDuration:(e,t)=>this._getDurationAtScreen(e,t),getMode:()=>this.analysis.mode,getShowsSeparateZeroBucketInHourlyMode:()=>this._showsSeparateZeroBucketInHourlyMode,getTotalDuration:()=>this._totalDuration,getTotalDurationMode:()=>this.analysis.totalDurationOptions.mode,getVisualizeSunlight:()=>this.analysis.visualizeSunlight,isVisible:()=>this.interactive&&this.visible,view:this.view})}destroy(){this.visible&&R(this._renderer,!0,{enabled:!1}),this._tooltip=s(this._tooltip),this._stopPreviewingTask=o(this._stopPreviewingTask),this._updatingHandles=s(this._updatingHandles)}get interactive(){return super.interactive}set interactive(e){super.interactive=e}get updating(){return this._previewing||this._stopPreviewingTask!=null&&!this._stopPreviewingTask.finished||this._tooltip?.updating===!0||this._updatingHandles.updating}get visible(){return super.visible}set visible(e){super.visible=e}get _previewing(){let e=this._updatedRecently,t=this._sceneUpdating;return e||t}get _sceneUpdating(){let{view:e}=this;if(e?.allLayerViews==null)return!0;let{stationary:t,navigating:n,interacting:r,graphicsView:i}=e,a=!t||n||r,o=this._shadowLayerViews.some(e=>e.updating),s=!i?.suspended&&!!i?.updating;return a||o||s}get _effectiveUtcOffset(){return this.analysis.utcOffset??this._utcOffsetAuto}get _utcOffsetAuto(){let e=this._referencePosition;return e==null?0:M(e[0],!1)}get _dateUTCOffset(){let e=this.analysis.date;return e=g(e,-e.getTimezoneOffset(),`minutes`),e=g(e,-this._effectiveUtcOffset,`hours`),e}get _startDateTimeUTC(){return this._getDateTimeUTC(this.analysis.startTimeOfDay)}get _endDateTimeUTC(){return this._getDateTimeUTC(this.analysis.endTimeOfDay)}_getDateTimeUTC(e){let{date:t,timeZone:n}=this.analysis;if(n==null)return g(this._dateUTCOffset,e);let r=_({year:t.getFullYear(),month:t.getMonth()+1,day:t.getDate()},h(e,`milliseconds`,`minutes`),n);if(r==null)throw RangeError(`Invalid shadow cast date or time zone`);return r}get _referencePosition(){return this.view?.environmentView?.referencePositionGeographic}get _totalDurationInterval(){return this._totalDuration>0?Math.floor(this._totalDuration/(W-1)):W}get _interval(){let e=this._totalDurationInterval;switch(this.analysis.mode){case`min-duration`:return this._totalDuration>0?e:0;case`total-duration`:return e;case`discrete`:return this.analysis.discreteOptions.interval||e}}get _intervalContext(){let{mode:e,minDurationOptions:t}=this.analysis;return e===`min-duration`&&t.contextEnabled?t.contextOptions.interval||this._totalDurationInterval:-1}get _totalDurationSampleCount(){return this._lightDirections.length}get _totalDuration(){return this._endDateTimeUTC.getTime()-this._startDateTimeUTC.getTime()}get _lightDirections(){return this._calculateLightDirections(this._interval)}get _lightDirectionsContext(){return this._calculateLightDirections(this._intervalContext)}_calculateLightDirections(e){let{view:t}=this;if(e<=0)return[];let n=t.viewingMode===`global`?G:this._referencePosition;if(n==null)return[];let r=N(this._startDateTimeUTC,this._endDateTimeUTC,e,n,t.state.viewingMode,W),i=r.length;K.length=0;let a=F(0,i,K),o=Array(i);for(let e=0;e<i;++e)o[e]=r[a[e]];return o}get _analysisVolume(){let{geometry:e}=this.analysis;if(e==null)return this._previousVolume=null,null;try{let t=E(e,this.view,q);return t==null?(this._previousVolume=null,null):u(t)?(this._updatingHandles.consumePromise(t),this._previousVolume):(this._previousVolume=t,t)}catch(t){return a.getLogger(this).error(new i(`shadowcastanalysisview3d:projection-failed`,`Failed to project analysis area geometry to view spatial reference`,{geometry:e,error:t})),null}}get _visualizationParameters(){if(!this.visible)return null;switch(this.analysis.mode){case`min-duration`:return this._minDurationVisualizationParameters;case`total-duration`:return this._durationVisualizationParameters;case`discrete`:return this._discreteVisualizationParameters}}get _minDurationVisualizationParameters(){let{color:e,minDuration:t}=this.analysis.minDurationOptions,n=this._totalDuration;return{rendersSunlight:this.analysis.visualizeSunlight,visualization:2,thresholdColor:e.toUnitRGBA(),threshold:n>0?t/this._totalDuration:0,...this._minDurationContextVisualizationParameters}}get _minDurationContextVisualizationParameters(){let{minDurationOptions:e,visualizeSunlight:t}=this.analysis;if(!e.contextEnabled||t)return{};let{color:n,colorStops:r}=e.contextOptions,i=1/this._lightDirectionsContext.length;return{visualization:3,gradientColorRamp:this._getEffectiveShadowCastColorRamp(n,r,i)}}get _durationVisualizationParameters(){let{color:e,colorStops:t,mode:n}=this.analysis.totalDurationOptions,r=this._totalDuration,i=r>0&&n===`hourly`?H/r:0,a=this._getEffectiveShadowCastColorRamp(e,t,1/r);return i===0?{...this._discreteVisualizationParameters,gradientColorRamp:a}:{rendersSunlight:this.analysis.visualizeSunlight,bandedGradientColorRamp:a,visualization:1,bandSize:i}}get _showsSeparateZeroBucketInHourlyMode(){let{colorStops:e}=this.analysis.totalDurationOptions;return e==null||e.length===0||e.reduce((e,t)=>Math.min(e,t.value),1/0)<=0}get _discreteVisualizationParameters(){let{color:e,colorStops:t}=this.analysis.discreteOptions,n=1/this._lightDirections.length;return{rendersSunlight:this.analysis.visualizeSunlight,gradientColorRamp:this._getEffectiveShadowCastColorRamp(e,t,n),visualization:0}}get _shadowLayerViews(){return this.view.allLayerViews.items.filter(B)}get _previewDependencies(){let{view:e}=this,n=e.slice.plane,r=this._shadowLayerViews,i=r.map(e=>e.layer).filter(t),a=r.map(e=>e.suspended),o=i.map(e=>e.visible),s=i.map(e=>e.opacity),c=!!e.graphicsView?.suspended,l=i.filter(e=>`definitionExpression`in e).map(e=>e.definitionExpression),u=r.filter(e=>`filter`in e).map(e=>e.filter);return{slicePlane:n,startDateUTC:this._startDateTimeUTC,endDateUTC:this._endDateTimeUTC,layerViewSuspended:a,graphicsViewSuspended:c,layerVisibilities:o,layerOpacities:s,filters:u,definitionExpressions:l}}get _renderer(){return this.view?.stage?.renderer}get testData(){}async getDurationAtScreen(e){return this._getDurationAtScreen(e)}async _getDurationAtScreen(e,t){if(!await this._isScreenPointInAnalysisArea(e,t))return-1;let{_renderer:n,_totalDurationSampleCount:r}=this;if(n==null||r===0)return 0;let i=this.view.state.camera.screenToRender(p(e.x,e.y),m()),a=n.readAccumulatedShadow(i);return(this.analysis.visualizeSunlight?1-a:a)*this._totalDuration}async _isScreenPointInAnalysisArea(e,t){let{geometry:n}=this.analysis;if(!n)return!0;let r=await this.view.hitTest(e);l(t);let i=r.results.find(e=>e.mapPoint)?.mapPoint??r?.ground?.mapPoint;if(!i)return!1;let a=await C(i,n.spatialReference,{signal:t});return l(t),a!=null&&w(n,a)}_getEffectiveShadowCastColorRamp(e,t,n){if(t!=null){t.length>P&&a.getLogger(this).warnOnce(`ShadowCastAnalysis supports at most 8 color stops`);let e=t.map(e=>[e.value*n,e.color.toUnitRGBA()]);return e.sort(([e],[t])=>e-t),e}return z(e)}};e([v({readOnly:!0,type:[`shadow-cast-view-3d`]})],I.prototype,`type`,void 0),e([v({constructOnly:!0,nonNullable:!0})],I.prototype,`analysis`,void 0),e([v({readOnly:!0})],I.prototype,`updating`,null),e([v()],I.prototype,`_stopPreviewingTask`,void 0),e([v()],I.prototype,`_updatedRecently`,void 0),e([v()],I.prototype,`_tooltip`,void 0),e([v()],I.prototype,`_sceneUpdating`,null),e([v()],I.prototype,`_effectiveUtcOffset`,null),e([v()],I.prototype,`_utcOffsetAuto`,null),e([v()],I.prototype,`_dateUTCOffset`,null),e([v()],I.prototype,`_startDateTimeUTC`,null),e([v()],I.prototype,`_endDateTimeUTC`,null),e([v()],I.prototype,`_referencePosition`,null),e([v()],I.prototype,`_interval`,null),e([v()],I.prototype,`_intervalContext`,null),e([v()],I.prototype,`_totalDurationSampleCount`,null),e([v()],I.prototype,`_totalDuration`,null),e([v()],I.prototype,`_lightDirections`,null),e([v()],I.prototype,`_lightDirectionsContext`,null),e([v()],I.prototype,`_analysisVolume`,null),e([v()],I.prototype,`_visualizationParameters`,null),e([v()],I.prototype,`_minDurationVisualizationParameters`,null),e([v()],I.prototype,`_minDurationContextVisualizationParameters`,null),e([v()],I.prototype,`_durationVisualizationParameters`,null),e([v()],I.prototype,`_showsSeparateZeroBucketInHourlyMode`,null),e([v()],I.prototype,`_discreteVisualizationParameters`,null),e([v()],I.prototype,`_shadowLayerViews`,null),e([v()],I.prototype,`_previewDependencies`,null),e([v()],I.prototype,`_renderer`,null),I=e([y(`esri.views.3d.analysis.ShadowCastAnalysisView3D`)],I);const L=I;function R(e,t,n){t&&n!=null&&e?.setParameters({shadowCast:n})}function z(e){let t=e.toUnitRGBA();return[[0,x(t[0],t[1],t[2],0)],[1,t]]}function B(e){if(e.suspended)return!1;switch(e.type){case`building-scene-3d`:case`csv-3d`:case`elevation-3d`:case`feature-3d`:case`gaussian-splat-3d`:case`geojson-3d`:case`integrated-mesh-3d`:case`integrated-mesh-3dtiles`:case`ogc-feature-3d`:case`route-3d`:case`scene-layer-3d`:case`scene-layer-graphics-3d`:case`stream-3d`:case`wms-3d`:case`catalog-footprint-3d`:return!0;case`base-dynamic-3d`:case`catalog-3d`:case`catalog-dynamic-group-3d`:case`dimension-3d`:case`imagery-3d`:case`imagery-tile-3d`:case`line-of-sight-3d`:case`map-image-3d`:case`point-cloud-3d`:case`tile-3d`:case`vector-tile-3d`:case`viewshed-3d`:case`voxel-3d`:case`wfs-3d`:case`wmts-3d`:case`media-3d`:return!1;case`group`:return!1;case`graphics-3d`:return e.layer.graphics.some(e=>{let{symbol:t}=e;return t==null||t.type!==`text`&&!(`symbolLayers`in t)||t.type!==`text`&&t.symbolLayers.some(e=>e.type!==`text`)});default:return!1}}function V(e,t){if(e===t||e==null&&t==null)return!0;if(e==null||t==null)return!1;let r=T(e.slicePlane,t.slicePlane),i=e.startDateUTC.valueOf()===t.startDateUTC.valueOf()&&e.endDateUTC.valueOf()===t.endDateUTC.valueOf(),a=n(e.layerViewSuspended,t.layerViewSuspended)&&e.graphicsViewSuspended===t.graphicsViewSuspended,o=n(e.layerVisibilities,t.layerVisibilities),s=n(e.layerOpacities,t.layerOpacities),c=n(e.filters,t.filters),l=n(e.definitionExpressions,t.definitionExpressions);return r&&i&&a&&o&&s&&c&&l}const H=h(1,`hours`,`milliseconds`),U=500,W=255,G=b(),K=[],q=new j;export{L as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{watch as i,sync as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{c}from"../../../../
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import n from"../../../../core/Accessor.js";import r from"../../../../core/Logger.js";import{watch as i,sync as a}from"../../../../core/reactiveUtils.js";import{property as o,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{create as c}from"../../../../geometry/support/boundedPlane.js";import l from"../../../../layers/Layer.js";import u from"../../../../layers/buildingSublayers/BuildingComponentSublayer.js";import{isBuildingSceneLayerView3D as d,projectAndElevationAlignShape as f,projectedShapeToPlane as p,planeToShape as m}from"./sliceToolUtils.js";import{logFailedGeometryProjectionError as h}from"../support/projectionUtils.js";import{isTerrainSurfaceLayer as g}from"../../terrain/isTerrainSurfaceLayer.js";let _=class extends n{constructor(e){super(e),this._internalChange=!1,this._currentSlicePlane=null}initialize(){this.addHandles(this.analysis.excludedLayers.on(`before-add`,e=>{let t=e.item;t!=null&&(t instanceof l||t instanceof u)?t instanceof l&&g(t)?(r.getLogger(this).error(`excludedLayers`,`Layer '${t.title}, id:${t.id}' of type '${t.type}' can not be individually excluded from slicing. Use 'excludeGroundSurface' instead.`),e.preventDefault()):this.analysis.excludedLayers.includes(t)&&e.preventDefault():(r.getLogger(this).error(`excludedLayers`,`Invalid layer type, layer must derive from Layer or BuildingComponentSublayer`),e.preventDefault())})),S(this.view,this),this.addHandles([i(()=>this.analysisViewData.plane,()=>{this._internalChange||this._updateSlicePlaneFromBoundedPlane(),this._updateLayerViews()},a),i(()=>this.analysis.excludeGroundSurface,()=>this._updateLayerViews(),a),this.analysis.excludedLayers.on(`change`,()=>this._updateLayerViews()),i(()=>[this.analysisViewData.active,this.analysisViewData.visible],()=>{this._updateActiveController(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()},a),i(()=>this._allLayerAndSubLayerViews,()=>this._updateLayerViews())]),this.addHandles([i(()=>this.analysis.shape,()=>{this._internalChange||(this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane())},a),i(()=>this.analysis.origin?.type!==`web-scene`,()=>this._updateViewSlicePlaneDecoration(),a)],`analysis`),this._updateActiveController(),this._updateBoundedPlaneFromSlicePlane(),this._updateViewSlicePlane(),this._updateViewSlicePlaneDecoration()}destroy(){this.analysisViewData.active&&(this.analysisViewData.active=!1,this.view.slice.plane=null,this._updateActiveController(),this._updateViewSlicePlane()),w(this.view,this),this.set(`view`,null)}get _allLayerAndSubLayerViews(){let e=this.view.allLayerViews.items;return e.concat(e.filter(d).flatMap(({sublayerViews:e})=>e.items))}_updateBoundedPlaneFromSlicePlane(){let e=this.analysis.shape,n=this._currentSlicePlane;if(n==null&&e==null||n!=null&&e!=null&&e.equals(n))return;let i=null,a=null;if(e?.position!=null){let n=e.position.spatialReference,o=f(e,this.view);o??h(this.analysis,n,r.getLogger(this)),i=p(o,this.view,{tiltEnabled:this.analysis.tiltEnabled},c()),i!=null&&(a=new t({heading:e.heading,tilt:e.tilt,position:e.position,width:e.width,height:e.height}))}this._currentSlicePlane=a,this._internalChange=!0,this.analysisViewData.plane=i,this._internalChange=!1}_updateSlicePlaneFromBoundedPlane(){let e=this.analysisViewData.plane,n=m(e,this.view,this.view.spatialReference,new t),r=null;n!=null&&(r=new t({heading:n.heading,tilt:n.tilt,position:n.position,width:n.width,height:n.height})),this._currentSlicePlane=r,this._internalChange=!0,this.analysis.shape=n,this._internalChange=!1,this._updateViewSlicePlane()}_updateActiveController(){if(y)return;let e=C(this.view);if(e){if(this.analysisViewData.active)e.activeController!=null&&e.activeController!==this?(y=!0,e.activeController.analysisViewData.active=!1,y=!1):e.activeController!=null&&e.activeController,this._updateLayerViews(),e.activeController=this;else{if(e.activeController!=null&&e.activeController!==this)return;e.activeController!=null&&e.activeController===this&&(e.activeController=null,this._updateLayerViews())}}}_updateViewSlicePlane(){b(this.view)}_updateViewSlicePlaneDecoration(){x(this.view)}_updateLayerViews(){let e=this.analysisViewData.plane!=null&&this.analysisViewData.visible&&this.analysisViewData.active,t=[],n=e=>{`layers`in e?e.layers.forEach(n):t.push(e)};this.analysis.excludedLayers.forEach(n),this.view.allLayerViews.forEach(n=>{n.destroyed||(`slicePlaneEnabled`in n&&(n.slicePlaneEnabled=e&&!t.includes(n.layer)),`sublayerViews`in n&&n.sublayerViews.forEach(n=>{n.slicePlaneEnabled=e&&!t.includes(n.sublayer)}))}),this.view.basemapTerrain!=null&&(this.view.basemapTerrain.slicePlaneEnabled=e&&!this.analysis.excludeGroundSurface)}};e([o()],_.prototype,`view`,void 0),e([o()],_.prototype,`analysis`,void 0),e([o()],_.prototype,`analysisViewData`,void 0),e([o()],_.prototype,`_allLayerAndSubLayerViews`,null),_=e([s(`esri.views.3d.analysis.Slice.SliceController`)],_);const v=new Map;let y=!1;function b(e){let t=C(e)?.activeController;t?.analysisViewData.plane!=null&&t.analysisViewData.visible?e.slice.plane=t.analysisViewData.plane:e.slice.plane=null}function x(e){let t=C(e)?.activeController;e.slice.isDecoration=t?.analysis.origin?.type!==`web-scene`}function S(e,t){v.has(e)||v.set(e,{all:[],activeController:null}),v.get(e)?.all.push(t)}function C(e){return v.get(e)}function w(e,t){if(!v.has(e))throw Error(`view expected in global slice register`);let n=v.get(e),r=n?.all.lastIndexOf(t)??-1;if(!n||r===-1)throw Error(`controller expected in global slice register`);n.all.splice(r,1),n.all.length===0&&v.delete(e)}export{_ as SliceController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import{clock as n}from"../../../../core/clock.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../core/maybe.js";import{watch as a,sync as o,when as s,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{addFrameTask as l}from"../../../../core/scheduling.js";import{createScreenPoint as u,screenPointObjectToArray as d}from"../../../../core/screenUtils.js";import{property as f,subclass as ee}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as p,fromScaling as m,multiply as te}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{dot as h,length as g,copy as _,scale as v,add as y,transformMat4 as b,normalize as x,set as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as re,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as ie,ZEROS as ae}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as oe}from"../../../../core/support/UpdatingHandles.js";import{c as C,a as w,n as T,f as E}from"../../../../chunks/boundedPlane.js";import{signedDistance as D,create as O,intersectRay as k,getNormal as A}from"../../../../geometry/support/plane.js";import{create as se}from"../../../../geometry/support/ray.js";import{sv3d as j,sm4d as M,sv2d as ce}from"../../../../geometry/support/vectorStacks.js";import{getSliceableContainer as le}from"../../../../graphic/getSliceableContainer.js";import{getRotateHeadingTexture as ue,getTiltRotateTexture as de}from"../images/Factory.js";import{getOutlineColor as fe,planeColor as N}from"./settings.js";import{pointerMoveTimerMs as P,planePreviewOutlineWidth as F,forceVerticalModifier as I,forceHorizontalModifier as L,previewFadeDurationSeconds as R,previewFadeDotThreshold as z,initialDepthOffsetFrac as B}from"./sliceToolConfig.js";import{createGridVisualElement as V,createOutlineVisualElement as pe,planeToShape as me,createRotatePlane as H,resizePlane as he,calculatePlaneHalfSize as ge,createPlane as _e,DidPointerMoveRecentlyFlag as U,calculateBoundedPlaneTranslateRotate as W,updateShiftRestartHandle as ve,updateRotateHeadingHandle as ye,updateRotateTiltHandle as be,updateResizeHandle as xe,createShiftPlane as Se}from"./sliceToolUtils.js";import{calculateInputRotationTransform as Ce}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as G}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ResizeManipulator as we}from"../../interactive/manipulators/ResizeManipulator.js";import{RotateManipulator as K}from"../../interactive/manipulators/RotateManipulator.js";import{ShiftManipulator as Te}from"../../interactive/manipulators/ShiftManipulator.js";import{fromScreenNormalized as q}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as J}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Y}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Ee}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as X}from"../../../support/screenUtils.js";var Z;let Q=class extends J{static{Z=this}constructor(e){super(e),this._clock=n,this._previewPlaneOpacity=1,this.multiTouchEnabled=!1,this.removeIncompleteOnCancel=!1,this._mode=`none`,this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=P,this._prevPointerMoveTimeout=null,this._updatingHandles=new oe,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=C(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=u(),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._intersector=Ee(e.view.state.viewingMode)}initialize(){if(this.analysis==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);let e=e=>{this._updateManipulatorsInteractive(e),e.grabbing||(this.analysisViewData.plane!=null&&w(this.analysisViewData.plane,this._startPlane),this.inputState=null)},t=new Te(this.view,1);this.shiftManipulator=t,this.manipulators.add(t),this.addHandles([this._createShiftDragPipeline(t),t.events.on(`grab-changed`,n=>{this._onShiftGrab(n),e(t)})]);let n=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,r=new K(this.view,(e,t)=>ue(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateHeadingManipulator=r,this.manipulators.add(r),this.addHandles([this._createRotateHeadingDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onRotateHeadingGrab(t),e(r)})]);let i=new K(this.view,(e,t)=>de(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateTiltManipulator=i,this.manipulators.add(i),this.addHandles([this._createRotateTiltDragPipeline(i),i.events.on(`grab-changed`,t=>{this._onRotateTiltGrab(t),e(i)})]),this.resizeManipulators=this._resizeHandles.map((t,n)=>{let r=new we(this.view,t);return this.addHandles([this._createResizeDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onResizeGrab(t,n),e(r)})]),r}),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=V(this.view),this._previewPlaneOutlineVisualElement=pe(this.view),this._previewPlaneOutlineVisualElement.width=F,this.addHandles(a(()=>[this.analysisViewData.plane,this.analysis.tiltEnabled],()=>this._updateManipulators(),o)),this.addHandles([s(()=>this.state===`sliced`,()=>{this.finishToolCreation(),this.stop()},c),this._updatingHandles.add(()=>this.view.state.camera,()=>this._onCameraChange())])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=r(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=r(this._previewPlaneGridVisualElement),this._updatingHandles.destroy()}get state(){let e=!!this.analysisViewData.plane,t=!!this.inputState;return e?e&&t?`slicing`:e&&!t?`sliced`:`ready`:`ready`}get cursor(){return this.active&&(this._placingSlicePlane||this.mode===`exclude`)?`crosshair`:null}set analysis(e){if(e==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);this.removeHandles(`analysis`),this._set(`analysis`,e)}get updating(){return this._updatingHandles.updating}get mode(){return this._mode}static{this.disableEngineLayers=!1}get inputState(){return this._get(`inputState`)}set inputState(e){this._set(`inputState`,e),this.analysisViewData.showGrid=e!=null&&e.type===`resize`,this._updateMaterials()}get _placingSlicePlane(){return this.active&&!this.inputState&&this._mode===`place`}start(e){this._finishToolCreationIfValid(),this._mode=e,this.active||(this.view.activeTool=this)}stop(){this.active&&(this.view.activeTool=null)}onActivate(){this._finishToolCreationIfValid(),this._mode===`none`&&this.analysisViewData.plane==null&&(this._mode=`place`)}onDeactivate(){this._mode=`none`,this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(e){this._updateManipulators(),e||this._clearPointerMoveTimeout()}onInputEvent(e){switch(e.type){case`pointer-move`:this._onPointerMove(e);break;case`immediate-click`:if(!ke(e))return;this._mode===`exclude`?e.defer(async()=>{await this._onClickExcludeLayer(e)&&e.stopPropagation()}):this._onClickPlacePlane(e)&&e.stopPropagation();break;case`drag`:this.inputState&&e.stopPropagation();break;case`key-down`:this._onKeyDown(e)&&e.stopPropagation();break;case`key-up`:this._onKeyUp(e)&&e.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerMove(e){this._lastCursorPosition.x=e.x,this._lastCursorPosition.y=e.y,this._resetPointerMoveTimeout(),e.pointerType!==`touch`&&this._updatePreviewPlane(X(e),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onClickPlacePlane(e){if(!this._placingSlicePlane)return!1;let n=X(e),r=C();return this._pickPlane(n,!1,this._activeKeyModifiers,r)?(w(r,this._startPlane),this.analysis.shape=me(r,this.view,this.view.spatialReference,new t),this.stop(),!0):!1}async _onClickExcludeLayer(e){if(this.mode!==`exclude`)return!1;let t=await this.view.hitTest(X(e)),n=t.results.at(0);if(n){let e=(n.type===`graphic`?le(n.graphic.origin)??n.graphic.sourceLayer??null:null)??n.layer;e&&e.type!==`subtype-sublayer`&&this.analysis.excludedLayers.push(e)}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0;return this.stop(),!0}_onKeyDown(e){return this._placingSlicePlane&&(e.key===I||e.key===L)?(this._activeKeyModifiers[e.key]=!0,this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onKeyUp(e){return this._placingSlicePlane&&(e.key===I||e.key===L)&&this._activeKeyModifiers[e.key]?(delete this._activeKeyModifiers[e.key],this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onShiftGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=q(this.view.state.camera,e.screenPoint,$);w(this.analysisViewData.plane,this._startPlane),this.inputState=Oe(t,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`shift`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.shiftPlane)).next(this._shiftDragAdjustSensitivity(r)).next(this._shiftDragUpdatePlane(r)),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_shiftDragAdjustSensitivity(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=Math.min((1-Math.abs(h(T(this.analysisViewData.plane),t.ray.direction)/g(t.ray.direction)))/.001,1),r=-D(this._startPlane.plane,t.renderEnd),i=-D(this._startPlane.plane,e.startPoint);return e.depth=e.depth*(1-n)+r*n-i,t}}_shiftDragUpdatePlane(e){return()=>{if(this.analysisViewData.plane==null)return;let t=_(j.get(),this._startPlane.origin),n=_(j.get(),T(this._startPlane));v(n,n,-e.depth),y(n,n,t);let r=E(n,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,C());this._updateBoundedPlane(r)}}_onRotateHeadingGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.analysisViewData.plane,this.view.renderCoordsHelper,1,O()),n=q(this.view.state.camera,e.screenPoint,$),r=S();k(t,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateHeadingDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_onRotateTiltGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.analysisViewData.plane,this.view.renderCoordsHelper,2,O()),n=q(this.view.state.camera,e.screenPoint,$),r=S();k(t,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateTiltDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_rotateDragRenderPlaneToRotate(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=A(e.rotatePlane),r=Ce(e.startPoint,t.renderEnd,this.analysisViewData.plane.origin,n);return{...t,rotateAxis:n,rotateAngle:r}}}_rotateDragUpdatePlaneFromRotate(){return e=>{if(this.analysisViewData.plane==null)return;let t=p(M.get(),e.rotateAngle,e.rotateAxis);if(t==null)return;let n=b(j.get(),this._startPlane.basis1,t),r=b(j.get(),this._startPlane.basis2,t),i=E(this.analysisViewData.plane.origin,n,r,C());this._updateBoundedPlane(i)}}_onResizeGrab(e,t){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let n=q(this.view.state.camera,e.screenPoint,$),r=j.get();k(this.analysisViewData.plane.plane,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`resize`,activeHandleIdx:t,startPoint:re(r)})}_createResizeDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`resize`||this.analysisViewData.plane==null)return;let i=w(this.analysisViewData.plane,C());t.next(G(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(r)),n.next(()=>{this._updateBoundedPlane(i)})})}_resizeDragUpdatePlane(e){return t=>{if(this.analysisViewData.plane==null)return;let n=this._resizeHandles[e.activeHandleIdx],r=he(n,e.startPoint,t.renderEnd,this.view.state.camera,this._startPlane,w(this.analysisViewData.plane));this._updateBoundedPlane(r)}}_updateBoundedPlane(e){let t=this.analysisViewData;if(t!=null)t.plane=e;else throw Error(`valid internal object expected`)}_updatePreviewPlane(e,t={}){if(this.mode===`exclude`)return;let n=this._previewPlane;if(this._previewPlane=null,e==null)this._removeFrameTask(),this._updateManipulators();else{if(this.active){let r=n??C();if(n=n==null?null:w(n,Ae),this._pickPlane(e,!0,t,r)){let e=z,t=!1;n!=null&&(t=h(A(n.plane),A(r.plane))<e||h(x(j.get(),n.basis1),x(j.get(),r.basis1))<e),t&&(this._previewPlaneOpacity=0),this._previewPlane=r}}this._previewPlane!=null&&this._frameTask==null&&this._previewPlaneOpacity===0?this._frameTask=l({update:({deltaTime:e})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+e/(R*1e3),1),this._updateManipulators(),this._previewPlaneOpacity===1&&this._removeFrameTask()}}):this._previewPlane==null&&this._frameTask!=null?this._removeFrameTask():this._previewPlane!=null&&this._updateManipulators()}}_removeFrameTask(){this._frameTask=i(this._frameTask)}_pickMinResult(e){let t=d(e,ce.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector),this._intersector.results.min}_pickPlane(e,t,n,r){let i=this._pickMinResult(e),a=j.get();if(!i.getIntersectionPoint(a))return!1;let o=i.getTransformedNormal(j.get()),s=this.view.state.camera;h(o,s.viewForward)>0&&v(o,o,-1);let c=ge(a,s),l=(t?1:-1)*c*B,u=v(j.get(),o,l);y(u,u,a);let d=this.analysis.tiltEnabled?3:0,f=n[I]?2:n[L]?1:d;return _e(u,o,c,c,s,f,this.view.renderCoordsHelper,r),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=i(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=U,this.rotateHeadingManipulator.state|=U,this.rotateTiltManipulator.state|=U,this._prevPointerMoveTimeout=this._clock.setTimeout(()=>{this.shiftManipulator.state&=~U,this.rotateHeadingManipulator.state&=~U,this.rotateTiltManipulator.state&=~U},this._pointerMoveTimerMs)}_updateManipulators(){if(Z.disableEngineLayers)return;let e,t,n=!1;if(this.analysisViewData.plane!=null)e=this.analysisViewData.plane,t=this._previewPlane??e,n=!1;else if(this._previewPlane!=null)t=e=this._previewPlane,n=!0;else{this._setManipulatorVisibility(!1),this._setPreviewPlaneVisibility(!1);return}if(this._setManipulatorVisibility(!n),!n){let t=W(e,M.get());ve(this.shiftManipulator,t,e,this.view.state.camera),ye(this.rotateHeadingManipulator,t,e,this.view.renderCoordsHelper),be(this.rotateTiltManipulator,t,e),this.resizeManipulators.forEach((n,r)=>xe(n,this._resizeHandles[r],t,e))}this._setPreviewPlaneVisibility(n||this._mode===`place`),this._updatePreviewPlaneTransform(t),this._updateMaterials()}_setManipulatorVisibility(e){this.shiftManipulator.available=e,this.rotateHeadingManipulator.available=e,this.rotateTiltManipulator.available=e&&this.analysis.tiltEnabled,this.resizeManipulators.forEach(t=>t.available=e)}_updatePreviewPlaneTransform(e){let t=W(e,M.get()),n=ne(j.get(),g(e.basis1),g(e.basis2),1),r=m(M.get(),n),i=te(r,t,r);this._previewPlaneOutlineVisualElement.transform=i,this._previewPlaneGridVisualElement.transform=i}_setPreviewPlaneVisibility(e){let t=this._previewPlaneOutlineVisualElement,n=this._previewPlaneGridVisualElement;e&&(t.attached=!0,n.attached=!0),t.visible=e,n.visible=e}_updateMaterials(){let e=fe(this.view.effectiveTheme);e[3]*=this._previewPlaneOpacity;let t=ie(N);t[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=e,this._previewPlaneGridVisualElement.backgroundColor=t,this._previewPlaneGridVisualElement.gridColor=ae}_updateManipulatorsInteractive(e){e.grabbing?(this.shiftManipulator.interactive=this.shiftManipulator===e,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===e,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===e,this.resizeManipulators.forEach(t=>{t.interactive=t===e})):(this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,this.resizeManipulators.forEach(e=>{e.interactive=!0}))}_finishToolCreationIfValid(){this.analysis.valid&&this.finishToolCreation()}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:e=>{this._pointerMoveTimerMs=e}}}};e([f()],Q.prototype,`_clock`,void 0),e([f({constructOnly:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`analysisViewData`,void 0),e([f({readOnly:!0})],Q.prototype,`state`,null),e([f({readOnly:!0})],Q.prototype,`cursor`,null),e([f()],Q.prototype,`analysis`,null),e([f()],Q.prototype,`multiTouchEnabled`,void 0),e([f()],Q.prototype,`removeIncompleteOnCancel`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`_mode`,void 0),e([f()],Q.prototype,`mode`,null),e([f({value:null})],Q.prototype,`inputState`,null),e([f()],Q.prototype,`_placingSlicePlane`,null),Q=Z=e([ee(`esri.views.3d.analysis.Slice.SliceTool`)],Q);const De=Q;function Oe(e,t,n){let r=Se(t,T(n),e.direction,O()),i=S();return k(r,e,i)?{type:`shift`,shiftPlane:r,depth:0,startPoint:i}:null}function ke(e){return e.pointerType!==`mouse`||e.button===0}const Ae=C(),$=se();export{De as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../analysis/SlicePlane.js";import{clock as n}from"../../../../core/clock.js";import{destroyMaybe as r,removeMaybe as i}from"../../../../core/maybe.js";import{watch as a,sync as o,when as s,syncAndInitial as c}from"../../../../core/reactiveUtils.js";import{addFrameTask as l}from"../../../../core/scheduling.js";import{createScreenPoint as u,screenPointObjectToArray as d}from"../../../../core/screenUtils.js";import{property as f,subclass as ee}from"../../../../core/accessorSupport/decorators.js";import{fromRotation as p,fromScaling as m,multiply as te}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{dot as h,length as g,copy as _,scale as v,add as y,transformMat4 as b,normalize as x,set as ne}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as re,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{clone as ie,ZEROS as ae}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{UpdatingHandles as oe}from"../../../../core/support/UpdatingHandles.js";import{create as C,copy as w,normal as T,fromValues as E}from"../../../../geometry/support/boundedPlane.js";import{signedDistance as D,create as O,intersectRay as k,getNormal as A}from"../../../../geometry/support/plane.js";import{create as se}from"../../../../geometry/support/ray.js";import{sv3d as j,sm4d as M,sv2d as ce}from"../../../../geometry/support/vectorStacks.js";import{getSliceableContainer as le}from"../../../../graphic/getSliceableContainer.js";import{getRotateHeadingTexture as ue,getTiltRotateTexture as de}from"../images/Factory.js";import{getOutlineColor as fe,planeColor as N}from"./settings.js";import{pointerMoveTimerMs as P,planePreviewOutlineWidth as F,forceVerticalModifier as I,forceHorizontalModifier as L,previewFadeDurationSeconds as R,previewFadeDotThreshold as z,initialDepthOffsetFrac as B}from"./sliceToolConfig.js";import{createGridVisualElement as V,createOutlineVisualElement as pe,planeToShape as me,createRotatePlane as H,resizePlane as he,calculatePlaneHalfSize as ge,createPlane as _e,DidPointerMoveRecentlyFlag as U,calculateBoundedPlaneTranslateRotate as W,updateShiftRestartHandle as ve,updateRotateHeadingHandle as ye,updateRotateTiltHandle as be,updateResizeHandle as xe,createShiftPlane as Se}from"./sliceToolUtils.js";import{calculateInputRotationTransform as Ce}from"../../interactive/manipulatorUtils.js";import{screenToRenderPlane as G}from"../../interactive/editingTools/dragEventPipeline3D.js";import{ResizeManipulator as we}from"../../interactive/manipulators/ResizeManipulator.js";import{RotateManipulator as K}from"../../interactive/manipulators/RotateManipulator.js";import{ShiftManipulator as Te}from"../../interactive/manipulators/ShiftManipulator.js";import{fromScreenNormalized as q}from"../../support/geometryUtils/ray.js";import{AnalysisToolBase as J}from"../../../interactive/AnalysisToolBase.js";import{createManipulatorDragEventPipeline as Y}from"../../../interactive/dragEventPipeline.js";import{newToolIntersector as Ee}from"../../../interactive/ToolIntersector.js";import{createScreenPointFromEvent as X}from"../../../support/screenUtils.js";var Z;let Q=class extends J{static{Z=this}constructor(e){super(e),this._clock=n,this._previewPlaneOpacity=1,this.multiTouchEnabled=!1,this.removeIncompleteOnCancel=!1,this._mode=`none`,this.shiftManipulator=null,this.rotateHeadingManipulator=null,this.rotateTiltManipulator=null,this.resizeManipulators=null,this._frameTask=null,this._pointerMoveTimerMs=P,this._prevPointerMoveTimeout=null,this._updatingHandles=new oe,this._previewPlaneGridVisualElement=null,this._previewPlaneOutlineVisualElement=null,this._startPlane=C(),this._previewPlane=null,this._activeKeyModifiers={},this._lastCursorPosition=u(),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._intersector=Ee(e.view.state.viewingMode)}initialize(){if(this.analysis==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);let e=e=>{this._updateManipulatorsInteractive(e),e.grabbing||(this.analysisViewData.plane!=null&&w(this.analysisViewData.plane,this._startPlane),this.inputState=null)},t=new Te(this.view,1);this.shiftManipulator=t,this.manipulators.add(t),this.addHandles([this._createShiftDragPipeline(t),t.events.on(`grab-changed`,n=>{this._onShiftGrab(n),e(t)})]);let n=!this.view.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result,r=new K(this.view,(e,t)=>ue(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateHeadingManipulator=r,this.manipulators.add(r),this.addHandles([this._createRotateHeadingDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onRotateHeadingGrab(t),e(r)})]);let i=new K(this.view,(e,t)=>de(this.view.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:n}));this.rotateTiltManipulator=i,this.manipulators.add(i),this.addHandles([this._createRotateTiltDragPipeline(i),i.events.on(`grab-changed`,t=>{this._onRotateTiltGrab(t),e(i)})]),this.resizeManipulators=this._resizeHandles.map((t,n)=>{let r=new we(this.view,t);return this.addHandles([this._createResizeDragPipeline(r),r.events.on(`grab-changed`,t=>{this._onResizeGrab(t,n),e(r)})]),r}),this.manipulators.addMany(this.resizeManipulators),this._previewPlaneGridVisualElement=V(this.view),this._previewPlaneOutlineVisualElement=pe(this.view),this._previewPlaneOutlineVisualElement.width=F,this.addHandles(a(()=>[this.analysisViewData.plane,this.analysis.tiltEnabled],()=>this._updateManipulators(),o)),this.addHandles([s(()=>this.state===`sliced`,()=>{this.finishToolCreation(),this.stop()},c),this._updatingHandles.add(()=>this.view.state.camera,()=>this._onCameraChange())])}destroy(){this._removeFrameTask(),this._clearPointerMoveTimeout(),this._previewPlaneOutlineVisualElement=r(this._previewPlaneOutlineVisualElement),this._previewPlaneGridVisualElement=r(this._previewPlaneGridVisualElement),this._updatingHandles.destroy()}get state(){let e=!!this.analysisViewData.plane,t=!!this.inputState;return e?e&&t?`slicing`:e&&!t?`sliced`:`ready`:`ready`}get cursor(){return this.active&&(this._placingSlicePlane||this.mode===`exclude`)?`crosshair`:null}set analysis(e){if(e==null)throw Error(`SliceTool requires valid analysis, but null was provided.`);this.removeHandles(`analysis`),this._set(`analysis`,e)}get updating(){return this._updatingHandles.updating}get mode(){return this._mode}static{this.disableEngineLayers=!1}get inputState(){return this._get(`inputState`)}set inputState(e){this._set(`inputState`,e),this.analysisViewData.showGrid=e!=null&&e.type===`resize`,this._updateMaterials()}get _placingSlicePlane(){return this.active&&!this.inputState&&this._mode===`place`}start(e){this._finishToolCreationIfValid(),this._mode=e,this.active||(this.view.activeTool=this)}stop(){this.active&&(this.view.activeTool=null)}onActivate(){this._finishToolCreationIfValid(),this._mode===`none`&&this.analysisViewData.plane==null&&(this._mode=`place`)}onDeactivate(){this._mode=`none`,this._updatePreviewPlane(null)}onShow(){this._updateVisibility(!0)}onHide(){this._updateVisibility(!1)}_updateVisibility(e){this._updateManipulators(),e||this._clearPointerMoveTimeout()}onInputEvent(e){switch(e.type){case`pointer-move`:this._onPointerMove(e);break;case`immediate-click`:if(!ke(e))return;this._mode===`exclude`?e.defer(async()=>{await this._onClickExcludeLayer(e)&&e.stopPropagation()}):this._onClickPlacePlane(e)&&e.stopPropagation();break;case`drag`:this.inputState&&e.stopPropagation();break;case`key-down`:this._onKeyDown(e)&&e.stopPropagation();break;case`key-up`:this._onKeyUp(e)&&e.stopPropagation()}}onEditableChange(){this.analysisViewData.editable=this.internallyEditable}_onPointerMove(e){this._lastCursorPosition.x=e.x,this._lastCursorPosition.y=e.y,this._resetPointerMoveTimeout(),e.pointerType!==`touch`&&this._updatePreviewPlane(X(e),this._activeKeyModifiers)}_onCameraChange(){this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),this._updateManipulators()}_onClickPlacePlane(e){if(!this._placingSlicePlane)return!1;let n=X(e),r=C();return this._pickPlane(n,!1,this._activeKeyModifiers,r)?(w(r,this._startPlane),this.analysis.shape=me(r,this.view,this.view.spatialReference,new t),this.stop(),!0):!1}async _onClickExcludeLayer(e){if(this.mode!==`exclude`)return!1;let t=await this.view.hitTest(X(e)),n=t.results.at(0);if(n){let e=(n.type===`graphic`?le(n.graphic.origin)??n.graphic.sourceLayer??null:null)??n.layer;e&&e.type!==`subtype-sublayer`&&this.analysis.excludedLayers.push(e)}else t.ground.layer?this.analysis.excludedLayers.push(t.ground.layer):this.analysis.excludeGroundSurface=!0;return this.stop(),!0}_onKeyDown(e){return this._placingSlicePlane&&(e.key===I||e.key===L)?(this._activeKeyModifiers[e.key]=!0,this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onKeyUp(e){return this._placingSlicePlane&&(e.key===I||e.key===L)&&this._activeKeyModifiers[e.key]?(delete this._activeKeyModifiers[e.key],this._previewPlane!=null&&this._updatePreviewPlane(this._lastCursorPosition,this._activeKeyModifiers),!0):!1}_onShiftGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=q(this.view.state.camera,e.screenPoint,$);w(this.analysisViewData.plane,this._startPlane),this.inputState=Oe(t,this.shiftManipulator.renderLocation,this.analysisViewData.plane)}_createShiftDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`shift`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.shiftPlane)).next(this._shiftDragAdjustSensitivity(r)).next(this._shiftDragUpdatePlane(r)),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_shiftDragAdjustSensitivity(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=Math.min((1-Math.abs(h(T(this.analysisViewData.plane),t.ray.direction)/g(t.ray.direction)))/.001,1),r=-D(this._startPlane.plane,t.renderEnd),i=-D(this._startPlane.plane,e.startPoint);return e.depth=e.depth*(1-n)+r*n-i,t}}_shiftDragUpdatePlane(e){return()=>{if(this.analysisViewData.plane==null)return;let t=_(j.get(),this._startPlane.origin),n=_(j.get(),T(this._startPlane));v(n,n,-e.depth),y(n,n,t);let r=E(n,this.analysisViewData.plane.basis1,this.analysisViewData.plane.basis2,C());this._updateBoundedPlane(r)}}_onRotateHeadingGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.analysisViewData.plane,this.view.renderCoordsHelper,1,O()),n=q(this.view.state.camera,e.screenPoint,$),r=S();k(t,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateHeadingDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_onRotateTiltGrab(e){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let t=H(this.analysisViewData.plane,this.view.renderCoordsHelper,2,O()),n=q(this.view.state.camera,e.screenPoint,$),r=S();k(t,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`rotate`,rotatePlane:t,startPoint:r})}_createRotateTiltDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`rotate`)return;let i=this.analysisViewData.plane==null?null:w(this.analysisViewData.plane,C());t.next(G(this.view,r.rotatePlane)).next(this._rotateDragRenderPlaneToRotate(r)).next(this._rotateDragUpdatePlaneFromRotate()),n.next(()=>{i!=null&&this._updateBoundedPlane(i)})})}_rotateDragRenderPlaneToRotate(e){return t=>{if(this.analysisViewData.plane==null)return null;let n=A(e.rotatePlane),r=Ce(e.startPoint,t.renderEnd,this.analysisViewData.plane.origin,n);return{...t,rotateAxis:n,rotateAngle:r}}}_rotateDragUpdatePlaneFromRotate(){return e=>{if(this.analysisViewData.plane==null)return;let t=p(M.get(),e.rotateAngle,e.rotateAxis);if(t==null)return;let n=b(j.get(),this._startPlane.basis1,t),r=b(j.get(),this._startPlane.basis2,t),i=E(this.analysisViewData.plane.origin,n,r,C());this._updateBoundedPlane(i)}}_onResizeGrab(e,t){if(e.action!==`start`||this.analysisViewData.plane==null||!e.screenPoint)return;let n=q(this.view.state.camera,e.screenPoint,$),r=j.get();k(this.analysisViewData.plane.plane,n,r)&&(w(this.analysisViewData.plane,this._startPlane),this.inputState={type:`resize`,activeHandleIdx:t,startPoint:re(r)})}_createResizeDragPipeline(e){return Y(e,(e,t,n)=>{let r=this.inputState;if(r==null||r.type!==`resize`||this.analysisViewData.plane==null)return;let i=w(this.analysisViewData.plane,C());t.next(G(this.view,this.analysisViewData.plane.plane)).next(this._resizeDragUpdatePlane(r)),n.next(()=>{this._updateBoundedPlane(i)})})}_resizeDragUpdatePlane(e){return t=>{if(this.analysisViewData.plane==null)return;let n=this._resizeHandles[e.activeHandleIdx],r=he(n,e.startPoint,t.renderEnd,this.view.state.camera,this._startPlane,w(this.analysisViewData.plane));this._updateBoundedPlane(r)}}_updateBoundedPlane(e){let t=this.analysisViewData;if(t!=null)t.plane=e;else throw Error(`valid internal object expected`)}_updatePreviewPlane(e,t={}){if(this.mode===`exclude`)return;let n=this._previewPlane;if(this._previewPlane=null,e==null)this._removeFrameTask(),this._updateManipulators();else{if(this.active){let r=n??C();if(n=n==null?null:w(n,Ae),this._pickPlane(e,!0,t,r)){let e=z,t=!1;n!=null&&(t=h(A(n.plane),A(r.plane))<e||h(x(j.get(),n.basis1),x(j.get(),r.basis1))<e),t&&(this._previewPlaneOpacity=0),this._previewPlane=r}}this._previewPlane!=null&&this._frameTask==null&&this._previewPlaneOpacity===0?this._frameTask=l({update:({deltaTime:e})=>{this._previewPlaneOpacity=Math.min(this._previewPlaneOpacity+e/(R*1e3),1),this._updateManipulators(),this._previewPlaneOpacity===1&&this._removeFrameTask()}}):this._previewPlane==null&&this._frameTask!=null?this._removeFrameTask():this._previewPlane!=null&&this._updateManipulators()}}_removeFrameTask(){this._frameTask=i(this._frameTask)}_pickMinResult(e){let t=d(e,ce.get());return this.view.sceneIntersectionHelper.intersectToolIntersectorScreen(t,this._intersector),this._intersector.results.min}_pickPlane(e,t,n,r){let i=this._pickMinResult(e),a=j.get();if(!i.getIntersectionPoint(a))return!1;let o=i.getTransformedNormal(j.get()),s=this.view.state.camera;h(o,s.viewForward)>0&&v(o,o,-1);let c=ge(a,s),l=(t?1:-1)*c*B,u=v(j.get(),o,l);y(u,u,a);let d=this.analysis.tiltEnabled?3:0,f=n[I]?2:n[L]?1:d;return _e(u,o,c,c,s,f,this.view.renderCoordsHelper,r),!0}_clearPointerMoveTimeout(){this._prevPointerMoveTimeout=i(this._prevPointerMoveTimeout)}_resetPointerMoveTimeout(){this._clearPointerMoveTimeout(),this.shiftManipulator.state|=U,this.rotateHeadingManipulator.state|=U,this.rotateTiltManipulator.state|=U,this._prevPointerMoveTimeout=this._clock.setTimeout(()=>{this.shiftManipulator.state&=~U,this.rotateHeadingManipulator.state&=~U,this.rotateTiltManipulator.state&=~U},this._pointerMoveTimerMs)}_updateManipulators(){if(Z.disableEngineLayers)return;let e,t,n=!1;if(this.analysisViewData.plane!=null)e=this.analysisViewData.plane,t=this._previewPlane??e,n=!1;else if(this._previewPlane!=null)t=e=this._previewPlane,n=!0;else{this._setManipulatorVisibility(!1),this._setPreviewPlaneVisibility(!1);return}if(this._setManipulatorVisibility(!n),!n){let t=W(e,M.get());ve(this.shiftManipulator,t,e,this.view.state.camera),ye(this.rotateHeadingManipulator,t,e,this.view.renderCoordsHelper),be(this.rotateTiltManipulator,t,e),this.resizeManipulators.forEach((n,r)=>xe(n,this._resizeHandles[r],t,e))}this._setPreviewPlaneVisibility(n||this._mode===`place`),this._updatePreviewPlaneTransform(t),this._updateMaterials()}_setManipulatorVisibility(e){this.shiftManipulator.available=e,this.rotateHeadingManipulator.available=e,this.rotateTiltManipulator.available=e&&this.analysis.tiltEnabled,this.resizeManipulators.forEach(t=>t.available=e)}_updatePreviewPlaneTransform(e){let t=W(e,M.get()),n=ne(j.get(),g(e.basis1),g(e.basis2),1),r=m(M.get(),n),i=te(r,t,r);this._previewPlaneOutlineVisualElement.transform=i,this._previewPlaneGridVisualElement.transform=i}_setPreviewPlaneVisibility(e){let t=this._previewPlaneOutlineVisualElement,n=this._previewPlaneGridVisualElement;e&&(t.attached=!0,n.attached=!0),t.visible=e,n.visible=e}_updateMaterials(){let e=fe(this.view.effectiveTheme);e[3]*=this._previewPlaneOpacity;let t=ie(N);t[3]*=this._previewPlaneOpacity,this._previewPlaneOutlineVisualElement.color=e,this._previewPlaneGridVisualElement.backgroundColor=t,this._previewPlaneGridVisualElement.gridColor=ae}_updateManipulatorsInteractive(e){e.grabbing?(this.shiftManipulator.interactive=this.shiftManipulator===e,this.rotateHeadingManipulator.interactive=this.rotateHeadingManipulator===e,this.rotateTiltManipulator.interactive=this.rotateTiltManipulator===e,this.resizeManipulators.forEach(t=>{t.interactive=t===e})):(this.shiftManipulator.interactive=!0,this.rotateHeadingManipulator.interactive=!0,this.rotateTiltManipulator.interactive=!0,this.resizeManipulators.forEach(e=>{e.interactive=!0}))}_finishToolCreationIfValid(){this.analysis.valid&&this.finishToolCreation()}get test(){return{plane:this.analysisViewData.plane,setPointerMoveTimerMs:e=>{this._pointerMoveTimerMs=e}}}};e([f()],Q.prototype,`_clock`,void 0),e([f({constructOnly:!0})],Q.prototype,`view`,void 0),e([f()],Q.prototype,`analysisViewData`,void 0),e([f({readOnly:!0})],Q.prototype,`state`,null),e([f({readOnly:!0})],Q.prototype,`cursor`,null),e([f()],Q.prototype,`analysis`,null),e([f()],Q.prototype,`multiTouchEnabled`,void 0),e([f()],Q.prototype,`removeIncompleteOnCancel`,void 0),e([f()],Q.prototype,`updating`,null),e([f()],Q.prototype,`_mode`,void 0),e([f()],Q.prototype,`mode`,null),e([f({value:null})],Q.prototype,`inputState`,null),e([f()],Q.prototype,`_placingSlicePlane`,null),Q=Z=e([ee(`esri.views.3d.analysis.Slice.SliceTool`)],Q);const De=Q;function Oe(e,t,n){let r=Se(t,T(n),e.direction,O()),i=S();return k(r,e,i)?{type:`shift`,shiftPlane:r,depth:0,startPoint:i}:null}function ke(e){return e.pointerType!==`mouse`||e.button===0}const Ae=C(),$=se();export{De as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../analysis/SlicePlane.js";import t from"../../../../core/Logger.js";import{rad2deg as n,deg2rad as r}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{fromZRotation as a,scale as o,multiply as s,rotateZ as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{length as u,set as d,add as f,scale as p,copy as m,subtract as h,dot as g,normalize as _,cross as v,squaredLength as y,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as x,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import C from"../../../../geometry/Point.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{
|
|
2
|
+
import e from"../../../../analysis/SlicePlane.js";import t from"../../../../core/Logger.js";import{rad2deg as n,deg2rad as r}from"../../../../core/mathUtils.js";import{castRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{fromZRotation as a,scale as o,multiply as s,rotateZ as c,rotateX as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{length as u,set as d,add as f,scale as p,copy as m,subtract as h,dot as g,normalize as _,cross as v,squaredLength as y,negate as b}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as x,create as S}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import C from"../../../../geometry/Point.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{create as T,rotate as E,normal as D,updateUnboundedPlane as ee,fromValues as te,intersectRay as ne}from"../../../../geometry/support/boundedPlane.js";import{fromPositionAndNormal as O,fromVectorsAndPoint as k}from"../../../../geometry/support/plane.js";import{create as re}from"../../../../geometry/support/ray.js";import{angleAroundAxis as ie}from"../../../../geometry/support/vector.js";import{sv3d as A,sm4d as j}from"../../../../geometry/support/vectorStacks.js";import{planeColor as ae,getGridColor as oe,getOutlineColor as M}from"./settings.js";import{resizeHandleEdgePaddingFrac as se,planeOutlineWidth as ce,planeMinBasisScreenLen2 as N,initialPlaneHalfSizeViewProportion as le,shiftRestartOffsetDistance as ue,smallAngleDotThreshold as P,verticalDotThreshold as de}from"./sliceToolConfig.js";import{applyProjectionAndElevationAlignment as fe}from"../support/projectionUtils.js";import{calculateTranslateRotateFromBases as pe}from"../../interactive/manipulatorUtils.js";import{LineVisualElement as F}from"../../interactive/visualElements/LineVisualElement.js";import{SlicePlaneVisualElement as I}from"../../interactive/visualElements/SlicePlaneVisualElement.js";import{RenderCoordsHelper as L}from"../../support/RenderCoordsHelper.js";import{fromRender as R}from"../../support/geometryUtils/ray.js";function z(e,t,n,r,i,a,o,s){return V(t,o.worldUpAtPosition(e,A.get()),i,a,s.basis1,s.basis2),p(s.basis1,s.basis1,n),p(s.basis2,s.basis2,r),m(s.origin,e),k(s.basis2,s.basis1,s.origin,s.plane),s}const B=S();function V(e,t,n,r,i,a){let o=g(e,t),s=A.get(),c=A.get();switch(r===0?Math.abs(o)>de?1:2:r){case 2:{let r=Math.abs(o)<=P?e:b(B,n.viewUp);v(s,t,r),m(c,t);break}case 1:v(s,n.viewUp,t),v(c,t,s);break;case 3:{let r=Math.abs(o)<=P?t:n.viewUp;v(s,r,e),v(c,e,s);break}}let l=v(A.get(),s,c);g(l,n.viewForward)>0&&p(c,c,-1),_(i,s),_(a,c)}function H(e,t,n){let r=t.worldUpAtPosition(e.origin,A.get()),i=e.basis1,a=J(e,r),o=Math.round(a/$)*$;return E(e,o-a,i,n)}function me(e,t,n,r,i,a){let o=m(A.get(),i.origin);f(o,o,p(A.get(),i.basis1,e.direction[0]<0?1:-1)),f(o,o,p(A.get(),i.basis2,e.direction[1]<0?1:-1));let s=u(i.basis1),c=u(i.basis2),l=h(A.get(),n,o),d=h(A.get(),t,o),_=0,v=0;if(q(e)){let t=K(i),n=K(a);_=s-.5*e.direction[0]*g(i.basis1,d)/s,v=c-.5*e.direction[1]*g(i.basis2,d)/c;let r=n/t;_*=r,v*=r}let y=.5*e.direction[0]*g(i.basis1,l)/s,b=.5*e.direction[1]*g(i.basis2,l)/c,x=_+y,S=v+b,C=p(A.get(),i.basis1,x/s),w=p(A.get(),i.basis2,S/c);(x<=0||W(a.origin,C,r)<=N)&&m(C,a.basis1),(S<=0||W(a.origin,w,r)<=N)&&m(w,a.basis2);let T=m(A.get(),o);return f(T,T,p(A.get(),C,e.direction[0]<0?-1:1)),f(T,T,p(A.get(),w,e.direction[1]<0?-1:1)),te(T,C,w,a)}function he(e,t){return le*Math.min(t.width,t.height)*t.computeRenderPixelSizeAt(e)}function ge(e,t,n,r){let i=v(A.get(),t,n);return v(i,i,t),O(e,i,r)}function _e(e,t){return pe(e.basis1,e.basis2,e.origin,t)}function ve(e,t,n,r){let i=t.worldUpAtPosition(e.origin,A.get()),a=A.get();switch(n){case 1:m(a,i);break;case 2:m(a,e.basis1)}return O(e.origin,a,r)}function ye(e,t,n,r){let a=U(n,2),o=j.get();c(o,t,a.edge*Math.PI/2);let s=_(A.get(),a.basis),l=p(A.get(),s,a.direction*r.computeScreenPixelSizeAt(a.position)*ue);f(l,l,a.position);let u=r.projectToRenderScreen(l,i(A.get())),d=be(r,u);R(r,u,Q),_(Q.direction,Q.direction);let m=A.get();!d&&ne(n,Q,m)&&(l=m),o[12]=0,o[13]=0,o[14]=0,e.modelTransform=o,e.renderLocation=x(l),d?e.state|=Z:e.state&=~Z}function be(e,t){if(t==null)return!1;let[n,r,i,a]=e.viewport,o=Math.min(i,a)/16,s=!0;return t[0]<n+o?(t[0]=n+o,s=!1):t[0]>n+i-o&&(t[0]=n+i-o,s=!1),t[1]<r+o?(t[1]=r+o,s=!1):t[1]>r+a-o&&(t[1]=r+a-o,s=!1),s}function xe(e,t,n,r){let i=u(r.basis1),c=u(r.basis2),l=G(r),m=K(r),h=d(A.get(),0,0,0);f(h,p(A.get(),r.basis1,t.direction[0]),p(A.get(),r.basis2,t.direction[1])),f(h,r.origin,h);let g=0,_=1;if(q(t))t.direction[0]===1&&t.direction[1]===-1?g=$:t.direction[0]===1&&t.direction[1]===1?g=Math.PI:t.direction[0]===-1&&t.direction[1]===1&&(g=3*Math.PI/2),_=m;else{let e=t.direction[0]===0?2:1,n=e===1?c:i;g=e===1?$:0,_=n-l}let v=a(j.get(),g);o(v,v,d(A.get(),_,_,_)),s(v,n,v),v[12]=0,v[13]=0,v[14]=0,e.modelTransform=v,e.renderLocation=h}function Se(e,t,n,r){let i=r.worldUpAtPosition(n.origin,A.get()),o=U(n,0),c=a(j.get(),o.edge*Math.PI/2);l(c,c,-J(n,i)),s(c,t,c),c[12]=0,c[13]=0,c[14]=0,e.modelTransform=c,e.renderLocation=o.position}function Ce(e,t,n){let r=U(n,1),i=a(j.get(),r.edge*Math.PI/2);l(i,i,$),s(i,t,i),i[12]=0,i[13]=0,i[14]=0,e.modelTransform=i,e.renderLocation=r.position}function U(e,t){switch(t){case 0:return{basis:e.basis1,direction:1,position:f(A.get(),e.origin,e.basis1),edge:t};case 1:return{basis:e.basis2,direction:1,position:f(A.get(),e.origin,e.basis2),edge:t};case 2:return{basis:e.basis1,direction:-1,position:h(A.get(),e.origin,e.basis1),edge:t};case 3:return{basis:e.basis2,direction:-1,position:h(A.get(),e.origin,e.basis2),edge:t}}}function W(e,t,n){let r=n.projectToRenderScreen(f(A.get(),e,t),i(A.get())),a=n.projectToRenderScreen(h(A.get(),e,t),i(A.get()));return r&&a?y(h(r,r,a)):0}function G(e){let t=u(e.basis1),n=u(e.basis2);return se*Math.min(t,n)}function K(e){return G(e)}function q(e){return e.direction[0]!==0&&e.direction[1]!==0}function we(e){return new F({view:e,attached:!1,color:M(e.effectiveTheme),width:ce,renderOccluded:4,geometry:[[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0],[-1,-1,0]]],isDecoration:!0})}function Te(e){return new I({view:e,attached:!1,backgroundColor:ae,gridColor:oe(e.effectiveTheme),gridWidth:4,renderOccluded:4,isDecoration:!0})}function Ee(t,r,i,a=new e){if(t==null)return null;let{renderCoordsHelper:o}=r,s=o.fromRenderCoords(t.origin,new C({spatialReference:r.spatialReference}));if(s==null)return null;let c=w(s,i);if(c==null)return null;a.position=c;let l=u(t.basis1)*2,d=u(t.basis2)*2,f=L.renderUnitScaleFactor(r.spatialReference,i);a.width=l*f,a.height=d*f;let p=o.worldUpAtPosition(t.origin,A.get());return a.tilt=n(J(t,p)),a.heading=o.headingAtPosition(t.origin,t.basis1)-90,a}function J(e,t){return ie(t,e.basis2,e.basis1)+$}function De(e,n,i,a,o,s,c=T()){return s.toRenderCoords(e,c.origin)?(s.worldBasisAtPosition(c.origin,0,c.basis1),s.worldBasisAtPosition(c.origin,1,c.basis2),k(c.basis2,c.basis1,c.origin,c.plane),E(c,-r(n),D(c),c),E(c,r(i),c.basis1,c),p(c.basis1,c.basis1,a/2),p(c.basis2,c.basis2,o/2),ee(c),c):(t.getLogger(`esri.views.3d.analysis.Slice.sliceToolUtils`).error(`Failed to project slice plane position, projection from ${e.spatialReference.wkid} is not supported`),null)}function Y(e,t){if(e?.position==null)return null;let n=fe(e.position,t.spatialReference,t.elevationProvider);if(n==null)return null;let r=L.renderUnitScaleFactor(e.position.spatialReference,t.spatialReference),i=e.width*r,a=e.height*r;return{position:n,heading:e.heading,tilt:e.tilt,renderWidth:i,renderHeight:a}}function Oe(e,t,n,r=T()){let i=Y(e,t);return i==null?null:X(i,t,n,r)}function X(e,t,n,r=T()){if(e==null)return null;let i=De(e.position,e.heading,e.tilt,e.renderWidth,e.renderHeight,t.renderCoordsHelper,r);return!n.tiltEnabled&&i!=null&&H(i,t.renderCoordsHelper,i),i}const ke=16,Z=32,Q=re(),$=Math.PI/2,Ae=16,je=32;function Me(e){return(e.type===`building-scene-3d`?e:null)!=null}export{ke as DidPointerMoveRecentlyFlag,Z as IsShiftEdgeOnScreenFlag,_e as calculateBoundedPlaneTranslateRotate,K as calculateDiagonalResizeHandleScale,he as calculatePlaneHalfSize,Te as createGridVisualElement,we as createOutlineVisualElement,z as createPlane,ve as createRotatePlane,ge as createShiftPlane,H as forceHorizontalOrVertical,Me as isBuildingSceneLayerView3D,q as isDiagonalResizeHandle,V as normalToBases,Ee as planeToShape,Y as projectAndElevationAlignShape,X as projectedShapeToPlane,Ae as resizeNormal,je as resizeOutlineOnly,me as resizePlane,Oe as shapeToPlane,xe as updateResizeHandle,Se as updateRotateHeadingHandle,Ce as updateRotateTiltHandle,ye as updateShiftRestartHandle};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Handles.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import{deg2rad as n,clamp as r}from"../../../../core/mathUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,initial as o}from"../../../../core/reactiveUtils.js";import{fromYRotation as s,fromXRotation as c,fromScaling as l,fromZRotation as u,fromRotation as d,multiply as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as m,sub as h,scale as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import e from"../../../../core/Handles.js";import{handlesGroup as t}from"../../../../core/handleUtils.js";import{deg2rad as n,clamp as r}from"../../../../core/mathUtils.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as a,initial as o}from"../../../../core/reactiveUtils.js";import{fromYRotation as s,fromXRotation as c,fromScaling as l,fromZRotation as u,fromRotation as d,multiply as f}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as m,sub as h,scale as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as y}from"../../../../geometry/support/boundedPlane.js";import{viewshedToolManipulatorConfiguration as b}from"./ViewshedConfiguration.js";import{screenToCircleAngle as x,getViewshedRotationMatrix as S}from"./viewshedToolUtils.js";import{Manipulator3D as C}from"../../interactive/Manipulator3D.js";import{RenderObject as w}from"../../interactive/RenderObject.js";import{InteractiveManipulation as T}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createPolylineGeometry as E}from"../../webgl-engine/lib/GeometryUtil.js";import{assert as D}from"../../webgl-engine/lib/Util.js";import{RibbonLineMaterial as O}from"../../webgl-engine/materials/RibbonLineMaterial.js";import{createManipulatorDragEventPipeline as k}from"../../../interactive/dragEventPipeline.js";class A extends T{constructor(t){super(),this._handles=new e,this._tool=t.tool,this._view=t.view,this._focusedArcMaterial=this._createArcMaterial(!0),this._unfocusedArcMaterial=this._createArcMaterial(!1),this._createManipulators(),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles=i(this._handles),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._tool=null,this._view=null,this._manipulators=null}createDragPipeline(e,n){let r=Object.values(this._manipulators);return t(r.map(({manipulator:t,side:r})=>k(t,(t,i,a,o,s)=>{let c=L(r,n),l=i.next(e=>({...e,manipulatorType:2,side:r}));e(t,x(l,this._view,c,n),a)})))}updateManipulatorsTransform(e){e.arcCentersPoints(H),this._forEachManipulatorInfo(t=>this._updateArcManipulatorTransform(t,e,H[t.side]))}updateManipulatorVisuals(e){this._forEachManipulatorInfo(t=>this._updateArcManipulatorVisuals(t,e))}_updateArcManipulatorVisuals({manipulator:e,side:t},n){let r=[];if(n!=null){let[i,a]=j(t,n,this._unfocusedArcMaterial);r.push(new w(i,1),new w(i.instantiate({material:this._focusedArcMaterial}),2)),e.collisionType={type:`line`,paths:[a]}}e.renderObjects=r,e.radius=b.collisionRadius}_updateArcManipulatorTransform({manipulator:e,side:t},r,i){let a=r.horizontalFieldOfView,o=n(r.verticalFieldOfView/2),h=n(a/2),g=F(t);e.renderLocation=i;let _=p(),v=e=>{f(_,e,_)};v(s(z,n(-90))),g||v(c(z,o));let y=r.farDistanceRenderSpace;v(l(z,m(B,y,y,y))),v(u(z,P(t))),v(S(r,z));let b,x;g?(b=h,x=r.tiltedUpVector):(x=r.rightVector,b=o),b*=t===`right`||t===`bottom`?-1:1;let C=d(z,b,x);C!=null&&v(C),e.modelTransform=_}_createManipulators(){let e=this._createArcManipulator(`left`),t=this._createArcManipulator(`right`),n=this._createArcManipulator(`top`),r=this._createArcManipulator(`bottom`);this._manipulators={left:e,right:t,top:n,bottom:r},[[r.manipulator,n.manipulator],[e.manipulator,t.manipulator]].forEach(([e,t])=>{e.metadata={pairedManipulator:t},t.metadata={pairedManipulator:e}})}_createArcManipulator(e){let t=new C({view:this._view,autoScaleRenderObjects:!1,worldSized:!0}),n={manipulator:t,side:e};return this._updateArcManipulatorVisuals(n),this._handles.add(t.events.on([`focus-changed`,`grab-changed`],e=>{let n=t.metadata?.pairedManipulator;n!=null&&(n.hovering!==t.hovering&&(n.hovering=t.hovering),n.grabbing!==t.grabbing&&(n.grabbing=t.grabbing))})),n}_createArcMaterial(e){let t=b.getFovArcWidth(e),n=new O({renderOccluded:4,isDecoration:!0,width:t},this._view);return this._handles.add(a(()=>this._view.effectiveTheme.accentColor.toUnitRGBA(),e=>n.setParameters({color:e}),o)),n}forEachManipulator(e){Object.values(this._manipulators).forEach(({manipulator:t})=>e(t,2))}_forEachManipulatorInfo(e){Object.values(this._manipulators).forEach(t=>e(t))}get test(){return{manipulators:this._manipulators}}}function j(e,t,i){let{horizontalFieldOfView:a,verticalFieldOfView:o}=t,s=F(e),c=(s?o:a)/2,l=n(r(c,0,15)),u=s?1:Math.max(Math.sin(n(90-o/2)),.1),d=M(-l/2,l/2,u);return[E(i,d),d]}function M(e,t,n,r=10){D(r>1,`createArcPolylineGeometry() needs at least 2 for numVertices`);let i=t-e;if(i<=0||n<=0)return[v(0,0,.01),v(0,0,-.01)];let a=[],o=i/r;for(let i=0;i<r;i++){let s=e+i*o;i===r-1&&(s=t);let c=Math.cos(s)*n,l=Math.sin(s)*n,u=v(c-n,0,l);a.push(u)}return a}function N(e){switch(e){case`left`:return 0;case`bottom`:return 1;case`right`:return 2;case`top`:return 3}}function P(e){return N(e)*R}function F(e){return e===`left`||e===`right`}function I(e){return e===`left`?`right`:e===`right`?`left`:e===`top`?`bottom`:`top`}function L(e,t){let{elevationAlignedObserverRenderSpace:n,elevationAlignedTargetRenderSpace:r,tiltedUpVector:i,rightVector:a,farDistanceRenderSpace:o}=t,s=h(B,r,n),c=F(e)?a:i,l=g(V,c,o);return y(n,s,l)}const R=Math.PI/2,z=p(),B=_(),V=_(),H={top:_(),bottom:_(),left:_(),right:_()};export{A as ViewshedFieldOfViewManipulation,M as createArcPolylineVertices,I as flipSide,F as isSideHorizontal,P as sideToRad};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Handles.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{fromScaling as n,fromTranslation as r,fromZRotation as i,mul as a,fromYRotation as o,multiply as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as l,scale as u,sub as d,len as f,dot as p,scaleAndAdd as m,normalize as h,set as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{
|
|
2
|
+
import e from"../../../../core/Handles.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{fromScaling as n,fromTranslation as r,fromZRotation as i,mul as a,fromYRotation as o,multiply as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{add as l,scale as u,sub as d,len as f,dot as p,scaleAndAdd as m,normalize as h,set as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as v}from"../../../../geometry/support/boundedPlane.js";import{fromValues as y}from"../../../../geometry/support/ray.js";import{displayFocusMultiplier as b}from"../Slice/sliceToolConfig.js";import{ViewshedArrowManipulator as x}from"./ViewshedArrowManipulator.js";import{viewshedToolManipulatorConfiguration as S}from"./ViewshedConfiguration.js";import{screenToCircleAngle as C,getViewshedRotationMatrix as w}from"./viewshedToolUtils.js";import{screenToRenderRay as T}from"../../interactive/editingTools/dragEventPipeline3D.js";import{discRadiusSmall as E,discRadius as D}from"../../interactive/editingTools/manipulations/config.js";import{InteractiveManipulation as O}from"../../interactive/editingTools/manipulations/InteractiveManipulation.js";import{createManipulatorDragEventPipeline as k,dragAtLocation as A}from"../../../interactive/dragEventPipeline.js";class j extends O{constructor(t){super(),this._handles=new e,this._tool=t.tool,this._view=t.view;let n=S.scaleOrientHandleRadius;this._manipulatorHeading=new x(this._view,n),this._manipulatorTilt=new x(this._view,n),this._manipulatorDistance=new x(this._view,n),this.forEachManipulator(e=>this._tool.manipulators.add(e))}destroy(){this._handles.destroy(),this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._manipulatorHeading=null,this._manipulatorTilt=null,this._manipulatorDistance=null,this._tool=null,this._view=null}createHeadingDragPipeline(e,n){return k(this._manipulatorHeading,(r,i,a,o,s)=>{let c=this._view,{tiltParallelToSurface:p,farDistanceRenderSpace:m,upVector:h,elevationAlignedObserverRenderSpace:g,elevationAlignedTargetRenderSpace:_,rightVector:y}=n,b=Math.sin(t(p))*m,x=l(P,g,u(F,h,b)),S=d(F,_,x),w=u(I,y,f(S)),T=v(x,S,w);e(r,C(i,c,T,n).next(e=>({...e,manipulatorType:3})),a)})}createTiltDragPipeline(e,t){return k(this._manipulatorTilt,(n,r,i,a,o)=>{let{elevationAlignedObserverRenderSpace:s,farDistanceRenderSpace:c,upVector:l,targetDirection:d}=t,f=p(d,l),g=m(P,d,l,-f);u(g,h(g,g),c);let _=u(F,l,c),y=v(s,g,_);e(n,C(r,this._view,y,t).next(e=>({...e,manipulatorType:3})),i)})}createDistanceDragPipeline(e,t){return k(this._manipulatorDistance,(n,r,i,a,o)=>{let s=y(t.elevationAlignedObserverRenderSpace,t.targetDirection);e(n,r.next(A(this._view,n.location)).next(T(this._view,s)).next(e=>({...e,manipulatorType:2})),i)})}updateManipulators(e){let{elevationAlignedTargetRenderSpace:t}=e;this._manipulatorHeading.renderLocation=t,this._manipulatorTilt.renderLocation=t,this._manipulatorDistance.renderLocation=t;let l=c(),d=e=>{s(l,e,l)},f=S.scaleOrientSize*(E/D);d(n(M,g(P,f,f,f))),d(w(e,M));let p=S.scaleOrientHandleRadius*b*f,m=u(P,e.targetDirection,p);d(r(M,m));let h=i(M,-L);a(h,h,o(N,-L)),this._manipulatorHeading.modelTransform=a(c(),l,h);let _=o(M,L);a(_,_,i(N,Math.PI)),this._manipulatorTilt.modelTransform=s(c(),l,_),this._manipulatorDistance.modelTransform=l}forEachManipulator(e){e(this._manipulatorHeading,3),e(this._manipulatorTilt,3),e(this._manipulatorDistance,2)}}const M=c(),N=c(),P=_(),F=_(),I=_(),L=Math.PI/2;export{j as ViewshedScaleOrientManipulation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{rad2deg as e}from"../../../../../../core/mathUtils.js";import{rotateX as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{add as n,copy as r}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a}from"../../../../../../
|
|
2
|
+
import{rad2deg as e}from"../../../../../../core/mathUtils.js";import{rotateX as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{add as n,copy as r}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as a}from"../../../../../../geometry/support/boundedPlane.js";import{create as o,intersectRay as s,getNormal as c}from"../../../../../../geometry/support/plane.js";import{sm4d as l,sv3d as u}from"../../../../../../geometry/support/vectorStacks.js";import{getRotateHeadingTexture as d}from"../../../../analysis/images/Factory.js";import{createRotatePlane as f}from"../../../../analysis/Slice/sliceToolUtils.js";import{calculateInputRotationTransform as p}from"../../../manipulatorUtils.js";import{screenToRenderPlane as m}from"../../dragEventPipeline3D.js";import{RotateManipulator as h}from"../../../manipulators/RotateManipulator.js";import{fromScreenNormalized as g}from"../../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as _}from"../../../../../interactive/dragEventPipeline.js";import{ExtentRotateTooltipInfo as v}from"../../../../../interactive/tooltip/infos/ExtentRotateTooltipInfo.js";class y{get _object(){return this._tool.object}get _operations(){return this._object.operations}constructor(e,t,n){this._tool=e,this._bounds=t,this._snapRotation=n,this._rotateTooltipInfo=null,this._startAngle=0,this._endAngle=0;let r=this._tool,i=r.view,a=!i.stage?.renderView.renderingContext.driverTest.svgPremultipliesAlpha.result;this.rotateManipulator=new h(i,(e,t)=>d(i.stage.textures,{accentColor:e,contrastColor:t,preMultiplyAlpha:a})),r.addHandles([this.rotateManipulator.events.on(`grab-changed`,e=>this._onGrabChanged(e)),this._createRotateDragPipeline(this.rotateManipulator)]),r.manipulators.add(this.rotateManipulator),r.addHandles([r.events.on(`rotate-start`,e=>this._startAngle=e.angle),r.events.on(`rotate`,e=>this._endAngle=e.angle),r.events.on(`rotate-stop`,()=>{this._startAngle=0,this._endAngle=0})])}destroy(){this._tool.manipulators.remove(this.rotateManipulator),this.rotateManipulator.destroy()}forEachManipulator(e){e(this.rotateManipulator,3)}updateManipulators(e,r){let i=this._bounds.mapBounds.plane[2]<0?Math.PI:0,a=t(l.get(),e,i);a[12]=0,a[13]=0,a[14]=0,this.rotateManipulator.modelTransform=a,this.rotateManipulator.renderLocation=n(u.get(),r.origin,r.basis1)}getUpdatedTooltipInfo(){return this.rotateManipulator.focused?this._computeRotateTooltipInfo():null}_computeRotateTooltipInfo(){let e=this._rotateTooltipInfo??=new v({toolOptions:this._tool.toolOptions});return e.angle=this._startAngle-this._endAngle,e}_onGrabChanged({action:e,screenPoint:t}){let n=this._tool,r=this._bounds;if(e!==`start`||!t)return;let i=f(r.displayBounds,n.view.renderCoordsHelper,1,o()),a=g(n.view.state.camera,t);s(i,a,u.get())&&(r.backupMapBounds(),n.inputState={type:`rotate`,rotatePlane:i})}_createRotateDragPipeline(t){let{_tool:n,_object:r}=this;return _(t,(t,i,a)=>{let o=n.inputState;o!=null&&(i.next(e=>(e.action===`start`&&n.events.emit(`rotate-start`,{object:r,angle:0}),e)).next(m(n.view,o.rotatePlane)).next(this._renderPlaneToAngle()).next(...this._snapRotation()).next(this._updateGeometry()).next(t=>{let i={object:r,angle:e(t.rotateAngle)};switch(t.action){case`start`:case`update`:n.events.emit(`rotate`,i);break;case`end`:n.inputState=null,n.events.emit(`rotate-stop`,i)}return t}),a.next(()=>{n.inputState!=null&&n.events.emit(`rotate-stop`,{object:r,angle:0}),n.cancelDrag()}))})}_renderPlaneToAngle(){return e=>{let t=p(e.renderStart,e.renderEnd,this._bounds.displayBounds.origin,c(e.plane));return{...e,rotateAngle:t}}}_updateGeometry(){let e=this._bounds;return t=>{let n=r(i(),e.mapBoundsStart.origin),o=t.action===`start`?0:1;if(this._operations){let r=this._operations.rotate(n,t.rotateAngle,o,1);a(e.mapBoundsStart,e.mapBounds),e.updateMapBoundsFromOperation(r)}return t}}}export{y as ExtentRotate};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{set as e,normalize as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as r,scaleAndAdd as i,subtract as a,length as o,dot as s}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as l}from"../../../../../../core/support/UpdatingHandles.js";import{
|
|
2
|
+
import{set as e,normalize as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{copy as r,scaleAndAdd as i,subtract as a,length as o,dot as s}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as l}from"../../../../../../core/support/UpdatingHandles.js";import{create as u,copy as d}from"../../../../../../geometry/support/boundedPlane.js";import{intersectRay as f}from"../../../../../../geometry/support/plane.js";import{sv3d as p}from"../../../../../../geometry/support/vectorStacks.js";import{updateResizeHandle as m,isDiagonalResizeHandle as h,calculateDiagonalResizeHandleScale as g}from"../../../../analysis/Slice/sliceToolUtils.js";import{screenToRenderPlane as _}from"../../dragEventPipeline3D.js";import{mapPlaneAutoSize2D as v}from"./extentUtils.js";import{ResizeManipulator as y}from"../../../manipulators/ResizeManipulator.js";import{fromScreenNormalized as b}from"../../../../support/geometryUtils/ray.js";import{createManipulatorDragEventPipeline as x}from"../../../../../interactive/dragEventPipeline.js";import{ExtentScaleTooltipInfo as S}from"../../../../../interactive/tooltip/infos/ExtentScaleTooltipInfo.js";import{GeometryWorkerHandle as C}from"../../../../../support/GeometryWorkerHandle.js";class w{get _object(){return this._tool.object}get _operations(){return this._object.operations}get updating(){return this._updatingHandles.updating}get zMax(){if(!this._zMaxDirty||!this._operations)return this._zMax;let e=this._operations.data;if(!e.geometry.hasZ)this._zMax=0;else{let t=e.coordinateHelper;this._zMax=-1/0;for(let n of e.parts)for(let e of n.vertices){let n=t.getZ(e.pos)??0;this._zMax=Math.max(n,this._zMax)}}return this._zMaxDirty=!1,this._zMax}constructor(e,t,n){this._tool=e,this._bounds=t,this._preserveAspectRatioStep=n,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._displayBoundsStart=u(),this._displayBoundsMarginStart=0,this._updatingHandles=new l,this._measurementWorker=new C({preloadGeodetic:!0}),this._zMax=0,this._zMaxDirty=!0;let r=this._tool,i=r.view;this.resizeManipulators=this._resizeHandles.map(e=>{let t=new y(i,e);return r.addHandles([t.events.on(`grab-changed`,e=>this._onGrabChanged(e)),this._createResizeDragPipeline(t,e)]),t}),r.manipulators.addMany(this.resizeManipulators),this._operations&&r.addHandles(this._operations.data.on(`change`,()=>{r.inputState?.type!==`resize`&&(this._zMaxDirty=!0)}))}destroy(){this.forEachManipulator(e=>{this._tool.manipulators.remove(e),e.destroy()}),this._measurementWorker.destroy(),this._updatingHandles.destroy()}forEachManipulator(e){this.resizeManipulators.forEach(t=>e(t,2))}updateManipulators(e,t){this.resizeManipulators.forEach((n,r)=>{m(n,this._resizeHandles[r],e,t)})}getUpdatedTooltipInfo(){if(!this.resizeManipulators.some(e=>e.focused))return null;let e=this._tooltipInfo??=new S({toolOptions:this._tool.toolOptions});return this.resizeManipulators.some(e=>e.dragging)||(e.xScale=1,e.yScale=1),this._updatingHandles.consumePromise(v(this._bounds.mapBounds,this.zMax,this._bounds.spatialReference,this._measurementWorker).then(({width:t,height:n})=>{e.xSize=t,e.ySize=n})),e}_onGrabChanged({action:e,screenPoint:t}){let n=this._tool,r=this._bounds;if(e!==`start`||!t)return;let i=b(n.view.state.camera,t);f(r.displayBounds.plane,i,p.get())&&(r.backupMapBounds(),d(r.displayBounds,this._displayBoundsStart),this._displayBoundsMarginStart=r.displayBoundsMargin,n.inputState={type:`resize`})}_createResizeDragPipeline(e,t){let{_tool:n,_object:r}=this;return x(e,(e,i,a)=>{let o;n.inputState!=null&&(i.next(e=>(e.action===`start`&&n.events.emit(`scale-start`,{object:r,xScale:1,yScale:1}),{...e,handle:t})).next(_(n.view,this._displayBoundsStart.plane)).next(this._renderPlaneToFactors()).next(...this._preserveAspectRatioStep()).next(e=>(e.action===`end`&&o?[e.factor1,e.factor2]=o:o=[e.factor1,e.factor2],e)).next(this._updateGeometry()).next(e=>{let t=this._tooltipInfo;t&&(t.xScale=e.factor1,t.yScale=e.factor2);let i={object:r,xScale:e.factor1,yScale:e.factor2};switch(e.action){case`start`:case`update`:n.events.emit(`scale`,i);break;case`end`:n.inputState=null,n.events.emit(`scale-stop`,i)}return e}),a.next(()=>{n.inputState!=null&&n.events.emit(`scale-stop`,{object:r,xScale:1,yScale:1}),n.cancelDrag()}))})}_renderPlaneToFactors(){let e=this._bounds;return t=>{let n=this._displayBoundsStart,c=t.handle.direction,l=e.displayBoundsMargin,u=this._displayBoundsMarginStart,d=r(p.get(),n.origin);i(d,d,n.basis1,-c[0]),i(d,d,n.basis2,-c[1]);let f=a(p.get(),t.renderEnd,d),m=a(p.get(),t.renderStart,d),_=h(t.handle),v=g(n),y=g(e.displayBounds)/v,b=(e,t)=>{if(e===0)return 1;let n=o(t),r=.5*e*s(t,f)/n,i=r<0?-1:1;if(_){let a=n-.5*e*s(t,m)/n;r+=a*i*y}let a=n<u*1.5?1:T;return n=Math.max(n-u,T),i>0&&(r-=l),i*Math.max(r/n*i,a)};return{...t,factor1:b(c[0],n.basis1),factor2:b(c[1],n.basis2)}}}_updateGeometry(){let a=this._bounds;return o=>{let s=r(c(),a.mapBoundsStart.origin);i(s,s,a.mapBoundsStart.basis1,-o.handle.direction[0]),i(s,s,a.mapBoundsStart.basis2,-o.handle.direction[1]);let l=e(n(),a.mapBoundsStart.basis1[0],a.mapBoundsStart.basis1[1]);t(l,l);let u=o.action===`start`?0:1;if(this._operations){let e=this._operations.scale(s,l,o.factor1,o.factor2,u,1);d(a.mapBoundsStart,a.mapBounds),a.updateMapBoundsFromOperation(e)}return o}}}const T=1e-6;export{w as ExtentScale,T as scaleEpsilon};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{on as e}from"../../../../../../core/reactiveUtils.js";import{scale as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{add as n,subtract as r,scale as i,lerp as a,cross as o,normalize as s,dot as c,copy as l,scaleAndAdd as u}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../../../../../../geometry/Point.js";import{
|
|
2
|
+
import{on as e}from"../../../../../../core/reactiveUtils.js";import{scale as t}from"../../../../../../core/libs/gl-matrix-2/math/vec2.js";import{add as n,subtract as r,scale as i,lerp as a,cross as o,normalize as s,dot as c,copy as l,scaleAndAdd as u}from"../../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import f from"../../../../../../geometry/Point.js";import{create as p,copy as m,updateUnboundedPlane as h}from"../../../../../../geometry/support/boundedPlane.js";import{fromPositionAndNormal as g,projectPoint as _}from"../../../../../../geometry/support/plane.js";import{sv3d as v}from"../../../../../../geometry/support/vectorStacks.js";import{mainAxis as y}from"../../geometryUtils.js";import{manipulatedObjectGeometry as b}from"../../manipulatedObjectUtils.js";import{evaluateElevationAlignmentAtPoint as x}from"../../../../layers/graphics/elevationAlignmentUtils.js";import{ElevationContext as S}from"../../../../layers/graphics/ElevationContext.js";import{apply as C,applyInverse as w,calculateOrientedBounds as T}from"../../../../../interactive/editGeometry/support/editPlaneUtils.js";class E{constructor(t,n){this._tool=t,this.mapBounds=p(),this.mapBoundsStart=p(),this.displayBounds=p(),t.addHandles(e(()=>t.object,`modified-externally`,()=>this._resetMapBounds(),{onListenerAdd:()=>this._resetMapBounds()})),this._onDisplayBoundsChanged=n}get displayBoundsMargin(){let{view:e,object:t}=this._tool,n=b(t),r=e.pointsOfInterest?.centerOnSurfaceFrequent.location??n?.extent?.center;return r?D*e.pixelSizeAt(r):0}backupMapBounds(){m(this.mapBounds,this.mapBoundsStart)}updateDisplayBounds(){this._calculateDisplayBounds(),this._onDisplayBoundsChanged?.()}updateMapBoundsFromOperation(e){C(e,this.mapBounds),this.updateDisplayBounds()}updateMapBoundsFromOperationInverse(e){w(e,this.mapBounds),this.updateDisplayBounds()}_resetMapBounds(){this._calculateMapBounds(),this.updateDisplayBounds()}_calculateMapBounds(){let{view:e,attachmentOrigin:n,object:r}=this._tool,i=r.operations?.data;if(!i)return;let a=i.geometry;this.spatialReference=a.spatialReference;let o=y(a);t(o,o,-1);let s=n?e.pixelSizeAt(n,a.spatialReference):0,c=O*s,l=i.coordinateHelper.hasZ()&&r.elevationInfo.mode!==`on-the-ground`;T(o,i,c,this.mapBounds,l)}_calculateDisplayBounds(){let{view:e,attachmentOrigin:t}=this._tool,n=t?.z??x(this.mapBounds.origin,e.elevationProvider,S.fromElevationInfo(this._tool.object.elevationInfo),e.renderCoordsHelper);k(this.mapBounds,n??0,e.renderCoordsHelper,this.spatialReference,this.displayBoundsMargin,this.displayBounds)}}const D=10,O=80;function k(e,t,u,d,f=0,m){m||=p();let y=v.get();n(y,e.origin,e.basis1),n(y,y,e.basis2),u.toRenderCoords(y,d,y);let b=v.get();n(b,e.origin,e.basis1),r(b,b,e.basis2),u.toRenderCoords(b,d,b);let x=v.get();r(x,e.origin,e.basis1),r(x,x,e.basis2),u.toRenderCoords(x,d,x);let S=v.get();r(S,e.origin,e.basis1),n(S,S,e.basis2),u.toRenderCoords(S,d,S),n(m.origin,y,b),n(m.origin,m.origin,x),n(m.origin,m.origin,S),i(m.origin,m.origin,.25),r(y,y,m.origin),r(b,b,m.origin),r(x,x,m.origin),r(S,S,m.origin);let C=a(v.get(),y,b,.5),w=a(v.get(),x,S,.5);i(w,w,-1),a(m.basis1,C,w,.5);let T=a(v.get(),y,S,.5),E=a(v.get(),b,x,.5);i(E,E,-1),a(m.basis2,T,E,.5);let D=o(v.get(),m.basis1,m.basis2);o(m.basis2,D,m.basis1),s(m.basis1,m.basis1);let O=Math.max(Math.abs(c(m.basis1,y)),Math.abs(c(m.basis1,b)),Math.abs(c(m.basis1,x)),Math.abs(c(m.basis1,S)));s(m.basis2,m.basis2);let k=Math.max(Math.abs(c(m.basis2,y)),Math.abs(c(m.basis2,b)),Math.abs(c(m.basis2,x)),Math.abs(c(m.basis2,S)));i(m.basis1,m.basis1,O+f),i(m.basis2,m.basis2,k+f);let A=l(v.get(),e.origin);return A[2]=t,u.toRenderCoords(A,d,A),g(A,D,m.plane),_(m.plane,m.origin,m.origin),h(m),m}async function A(e,t,n,i){return r(F,r(F,e.origin,e.basis1),e.basis2),u(P,F,e.basis1,2),u(N,P,e.basis2,2),u(M,F,e.basis2,2),F[2]=P[2]=N[2]=M[2]=t,i.autoSize2D(j(I,M,n),j(L,N,n),j(R,P,n),j(z,F,n))}function j(e,t,n){return e.x=t[0],e.y=t[1],e.spatialReference=n,e}const M=d(),N=d(),P=d(),F=d(),I=new f,L=new f,R=new f,z=new f;export{E as TransformBounds,A as mapPlaneAutoSize2D};
|