@arcgis/core 4.30.0-next.20240511 → 4.30.0-next.20240513
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/interfaces.d.ts +83 -2
- package/layers/orientedImagery/core/coverageUtils.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/vectorTiles/VectorTileRendererHelper3D.js +1 -1
- package/views/2d/engine/vectorTiles/decluttering/jobsUtil.js +1 -1
- package/views/2d/support/hitTestUtils.js +1 -1
- package/views/3d/interactive/editingTools/move/MoveTool3D.js +1 -1
- package/views/3d/interactive/editingTools/reshape/reshapeTooltipUtils.js +1 -1
- package/views/3d/interactive/editingTools/tooltipUtils3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/TransformTool3D.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/reshapeTooltipUtils.js +5 -0
- package/views/interactive/tooltip/Tooltip.js +1 -1
- package/views/interactive/tooltip/content/tooltipContentFactory.js +1 -1
- package/views/interactive/tooltip/infos/TooltipInfoWithCoordinates.js +1 -1
- package/views/interactive/tooltip/infos/TransformMeshTooltipInfo.js +1 -1
- package/views/interactive/tooltip/tooltipCommonUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/views/interactive/tooltip/content/TooltipContentTranslateVertex.js +0 -5
package/interfaces.d.ts
CHANGED
|
@@ -10106,6 +10106,14 @@ declare namespace __esri {
|
|
|
10106
10106
|
*/
|
|
10107
10107
|
title: string;
|
|
10108
10108
|
readonly type: "building-scene";
|
|
10109
|
+
/**
|
|
10110
|
+
* Determines if the layer will update its temporal data based on the view's [timeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#timeExtent).
|
|
10111
|
+
*
|
|
10112
|
+
* @default true
|
|
10113
|
+
*
|
|
10114
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html#useViewTime)
|
|
10115
|
+
*/
|
|
10116
|
+
useViewTime: boolean;
|
|
10109
10117
|
/**
|
|
10110
10118
|
* The BuildingSceneLayer is designed for visualizing buildings with detailed interiors in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
10111
10119
|
*
|
|
@@ -10162,6 +10170,14 @@ declare namespace __esri {
|
|
|
10162
10170
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html#title)
|
|
10163
10171
|
*/
|
|
10164
10172
|
title?: string;
|
|
10173
|
+
/**
|
|
10174
|
+
* Determines if the layer will update its temporal data based on the view's [timeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#timeExtent).
|
|
10175
|
+
*
|
|
10176
|
+
* @default true
|
|
10177
|
+
*
|
|
10178
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-BuildingSceneLayer.html#useViewTime)
|
|
10179
|
+
*/
|
|
10180
|
+
useViewTime?: boolean;
|
|
10165
10181
|
}
|
|
10166
10182
|
|
|
10167
10183
|
export interface BuildingSceneLayerElevationInfo {
|
|
@@ -10234,6 +10250,14 @@ declare namespace __esri {
|
|
|
10234
10250
|
*/
|
|
10235
10251
|
renderer: Renderer;
|
|
10236
10252
|
readonly type: "building-component";
|
|
10253
|
+
/**
|
|
10254
|
+
* Determines if the layer will update its temporal data based on the view's [timeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#timeExtent).
|
|
10255
|
+
*
|
|
10256
|
+
* @default true
|
|
10257
|
+
*
|
|
10258
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-buildingSublayers-BuildingComponentSublayer.html#useViewTime)
|
|
10259
|
+
*/
|
|
10260
|
+
readonly useViewTime: boolean;
|
|
10237
10261
|
/**
|
|
10238
10262
|
* BuildingComponentSublayers contain 3D Object features representing building components like doors, pipes or AC units.
|
|
10239
10263
|
*
|
|
@@ -10297,7 +10321,7 @@ declare namespace __esri {
|
|
|
10297
10321
|
static fromJSON(json: any): BuildingComponentSublayer;
|
|
10298
10322
|
}
|
|
10299
10323
|
|
|
10300
|
-
interface BuildingComponentSublayerProperties extends BuildingSublayerProperties, LoadableProperties {
|
|
10324
|
+
interface BuildingComponentSublayerProperties extends BuildingSublayerProperties, TemporalSceneLayerProperties, LoadableProperties {
|
|
10301
10325
|
/**
|
|
10302
10326
|
* The SQL where clause used to filter features on the client.
|
|
10303
10327
|
*
|
|
@@ -19710,6 +19734,47 @@ declare namespace __esri {
|
|
|
19710
19734
|
}
|
|
19711
19735
|
|
|
19712
19736
|
export class TemporalSceneLayer {
|
|
19737
|
+
datesInUnknownTimezone: boolean;
|
|
19738
|
+
/**
|
|
19739
|
+
* The layer's time extent.
|
|
19740
|
+
*
|
|
19741
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-TemporalSceneLayer.html#timeExtent)
|
|
19742
|
+
*/
|
|
19743
|
+
timeExtent: TimeExtent;
|
|
19744
|
+
/**
|
|
19745
|
+
* TimeInfo provides information such as date fields that store [start](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#startField) and [end](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#endField) time for each feature and the [fullTimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#fullTimeExtent) for the layer.
|
|
19746
|
+
*
|
|
19747
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-TemporalSceneLayer.html#timeInfo)
|
|
19748
|
+
*/
|
|
19749
|
+
timeInfo: TimeInfo;
|
|
19750
|
+
/**
|
|
19751
|
+
* A temporary offset of the time data based on a certain [TimeInterval](https://developers.arcgis.com/javascript/latest/api-reference/esri-TimeInterval.html).
|
|
19752
|
+
*
|
|
19753
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-TemporalSceneLayer.html#timeOffset)
|
|
19754
|
+
*/
|
|
19755
|
+
timeOffset: TimeInterval;
|
|
19756
|
+
}
|
|
19757
|
+
|
|
19758
|
+
interface TemporalSceneLayerProperties {
|
|
19759
|
+
datesInUnknownTimezone?: boolean;
|
|
19760
|
+
/**
|
|
19761
|
+
* The layer's time extent.
|
|
19762
|
+
*
|
|
19763
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-TemporalSceneLayer.html#timeExtent)
|
|
19764
|
+
*/
|
|
19765
|
+
timeExtent?: TimeExtentProperties;
|
|
19766
|
+
/**
|
|
19767
|
+
* TimeInfo provides information such as date fields that store [start](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#startField) and [end](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#endField) time for each feature and the [fullTimeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-support-TimeInfo.html#fullTimeExtent) for the layer.
|
|
19768
|
+
*
|
|
19769
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-TemporalSceneLayer.html#timeInfo)
|
|
19770
|
+
*/
|
|
19771
|
+
timeInfo?: TimeInfoProperties;
|
|
19772
|
+
/**
|
|
19773
|
+
* A temporary offset of the time data based on a certain [TimeInterval](https://developers.arcgis.com/javascript/latest/api-reference/esri-TimeInterval.html).
|
|
19774
|
+
*
|
|
19775
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-mixins-TemporalSceneLayer.html#timeOffset)
|
|
19776
|
+
*/
|
|
19777
|
+
timeOffset?: TimeIntervalProperties;
|
|
19713
19778
|
}
|
|
19714
19779
|
|
|
19715
19780
|
/**
|
|
@@ -21616,6 +21681,14 @@ declare namespace __esri {
|
|
|
21616
21681
|
*/
|
|
21617
21682
|
title: string;
|
|
21618
21683
|
readonly type: "scene";
|
|
21684
|
+
/**
|
|
21685
|
+
* Determines if the layer will update its temporal data based on the view's [timeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#timeExtent).
|
|
21686
|
+
*
|
|
21687
|
+
* @default true
|
|
21688
|
+
*
|
|
21689
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#useViewTime)
|
|
21690
|
+
*/
|
|
21691
|
+
useViewTime: boolean;
|
|
21619
21692
|
/**
|
|
21620
21693
|
* The SceneLayer is a layer type designed for on-demand streaming and displaying large amounts of data in a [SceneView](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-SceneView.html).
|
|
21621
21694
|
*
|
|
@@ -21719,7 +21792,7 @@ declare namespace __esri {
|
|
|
21719
21792
|
static fromJSON(json: any): SceneLayer;
|
|
21720
21793
|
}
|
|
21721
21794
|
|
|
21722
|
-
interface SceneLayerProperties extends LayerProperties, SceneServiceProperties, PortalLayerProperties, ScaleRangeLayerProperties, CustomParametersMixinProperties, APIKeyMixinProperties {
|
|
21795
|
+
interface SceneLayerProperties extends LayerProperties, SceneServiceProperties, PortalLayerProperties, ScaleRangeLayerProperties, TemporalSceneLayerProperties, CustomParametersMixinProperties, APIKeyMixinProperties {
|
|
21723
21796
|
/**
|
|
21724
21797
|
* The SQL where clause used to filter features.
|
|
21725
21798
|
*
|
|
@@ -21832,6 +21905,14 @@ declare namespace __esri {
|
|
|
21832
21905
|
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#title)
|
|
21833
21906
|
*/
|
|
21834
21907
|
title?: string;
|
|
21908
|
+
/**
|
|
21909
|
+
* Determines if the layer will update its temporal data based on the view's [timeExtent](https://developers.arcgis.com/javascript/latest/api-reference/esri-views-View.html#timeExtent).
|
|
21910
|
+
*
|
|
21911
|
+
* @default true
|
|
21912
|
+
*
|
|
21913
|
+
* [Read more...](https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-SceneLayer.html#useViewTime)
|
|
21914
|
+
*/
|
|
21915
|
+
useViewTime?: boolean;
|
|
21835
21916
|
}
|
|
21836
21917
|
|
|
21837
21918
|
/**
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{zeros as t,create as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{A as r,g as a}from"../../../chunks/vec32.js";import o from"../../../geometry/Circle.js";import i from"../../../geometry/Mesh.js";import{projectWithZConversion as s}from"../../../geometry/projection.js";import{earth as c}from"../../../geometry/support/Ellipsoid.js";import{wrap as f}from"../../../geometry/support/lineSegment.js";import y from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as l}from"../../../geometry/support/MeshVertexAttributes.js";import{intersectLineSegmentClamp as m,create as u,fromArray as x}from"../../../geometry/support/plane.js";import{isWebMercator as p}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as h,calculateRotationMatrix as g,transformMat3 as M,scaleAndAddWithFactor as z,scaleWithFactor as w,computeHFOVAndVFOV as d,projectiveTransform as R}from"../transformations/utils.js";import j from"../../../geometry/Polygon.js";import P from"../../../geometry/SpatialReference.js";import A from"../../../geometry/Multipoint.js";const v=Math.PI/180;function b(e){return e.isSpherical?V(e):D(e)}function D(e){const{horizontalFieldOfView:t,verticalFieldOfView:n,geometry:r,cameraHeading:a}=e,o=h(r);let i=e.cameraPitch,s=e.cameraRoll,c=150;t>150&&(i=90,s=0,c=5);const f=Math.ceil(t/c),y=H(f,a,t);let l=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*v);e.cameraPitch+n/2>=90&&(l=(e.farDistance||20)*o);const m=new j({spatialReference:r?.spatialReference});m.imageID=e.objectId;let u=null;for(const x of y)u=I(x,i,s,e,r,l,o,n,t,f,m);return u.imageID=e.objectId,{polygon:m,frustum:u}}function H(e,t,n){const r=[];if(e%2==0)for(let a=0;a<e/2;a++)r.push(t-n/e*(a+.5),t+n/e*(a+.5));else{r.push(t);for(let a=1;a<e/2;a++)r.push(t-n/e*a,t+n/e*a)}return r.sort(),r}function I(e,n,o,i,s,c,f,y,l,m,u){const x=g("HPR",[e,n,o]),p=q(i,x),h=M([0,0,-1],x),{x:d,y:R}=s,j=z([d,R,i.cameraHeight],h,c,f),P=2*Math.tan(y*v/2)*c,A=2*Math.tan(l/m*v/2)*c,b=M([0,1,0],x),D=M([1,0,0],x),H=w(b,P/2,f),I=w(D,A/2,f),V=r(t(),H,I),F=a(t(),H,I),U=S([a(t(),j,V),a(t(),j,F),r(t(),j,V),r(t(),j,F)],i.cameraHeight,s,f);return U.push(U[0]),u.addRing(U),p}function S(e,t,n,r){return e.map((e=>O(e,t,n,r)))}function V(e){const{geometry:t,farDistance:n,objectId:r,nearDistance:a,cameraHeight:s}=e,c=h(t),f=new o({center:t.clone(),radius:n*c});if(f.imageID=r,a){const e=new o({center:t.clone(),radius:a*c});f.addRing(e.rings[0])}const y=t.clone();y.z=s-n*c;const l=i.createSphere(y,{size:2*n*c});return l.imageID=r,{polygon:f,frustum:l}}function F(e,t){return e.contains(t)}function U(e,t){return Math.sign(e)!==Math.sign(t)}function q(e,n,o){const{cameraHeight:s,cameraPitch:c,farDistance:f,geometry:y,horizontalFieldOfView:m,nearDistance:u,verticalFieldOfView:x}=e,p=k(y),h=u<0?0:u*p;let g=s*p/Math.cos(c*v),d=!0;c+x/2>=90&&(g=(f??20)*p,d=!1);const R=2*Math.tan(x*v/2)*h,j=2*Math.tan(m*v/2)*h,P=2*Math.tan(x*v/2)*g,A=2*Math.tan(m*v/2)*g;let b,D;D=[0,0,-1],D=M(D,n),b=z([y.x,y.y,s],D,g,p),d&&(b[2]=0);const H=z([y.x,y.y,s],D,h,p);let I=[0,1,0];I=M(I,n);let S=[1,0,0];S=M(S,n);let V=[],F=[];h?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(a(t(),H,r(t(),w(I,R/2,p),w(S,j/2,p)))),V=V.concat(a(t(),H,a(t(),w(I,R/2,p),w(S,j/2,p)))),V=V.concat(r(t(),H,r(t(),w(I,R/2,p),w(S,j/2,p)))),V=V.concat(r(t(),H,a(t(),w(I,R/2,p),w(S,j/2,p))))):(V=[y.x,y.y,s],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(a(t(),b,r(t(),w(I,P/2,p),w(S,A/2,p)))),V=V.concat(a(t(),b,a(t(),w(I,P/2,p),w(S,A/2,p)))),V=V.concat(r(t(),b,r(t(),w(I,P/2,p),w(S,A/2,p)))),V=V.concat(r(t(),b,a(t(),w(I,P/2,p),w(S,A/2,p))));const U=new l({position:Float64Array.from(V)});return new i({vertexAttributes:U,components:F,spatialReference:y.spatialReference})}function O(e,n,a,o){{const i=Math.sqrt((e[2]-n)**2+(Math.sqrt((e[0]-a.x)**2+(e[1]-a.y)**2)/o)**2)*o,s=w(r(t(),[e[0],e[1],e[2]],[a.x,a.y,n]),1/i,1/o),c=n/(n-e[2]),f={x:(1-c)*a.x+c*e[0],y:(1-c)*a.y+c*e[1],z:(1-c)*n+c*e[2]},y=Math.sqrt((f.z-n)**2+(Math.sqrt((f.x-a.x)**2+(f.y-a.y)**2)/o)**2)*o,l=w(r(t(),[f.x,f.y,f.z],[a.x,a.y,n]),1/y,1/o);return U(s[0],l[0])&&U(s[1],l[1])&&U(s[2],l[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function C(e){const{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:s}=e,c=k(e.geometry),f=new j({spatialReference:t}),y=Math.abs(1.44*i*c);let l=Math.abs(1.44*s*c);(o<20||null==a)&&(l=y);const m=[];return m[0]={x:n+y*Math.sin((a-45)*v),y:r+y*Math.cos((a-45)*v)},m[1]={x:n+y*Math.sin((a+45)*v),y:r+y*Math.cos((a+45)*v)},m[2]={x:n+l*Math.sin((a+135)*v),y:r+l*Math.cos((a+135)*v)},m[3]={x:n+l*Math.sin((a+225)*v),y:r+l*Math.cos((a+225)*v)},f.addRing([[m[0].x,m[0].y,0],[m[1].x,m[1].y,0],[m[2].x,m[2].y,0],[m[3].x,m[3].y,0],[m[0].x,m[0].y,0]]),f}function k(e){return e&&p(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/c.radius))):1}function E(e,n){const a=1+n/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:n}=e,r=new o({radius:t*a,center:n});return e.rings.length>1&&r.addRing(e.rings[1]),r}if("esri.geometry.Polygon"===e.declaredClass){const n=new j({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let n=0;n<e.rings[0].length;n++){const s=Math.sqrt((o.x-e.rings[0][n][0])**2+(o.y-e.rings[0][n][1])**2),c=w(r(t(),[e.rings[0][n][0],e.rings[0][n][1],0],[o.x,o.y,0]),1/s,1),f=z([o.x,o.y,0],c,s*a,1);i.push({x:f[0],y:f[1]})}n.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return n}return e}async function L(e,t,n){const{cameraHeight:r,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:s,imageHeight:c,imageWidth:f,inSRS:y,outSRS:l,verticalFieldOfView:m,cameraRoll:u,imageRotation:x,options:p}=n,h=new P(y),g=new P(l),M=d(s,m,u??0),z=i.length>15;return o+M.vfov/2>=90?await K(i,e,f,c,h,g,z,x,p):await W(i,e,t,a,r,z,h,g,p)}async function W(e,t,n,r,a,o,s,c,f){const y=B(e,t,n,r,a);if(!y)return;const{farPlane:m,nearPlane:u}=y,x=await N([...u?.vertexPositions??e.slice(0,3),...m.vertexPositions],s,c,f);return new i({vertexAttributes:new l({position:x}),components:Y(X(o)),spatialReference:c})}function B(e,t,n,r,a){const o=T(e),i=T(e,"near");if(!o)return;const{coefficients:s}=o,c=t.length;for(let f=0;f<c;f++){const e=Q([n[f][0],n[f][1]],s),t=n[f];t[2]=(t[2]>=0?e:t[2])??0;const c=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??a)];J(r,c,f,i),G(r,c,f,o,n,e)}return{farPlane:o,nearPlane:i}}function G(e,t,r,a,o,i){const{coefficients:s,vertexPositions:c}=a;if(null!=i&&i>=0)c.splice(3*r,3,...o[r]);else{const a=n();m(s,f(e,t),a)&&c.splice(3*r,3,...a)}}function J(e,t,r,a){if(!a)return;const o=n();m(a.coefficients,f(e,t),o)&&a.vertexPositions.splice(3*r,3,...o)}async function K(e,t,n,r,a,o,s,c=0,f){const y=Math.cos((c??0)*v),m=Math.sin((c??0)*v),u=Math.abs(n*y+r*m),x=Math.abs(n*-m+r*y);let p,h,g=s?new Array:[e[0],e[1],e[2]],M=new Array;const z=t.length;for(let i=0;i<z;i++){const a=[u/2,x/2],o=t[i];h=[(o[0]-a[0])*y-(o[1]-a[1])*m+a[0],(o[0]-a[0])*m+(o[1]-a[1])*y+a[1]],s?(p=R({x:h[0],y:h[1],z:1},{x:0,y:0,z:1},{x:n,y:0,z:1},{x:n,y:r,z:1},{x:0,y:r,z:1},{x:e[0],y:e[1],z:e[2]},{x:e[3],y:e[4],z:e[5]},{x:e[6],y:e[7],z:e[8]},{x:e[9],y:e[10],z:e[11]}),g=g.concat([p.x,p.y,p.z]),p=R({x:h[0],y:h[1],z:1},{x:0,y:0,z:1},{x:n,y:0,z:1},{x:n,y:r,z:1},{x:0,y:r,z:1},{x:e[12],y:e[13],z:e[14]},{x:e[15],y:e[16],z:e[17]},{x:e[18],y:e[19],z:e[20]},{x:e[21],y:e[22],z:e[23]}),M=M.concat([p.x,p.y,p.z])):(p=R({x:h[0],y:h[1],z:1},{x:0,y:0,z:1},{x:n,y:0,z:1},{x:n,y:r,z:1},{x:0,y:r,z:1},{x:e[3],y:e[4],z:e[5]},{x:e[6],y:e[7],z:e[8]},{x:e[9],y:e[10],z:e[11]},{x:e[12],y:e[13],z:e[14]}),g=g.concat([p.x,p.y,p.z]))}g=g.concat(M);const w=await N(g,a,o,f);return new i({vertexAttributes:new l({position:w}),components:Y(X(s)),spatialReference:o})}async function N(t,n,r,a){if(n.equals(r))return t;const o=t.reduce(((e,t,n)=>{const r=Math.floor(n/3);return e[r]||(e[r]=new Array),e[r].push(t),e}),new Array),{points:i}=await s(new A(o,n),r,a);return e(a),i.flat()}function Q(e,t){if(t)return(-t[3]-t[0]*e[0]-t[1]*e[1])/t[2]}function T(e,t="far"){const n=u();let r;switch(t){case"far":if(r=Array.from(15===e.length?e.slice(3):e.slice(12)),x(n,r,!1))return{coefficients:n,vertexPositions:r};break;case"near":if(r=Array.from(e.slice(0,12)),15===e.length||!x(n,r,!1))return;return{coefficients:n,vertexPositions:r}}}const X=e=>e?[{faces:new Uint32Array([4,0,3,4,7,3])},{faces:new Uint32Array([5,1,2,5,6,2])},{faces:new Uint32Array([4,0,1,4,5,1])},{faces:new Uint32Array([6,2,3,6,7,3])}]:[{faces:new Uint32Array([0,1,2,0,2,3,0,3,4,0,4,1])}],Y=e=>e.map((e=>new y(e)));export{F as checkIfPolygonContainsSelectedPoint,C as computePolygonForInspection,b as createCoveragePolygon,N as projectVertices,E as resizePolygon,L as updateFrustum};
|
|
5
|
+
import"../../../geometry.js";import{throwIfAborted as e}from"../../../core/promiseUtils.js";import{zeros as t,create as n}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{A as r,g as a}from"../../../chunks/vec32.js";import o from"../../../geometry/Circle.js";import i from"../../../geometry/Mesh.js";import{projectWithZConversion as s}from"../../../geometry/projection.js";import{earth as c}from"../../../geometry/support/Ellipsoid.js";import{wrap as f}from"../../../geometry/support/lineSegment.js";import y from"../../../geometry/support/MeshComponent.js";import{MeshVertexAttributes as l}from"../../../geometry/support/MeshVertexAttributes.js";import{intersectLineSegmentClamp as m,create as u,fromArray as x}from"../../../geometry/support/plane.js";import{isWebMercator as p}from"../../../geometry/support/spatialReferenceUtils.js";import{getWebMercatorScalingFactor as h,calculateRotationMatrix as g,transformMat3 as M,scaleAndAddWithFactor as z,scaleWithFactor as w,computeHFOVAndVFOV as d,projectiveTransform as R}from"../transformations/utils.js";import j from"../../../geometry/Polygon.js";import P from"../../../geometry/SpatialReference.js";import A from"../../../geometry/Multipoint.js";const v=Math.PI/180;function b(e){return e.isSpherical?V(e):D(e)}function D(e){const{horizontalFieldOfView:t,verticalFieldOfView:n,geometry:r,cameraHeading:a}=e,o=h(r);let i=e.cameraPitch,s=e.cameraRoll,c=150;t>150&&(i=90,s=0,c=5);const f=Math.ceil(t/c),y=H(f,a,t);let l=e.farDistance?e.farDistance*o:e.cameraHeight*o/Math.cos(i*v);e.cameraPitch+n/2>=90&&(l=(e.farDistance||20)*o);const m=new j({spatialReference:r?.spatialReference});m.imageID=e.objectId;let u=null;for(const x of y)u=I(x,i,s,e,r,l,o,n,t,f,m);return u.imageID=e.objectId,{polygon:m,frustum:u}}function H(e,t,n){const r=[];if(e%2==0)for(let a=0;a<e/2;a++)r.push(t-n/e*(a+.5),t+n/e*(a+.5));else{r.push(t);for(let a=1;a<e/2;a++)r.push(t-n/e*a,t+n/e*a)}return r.sort(),r}function I(e,n,o,i,s,c,f,y,l,m,u){const x=g("HPR",[e,n,o]),p=q(i,x),h=M([0,0,-1],x),{x:d,y:R}=s,j=z([d,R,i.cameraHeight],h,c,f),P=2*Math.tan(y*v/2)*c,A=2*Math.tan(l/m*v/2)*c,b=M([0,1,0],x),D=M([1,0,0],x),H=w(b,P/2,f),I=w(D,A/2,f),V=r(t(),H,I),F=a(t(),H,I),U=S([a(t(),j,V),a(t(),j,F),r(t(),j,V),r(t(),j,F)],i.cameraHeight,s,f);return U.push(U[0]),u.addRing(U),p}function S(e,t,n,r){return e.map((e=>O(e,t,n,r)))}function V(e){const{geometry:t,farDistance:n,objectId:r,nearDistance:a,cameraHeight:s}=e,c=h(t),f=new o({center:t.clone(),radius:n*c});if(f.imageID=r,a){const e=new o({center:t.clone(),radius:a*c});f.addRing(e.rings[0])}const y=t.clone();y.z=s-n*c;const l=i.createSphere(y,{size:2*n*c});return l.imageID=r,{polygon:f,frustum:l}}function F(e,t){return e.contains(t)}function U(e,t){return Math.sign(e)!==Math.sign(t)}function q(e,n,o){const{cameraHeight:s,cameraPitch:c,farDistance:f,geometry:y,horizontalFieldOfView:m,nearDistance:u,verticalFieldOfView:x}=e,p=k(y),h=u<0?0:u*p;let g=s*p/Math.cos(c*v),d=!0;c+x/2>=90&&(g=(f??20)*p,d=!1);const R=2*Math.tan(x*v/2)*h,j=2*Math.tan(m*v/2)*h,P=2*Math.tan(x*v/2)*g,A=2*Math.tan(m*v/2)*g;let b,D;D=[0,0,-1],D=M(D,n),b=z([y.x,y.y,s],D,g,p),d&&(b[2]=0);const H=z([y.x,y.y,s],D,h,p);let I=[0,1,0];I=M(I,n);let S=[1,0,0];S=M(S,n);let V=[],F=[];h?(F=[{faces:[4,0,3,4,7,3]},{faces:[5,1,2,5,6,2]},{faces:[4,0,1,4,5,1]},{faces:[6,2,3,6,7,3]}],V=V.concat(a(t(),H,r(t(),w(I,R/2,p),w(S,j/2,p)))),V=V.concat(a(t(),H,a(t(),w(I,R/2,p),w(S,j/2,p)))),V=V.concat(r(t(),H,r(t(),w(I,R/2,p),w(S,j/2,p)))),V=V.concat(r(t(),H,a(t(),w(I,R/2,p),w(S,j/2,p))))):(V=[y.x,y.y,s],F=[{faces:[0,1,2,0,2,3,0,3,4,0,4,1]}]),V=V.concat(a(t(),b,r(t(),w(I,P/2,p),w(S,A/2,p)))),V=V.concat(a(t(),b,a(t(),w(I,P/2,p),w(S,A/2,p)))),V=V.concat(r(t(),b,r(t(),w(I,P/2,p),w(S,A/2,p)))),V=V.concat(r(t(),b,a(t(),w(I,P/2,p),w(S,A/2,p))));const U=new l({position:Float64Array.from(V)});return new i({vertexAttributes:U,components:F,spatialReference:y.spatialReference})}function O(e,n,a,o){{const i=Math.sqrt((e[2]-n)**2+(Math.sqrt((e[0]-a.x)**2+(e[1]-a.y)**2)/o)**2)*o,s=w(r(t(),[e[0],e[1],e[2]],[a.x,a.y,n]),1/i,1/o),c=n/(n-e[2]),f={x:(1-c)*a.x+c*e[0],y:(1-c)*a.y+c*e[1],z:(1-c)*n+c*e[2]},y=Math.sqrt((f.z-n)**2+(Math.sqrt((f.x-a.x)**2+(f.y-a.y)**2)/o)**2)*o,l=w(r(t(),[f.x,f.y,f.z],[a.x,a.y,n]),1/y,1/o);return U(s[0],l[0])&&U(s[1],l[1])&&U(s[2],l[2])||e[2]>=0?[e[0],e[1],0]:[f.x,f.y,f.z]}}function C(e){const{spatialReference:t,x:n,y:r}=e.geometry,{cameraHeading:a,cameraPitch:o,farDistance:i,nearDistance:s}=e,c=k(e.geometry),f=new j({spatialReference:t}),y=Math.abs(1.44*i*c);let l=Math.abs(1.44*s*c);(o<20||null==a)&&(l=y);const m=[];return m[0]={x:n+y*Math.sin((a-45)*v),y:r+y*Math.cos((a-45)*v)},m[1]={x:n+y*Math.sin((a+45)*v),y:r+y*Math.cos((a+45)*v)},m[2]={x:n+l*Math.sin((a+135)*v),y:r+l*Math.cos((a+135)*v)},m[3]={x:n+l*Math.sin((a+225)*v),y:r+l*Math.cos((a+225)*v)},f.addRing([[m[0].x,m[0].y,0],[m[1].x,m[1].y,0],[m[2].x,m[2].y,0],[m[3].x,m[3].y,0],[m[0].x,m[0].y,0]]),f}function k(e){return e&&p(e?.spatialReference)?1/Math.cos(Math.PI/2-2*Math.atan(Math.exp(-1*e.y/c.radius))):1}function E(e,n){const a=1+n/100;if("esri.geometry.Circle"===e.declaredClass){const{radius:t,center:n}=e,r=new o({radius:t*a,center:n});return e.rings.length>1&&r.addRing(e.rings[1]),r}if("esri.geometry.Polygon"===e.declaredClass){const n=new j({spatialReference:e.spatialReference}),o=e.centroid;if(o){const i=[];for(let n=0;n<e.rings[0].length;n++){const s=Math.sqrt((o.x-e.rings[0][n][0])**2+(o.y-e.rings[0][n][1])**2),c=w(r(t(),[e.rings[0][n][0],e.rings[0][n][1],0],[o.x,o.y,0]),1/s,1),f=z([o.x,o.y,0],c,s*a,1);i.push({x:f[0],y:f[1]})}n.addRing([[i[0].x,i[0].y,0],[i[1].x,i[1].y,0],[i[2].x,i[2].y,0],[i[3].x,i[3].y,0],[i[0].x,i[0].y,0]])}return n}return e}async function L(e,t,n){const{cameraHeight:r,cameraLocation:a,cameraPitch:o,frustumVertices:i,horizontalFieldOfView:s,imageHeight:c,imageWidth:f,inSRS:y,outSRS:l,verticalFieldOfView:m,cameraRoll:u,imageRotation:x,options:p}=n,h=new P(y),g=new P(l),M=d(s,m,u??0),z=i.length>15;return o+M.vfov/2>=90?await K(i,e,f,c,h,g,z,x,p):await W(i,e,t,a,r,z,h,g,p)}async function W(e,t,n,r,a,o,s,c,f){const y=B(e,t,n,r,a);if(!y)return;const{farPlane:m,nearPlane:u}=y,x=await N([...u?.vertexPositions??e.slice(0,3),...m.vertexPositions],s,c,f);return new i({vertexAttributes:new l({position:x}),components:Y(X(o)),spatialReference:c})}function B(e,t,n,r,a){const o=T(e),i=T(e,"near");if(!o)return;const{coefficients:s}=o,c=t.length;for(let f=0;f<c;f++){const e=Q([n[f][0],n[f][1]],s),t=n[f];t[2]=(t[2]>=0?e:t[2])??0;const c=[t[0]-r[0],t[1]-r[1],t[2]-(r[2]??a)];J(r,c,f,i),G(r,c,f,o,n,e)}return{farPlane:o,nearPlane:i}}function G(e,t,r,a,o,i){const{coefficients:s,vertexPositions:c}=a;if(null!=i&&i>=0)c.splice(3*r,3,...o[r]);else{const a=n();m(s,f(e,t),a)&&c.splice(3*r,3,...a)}}function J(e,t,r,a){if(!a)return;const o=n();m(a.coefficients,f(e,t),o)&&a.vertexPositions.splice(3*r,3,...o)}async function K(e,t,n,r,a,o,s,c=0,f){const y=Math.cos((c??0)*v),m=Math.sin((c??0)*v),u=Math.abs(n*y+r*m),x=Math.abs(n*-m+r*y);let p,h,g=s?new Array:[e[0],e[1],e[2]],M=new Array;const z=t.length;for(let i=0;i<z;i++){const a=[u/2,x/2],o=t[i];h=[(o[0]-a[0])*y-(o[1]-a[1])*m+a[0],(o[0]-a[0])*m+(o[1]-a[1])*y+a[1]],s?(p=R({x:h[0],y:h[1],z:1},{x:0,y:0,z:1},{x:n,y:0,z:1},{x:n,y:r,z:1},{x:0,y:r,z:1},{x:e[0],y:e[1],z:e[2]},{x:e[3],y:e[4],z:e[5]},{x:e[6],y:e[7],z:e[8]},{x:e[9],y:e[10],z:e[11]}),g=g.concat([p.x,p.y,p.z]),p=R({x:h[0],y:h[1],z:1},{x:0,y:0,z:1},{x:n,y:0,z:1},{x:n,y:r,z:1},{x:0,y:r,z:1},{x:e[12],y:e[13],z:e[14]},{x:e[15],y:e[16],z:e[17]},{x:e[18],y:e[19],z:e[20]},{x:e[21],y:e[22],z:e[23]}),M=M.concat([p.x,p.y,p.z])):(p=R({x:h[0],y:h[1],z:1},{x:0,y:0,z:1},{x:n,y:0,z:1},{x:n,y:r,z:1},{x:0,y:r,z:1},{x:e[3],y:e[4],z:e[5]},{x:e[6],y:e[7],z:e[8]},{x:e[9],y:e[10],z:e[11]},{x:e[12],y:e[13],z:e[14]}),g=g.concat([p.x,p.y,p.z]))}g=g.concat(M);const w=await N(g,a,o,f);return new i({vertexAttributes:new l({position:w}),components:Y(X(s)),spatialReference:o})}async function N(t,n,r,a){if(n.equals(r))return t;const o=t.reduce(((e,t,n)=>{const r=Math.floor(n/3);return e[r]||(e[r]=new Array),e[r].push(t),e}),new Array),{points:i}=await s(new A(o,n),r,a);return e(a),i.flat()}function Q(e,t){if(t)return(-t[3]-t[0]*e[0]-t[1]*e[1])/t[2]}function T(e,t="far"){const n=u();let r;switch(t){case"far":if(r=Array.from(15===e.length?e.slice(3):e.slice(12)),x(n,r,!1))return{coefficients:n,vertexPositions:r};break;case"near":if(r=Array.from(e.slice(0,12)),15===e.length||!x(n,r,!1))return;return{coefficients:n,vertexPositions:r}}}const X=e=>e?[{faces:new Uint32Array([4,0,3,4,7,3])},{faces:new Uint32Array([5,1,2,5,6,2])},{faces:new Uint32Array([4,0,1,4,5,1])},{faces:new Uint32Array([6,2,3,6,7,3])}]:[{faces:new Uint32Array([0,1,2,0,2,3,0,3,4,0,4,1])}],Y=e=>e.map((e=>new y(e)));export{F as checkIfPolygonContainsSelectedPoint,C as computePolygonForInspection,b as createCoveragePolygon,S as limitZToGround,N as projectVertices,E as resizePolygon,L as updateFrustum};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import"../../../core/has.js";import"../../../core/Logger.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{zeros as t,create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{m as a,A as n,g as i}from"../../../chunks/vec32.js";import o from"../../../geometry/Point.js";import{projectWithZConversion as s,initializeProjection as c,project as f}from"../../../geometry/projection.js";import{fromPoints as
|
|
5
|
+
import"../../../geometry.js";import"../../../core/has.js";import"../../../core/Logger.js";import{deg2rad as e}from"../../../core/mathUtils.js";import{zeros as t,create as r}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{m as a,A as n,g as i}from"../../../chunks/vec32.js";import o from"../../../geometry/Point.js";import{projectWithZConversion as s,initializeProjection as c,project as f}from"../../../geometry/projection.js";import{fromPoints as m,fromValues as p}from"../../../geometry/support/ray.js";import{k as l,i as y}from"../../../chunks/sphere.js";import{geographicToWebMercator as u,webMercatorToGeographic as x}from"../../../geometry/support/webMercatorUtils.js";import{limitZToGround as w}from"../core/coverageUtils.js";import z from"../core/ExposurePoint.js";import{transformPoints as g,updateElevation as h}from"./groundToImageUtils.js";import{getWebMercatorScalingFactor as d,convertPixelToHeadingPitch as R,convertHeadingPitchToSphereVertex as j,scaleAndAddWithFactor as b,hasCameraOrientationLTP as P,computeHFOVAndVFOV as v,ltpToGeographic as M,projectiveTransform2 as O,scaleWithFactor as S,calculateRotationMatrix as F,transformMat3 as L,projectiveTransform as H,getPlaneLineIntersectionPoint as A}from"./utils.js";import{defaultImageSphereCenter as V}from"../../../widgets/PanoramicViewer/constants.js";import{isNumber as T}from"../../../widgets/support/dataUtils.js";import U from"../../../geometry/Polygon.js";import C from"../../../geometry/SpatialReference.js";function D(e,t){if(!e)return Promise.resolve([]);const r=t.feature;let a=r.attributes;return a instanceof z||(a=z.fromJSON(r),a&&(r.attributes=a)),E(e,t)}function E(e,t){const{attributes:r}=t.feature;if(r.isSpherical||360===r.horizontalFieldOfView){const{location:a,cameraOrientation:n,farDistance:i,cameraHeading:o,cameraHeight:s}=r;return G(e,a,i,[t.imageProperties.width,t.imageProperties.height],o,s,n)}return W(e,t)}async function G(e,t,a,n,i,s,c){let f=new o(t);const x=d(f);f.spatialReference.isGeographic&&f.spatialReference.isWGS84&&4!==c?.type&&(f=u(f));const w=new Array,[z,g,h]=f.toArray(),P=l([z,g,h??0],a/x),v=V.toArray();for(const l of e){let e,t;if(T(l.heading)&&T(l.pitch))e=l.heading,t=l.pitch;else{const r=R({x:l.x,y:l.y},n[0],n[1]);e=r.heading,t=r.pitch}e=(e+i)%360;const a=m([v[0],v[1],v[2]],j(e,t)),c=p([z,g,h??0],a.direction),u=r();y(P,c,u);const d=(f.z??0)-s;if(u[2]<d){const e=Math.abs((f.z-d)/-a.direction[2])*x;b([f.x,f.y,f.z],a.direction,e,x,u)}else u[2]=d;w.push(new o(u,f.spatialReference))}return w}async function W(e,t){const{feature:r,footprintExtent:a,options:n}=t,{attributes:{cameraHeight:i,cameraOrientation:c,cameraPitch:f,cameraRoll:m,elevationSource:p,horizontalFieldOfView:l,location:y,verticalFieldOfView:w},elevationSample:z}=r,h=P(c),{vfov:R}=v(l,w,m??0);let j=new o(y),b=!1;h&&(j=new o(M(j,[c.latitude,c.longitude,c.ellipsoidRadius,c.squaredEccentricity]))),j.spatialReference.isWGS84&&(b=!0,j=u(j));const S=d(j),F=N(t,j,S),L=h?F.map((e=>x(new o(e)))):F,H=await g(L,t,!0).then((e=>e.map((e=>({x:e.x,y:e.y,z:1}))))),A=new Array;for(const u of e){const e={...u,z:1},r={...O(e,H,L),spatialReference:j.spatialReference},[c]=await g([h?x(new o(r)):new o(r)],t,!0);await Z(e,c,H,L,j,r,h,t);const m=await s(p||z?await k({cameraLocation:j,groundFootPrint:L,projectedPoint:r,webMercatorScalingFactor:S,vfov:R,shouldConvertToLatLong:b,isCameraOrientationLTP:h,imgPoint:e},t):new o(J(r,j,S,j.z-i,f,R,b)),a.spatialReference,n);A.push(m)}return A}async function k(e,t){const{cameraLocation:r,groundFootPrint:a,projectedPoint:n,webMercatorScalingFactor:i,vfov:s,shouldConvertToLatLong:f,isCameraOrientationLTP:m,imgPoint:p}=e,{cameraHeight:l,cameraPitch:y}=t.feature.attributes;await c(r.spatialReference,t.footprintExtent.spatialReference,null,t.options);let u=await I(a,t),w=0,z=r.z??0-l,d=0;for(;d<10;){const e=B(u,r,n);if(!e||!q([r.x,r.y,r.z],[e.x,e.y,e.z],[n.x,n.y,n.z]))return new o(J(n,r,i,z,y,s,f));const a=new o({x:e.x,y:e.y,z:e.z,spatialReference:r.spatialReference}),c=await g([m?x(a):a],t);if(w=Math.abs(p.x-c[0].x)+Math.abs(p.y-c[0].y),z=e.z,w<=1)return new o(J(n,r,i,z,y,s,f));d+=1;const{extent:l}=u,R=(l?.width??0)/10,j=(l?.height??0)/10;if(R<1||j<1)return new o(J(n,r,i,z,y,s,f));const{x:b,y:P}=e,v=await h(K(R,j).map((([e,t])=>new o({x:b+e,y:P+t,spatialReference:r.spatialReference}))),t,!1);v.push(v[0]),u=new U({rings:[v.map((e=>e.toArray()))],spatialReference:r.spatialReference})}return new o(J(n,r,i,z,y,s,f))}const q=(e,r,i)=>a(n(t(),r,e),n(t(),i,e))>0;function J(e,r,a,i,s,c,f){const m=Math.sqrt((e.z-r.z)**2+(Math.sqrt((e.x-r.x)**2+(e.y-r.y)**2)/a)**2)*a,p=S(n(t(),[e.x,e.y,e.z],[r.x,r.y,r.z]),1/m,1/a);if(e.z<i||s+c/2<90){const t=Math.abs((r.z-i)/-p[2])*a,n=b([r.x,r.y,r.z],p,t,a);e.x=n[0],e.y=n[1],e.z=n[2]}else e.z=i;return f?x(new o(e)).toJSON():e}function N(r,a,s){const{feature:c}=r,{attributes:f}=c,m=2*Math.tan(e(f.verticalFieldOfView)/2)*f.farDistance*s,p=2*Math.tan(e(f.horizontalFieldOfView)/2)*f.farDistance*s,l=F("HPR",[f.cameraHeading,f.cameraPitch,f.cameraRoll??0]),y=L([0,0,-1],l),u=b([a.x,a.y,a.z],y,f.farDistance*s,s),x=L([0,1,0],l),w=L([1,0,0],l),z=S(x,m/2,s),g=S(w,p/2,s),h=n(t(),z,g),d=i(t(),z,g);return[i(t(),u,h),i(t(),u,d),n(t(),u,h),n(t(),u,d)].map((e=>{const[t,r,n]=e;return new o({x:t,y:r,z:n,spatialReference:a.spatialReference})}))}async function I(e,t){const r=e[0].spatialReference.isWGS84?C.WebMercator:e[0].spatialReference,{cameraHeight:a,location:n,elevation:i}=t.feature.attributes,s="number"==typeof n.z&&"number"==typeof i?n.z-i:a,c=w(e.map((({x:e,y:t,z:r})=>[e,t,r])),s,n,d(n)),m=(await h(c.map((e=>new o(e,n.spatialReference))),t,!1)).map((e=>f(e,r)));return new U({hasZ:!0,rings:[m.map((e=>[e.x,e.y,e.z]))],spatialReference:r})}async function Z(e,t,r,a,n,i,s,c){let f=0;const m=8;for(let p=0;p<=m;p+=1){if(f=Math.abs(e.x-t.x)+Math.abs(e.y-t.y),f<=1)return;const[m,p,l,y]=K(f,f).map((([t,i])=>({...H({x:e.x+t,y:e.y+i,z:1},r[0],r[1],r[2],r[3],{x:a[0].x,y:a[0].y,z:a[0].z},{x:a[1].x,y:a[1].y,z:a[1].z},{x:a[2].x,y:a[2].y,z:a[2].z},{x:a[3].x,y:a[3].y,z:a[3].z}),spatialReference:n.spatialReference}))),[u,w,z,h]=await g(s?[x(new o(m)),x(new o(p)),x(new o(l)),x(new o(y))]:[new o(m),new o(p),new o(l),new o(y)],c,!0).then((e=>e.map((e=>({...e,z:0}))))),{x:d,y:R,z:j}=H(e,u,w,z,h,m,p,l,y);i.x=d,i.y=R,i.z=j,[t]=await g([s?x(new o(i)):new o(i)],c,!0)}}function B(e,t,r){const a={x:e.rings[0][0][0],y:e.rings[0][0][1],z:e.rings[0][0][2]},n={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},i={x:e.rings[0][1][0],y:e.rings[0][1][1],z:e.rings[0][1][2]},o={x:e.rings[0][2][0],y:e.rings[0][2][1],z:e.rings[0][2][2]},s=(o.z-i.z)*(n.y-a.y)-(o.y-i.y)*(n.z-a.z),c=-((o.z-i.z)*(n.x-a.x)-(n.z-a.z)*(o.x-i.x)),f=(o.y-i.y)*(n.x-a.x)-(n.y-a.y)*(o.x-i.x),m=-(s*a.x+c*a.y+f*a.z);return A(t.toJSON(),r,s,c,f,m)}const K=(e,t)=>[[-e,-t],[e,-t],[e,t],[-e,t]];export{D as transformPoints};
|
package/package.json
CHANGED
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const a="
|
|
5
|
+
const a="20240513",d="b34dabdaa8036c7a3dc559ef9209ad200a478430";export{a as buildDate,d as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{create as i}from"../../../../geometry/support/aaBoundingRect.js";import{TileHandler as s}from"./TileHandler.js";import{VectorTile as r}from"./VectorTile.js";import
|
|
5
|
+
import{MinPriority as e}from"../../../../core/MemCache.js";import{throwIfAborted as t}from"../../../../core/promiseUtils.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{create as i}from"../../../../geometry/support/aaBoundingRect.js";import{TileHandler as s}from"./TileHandler.js";import{VectorTile as r}from"./VectorTile.js";import n from"../../tiling/TileInfoViewPOT.js";import l from"../../tiling/TileKey.js";class a extends s{constructor(e,t,o,i){super(e,t,o,e.tileInfo.lods.length-1),this._memCache=i,this._ongoingTileRequests=new Map,this._ongoingRequestToController=new Map,this._tileInfoView=new n(e.tileInfo,e.fullExtent)}destroy(){super.destroy(),this._ongoingRequestToController.forEach((e=>e.abort())),this._ongoingRequestToController.clear(),this._ongoingTileRequests.clear()}async getVectorTile(s,n){const a=new l(s[0],s[1],s[2],0);let g=this._memCache.get(a.id);if(null!=g)return g.retain(),g;const h=await this._getVectorTileData(a);if(t(n),!this._layer)return null;if(g=this._memCache.get(a.id),null!=g)return g.retain(),g;const u=this._layer.tileInfo.getTileBounds(i(),a),m=this._tileInfoView.getTileResolution(s[0]);return g=new r(a,m,u[0],u[3],512,512,this._styleRepository,this._memCache),g.setData(h),h&&(g.retain(),this._memCache.put(a.id,g,g.usedMemory,e)),g.neededForCoverage=!0,g.transforms.tileUnitsToPixels=o(1/8,0,0,0,1/8,0,0,0,1),g}_getVectorTileData(e){const t=e.id;if(this._ongoingTileRequests.has(t))return this._ongoingTileRequests.get(t);const o=new AbortController,i={signal:o.signal},s=this._getParsedVectorTileData(e,i).then((e=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),e))).catch((()=>(this._ongoingTileRequests.delete(t),this._ongoingRequestToController.delete(t),null)));return this._ongoingTileRequests.set(t,s),this._ongoingRequestToController.set(t,o),s}_getParsedVectorTileData(e,t){return this.fetchTileData(e,t).then((o=>this.parseTileData({key:e,data:o},t)))}}export{a as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../
|
|
5
|
+
import{set as e,identity as t,translate as i,rotate as s,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{toRadian as r}from"../../../../core/libs/gl-matrix-2/math/common.js";import"../../tiling/TileInfoView.js";import a from"../../tiling/TileKey.js";import"../../tiling/TileQueue.js";import"../../tiling/TileStrategy.js";import{declutterSingleTile as o}from"./decluttering/jobsUtil.js";import{StyleLayerType as d}from"./style/StyleDefinition.js";import{RenderableTile as c}from"../webgl/RenderableTile.js";import{TileReshuffleManager as h}from"../webgl/TileReshuffleManager.js";import{CompareFunction as u,StencilOperation as m}from"../../../webgl/enums.js";const p=.125;class f{constructor(){this._renderParams={reshuffleManager:new h,context:null,drawPhase:1,state:new g,stationary:!0,pixelRatio:1,displayLevel:-1,requiredLevel:-1,globalOpacity:1,renderPass:"background",styleLayer:null,styleLayerUID:-1,painter:null,glyphMosaic:null,spriteMosaic:null,profiler:null,renderingOptions:null,requestRender:null,allowDelayedRender:!1,deltaTime:-1,timeline:null,time:0,hasClipping:!1,blendMode:null,dataUploadCounter:0,effects:null,inFadeTransition:!1,requireFBO:!1,highlightGradient:null,stencilSymbols:!0,is3D:!0,backgroundColor:null},this._backgroundTile=new c(new a(0,0,0,0),0,0,0,512,512,4096,4096),this._heading=0,this._declutteredForHeading=new WeakMap}dispose(){this._renderParams=null}renderBackground(e,t,i,s,l,n,r,a,o,d){const c=this._backgroundTile;this._updateRenderParameters(e,t,c,i,l,n,r,a,o,d),this._renderParams.stencilSymbols=!1,i.drawBackground(this._renderParams,c,s)}renderContent(e,t,i,s,l,n,r,a,o,d,c,h){this._declutter(i),s.forAll((e=>this._declutter(e.sourceLayerInfo.data))),this._stencilSymbols(e,t,i,s,l,n,r,Math.round(1/a),o,d,c,h);let m=1;i.stencilRef=m++,e.setStencilFunction(u.EQUAL,i.stencilRef,255),this._render(e,t,i,l,n,r,a,o,d,c,h),s.forAll((t=>{t.sourceLayerInfo.data.stencilRef=m++,this._renderSymbols(e,t.sourceLod,t.sourceLayerInfo.data,l,n,r,Math.round(1/a),t.offset,d,c,h)}))}_stencilSymbols(e,t,i,s,l,n,r,a,o,d,c,h){let p=1;i.stencilRef=p++,e.setDepthTestEnabled(!1),e.setDepthWriteEnabled(!1),e.setStencilTestEnabled(!0),e.setBlendingEnabled(!1),e.setColorMask(!1,!1,!1,!1),e.setStencilOp(m.KEEP,m.KEEP,m.REPLACE),e.setStencilWriteMask(255),e.setStencilFunction(u.ALWAYS,i.stencilRef,255),this._stencilTileSymbols(e,t,i,l,n,r,a,o,d,c,h);for(const m of s.toArray()){const{sourceLod:t,offset:i,sourceLayerInfo:s}=m;s.data.stencilRef=p++,e.setStencilFunction(u.ALWAYS,s.data.stencilRef,255),this._stencilTileSymbols(e,t,s.data,l,n,r,a,i,d,c,h)}e.setStencilWriteMask(0),e.setBlendingEnabled(!0),e.setDepthTestEnabled(!0),e.setColorMask(!0,!0,!0,!0)}_renderSymbols(e,t,i,s,l,n,r,a,o,c,h){e.setStencilFunction(u.EQUAL,i.stencilRef,255),this._render(e,t,i,s,l,n,r,a,o,c,h,d.SYMBOL)}_render(e,t,i,s,l,n,r,a,o,d,c,h){this._updateRenderParameters(e,t,i,s,n,r,a,o,d,c),this._renderParams.stencilSymbols=!1,s.drawTile(this._renderParams,i,l,h)}_stencilTileSymbols(e,t,i,s,l,n,r,a,o,d,c){this._updateRenderParameters(e,t,i,s,n,r,a,o,d,c),this._renderParams.stencilSymbols=!0,i.triangleCount=0,s.drawSymbols(this._renderParams,i,l)}_updateRenderParameters(n,a,o,d,c,h,u,m,f,g){"type"in o&&"vector-tile"===o.type&&!o.stage&&o.attachWithContext(n);const y=a[0]-c.getLevelShift(a[0]),_=this._renderParams;_.context=n,_.painter=d,_.glyphMosaic=d.glyphMosaic,_.spriteMosaic=d.spriteMosaic,_.pixelRatio=f*g,_.displayLevel=y,_.requiredLevel=y;const b=c.getScale(a[0]),[S,M]=c.getOffset(a,h*b),w=p*h*b/m,R=o.transforms.displayViewScreenMat3;R[0]=w,R[4]=-w,R[6]=-1-S-u[0]*h*2,R[7]=1+M+(1-u[1])*h*2-2;const L=_.state,T=m/g;L.size[0]=T,L.size[1]=T,L.pixelRatio=g,L.rotation=(360-this._heading)%360;const P=2/T;e(L.displayViewMat3,P,0,0,0,-P,0,-1,1,1);const E=t(L.displayMat3),j=r(this._heading);i(E,E,[T/2,T/2]),s(E,E,j),i(E,E,[-T/2,-T/2]),l(E,L.displayViewMat3,E)}updateHeading(e){this._heading=e}_declutter(e){this._declutteredForHeading.get(e)!==this._heading&&(o(e,(360-this._heading)%360),this._declutteredForHeading.set(e,this._heading))}}class g{constructor(){this.size=[0,0],this.pixelRatio=1,this.rotation=0,this.displayMat3=n(),this.displayViewMat3=n(),this.transform=null,this.inverseTransform=null,this.viewMat2d=null,this.viewMat3=null,this.id=0,this.extent=null,this.center=null,this.scale=1,this.resolution=0,this.worldScreenWidth=0,this.spatialReference=null,this.viewpoint=null,this.getScreenTransform=null,this.toMap=null,this.toScreen=null,this.clone=null,this.copy=null,this.toJSON=null}}export{f as VectorTileRendererHelper3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{identity as t,translate as o,rotate as e,scale as r}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{toRadian as i}from"../../../../../core/libs/gl-matrix-2/math/common.js";import{VTLUniqueSymbol as m}from"./core.js";import{CollisionJob as l}from"./jobs.js";import{SymbolDeclutterer as n}from"./SymbolDeclutterer.js";import{SymbolRepository as a}from"./SymbolRepository.js";import{writeOpacityToBuffers as c}from"./util.js";import{Visibility as f}from"../style/StyleDefinition.js";function y(s,y){const j=s.transforms.tileUnitsToPixels,b=i(y),h=Math.cos(b),u=Math.sin(b),x=Math.ceil(512*(Math.abs(u)+Math.abs(h)));t(p),o(p,p,[x/2,x/2]),e(p,p,b),o(p,p,[-256,-256]),r(p,p,[1/8,1/8,1]),s.transforms.tileUnitsToPixels=p;const g=[],S=new a(4096,g,(()=>new m)),M=new n(g,S,((t,o,e)=>new l(t,o,e,s.styleRepository,s.key.level,y)),((t,o)=>{c(t,o,!1)}),(()=>0),(t=>{const o=s.styleRepository.getStyleLayerByUID(t).getLayoutProperty("visibility");return!o||o.getValue()!==f.NONE}));g.push(s),S.add(s),M.setScreenSize(x,x),M.continue(1/0),S.removeTile(s),s.transforms.tileUnitsToPixels=j}const p=s();export{y as declutterSingleTile};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../Graphic.js";import{isSome as r}from"../../../core/arrayUtils.js";import{isIterable as i}from"../../../core/iteratorUtils.js";import{clipContainsPoint as t}from"./clippingUtils.js";import{isSupportedScreenPointEvent as a,createScreenPointFromSupportedEvent as l}from"../../support/screenUtils.js";async function s(e,i,s){const f=a(i)?l(e,i):i;if(!e.ready||isNaN(f.x)||isNaN(f.y))return{screenPoint:f,results:[]};let d=new Set;const y=new Set;let u=!1,h=null,g=null;s?.include?o(s.include,n(e,(e=>{d.add(e),p(e,(e=>y.add(e)))}),((e,r)=>{y.add(e),d.add(r)}),(e=>{h||(h=new Set),h.add(e)}),(e=>d.add(e)),(()=>u=!0))):(u=!0,d=new Set(e.allLayerViews),d.forEach((e=>{p(e,(e=>y.add(e)))}))),s?.exclude&&o(s.exclude,n(e,(e=>{d.delete(e),p(e,(e=>y.delete(e)))}),(e=>y.delete(e)),(e=>{g||(g=new Set),g.add(e)})));const m=e.toMap(f),w=e.allLayerViews.filter((r=>!r.suspended&&d.has(r)&&r.clips.every((r=>t(e,r,f,m))))).reverse();let V=[...u?e.graphicsView.hitTest(m).map((e=>({type:"graphic",graphic:e,layer:null,mapPoint:m}))):[],...await Promise.all(w.map((e=>e.hitTest(m,f))).toArray())].filter(r).flat().filter(r);return V=V.filter((e=>"graphic"!==e.type||"subtype-group"!==e.layer?.type||y.has(e.graphic.layer))),h&&(V=V.filter((e=>!("graphic"in e)||!e.graphic||h?.has(c(e.graphic))))),g&&(V=V.filter((e=>!("graphic"in e)||!e.graphic||!g?.has(c(e.graphic))))),{screenPoint:f,results:V}}function n(r,i,t,a,l,s){return n=>{if(n instanceof e){if(n.layer===r)s?.();else{const e=r.allLayerViews.find((e=>e.layer===n.layer));e&&l?.(e)}a(c(n))}else if("layer"in n&&"element"in n);else if("subtype-sublayer"===n.type){const e=r.allLayerViews.find((e=>e.layer===n.parent));e&&t(n,e)}else{const e=r.allLayerViews.find((e=>e.layer===n));e&&i(e)}}}function o(e,r){if(e)if(i(e))for(const t of e)if(i(t))for(const e of t)r(e);else r(t);else r(e)}function c(e){const r=e.getObjectId();return r?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${r}`:`"MapView/${e.uid}`}function p({layer:e},r){"subtype-group"===e
|
|
5
|
+
import e from"../../../Graphic.js";import{isSome as r}from"../../../core/arrayUtils.js";import{isIterable as i}from"../../../core/iteratorUtils.js";import{clipContainsPoint as t}from"./clippingUtils.js";import{isSupportedScreenPointEvent as a,createScreenPointFromSupportedEvent as l}from"../../support/screenUtils.js";async function s(e,i,s){const f=a(i)?l(e,i):i;if(!e.ready||isNaN(f.x)||isNaN(f.y))return{screenPoint:f,results:[]};let d=new Set;const y=new Set;let u=!1,h=null,g=null;s?.include?o(s.include,n(e,(e=>{d.add(e),p(e,(e=>y.add(e)))}),((e,r)=>{y.add(e),d.add(r)}),(e=>{h||(h=new Set),h.add(e)}),(e=>d.add(e)),(()=>u=!0))):(u=!0,d=new Set(e.allLayerViews),d.forEach((e=>{p(e,(e=>y.add(e)))}))),s?.exclude&&o(s.exclude,n(e,(e=>{d.delete(e),p(e,(e=>y.delete(e)))}),(e=>y.delete(e)),(e=>{g||(g=new Set),g.add(e)})));const m=e.toMap(f),w=e.allLayerViews.filter((r=>!r.suspended&&d.has(r)&&r.clips.every((r=>t(e,r,f,m))))).reverse();let V=[...u?e.graphicsView.hitTest(m).map((e=>({type:"graphic",graphic:e,layer:null,mapPoint:m}))):[],...await Promise.all(w.map((e=>e.hitTest(m,f))).toArray())].filter(r).flat().filter(r);return V=V.filter((e=>"graphic"!==e.type||"subtype-group"!==e.layer?.type||y.has(e.graphic.layer))),h&&(V=V.filter((e=>!("graphic"in e)||!e.graphic||h?.has(c(e.graphic))))),g&&(V=V.filter((e=>!("graphic"in e)||!e.graphic||!g?.has(c(e.graphic))))),{screenPoint:f,results:V}}function n(r,i,t,a,l,s){return n=>{if(n instanceof e){if(n.layer===r)s?.();else{const e=r.allLayerViews.find((e=>e.layer===n.layer));e&&l?.(e)}a(c(n))}else if("layer"in n&&"element"in n);else if("subtype-sublayer"===n.type){const e=r.allLayerViews.find((e=>e.layer===n.parent));e&&t(n,e)}else{const e=r.allLayerViews.find((e=>e.layer===n));e&&i(e)}}}function o(e,r){if(e)if(i(e))for(const t of e)if(i(t))for(const e of t)r(e);else r(t);else r(e)}function c(e){const r=e.getObjectId();return r?`${e.layer?.uid??e.sourceLayer?.uid??"MapView"}/${r}`:`"MapView/${e.uid}`}function p({layer:e},r){"subtype-group"===e?.type&&e.sublayers.forEach((e=>{r(e)}))}export{s as hitTest};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import o from"../../../../../core/Collection.js";import i from"../../../../../core/Evented.js";import{makeHandle as e}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{zeroMeters as s,scale as a}from"../../../../../core/quantityUtils.js";import{watch as l,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as m}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{orientation as f}from"../geometryUtils.js";import{SupportedObjectResult as v}from"../isSupportedObjectUtils.js";import{manipulatedObjectGeometry as g}from"../manipulatedObjectUtils.js";import{canMoveZOperations as _}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as j}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as M}from"../tooltipUtils3D.js";import{createVisualElements as b}from"../visualElementUtils.js";import{discRadius as y}from"../manipulations/config.js";import{ManipulationType as T,MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as I}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as S}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as x}from"./isSupportedObject.js";import{OutlineVisualElement as O}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as P}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as H}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as k}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import U from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as z}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as A}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as D}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as R}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoDistanceBetweenPoints2D as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as G}from"../../../../support/euclideanLengthMeasurementUtils.js";class V{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,i){this.dx=t,this.dy=o,this.objects=i,this.type="move"}}class N{constructor(t){this.objects=t,this.type="move-stop"}}const q=Symbol("manipulators"),B=Symbol("tooltips");let J=class extends H{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new o,this.enableZ=!0,this.sketchOptions=new U,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new h,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=new z({view:t}),this.addHandles([this.objects.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),this.objects.on("after-changes",(()=>this._connectTooltips()))]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=n(this.tooltip),this._moveManipulation=n(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}onInputEvent(t){if(!this.destroyed&&!A(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){return 1===this.objects.length&&"point"===g(this.objects.at(0))?.type}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const i of t){if(x(i)!==v.SUPPORTED)continue;const t=new K(i);this._infos.set(i,t)}for(const i of o)this._infos.delete(i)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(j(t.object),o)}}_refreshManipulators(){if(this.removeHandles(q),this._moveManipulation=n(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const i=o.object;o.manipulationXY=new S({tool:this,view:this.view,object:i}),o.manipulationXY.forEachManipulator((t=>{this.addHandles([t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:i}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{"start"===t?this._showTooltip(T.XY):this._hideTooltip()}))],q)})),this.addHandles(o.manipulationXY.createDragPipeline(((o,i,e,n)=>this._buildDragEventPipeline(t,T.XY,o,i,e,n))),q)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?w.radiusForSymbol(t[0].object.graphic?.symbol):y});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(i=>{const e=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&e&&this.events.emit("immediate-click",{...i,object:e}),i.stopPropagation()})),q)}));const i=t=>o=>{this.addHandles([o.events.on("focus-changed",(({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()})),o.events.on("grab-changed",(()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=s)}))],q)};this._moveManipulation.xyManipulation.forEachManipulator(i(T.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(i(T.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(i(T.Z));const e=()=>this._updateMoveManipulation(t);for(const s of t)this.addHandles([s.object.on("committed",e),l((()=>s.object.visible),e)],q);const n=t[t.length-1];this.addHandles(n.object.on("committed",(()=>this._updateMoveManipulationAngle(n))),q);const{object:a}=n,{operations:r}=a;if(r){const i=a.graphic;this.addHandles(o.createDragPipeline(((o,i,e,n,s)=>this._buildDragEventPipeline(t,o,i,e,n,s)),a.elevationInfo,r.data.spatialReference,i),q)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const i=o.object,n=b({view:this.view,object:i,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>e()});null!=n&&(o.geometryRepresentation=n.visualElement,o.geometryRepresentation instanceof O&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",(()=>{o.object.isDraped||this._updateMoveManipulation(t)})),l((()=>o.object.isDraped),(()=>this._updateMoveManipulation(t)))],q),this.addHandles(n,q))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=f(g(t.object)))}_updateMoveManipulation(t){const o=u(0,0,0,this.view.spatialReference);let i=0,e=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&_(n.object.operations,n.object.elevationInfo)&&(e=!0);const t=n.geometryRepresentation instanceof O&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:e,y:n,z:s}=t;o.x+=e,o.y+=n,s&&(o.z??=0,o.z+=s),i++}}i>0?(o.x/=i,o.y/=i,o.z??=0,o.z/=i,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=e):n.available=!1}}_buildDragEventPipeline(t,o,i,e,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&o===T.XY){const o=t[0].object;({steps:e,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,e,n,s))}return n=n.next((t=>p?.(t))).next((()=>(l.length&&this.events.emit("move-stop",new N(l)),this.destroyed||c(),null))),{steps:e=e.next((o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(i)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=P(l),this.events.emit("move-start",new V(l)),this.destroyed))return null}return 0!==l.length?o:null})).next((t=>r?.(t))).next((t=>(this._updateMoveTooltip(o,t),t))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),i=this.view.toScreen(t.mapEnd),e=i.x-o.x,n=i.y-o.y;if(this.events.emit("move",new L(e,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new N(l)),this.destroyed)return null;c()}return null})),cancel:n}}_connectTooltips(){this.removeHandles(B),this._movePointTooltipInfo=new D({viewType:this.view.type,sketchOptions:this.sketchOptions}),this.addHandles(this._shouldShowMovePointTooltip?M(this.tooltip,this.objects.at(0),(()=>this.sketchOptions),(()=>this._movePointTooltipInfo)):l((()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null),(t=>{this.tooltip.info=t}),r),B)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:i}=this;switch(t){case T.XY:this._latestTooltipInfo=this._translateTooltipInfo??=new R({sketchOptions:i}),Q(this._latestTooltipInfo,o,((t,o)=>F(t,o)));break;case T.XY_AXIS:this._latestTooltipInfo=this._translateXYTooltipInfo??=new Z({sketchOptions:i}),Q(this._latestTooltipInfo,o,((t,i)=>a(F(t,i),I(o))));break;case T.Z:this._latestTooltipInfo=this._translateZTooltipInfo??=new C({sketchOptions:i}),Q(this._latestTooltipInfo,o,G)}this._latestTooltipInfo.sketchOptions=i}_buildSnappingPipelineSteps(t,o,i,e,n){const s=g(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:i,cancel:e};const a=("point"===s.type?s:s.anchor).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:k.fromGeometry(a,this.view.state.viewingMode),visualizer:new d,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return e=e.next(c),{steps:i=i.next((o=>{a.z=m(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}})).next(...p),cancel:e}}};t([p({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),t([p()],J.prototype,"objects",void 0),t([p({constructOnly:!0,nonNullable:!0})],J.prototype,"enableZ",void 0),t([p({constructOnly:!0,type:U})],J.prototype,"sketchOptions",void 0),t([p({constructOnly:!0})],J.prototype,"snappingManager",void 0),t([p()],J.prototype,"type",void 0),t([p()],J.prototype,"updating",null),t([p()],J.prototype,"_latestTooltipInfo",void 0),t([p()],J.prototype,"_shouldShowMovePointTooltip",null),t([p()],J.prototype,"activeTooltipInfo",null),J=t([c("esri.views.3d.interactive.editingTools.move.MoveTool3D")],J);class K{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function Q(t,o,i){if(null==o||"end"===o.action)return void(t.distance=s);const{mapStart:e,mapEnd:n}=o,a=i(e,n);t.distance=null!=a?a:s}export{L as MoveEvent,V as MoveStartEvent,N as MoveStopEvent,J as MoveTool3D};
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import o from"../../../../../core/Collection.js";import i from"../../../../../core/Evented.js";import{makeHandle as e}from"../../../../../core/handleUtils.js";import{destroyMaybe as n}from"../../../../../core/maybe.js";import{zeroMeters as s,scale as a}from"../../../../../core/quantityUtils.js";import{watch as l,syncAndInitial as r}from"../../../../../core/reactiveUtils.js";import{property as p}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as c}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as h}from"../../../../../core/support/UpdatingHandles.js";import{makeDehydratedPoint as u}from"../../../../../layers/graphics/dehydratedPoint.js";import{getConvertedElevation as m}from"../../../../../support/elevationInfoUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{orientation as f}from"../geometryUtils.js";import{SupportedObjectResult as v}from"../isSupportedObjectUtils.js";import{manipulatedObjectGeometry as g}from"../manipulatedObjectUtils.js";import{canMoveZOperations as _}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as j}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as M}from"../tooltipUtils3D.js";import{createVisualElements as b}from"../visualElementUtils.js";import{discRadius as y}from"../manipulations/config.js";import{ManipulationType as T,MoveManipulation as w}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as I}from"../manipulations/moveUtils.js";import{MoveXYObjectManipulation as S}from"../manipulations/MoveXYObjectManipulation.js";import{isSupportedObject as O}from"./isSupportedObject.js";import{OutlineVisualElement as x}from"../../visualElements/OutlineVisualElement.js";import{dragManipulatedObjectMany as E,resetManipulatedObjectMany as P}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as k}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as H}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import U from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as X}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as Y}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as z}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as A}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{MovePointTooltipInfo as D}from"../../../../interactive/tooltip/infos/MovePointTooltipInfo.js";import{TranslateTooltipInfo as R}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as Z}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as C}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoDistanceBetweenPoints2D as F}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as G}from"../../../../support/euclideanLengthMeasurementUtils.js";class V{constructor(t){this.objects=t,this.type="move-start"}}class L{constructor(t,o,i){this.dx=t,this.dy=o,this.objects=i,this.type="move"}}class N{constructor(t){this.objects=t,this.type="move-stop"}}const q=Symbol("manipulators"),B=Symbol("tooltips");let J=class extends k{constructor(t){super(t),this._infos=new Map,this.events=new i,this.objects=new o,this.enableZ=!0,this.sketchOptions=new U,this.type="move-3d",this._latestTooltipInfo=null,this._translateTooltipInfo=null,this._translateXYTooltipInfo=null,this._translateZTooltipInfo=null,this._updatingHandles=new h,this._moveManipulation=null}initialize(){const{view:t}=this;this.tooltip=new z({view:t}),this.addHandles([this.objects.on("change",(t=>{t.removed.forEach((t=>this.removeHandles(t))),this._updateObjectInfos(t),this._setupFastTransformUpdates(t.added),this._refreshManipulators()})),this.objects.on("after-changes",(()=>this._connectTooltips()))]);const o=this.objects.toArray();this._updateObjectInfos({added:o,removed:[]}),this._setupFastTransformUpdates(o),this._refreshManipulators(),this._connectTooltips(),this.finishToolCreation()}destroy(){this.tooltip=n(this.tooltip),this._moveManipulation=n(this._moveManipulation),this._set("view",null),this._updatingHandles.destroy()}onInputEvent(t){if(!this.destroyed&&!A(t,this.tooltip))return super.onInputEvent(t)}get updating(){return this._updatingHandles.updating}get _shouldShowMovePointTooltip(){return 1===this.objects.length&&"point"===g(this.objects.at(0))?.type}get activeTooltipInfo(){return this._shouldShowMovePointTooltip?this._movePointTooltipInfo:this._latestTooltipInfo}reset(){}_updateObjectInfos({added:t,removed:o}){for(const i of t){if(O(i)!==v.SUPPORTED)continue;const t=new K(i);this._infos.set(i,t)}for(const i of o)this._infos.delete(i)}_setupFastTransformUpdates(t){for(const o of t){const t=this._infos.get(o);this.addHandles(j(t.object),o)}}_refreshManipulators(){if(this.removeHandles(q),this._moveManipulation=n(this._moveManipulation),this.manipulators.removeAll(),0===this._infos.size)return;const t=Array.from(this._infos.values());this._createManipulators(t),this._createVisualElements(t),this._updateMoveManipulation(t)}_createManipulators(t){for(const o of t){const i=o.object;o.manipulationXY=new S({tool:this,view:this.view,object:i}),o.manipulationXY.forEachManipulator((t=>{this.addHandles([t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:i}),t.stopPropagation()})),t.events.on("grab-changed",(({action:t})=>{"start"===t?this._showTooltip(T.XY):this._hideTooltip()}))],q)})),this.addHandles(o.manipulationXY.createDragPipeline(((o,i,e,n)=>this._buildDragEventPipeline(t,T.XY,o,i,e,n))),q)}this._createMoveManipulation(t)}_createMoveManipulation(t){const o=new w({tool:this,view:this.view,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:1===t.length?w.radiusForSymbol(t[0].object.graphic?.symbol):y});this._moveManipulation=o,o.elevationInfo={mode:"absolute-height",offset:0},o.forEachManipulator((t=>{this.addHandles(t.events.on("immediate-click",(i=>{const e=this.objects.at(0);!o.zManipulation.hasManipulator(t)&&1===this.objects.length&&e&&this.events.emit("immediate-click",{...i,object:e}),i.stopPropagation()})),q)}));const i=t=>o=>{this.addHandles([o.events.on("focus-changed",(({action:o})=>{"focus"===o?this._showTooltip(t):this._hideTooltip()})),o.events.on("grab-changed",(()=>{this._latestTooltipInfo&&(this._latestTooltipInfo.distance=s)}))],q)};this._moveManipulation.xyManipulation.forEachManipulator(i(T.XY)),this._moveManipulation.xyAxisManipulation.forEachManipulator(i(T.XY_AXIS)),this._moveManipulation.zManipulation.forEachManipulator(i(T.Z));const e=()=>this._updateMoveManipulation(t);for(const s of t)this.addHandles([s.object.on("committed",e),l((()=>s.object.visible),e)],q);const n=t[t.length-1];this.addHandles(n.object.on("committed",(()=>this._updateMoveManipulationAngle(n))),q);const{object:a}=n,{operations:r}=a;if(r){const i=a.graphic;this.addHandles(o.createDragPipeline(((o,i,e,n,s)=>this._buildDragEventPipeline(t,o,i,e,n,s)),a.elevationInfo,r.data.spatialReference,i),q)}this._updateMoveManipulationAngle(n)}_createVisualElements(t){for(const o of t){const i=o.object,n=b({view:this.view,object:i,forEachManipulator:t=>{o.manipulationXY?.forEachManipulator(t),this._moveManipulation?.forEachManipulator(t)},onManipulatorsChanged:()=>e()});null!=n&&(o.geometryRepresentation=n.visualElement,o.geometryRepresentation instanceof x&&this.addHandles([o.geometryRepresentation.events.on("attachment-origin-changed",(()=>{o.object.isDraped||this._updateMoveManipulation(t)})),l((()=>o.object.isDraped),(()=>this._updateMoveManipulation(t)))],q),this.addHandles(n,q))}}_updateMoveManipulationAngle(t){this._moveManipulation&&(this._moveManipulation.angle=f(g(t.object)))}_updateMoveManipulation(t){const o=u(0,0,0,this.view.spatialReference);let i=0,e=!1;const n=this._moveManipulation;if(n){for(const n of t){if(!n.object.visible)continue;this.enableZ&&_(n.object.operations,n.object.elevationInfo)&&(e=!0);const t=n.geometryRepresentation instanceof x&&!n.object.isDraped?n.geometryRepresentation.attachmentOrigin:n.object.origin;if(null!=t){const{x:e,y:n,z:s}=t;o.x+=e,o.y+=n,s&&(o.z??=0,o.z+=s),i++}}i>0?(o.x/=i,o.y/=i,o.z??=0,o.z/=i,n.location=o,n.xyManipulation.available=!0,n.xyAxisManipulation.available=!0,n.zManipulation.available=e):n.available=!1}}_buildDragEventPipeline(t,o,i,e,n,s){const a=[],l=[];let r=null,p=null;const c=()=>{for(const t of a)t.dragging=!1;a.length=0,l.length=0,r=null,p=null,this._moveManipulation&&(this._moveManipulation.interactive=!0)};if(1===t.length&&o===T.XY){const o=t[0].object;({steps:e,cancel:n}=this._buildSnappingPipelineSteps(o,o.elevationInfo,e,n,s))}return n=n.next((t=>p?.(t))).next((()=>(l.length&&this.events.emit("move-stop",new N(l)),this.destroyed||c(),null))),{steps:e=e.next((o=>{if("start"===o.action){a.length=0,l.length=0;for(const o of t)o.dragging||!o.manipulationXY?.hasManipulator(i)&&o.manipulationXY?.grabbing||(a.push(o),l.push(o.object),o.dragging=!0);if(0!==l.length&&(this._moveManipulation&&(this._moveManipulation.interactive=!1),r=E(l),p=P(l),this.events.emit("move-start",new V(l)),this.destroyed))return null}return 0!==l.length?o:null})).next((t=>r?.(t))).next((t=>(this._updateMoveTooltip(o,t),t))).next((t=>{switch(t.action){case"start":case"update":if(t.translationX||t.translationY||t.translationZ){const o=this.view.toScreen(t.mapStart),i=this.view.toScreen(t.mapEnd),e=i.x-o.x,n=i.y-o.y;if(this.events.emit("move",new L(e,n,l)),this.destroyed)return null}break;case"end":if(this.events.emit("move-stop",new N(l)),this.destroyed)return null;c()}return null})),cancel:n}}_connectTooltips(){let t;if(this.removeHandles(B),this._shouldShowMovePointTooltip){const o=this.objects.at(0);this._movePointTooltipInfo??=new D({viewType:this.view.type,sketchOptions:this.sketchOptions});const i=()=>{this.events.emit("record-undo",{objects:[o]})};t=M(this.tooltip,o,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this._movePointTooltipInfo,recordUndo:i})))}else t=l((()=>this.sketchOptions.tooltips.effectiveEnabled?this._latestTooltipInfo:null),(t=>{this.tooltip.info=t}),r);this.addHandles(t,B)}_showTooltip(t){this._shouldShowMovePointTooltip||this._updateMoveTooltip(t)}_hideTooltip(){this._shouldShowMovePointTooltip||(this.tooltip?.clear(),this._latestTooltipInfo=null)}_updateMoveTooltip(t,o){if(this._shouldShowMovePointTooltip)return;const{sketchOptions:i}=this;switch(t){case T.XY:this._latestTooltipInfo=this._translateTooltipInfo??=new R({sketchOptions:i}),Q(this._latestTooltipInfo,o,((t,o)=>F(t,o)));break;case T.XY_AXIS:this._latestTooltipInfo=this._translateXYTooltipInfo??=new Z({sketchOptions:i}),Q(this._latestTooltipInfo,o,((t,i)=>a(F(t,i),I(o))));break;case T.Z:this._latestTooltipInfo=this._translateZTooltipInfo??=new C({sketchOptions:i}),Q(this._latestTooltipInfo,o,G)}this._latestTooltipInfo.sketchOptions=i}_buildSnappingPipelineSteps(t,o,i,e,n){const s=g(t);if(null==s||"point"!==s.type&&"mesh"!==s.type)return{steps:i,cancel:e};const a=("point"===s.type?s:s.anchor).clone(),l=new X({elevationInfo:o,pointer:n,editGeometryOperations:H.fromGeometry(a,this.view.state.viewingMode),visualizer:new d,excludeFeature:t.graphic}),r=this.snappingManager,{snappingStep:p,cancelSnapping:c}=Y({snappingContext:l,snappingManager:r,updatingHandles:this._updatingHandles});return e=e.next(c),{steps:i=i.next((o=>{a.z=m(this.view,a,t.elevationInfo,{mode:"absolute-height",offset:0});return{...o,snapOrigin:l.coordinateHelper.pointToVector(a)}})).next(...p),cancel:e}}};t([p({constructOnly:!0,nonNullable:!0})],J.prototype,"view",void 0),t([p()],J.prototype,"objects",void 0),t([p({constructOnly:!0,nonNullable:!0})],J.prototype,"enableZ",void 0),t([p({constructOnly:!0,type:U})],J.prototype,"sketchOptions",void 0),t([p({constructOnly:!0})],J.prototype,"snappingManager",void 0),t([p()],J.prototype,"type",void 0),t([p()],J.prototype,"updating",null),t([p()],J.prototype,"_latestTooltipInfo",void 0),t([p()],J.prototype,"_shouldShowMovePointTooltip",null),t([p()],J.prototype,"activeTooltipInfo",null),J=t([c("esri.views.3d.interactive.editingTools.move.MoveTool3D")],J);class K{constructor(t){this.object=t,this.geometryRepresentation=null,this.manipulationXY=null,this.dragging=!1}}function Q(t,o,i){if(null==o||"end"===o.action)return void(t.distance=s);const{mapStart:e,mapEnd:n}=o,a=i(e,n);t.distance=null!=a?a:s}export{L as MoveEvent,V as MoveStartEvent,N as MoveStopEvent,J as MoveTool3D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{handlesGroup as t}from"../../../../../core/handleUtils.js";import{zeroMeters as e,createLength as o,scale as n}from"../../../../../core/quantityUtils.js";import{watch as i,syncAndInitial as r,sync as s}from"../../../../../core/reactiveUtils.js";import{getMetersPerUnitForSR as a}from"../../../../../core/unitUtils.js";import{projectPoint as p}from"../../../../../geometry/support/plane.js";import{sv3d as l}from"../../../../../geometry/support/vectorStacks.js";import{updateElevationFromPoint as c}from"../tooltipUtils3D.js";import{ManipulationType as m}from"../manipulations/MoveManipulation.js";import{axisConstrainedDragSign as f}from"../manipulations/moveUtils.js";import{AccumulationBehavior as u}from"../../../../interactive/editGeometry/interfaces.js";import{connectPasteEvent as d,getXYZDeltasFromTooltipInfo as y}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{ReshapeEdgeOffsetTooltipInfo as h}from"../../../../interactive/tooltip/infos/ReshapeEdgeOffsetTooltipInfo.js";import{SelectedVertexTooltipInfo as v}from"../../../../interactive/tooltip/infos/SelectedVertexTooltipInfo.js";import{TranslateTooltipInfo as g}from"../../../../interactive/tooltip/infos/TranslateTooltipInfo.js";import{TranslateXYTooltipInfo as j}from"../../../../interactive/tooltip/infos/TranslateXYTooltipInfo.js";import{TranslateZTooltipInfo as k}from"../../../../interactive/tooltip/infos/TranslateZTooltipInfo.js";import{autoArea2D as T}from"../../../../support/automaticAreaMeasurementUtils.js";import{autoLength2D as O,autoDistanceBetweenPoints2D as w}from"../../../../support/automaticLengthMeasurementUtils.js";import{verticalSignedDistanceBetweenPoints as U}from"../../../../support/euclideanLengthMeasurementUtils.js";import{geodesicDistance as I}from"../../../../support/geodesicLengthMeasurementUtils.js";function b(t,e){const o=e?.type;return{translate:new g({sketchOptions:t,viewType:o}),translateXY:new j({sketchOptions:t,viewType:o}),translateZ:new k({sketchOptions:t,viewType:o}),selectedVertex:new v({sketchOptions:t,viewType:o}),edgeOffset:new h({sketchOptions:t,viewType:o})}}function x(e,o,n,a,p){let l=!1;function c(){return n().tooltips.effectiveEnabled?a():null}function m(){l=!0,M(c(),p(),o),l=!1}return t([i((()=>({sketchOptions:n(),info:c()})),(({sketchOptions:t,info:o})=>{o&&(m(),o.sketchOptions=t),e.info=o}),r),i((()=>{const t=c();if("selected-vertex"===t?.type)return{info:t,...t.key,manipulatorInfo:p()}}),(t=>{t&&!l&&L(t.info,t.manipulatorInfo,o)}),s),o.on("committed",m),d(e)])}function L(t,e,o){if("vertex"!==e?.type)return;const{dx:n,dy:i,dz:r}=y(t,e.manipulator.location);0===n&&0===i&&0===r||o.operations?.moveVertices([e.handle],n,i,r,u.NEW_STEP)}function M(t,e,o){if(!t||"selected-vertex"!==t.type)return;const n=e?.manipulator.location;t.setLocationFromPoint(n),c(t,n,o);const i=o.operations?.data.geometry;switch(i?.type){case"polygon":t.geometryType="polygon",t.totalLength.visible=!1,t.area.actual=T(i);break;case"polyline":t.geometryType="polyline",t.totalLength.actual=O(i),t.area.visible=!1}}function X(t,e,{sketchOptions:o,tooltipInfos:i}){let r=null;switch(t){case m.XY:r=i.translate,E(r,e,((t,e)=>w(t,e)));break;case m.XY_AXIS:r=i.translateXY,E(r,e,((t,o)=>n(w(t,o),f(e))));break;case m.Z:r=i.translateZ,E(r,e,U)}return r.sketchOptions=o,r}function E(t,o,n){if(null!=o&&"end"!==o.action){const{mapStart:i,mapEnd:r}=o,s=n(i,r);t.distance=null!=s?s:e}else t.distance=e}function Y(t,{object:o,sketchOptions:n,tooltipInfos:i}){const r=i.edgeOffset;if(r.distance=e,null!=t&&"end"!==t.action){const e=o.operations,{mapEnd:n,signedDistance:i,operation:s}=t;if(null!=i&&null!=e){const t=e.data.coordinateHelper,a=i*s.selectedArrow;r.distance=S(o.isDraped,a,n,s.plane,t)}}const s=o.operations?.data.geometry;return r.area="polygon"===s?.type?T(s):null,r.totalLength="polyline"===s?.type?O(s):null,r.sketchOptions=n,r}function S(t,e,n,i,r){if(t){const t=r.toXYZ(r.pointToVector(n)),s=p(i,t,l.get()),a=I(s,t,r.spatialReference);if(null!=a)return o(a.value*Math.sign(e),a.unit)}return o(e*a(n.spatialReference),"meters")}export{x as connectTooltipToManipulatedObject,b as createTooltipInfos,Y as getUpdatedEdgeOffsetTooltipInfo,X as getUpdatedTranslateObjectTooltipInfo};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{handlesGroup as t}from"../../../../core/handleUtils.js";import{watch as o,syncAndInitial as e,sync as n}from"../../../../core/reactiveUtils.js";import{manipulatedObjectGeometry as i}from"./manipulatedObjectUtils.js";import{updateMeshFromTooltipInfo as r,connectPasteEvent as s,getXYZDeltasFromTooltipInfo as c,updateTooltipInfoFromMeshTransform as a}from"../../../interactive/tooltip/tooltipCommonUtils.js";import{elevationFromPoint as p}from"../../../support/euclideanLengthMeasurementUtils.js";function l(c,a,p){function l(){const t=p(),o=t.sketchOptions.tooltips.effectiveEnabled?t.activeTooltipInfo:null;return{...t,activeTooltipInfo:o}}let u=!1;function v({activeTooltipInfo:t,sketchOptions:o}){u=!0,t&&(t.sketchOptions=o,f(t,a)),c.info=t,u=!1}return t([o(l,v,e),o((()=>{const t=l(),{activeTooltipInfo:o}=t;if(o)return{context:t,activeTooltipInfo:o,key:o.key,geometry:i(a)}}),((t,o)=>{if(!t||u||!o||o.key===t.key)return;const{context:e,activeTooltipInfo:n,geometry:i}=t;switch(e.recordUndo(),i?.type){case"mesh":"transform-mesh"===n.type&&r(i,n);break;case"point":m(n,i,a)}}),n),a.on("committed",(()=>v(l()))),s(c)])}function m(t,o,e){const{dx:n,dy:i,dz:r}=c(t,o);0===n&&0===i&&0===r||e.operations?.move(n,i,r)}function f(t,o){const e=i(o);if(!t||!e||"mesh"!==e.type&&"point"!==e.type)return;const n="mesh"===e.type,r=n?e.origin:e;t.setLocationFromPoint(r),u(t,r,o),"transform-mesh"===t.type&&n&&a(t,e),t.clearInputValues()}function u(t,o,e){t.elevation.actual=p(o),t.elevation.visible=!!e.operations?.data.coordinateHelper.hasZ(),t.elevation.readOnly=!1,t.elevation.showAsZ=!0}export{l as connectTooltipToManipulatedObject,u as updateElevationFromPoint};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../../core/arrayUtils.js";import i from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/Point.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{Manipulator3D as h}from"../../Manipulator3D.js";import{placeAtObject as m}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{canMoveZOperations as v}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as f}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as
|
|
5
|
+
import{_ as t}from"../../../../../chunks/tslib.es6.js";import{isSome as e}from"../../../../../core/arrayUtils.js";import i from"../../../../../core/Evented.js";import{makeHandle as o}from"../../../../../core/handleUtils.js";import"../../../../../core/has.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{watch as s}from"../../../../../core/reactiveUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/Logger.js";import{subclass as r}from"../../../../../core/accessorSupport/decorators/subclass.js";import{UpdatingHandles as l}from"../../../../../core/support/UpdatingHandles.js";import p from"../../../../../geometry/Point.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{Manipulator3D as h}from"../../Manipulator3D.js";import{placeAtObject as m}from"../../manipulatorUtils.js";import{SnappingVisualizer3D as d}from"../../SnappingVisualizer3D.js";import{manipulatedObjectGeometry as u}from"../manipulatedObjectUtils.js";import{canMoveZOperations as v}from"../manipulatorUtils.js";import{meshTransformFastUpdateHandles as f}from"../meshFastUpdateUtils.js";import{connectTooltipToManipulatedObject as _}from"../tooltipUtils3D.js";import{createVisualElements as g}from"../visualElementUtils.js";import{alignArrowsScaleThreshold as b}from"../manipulations/config.js";import{MoveManipulation as j,ManipulationType as y}from"../manipulations/MoveManipulation.js";import{ScaleRotateMeshAdapter as M}from"./ScaleRotateMeshAdapter.js";import{ScaleRotateObjectSymbol3DAdapter as R}from"./ScaleRotateObjectSymbol3DAdapter.js";import{ScaleRotateTransform as S}from"./ScaleRotateTransform.js";import{createGraphicGeometryUndoRecord as w}from"./undoRecords.js";import{sceneSnappingAtProjectedLocation as T}from"../../../../interactive/dragEventPipeline.js";import{InteractiveToolBase as A}from"../../../../interactive/InteractiveToolBase.js";import{EditGeometryOperations as O}from"../../../../interactive/editGeometry/EditGeometryOperations.js";import I from"../../../../interactive/sketch/SketchOptions.js";import{SnappingContext as k}from"../../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as x}from"../../../../interactive/snapping/SnappingDragPipelineStep.js";import{Tooltip as U}from"../../../../interactive/tooltip/Tooltip.js";import{enterInputModeIfAvailable as E}from"../../../../interactive/tooltip/tooltipCommonUtils.js";import{TransformMeshTooltipInfo as H}from"../../../../interactive/tooltip/infos/TransformMeshTooltipInfo.js";import{TransformPointTooltipInfo as z}from"../../../../interactive/tooltip/infos/TransformPointTooltipInfo.js";let C=class extends A{constructor(t){super(t),this.events=new i,this.enableZ=!0,this.enableRotation=!0,this.enableScaling=!0,this.sketchOptions=new I,this.type="transform-3d",this._updatingHandles=new l,this._scaleRotate=null}initialize(){const{object:t,view:i}=this;this.tooltip=new U({view:i}),this._moveManipulation=new j({tool:this,view:i,snapToScene:this.snapToScene,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:this.enableZ&&v(t.operations,t.elevationInfo),radius:j.radiusForSymbol(t.graphic?.symbol)}),this._moveManipulation.forEachManipulator((t=>this.addHandles(t.events.on("immediate-click",(t=>{this.events.emit("immediate-click",{...t,object:this.object}),t.stopPropagation()})))));const a=t.elevationInfo;if(this._moveManipulation.elevationInfo=a,this.addHandles(f(t)),this._moveManipulation.createManipulatedObjectDragPipeline(((e,o,s,n,r)=>{if(e===y.XY){const{snappingStep:e,cancelSnapping:o}=x({snappingContext:new k({elevationInfo:a,pointer:r,editGeometryOperations:O.fromGeometry(new p({spatialReference:t.operations?.data.spatialReference}),i.state.viewingMode),visualizer:new d,excludeFeature:t.graphic}),snappingManager:this.snappingManager,updatingHandles:this._updatingHandles,useZ:!1});n=n.next(o),s=s.next(T(this.view,a)).next(...e)}return{steps:s,cancel:n}}),t,(t=>{const{action:e,object:i,dxScreen:o,dyScreen:a}=t,s={object:i,dxScreen:o,dyScreen:a};switch(e){case"start":this.events.emit("translate-start",s),this._emitRecordUndo();break;case"update":this.events.emit("translate",s);break;case"end":this.events.emit("translate-stop",s)}})),this._moveManipulation.angle=null!=this._scaleRotate?this._scaleRotate.angle:0,this._scaleRotateAdapter=this._createScaleRotateAdapter(),this.addHandles(s((()=>this._scaleRotateAdapter.angle),(()=>this._updateMoveAngle()))),this.enableScaling||this.enableRotation){const e=this.enableScaling&&this.enableRotation?null:this.enableScaling?"scale":"rotate";this._scaleRotate=new S({tool:this,mode:e,adapter:this._scaleRotateAdapter,sketchOptions:this.sketchOptions,tooltipEnabled:"mesh"!==u(t)?.type}),this.addHandles(this._scaleRotate.events.on("scale-changed",(()=>this._onScaleChanged())))}this.addHandles([g({view:this.view,object:this.object,forEachManipulator:t=>this._forEachManipulator(t),onManipulatorsChanged:()=>o()}),this.object.on("committed",(()=>this._onGeometryChanged())),this._hideManipulatorsForObjectState(),s((()=>i.scale),(()=>this._updateMoveAngle()))].filter(e)),this._onGeometryChanged(),this._updateMoveAngle(),this._forEachManipulator((t=>{t instanceof h&&this.addHandles(t.events.on("grab-changed",(()=>this._updateManipulatorsInteractive())))}));const n=i?.type,{sketchOptions:r}=this;this._meshTooltipInfo=new H({viewType:n,sketchOptions:r}),this._pointTooltipInfo=new z({viewType:n,sketchOptions:r});const l=()=>this._emitRecordUndo();this.addHandles(_(this.tooltip,this.object,(()=>({sketchOptions:this.sketchOptions,activeTooltipInfo:this.activeTooltipInfo,recordUndo:l})))),this.finishToolCreation()}destroy(){this.tooltip.destroy(),this._moveManipulation.destroy(),this._scaleRotate=a(this._scaleRotate),this._scaleRotateAdapter=a(this._scaleRotateAdapter),this._updatingHandles.destroy(),this._set("view",null),this._set("object",null)}onInputEvent(t){if(!this.destroyed&&!E(t,this.tooltip))return super.onInputEvent(t)}_updateManipulatorsInteractive(){null!=this._scaleRotate&&(this._scaleRotate.interactive=!this._moveManipulation.grabbing,this._moveManipulation.interactive=!this._scaleRotate.grabbing)}_createScaleRotateAdapter(){const t=u(this.object);return"mesh"===t?.type?new M({object:this.object,geometry:t,viewingMode:this.view.state.viewingMode}):new R({graphic:this.object.graphic,sizeFilter:t=>this._enforceNonZeroSize(t),findLayerView:()=>this.view.allLayerViews.find((t=>t.layer===this.object.graphic?.layer)),sizeAxis:this.sketchOptions?.tooltips?.visualVariables?.size?.axis??null})}_forEachManipulator(t){this._moveManipulation?.forEachManipulator(t),this._scaleRotate?.forEachManipulator(t)}_hideManipulatorsForObjectState(){return s((()=>this.object.visible),(t=>{this._forEachManipulator((e=>e.available=t)),this._moveManipulation.zManipulation.available=t&&this.enableZ&&v(this.object.operations,this.object.elevationInfo)}))}_emitRecordUndo(){this.events.emit("record-undo",{record:w(this.object)})}set snapToScene(t){this._moveManipulation&&(this._moveManipulation.snapToScene=t),this._set("snapToScene",t)}get updating(){return this._updatingHandles.updating||!!this._scaleRotate?.updating}get activeTooltipInfo(){return null!=this._scaleRotate?.tooltip?.info?null:"mesh"===u(this.object)?.type?this._meshTooltipInfo:this._pointTooltipInfo}set location(t){this._moveManipulation.location=t,this._scaleRotate&&(this._scaleRotate.location=t)}set elevationAlignedLocation(t){this._moveManipulation.elevationAlignedLocation=t,this._scaleRotate&&(this._scaleRotate.elevationAlignedLocation=t)}reset(){}onHide(){this._scaleRotate?.cancelActiveAnimation()}_onScaleChanged(){null!=this._scaleRotate&&(this._moveManipulation.displayScale=this._scaleRotate.getScale())}_updateMoveAngle(){const{view:t}=this,e=t.state.viewingMode===c.Local||t.scale<b;this._moveManipulation.angle=e?this._scaleRotateAdapter.angle:0}_onGeometryChanged(){m(this,this.object)}_enforceNonZeroSize(t){return t||this.view.state.camera.computeRenderPixelSizeAt(this._moveManipulation.renderLocation)}get test(){}};t([n({constructOnly:!0,nonNullable:!0})],C.prototype,"view",void 0),t([n({constructOnly:!0,nonNullable:!0})],C.prototype,"object",void 0),t([n({constructOnly:!0,nonNullable:!0})],C.prototype,"enableZ",void 0),t([n()],C.prototype,"enableRotation",void 0),t([n()],C.prototype,"enableScaling",void 0),t([n({constructOnly:!0,type:I})],C.prototype,"sketchOptions",void 0),t([n({value:!1})],C.prototype,"snapToScene",null),t([n({constructOnly:!0})],C.prototype,"snappingManager",void 0),t([n({readOnly:!0})],C.prototype,"type",void 0),t([n({readOnly:!0})],C.prototype,"updating",null),t([n()],C.prototype,"activeTooltipInfo",null),C=t([r("esri.views.3d.interactive.editingTools.transform.TransformTool3D")],C);export{C as TransformTool3D};
|