@arcgis/core 5.2.0-next.82 → 5.2.0-next.83
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/components/assets/icon/deleteAndReplaceFeatures16.json +1 -0
- package/assets/components/assets/icon/deleteAndReplaceFeatures24.json +1 -0
- package/assets/components/assets/icon/deleteAndReplaceFeatures32.json +1 -0
- package/assets/components/assets/icon/moveAndRotate16.json +1 -0
- package/assets/components/assets/icon/moveAndRotate24.json +1 -0
- package/assets/components/assets/icon/moveAndRotate32.json +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/028bee58f7bc19e5e39e.js +1 -0
- package/assets/esri/core/workers/chunks/{a2fd945659ce052f99d2.js → 03895d49fbd34ccb3ead.js} +1 -1
- package/assets/esri/core/workers/chunks/0775d1e3034d5e7ef7bc.js +1 -0
- package/assets/esri/core/workers/chunks/{95ff342e5c29bf91a765.js → 13a43c87d7952facbed4.js} +1 -1
- package/assets/esri/core/workers/chunks/{e59101f1d060d0a30a65.js → 14def8f47ae7265dd71b.js} +1 -1
- package/assets/esri/core/workers/chunks/1b00789511c9b27da4a7.js +1 -0
- package/assets/esri/core/workers/chunks/1b277311a4beb4243bf8.js +2 -0
- package/assets/esri/core/workers/chunks/1d03db4df18524cf391c.js +1 -0
- package/assets/esri/core/workers/chunks/24bfe759c8848143361e.js +1 -0
- package/assets/esri/core/workers/chunks/30dade7bf6032be32599.js +2 -0
- package/assets/esri/core/workers/chunks/{865f9adc591056458b6b.js → 33dc93d82407052fafe1.js} +1 -1
- package/assets/esri/core/workers/chunks/{0d982abff7c9496f7890.js → 3a6990058f1003bd2812.js} +1 -1
- package/assets/esri/core/workers/chunks/{0fd7590e545864f5fff4.js → 3ca0d503ce733088a6c2.js} +1 -1
- package/assets/esri/core/workers/chunks/46b3d6814ba4c0a71111.js +1 -0
- package/assets/esri/core/workers/chunks/49784f8e8e5fac0cc5a9.js +1 -0
- package/assets/esri/core/workers/chunks/{563a4d6788ad66b676e4.js → 5156d94f01b4fbbf8cde.js} +1 -1
- package/assets/esri/core/workers/chunks/{cdd4aeaa3f30bc4ea93a.js → 5568448e7f51508ffdf5.js} +1 -1
- package/assets/esri/core/workers/chunks/58e4aecabca047f1d229.js +1 -0
- package/assets/esri/core/workers/chunks/{218ddad849745d652a28.js → 5a3c1fe24814a345ab39.js} +1 -1
- package/assets/esri/core/workers/chunks/5b292831127bf981c1c5.js +1 -0
- package/assets/esri/core/workers/chunks/{bd1c870694edd25bf8aa.js → 5f13ade03500b39c1720.js} +1 -1
- package/assets/esri/core/workers/chunks/6154f4d39f9e53fe56cc.js +1 -0
- package/assets/esri/core/workers/chunks/62b116307483d5f0e37d.js +2 -0
- package/assets/esri/core/workers/chunks/6433a623af765b7e53ab.js +1 -0
- package/assets/esri/core/workers/chunks/65eff0ae773505495f21.js +1 -0
- package/assets/esri/core/workers/chunks/6d11b922898a8039dbe7.js +1 -0
- package/assets/esri/core/workers/chunks/7188559a685e0ba30c4f.js +1 -0
- package/assets/esri/core/workers/chunks/{faf14281a74a06fa1f30.js → 724b2631c9ced80a1661.js} +1 -1
- package/assets/esri/core/workers/chunks/7493ce5d02224c07a6d5.js +1 -0
- package/assets/esri/core/workers/chunks/7ad70c8a56f2481adc82.js +1 -0
- package/assets/esri/core/workers/chunks/7ca188f824956a5cac35.js +2 -0
- package/assets/esri/core/workers/chunks/852649460d664b0a1a1d.js +1 -0
- package/assets/esri/core/workers/chunks/{ab10388dcc17a665ac3b.js → 8e1b913067b8e88ff365.js} +2 -2
- package/assets/esri/core/workers/chunks/{e3eab61815ef1c521a6c.js → 9568932bafe689c38f63.js} +1 -1
- package/assets/esri/core/workers/chunks/{c8d83f71326222b98608.js → 996ac351e2322298a17d.js} +1 -1
- package/assets/esri/core/workers/chunks/{34f6093d2c00e3584037.js → 9be05d32528b395a7d34.js} +1 -1
- package/assets/esri/core/workers/chunks/{552d6aecc7d88d16227b.js → 9d41c02601d0bb75b525.js} +1 -1
- package/assets/esri/core/workers/chunks/{64a1ffc221e5b63b43fb.js → a4bb0951e1389e7b803c.js} +1 -1
- package/assets/esri/core/workers/chunks/{b09e9ac5fd928e69b053.js → aabffe53508730e504ec.js} +1 -1
- package/assets/esri/core/workers/chunks/b61c30cdf698b4d1573a.js +1 -0
- package/assets/esri/core/workers/chunks/bbb97c38d8670329d07e.js +2 -0
- package/assets/esri/core/workers/chunks/bd8b483e70acf0fc601e.js +1 -0
- package/assets/esri/core/workers/chunks/bef32acf368b4d5aba37.js +1 -0
- package/assets/esri/core/workers/chunks/c90dfdf2302b7db1f6f7.js +1 -0
- package/assets/esri/core/workers/chunks/{8a36b999cbd65dd2f16c.js → d8c3bdc3c6be8ba7c5e6.js} +1 -1
- package/assets/esri/core/workers/chunks/{40b842d055b87e442156.js → f20b88f5a6d3b988a055.js} +1 -1
- package/assets/esri/core/workers/chunks/{f248131df4eaa5291623.js → f6ae0c483579e227a2f2.js} +1 -1
- package/config.js +1 -1
- package/geometry/support/spatialReferenceUtils.js +1 -1
- package/kernel.js +1 -1
- package/package.json +2 -2
- package/renderers/UniqueValueRenderer.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/vectorTiles/buckets/SymbolBucket.js +1 -1
- package/views/2d/engine/vectorTiles/style/GeoJSONLabelUtils.js +2 -0
- package/views/2d/engine/vectorTiles/style/StyleLayer.js +1 -1
- package/views/2d/engine/vectorTiles/style/StyleRepository.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AAnimatedShader.js +1 -1
- package/views/3d/GroundView3D.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightAuthoringUtils.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightItemTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightObserverPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightPlacementLeafPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightRootPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTargetPlugin.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/analysis/LineOfSight/lineOfSightPlacementUtils.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/PinchAndPanNavigation.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerLocal.js +1 -1
- package/views/3d/state/controllers/ZoomControllerGlobal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/GroundAndIMSurface.js +2 -0
- package/views/3d/support/pointsOfInterest/CameraOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/support/pointsOfInterest/PointOfInterest.js +1 -1
- package/views/3d/support/pointsOfInterest/PointsOfInterest.js +1 -1
- package/views/3d/terrain/OverlayManager.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/support/PluginContext.js +1 -1
- package/views/draw/support/types.d.ts +6 -0
- package/views/interactive/interactiveToolUtils.js +1 -1
- package/widgets/Widget.js +1 -1
- package/widgets/support/jsxWidgetSupport.js +1 -1
- package/assets/esri/core/workers/chunks/0dcfd82a2669df6eb5a0.js +0 -1
- package/assets/esri/core/workers/chunks/1352b5c6767e5421bc02.js +0 -1
- package/assets/esri/core/workers/chunks/14469f664fd5ede469fc.js +0 -1
- package/assets/esri/core/workers/chunks/177c3b23c1cbd4737049.js +0 -1
- package/assets/esri/core/workers/chunks/21f763694a41968ac21a.js +0 -1
- package/assets/esri/core/workers/chunks/230925079cee040a8d77.js +0 -1
- package/assets/esri/core/workers/chunks/25696c194457e42b3bdc.js +0 -1
- package/assets/esri/core/workers/chunks/469e72ab6cd44272f474.js +0 -1
- package/assets/esri/core/workers/chunks/4f36596280142be1c666.js +0 -1
- package/assets/esri/core/workers/chunks/53d80202b5f43542d45b.js +0 -1
- package/assets/esri/core/workers/chunks/6c389e9646a48c26da20.js +0 -2
- package/assets/esri/core/workers/chunks/6f08c8a1e8e3ffd0a96a.js +0 -1
- package/assets/esri/core/workers/chunks/71ee7c51d2c60a180f1e.js +0 -1
- package/assets/esri/core/workers/chunks/927582ec15bff2acbb49.js +0 -1
- package/assets/esri/core/workers/chunks/98739b6e7904045edbab.js +0 -1
- package/assets/esri/core/workers/chunks/a69c10bfd632a5546b34.js +0 -1
- package/assets/esri/core/workers/chunks/ac9a3dfd02160e43fc8a.js +0 -2
- package/assets/esri/core/workers/chunks/c456abf5ee2a1ad5cc5b.js +0 -1
- package/assets/esri/core/workers/chunks/c61e94806b37ca3dd549.js +0 -2
- package/assets/esri/core/workers/chunks/c899457f19b749516275.js +0 -1
- package/assets/esri/core/workers/chunks/d0c8630177d3a4e316f1.js +0 -2
- package/assets/esri/core/workers/chunks/da0ef984509057ec8507.js +0 -1
- package/assets/esri/core/workers/chunks/ead4143d811aab610e00.js +0 -2
- package/assets/esri/core/workers/chunks/ffe2cbfea38b92a231d6.js +0 -1
- /package/assets/esri/core/workers/chunks/{d0c8630177d3a4e316f1.js.LICENSE.txt → 1b277311a4beb4243bf8.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ead4143d811aab610e00.js.LICENSE.txt → 30dade7bf6032be32599.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ac9a3dfd02160e43fc8a.js.LICENSE.txt → 62b116307483d5f0e37d.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{6c389e9646a48c26da20.js.LICENSE.txt → 7ca188f824956a5cac35.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ab10388dcc17a665ac3b.js.LICENSE.txt → 8e1b913067b8e88ff365.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{c61e94806b37ca3dd549.js.LICENSE.txt → bbb97c38d8670329d07e.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisObserver.js";import i from"../../../../analysis/LineOfSightAnalysisTarget.js";import s from"../../../../core/Collection.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{isPoint as a,isMultipoint as l}from"../../../../geometry/support/typeUtils.js";import{updateLineOfSightItemFromAuthoredPoint as u}from"./LineOfSightAuthoringUtils.js";import{isLineOfSightObserverPlugin as h,createLineOfSightObserverPluginConfiguration as g}from"./LineOfSightObserverPlugin.js";import{isLineOfSightPlacementLeafPlugin as c}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{isLineOfSightTargetPlugin as m,createLineOfSightTargetPluginConfiguration as _}from"./LineOfSightTargetPlugin.js";import{PluginBase as y}from"../../../draw/plugins/PluginBase.js";let v=class extends y{constructor(){super(...arguments),this.observerElevationInfo=null,this.targetElevationInfo=null,this._intersector=null,this._downstreamPlugin=null,this._initialObserver=null,this._operationObserver=null,this._initialTargets=new s,this._operationTargets=new s}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=r(this._intersector)}start(t){super.start(t),this._initialObserver=this.analysis.observer,this._operationObserver=this._initialObserver,f(this._initialTargets,this.analysis.targets.toArray()),this._operationTargets.removeAll(),t.session.appendOrReplacePart(null,[]),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}beforeAttachPlugin(t){return{geometryType:"point",useStandaloneSession:!0}}beforeComplete(){return{downstreamPluginCompletionMode:"cancel"}}attachPlugin(t){this._downstreamPlugin=t}afterUndoRedo(){this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}detachPlugin(t,s){if(this._downstreamPlugin===t&&(this._downstreamPlugin=null),m(t)&&this._clearCursorTarget(),"complete"!==s)return void this._syncAnalysisFromSession();const r=this._context?.getSession(t)?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"point"});if(!r||!a(r))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._truncateItemsToSession();const n=c(t)?t.preservedIntersection:null,o=!!c(t)&&t.
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisObserver.js";import i from"../../../../analysis/LineOfSightAnalysisTarget.js";import s from"../../../../core/Collection.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{property as n,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{isPoint as a,isMultipoint as l}from"../../../../geometry/support/typeUtils.js";import{updateLineOfSightItemFromAuthoredPoint as u}from"./LineOfSightAuthoringUtils.js";import{isLineOfSightObserverPlugin as h,createLineOfSightObserverPluginConfiguration as g}from"./LineOfSightObserverPlugin.js";import{isLineOfSightPlacementLeafPlugin as c}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as p}from"./LineOfSightRayIntersector.js";import{isLineOfSightTargetPlugin as m,createLineOfSightTargetPluginConfiguration as _}from"./LineOfSightTargetPlugin.js";import{PluginBase as y}from"../../../draw/plugins/PluginBase.js";let v=class extends y{constructor(){super(...arguments),this.observerElevationInfo=null,this.targetElevationInfo=null,this._intersector=null,this._downstreamPlugin=null,this._initialObserver=null,this._operationObserver=null,this._initialTargets=new s,this._operationTargets=new s}initialize(){this._intersector=new p({view:this.view})}destroy(){this._intersector=r(this._intersector)}start(t){super.start(t),this._initialObserver=this.analysis.observer,this._operationObserver=this._initialObserver,f(this._initialTargets,this.analysis.targets.toArray()),this._operationTargets.removeAll(),t.session.appendOrReplacePart(null,[]),this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}beforeAttachPlugin(t){return{geometryType:"point",useStandaloneSession:!0}}beforeComplete(){return{downstreamPluginCompletionMode:"cancel"}}attachPlugin(t){this._downstreamPlugin=t}afterUndoRedo(){this._syncAnalysisFromSession(),this._restartDownstreamPlugin()}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}detachPlugin(t,s){if(this._downstreamPlugin===t&&(this._downstreamPlugin=null),m(t)&&this._clearCursorTarget(),"complete"!==s)return void this._syncAnalysisFromSession();const r=this._context?.getSession(t)?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"point"});if(!r||!a(r))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._truncateItemsToSession();const n=c(t)?t.preservedIntersection:null,o=!!c(t)&&t.usesAuthoredAbsoluteHeight;if(h(t)){const i=t.observer??this._operationObserver??new e;if(!this._intersector||!u(this.view,i,this._intersector,r,{elevationInfo:this.observerElevationInfo,preservedIntersection:n,usesAuthoredAbsoluteHeight:o}))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._operationObserver=i}else if(m(t)){const e=t.target??new i;if(!this._intersector||!u(this.view,e,this._intersector,r,{elevationInfo:this.targetElevationInfo,preservedIntersection:n,usesAuthoredAbsoluteHeight:o}))return this._syncAnalysisFromSession(),void this._restartDownstreamPlugin();this._operationTargets.add(e)}this._appendCommittedPoint(r),this._syncAnalysisFromSession(),this._restartDownstreamPlugin(),this._clearCursorTarget()}_appendCommittedPoint(t){const e=this._session;e&&(e.appendOrReplacePoint(null,t),e.appendOrReplacePart(null,[]),e.automaticRestart=!1,e.groupGeometryChanges())}_clearCursorTarget(){this.analysisViewData.cursorTarget=r(this.analysisViewData.cursorTarget)}_truncateItemsToSession(){const t=this._getCommittedPointCount();null==this._initialObserver&&0===t&&(this._operationObserver=null),this._operationTargets.splice(this._getCommittedOperationTargetCount(t))}_restartDownstreamPlugin(){const t=null==this.analysis.observer,e=t?this._createObserverPluginConfiguration():this._createTargetPluginConfiguration();t&&h(this._downstreamPlugin)||!t&&m(this._downstreamPlugin)||this._context?.requestBeginDownstreamPlugin(e,{cancelExisting:!0})}_createObserverPluginConfiguration(t=null){return g({observer:t,defaultCaptureMode:t?"grabbable-object":"capture-always",inputMapPosition:t?.position??null})}_createTargetPluginConfiguration(t=null){return _({analysis:this.analysis,analysisViewData:this.analysisViewData,defaultCaptureMode:t?"grabbable-object":"capture-always",elevationInfo:this.targetElevationInfo,inputMapPosition:t?.position??null,target:t,view:this.view})}_syncAnalysisFromSession(){const t=this._getCommittedPointCount(),e=this._getCommittedOperationTargetCount(t);this.analysis.observer=this._getActiveObserver(t),f(this.analysis.targets,this._initialTargets.toArray().concat(this._operationTargets.toArray().slice(0,e)))}_getActiveObserver(t){return null!=this._initialObserver?this._operationObserver??null:t>0?this._operationObserver:null}_getCommittedOperationTargetCount(t){return Math.max(0,t-(null!=this._initialObserver?0:Math.min(t,1)))}_getCommittedPointCount(){const t=this._session?.generatePreviewGeometry({includeAutomaticConnection:!1,geometryType:"multipoint"});return t&&l(t)?t.points.length:0}};function d(t){return{uniqueId:Symbol("line-of-sight-root-plugin"),kind:["multipart"],geometryType:"multipoint",hidden:!0,localizationKey:"line-of-sight-root",icon:"point",create:()=>new v(t)}}function f(t,e){let i=-1;for(let s=0;s<Math.min(t.length,e.length);s++)if(t.getItemAt(s)!==e[s]){i=s;break}if(-1===i){if(t.length===e.length)return;i=Math.min(t.length,e.length)}t.splice(i,t.length-i,...e.slice(i))}t([n({constructOnly:!0})],v.prototype,"analysis",void 0),t([n({constructOnly:!0})],v.prototype,"analysisViewData",void 0),t([n({constructOnly:!0})],v.prototype,"view",void 0),t([n({constructOnly:!0})],v.prototype,"observerElevationInfo",void 0),t([n({constructOnly:!0})],v.prototype,"targetElevationInfo",void 0),t([n()],v.prototype,"_intersector",void 0),t([n()],v.prototype,"_downstreamPlugin",void 0),v=t([o("esri.views.3d.analysis.LineOfSight.LineOfSightRootPlugin")],v);export{v as LineOfSightRootPlugin,d as createLineOfSightRootPluginConfiguration};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as s,sync as r}from"../../../../core/reactiveUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as a,updateLineOfSightItemFromAuthoredPoint as l}from"./LineOfSightAuthoringUtils.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../../analysis/LineOfSightAnalysisTarget.js";import{destroyMaybe as i}from"../../../../core/maybe.js";import{watch as s,sync as r}from"../../../../core/reactiveUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{updateLineOfSightItemFromIntersection as a,updateLineOfSightItemFromAuthoredPoint as l}from"./LineOfSightAuthoringUtils.js";import{lineOfSightPlacementLeafPluginMarker as p}from"./LineOfSightPlacementLeafPlugin.js";import{usesLineOfSightAuthoredAbsoluteHeight as u}from"./lineOfSightPlacementUtils.js";import{LineOfSightRayIntersector as c}from"./LineOfSightRayIntersector.js";import{PluginBase as h}from"../../../draw/plugins/PluginBase.js";var d,v;const g=Symbol("line-of-sight-target-vertex"),y=Symbol("line-of-sight-target-plugin-marker");let f=class extends h{constructor(){super(...arguments),this[d]=!0,this[v]=!0,this.target=null,this.elevationInfo=null,this.defaultCaptureMode="capture-always",this.inputMapPosition=null,this.preservedIntersection=null,this._interactiveHandle=null,this._intersector=null}static{d=y,v=p}initialize(){this._intersector=new c({view:this.view})}destroy(){this._intersector=i(this._intersector)}get usesAuthoredAbsoluteHeight(){return u(this._context,this._interactiveHandle)}start(t){super.start(t),this.preservedIntersection=null;const{positionOfLastUserInput:o,session:n}=t,p="grabbable-object"===this.defaultCaptureMode?this.inputMapPosition??this._interactiveHandle?.outputMapPosition??o:this.inputMapPosition??o;!p||"grabbable-object"!==this.defaultCaptureMode&&this._interactiveHandle||n.appendOrReplacePoint(g,p);let u="capture-always"===this.defaultCaptureMode&&null!=p;this._interactiveHandle&&this._clearCursorTarget(),this._interactiveHandle||(this._interactiveHandle=t.createInteractiveHandle({defaultCaptureMode:this.defaultCaptureMode,inputMapPosition:"grabbable-object"===this.defaultCaptureMode?p??void 0:void 0}),this.addHandles(s(()=>this._interactiveHandle?.outputMapPosition,t=>{if(!t||this._isComplete)return;const s=this.analysisViewData.cursorTarget??new e,r={elevationInfo:this.elevationInfo,usesAuthoredAbsoluteHeight:this.usesAuthoredAbsoluteHeight},o=this._interactiveHandle?.screenPosition,n=o&&this._intersector?this._intersector.getScreenPointIntersection(o):null;return this._session?.appendOrReplacePoint(g,t),u?(u=!1,void this._clearCursorTarget()):null!=n?(this.analysisViewData.cursorTarget=s,void a(this.view,s,n,{...r,snappedMapPoint:t})):null!=o&&null!=this.preservedIntersection?(this.analysisViewData.cursorTarget=s,void a(this.view,s,this.preservedIntersection,{...r,snappedMapPoint:t})):void(null==o&&this._intersector&&l(this.view,s,this._intersector,t,{...r,preservedIntersection:this.preservedIntersection})?this.analysisViewData.cursorTarget=s:this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget))},r),this._ownHandlesKey))}complete(){this._clearCursorTarget(),super.complete()}cancel(){this._clearCursorTarget()}_clearCursorTarget(){this.analysisViewData.cursorTarget=i(this.analysisViewData.cursorTarget)}};function m(t){return!!t&&y in t}function _(t){return{uniqueId:Symbol("line-of-sight-target-plugin"),kind:["vertex"],geometryType:"point",hidden:!0,localizationKey:"leaf-point-segment",icon:"point",create:()=>new f(t)}}t([o({constructOnly:!0})],f.prototype,"analysis",void 0),t([o({constructOnly:!0})],f.prototype,"analysisViewData",void 0),t([o({constructOnly:!0})],f.prototype,"view",void 0),t([o({constructOnly:!0})],f.prototype,"target",void 0),t([o({constructOnly:!0})],f.prototype,"elevationInfo",void 0),t([o()],f.prototype,"defaultCaptureMode",void 0),t([o()],f.prototype,"inputMapPosition",void 0),t([o()],f.prototype,"preservedIntersection",void 0),t([o()],f.prototype,"_interactiveHandle",void 0),t([o()],f.prototype,"_intersector",void 0),f=t([n("esri.views.3d.analysis.LineOfSight.LineOfSightTargetPlugin")],f);export{f as LineOfSightTargetPlugin,_ as createLineOfSightTargetPluginConfiguration,m as isLineOfSightTargetPlugin,y as lineOfSightTargetPluginMarker};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as
|
|
2
|
+
import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as s,subclass as n}from"../../../../core/accessorSupport/decorators.js";import a from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as l}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as r}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as c}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as h}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as p}from"../../../input/InputManager.js";import{AnalysisToolBase as d}from"../../../interactive/AnalysisToolBase.js";import{deactivateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as u}from"../../../interactive/keybindings.js";import{acquire as _}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as m}from"../../../interactive/snapping/snappingUtils.js";const g={ready:"ready",creating:"creating",created:"created"};let y=class extends d{constructor(t){super(t),this._operationManager=new h,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1;const{snappingManager:e}=this._snappingManagerResult=_(t.view);this._editIntersector=new c({view:t.view}),this._editTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._editIntersector,snappingManager:e,view:t.view}),this._placementController=new r({...t,parent:this,snappingManager:e,shouldPreventVertexAdd:(t,e)=>this._editTool.hasManipulatorAt(t,e)})}get active(){return this._editTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?g.creating:null!=this.analysis.observer?.position?g.created:g.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._editTool.updating||this._placementController.updating}initialize(){m(this),this.addHandles([this._snappingManagerResult,this.view.on("key-down",t=>this._onKeyDown(t),p.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),o),i(()=>this.state===g.created,t=>{t?this.finishToolCreation():this._set("created",!1)},o),i(()=>this.analysisViewData.visible,t=>{this.visible=t},o),i(()=>this.editable,t=>{this.analysisViewData.editable=t},o)])}destroy(){this._operationManager.destroy(),this._editTool.stop(),this._placementController.stop(),this._editTool.destroy(),this._placementController.destroy(),this._editIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(s,n)=>{const{elevationInfo:a}=t??{},l=a&&"observer"in a?a.observer:a,r=a&&"targets"in a?a.targets:a;this._placementController.observerPlacementElevationInfo=f(l),this._placementController.targetPlacementElevationInfo=f(r);const c=this.analysis.clone();let h=!1,p=!1;const d=()=>{if(p)return;if(p=!0,this.stop(),!this.analysis.valid)return this.analysis.clear(),void s.reject();if(n.aborted||this.analysis.equals(c))return void s.reject();const t=this.analysis.targets.at(-1);null!=t&&this._editTool.selectItem(t),s.resolve({})};s.handles.push(e(()=>this.stop()),i(()=>this._placementController.active,t=>{t?h=!0:h&&d()},o)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.observerPlacementElevationInfo=null,this._placementController.targetPlacementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}get snappingOptions(){return this._snappingManager.options}set snappingOptions(t){this._snappingManager.options=t}get _snappingManager(){return this._snappingManagerResult.snappingManager}onEditableChange(){this.analysisViewData.editable=this.editable,this._editTool.setEditableFlag(1,!0),this._editTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideEditTool(){this._editTool.stop(),this._editTool.visible=!1}_onKeyDown(t){const e=t.key;e===u.undo&&this.canUndo?(t.stopPropagation(),this.undo()):e===u.redo&&this.canRedo?(t.stopPropagation(),this.redo()):e===u.cancel&&!this.active&&this._editTool.hasSelection&&this._editTool.clearSelection()}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateEditTool?this._placementController.active?this._placementController:null:this._editTool:null}get _canActivateEditTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateEditTool;if(this._placementController.visible=this.visible&&t,this._editTool.manipulatorsInteractive=t&&!this._placementController.active,!t)return this._placementController.stop(),this._hideEditTool(),this.analysisViewData.cursorTarget=null,void v(this.view,this);if(!this.visible)return this._editTool.stop(),this._editTool.visible=!0,void v(this.view,this);if(this._placementController.active)return this._editTool.stop(),this._editTool.visible=this.visible,void v(this.view,this);if(!e)return this._hideEditTool(),void v(this.view,this);this._editTool.visible=!0,this.analysisViewData.cursorTarget=null,v(this.view,this)}finally{this._syncingActiveTool=!1}}}};function f(t){if(null==t)return null;const{featureExpressionInfo:e,mode:i,offset:o,unit:s}=t;return new a({featureExpressionInfo:e,mode:i,offset:o,unit:s})}t([s({constructOnly:!0})],y.prototype,"view",void 0),t([s({constructOnly:!0})],y.prototype,"analysis",void 0),t([s({constructOnly:!0})],y.prototype,"analysisViewData",void 0),t([s()],y.prototype,"active",null),t([s()],y.prototype,"canRedo",null),t([s()],y.prototype,"canUndo",null),t([s()],y.prototype,"state",null),t([s()],y.prototype,"cursor",null),t([s()],y.prototype,"updating",null),t([s()],y.prototype,"removeIncompleteOnCancel",void 0),t([s()],y.prototype,"snappingOptions",null),t([s()],y.prototype,"_canActivateEditTool",null),y=t([n("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],y);export{y as LineOfSightTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as n,syncAndInitial as
|
|
2
|
+
import{destroyHandle as e}from"../../../../core/handleUtils.js";import{watch as n,syncAndInitial as t}from"../../../../core/reactiveUtils.js";import{LineOfSightDrawToolRenderer as o}from"./LineOfSightDrawToolRenderer.js";import{isLineOfSightPlacementLeafPlugin as i}from"./LineOfSightPlacementLeafPlugin.js";import{LineOfSightRayIntersector as r}from"./LineOfSightRayIntersector.js";import{DrawTool as a}from"../../../draw/DrawTool.js";import s from"../../../interactive/options/InteractiveToolOptions.js";import{createScreenPointFromEvent as l}from"../../../support/screenUtils.js";function p(p){const{analysis:c,analysisViewData:f,snappingManager:u,view:m,getVisible:d,getSourceElevationInfo:v,getSnapToSceneEnabled:g,onCancel:w,onComplete:b,onManipulatorCountChange:h,shouldPreventVertexAdd:I}=p,S=v(),j=new o({analysis:c,analysisViewData:f,view:m}),y=new r({view:m}),D=new a({elevationInfo:S,enableVertexVisuals:!1,hasZ:!0,renderer:j,toolOptions:new s({tooltips:{enabled:!0}}),snappingManager:u,view:m});return j.elevationInfo=S,D.addHandles([e(j),e(y),D.on("cancel",()=>w(D)),D.on("complete",()=>b(D)),n(()=>[D.surfaceManager,g()],([e,n])=>{e&&(e.snapToSceneEnabled=n)},t),n(()=>[d(),f.visible,v()],([e,n,t])=>{D.visible=e&&n,j.analysisVisible=D.visible,D.elevationInfo=t,j.elevationInfo=t,j.refresh()},t),n(()=>D.manipulators.length,()=>h(D),t),D.on(["before-vertex-add","before-vertex-add-at-point"],e=>{const n=e.detail.originalEvent;if("immediate-click"!==n?.type)return;const t=l(n);if(I(t,n.pointerType))return void e.preventDefault();const o=y.getScreenPointIntersection(t);if(null==o?.mapPoint)e.preventDefault();else{const e=D.mostDownstreamPlugin;i(e)&&(e.preservedIntersection=o)}})]),{drawTool:D,renderer:j}}function c(e,n){if(null!=e?.elevationConstraint)return!0;const t=n?.inputMapPosition,o=n?.selectedSnappingResult;return null!=t&&null!=o&&!t.equals(o)}export{p as createDrawTool,c as usesLineOfSightAuthoredAbsoluteHeight};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../core/Accessor.js";import"../../../core/has.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as o,initial as i,syncAndInitial as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as s}from"../../../core/accessorSupport/decorators.js";import{DoubleClickZoom as m}from"./handlers/DoubleClickZoom.js";import{DragRotate as d}from"./handlers/DragRotate.js";import{DragZoom as p}from"./handlers/DragZoom.js";import{DragZoomBox as g}from"./handlers/DragZoomBox.js";import{GamepadNavigation as h}from"./handlers/GamepadNavigation.js";import{KeyboardNavigation as l}from"./handlers/KeyboardNavigation.js";import{MouseWheelZoom as c}from"./handlers/MouseWheelZoom.js";import{PinchAndPanNavigation as u}from"./handlers/PinchAndPanNavigation.js";import{PointerDownCancelAnimation as w}from"./handlers/PointerDownCancelAnimation.js";import{TwoFingerTilt as f}from"./handlers/TwoFingerTilt.js";import{BrowserEventSource as v}from"../../input/BrowserEventSource.js";import{InputManager as y,ViewEventPriorities as _}from"../../input/InputManager.js";import{PreventContextMenu as D}from"../../input/handlers/PreventContextMenu.js";import{PreventTouchSelection as j}from"../../input/handlers/PreventTouchSelection.js";import{getPointerActions as P}from"../../input/handlers/support.js";import{Drag as A}from"../../input/recognizers/Drag.js";import{ImmediateDoubleClick as M}from"../../input/recognizers/ImmediateDoubleClick.js";import{PointerClickHoldAndDrag as T}from"../../input/recognizers/PointerClickHoldAndDrag.js";import{SingleAndDoubleClick as b}from"../../input/recognizers/SingleAndDoubleClick.js";import{VerticalTwoFingerDrag as I}from"../../input/recognizers/VerticalTwoFingerDrag.js";let N=class extends e{constructor(){super(...arguments),this.mode="default",this._keys={fov:"Shift",pan:{left:"ArrowLeft",right:"ArrowRight",forward:"ArrowUp",backward:"ArrowDown",up:["u","U"],down:["j","J"]},lookAround:{headingLeft:["a","A"],headingRight:["d","D"],tiltUp:["w","W"],tiltDown:["s","S"]},modifier:["b","B"],zoom:{zoomIn:["+","="],zoomOut:["-","_"]},reset:{heading:["n","N"],tilt:["p","P"]}},this._updateMode=({mode:t,dragPrimary:e,dragSecondary:r,dragTertiary:o})=>{"pro"===t&&(r="zoom",o="pan"===e?"rotate":"pan");const i={dragPrimary:e,dragSecondary:r,dragTertiary:o};this._modeDragPan&&(this._modeDragPan.pointerActions=P("pan",i)),this._modeDragRotate&&(this._modeDragRotate.pointerActions=P("rotate",i)),this._modeDragZoom&&(this._modeDragZoom.pointerActions=P("zoom",i))}}destroy(){this.disconnect()}get primaryDragAction(){return this.view.navigation.actionMap.dragPrimary}set primaryDragAction(t){const{actionMap:e}=this.view.navigation;e.dragPrimary=t,e.dragSecondary="pan"===t?"rotate":"pan"}get updating(){return!!this._inputManager?.updating}get latestPointerInfo(){return this._inputManager?.latestPointerInfo}get latestPenInfo(){return this._inputManager?.latestPenInfo}get multiTouchActive(){return this._inputManager?.multiTouchActive??!1}disconnect(){this.removeAllHandles(),this.view.viewEvents.disconnect(),this._modeDragPan=null,this._modeDragRotate=null,this._modeDragZoom=null,this._modeKeyboardNavigation=null,this._inputManager=r(this._inputManager),this._source=r(this._source)}connect(){const t=this.view;this._source=new v(this.view.surface,t.input);const e=[new M,new T,new b,new A(this.view.navigation),new I],r=new y({eventSource:this._source,recognizers:e});this._inputManager=r,r.installHandlers("prevent-context-menu",[new D],_.INTERNAL),r.installHandlers("prevent-touch-text-selection-gesture",[new j(this.view)],_.INTERNAL),this._modeDragPan=new u(t,["primary"]),this._modeDragRotate=new d(t,["secondary"],0),this._modeDragZoom=new p(t,["tertiary"],this._keys.fov),this._modeKeyboardNavigation=new l(t,this._keys),r.installHandlers("navigation",[new w(t),new m(t),new h(t),new c(t,this._keys.fov),new g(t),new d(t,["primary"],1,this._keys.modifier),this._modeDragRotate,this._modeDragZoom,this._modeDragPan,this._modeKeyboardNavigation,new f(t)],_.INTERNAL),this.view.viewEvents.connect(r),this.addHandles([o(()=>this.view.navigation?.browserTouchPanEnabled,t=>{this._source.browserTouchPanningEnabled=!t},i),o(()=>{const{actionMap:t}=this.view.navigation,{dragPrimary:e,dragSecondary:r,dragTertiary:o}=t;return{mode:this.mode,dragPrimary:e,dragSecondary:r,dragTertiary:o}},this._updateMode,n)])}isModifierKeyDown(t){return this._inputManager?.isModifierKeyDown(t)??!1}get test(){}};t([a()],N.prototype,"view",void 0),t([a({type:["default","pro"]})],N.prototype,"mode",void 0),t([a({readOnly:!0})],N.prototype,"updating",null),t([a()],N.prototype,"latestPointerInfo",null),t([a()],N.prototype,"latestPenInfo",null),t([a()],N.prototype,"multiTouchActive",null),t([a()],N.prototype,"_inputManager",void 0),N=t([s("esri.views.3d.input.SceneInputManager")],N);const S=N;export{S as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{PinchAndPanControllerGlobal as t}from"../../state/controllers/PinchAndPanControllerGlobal.js";import{PinchAndPanControllerLocal as e}from"../../state/controllers/PinchAndPanControllerLocal.js";import{InputHandler as
|
|
2
|
+
import{PinchAndPanControllerGlobal as t}from"../../state/controllers/PinchAndPanControllerGlobal.js";import{PinchAndPanControllerLocal as e}from"../../state/controllers/PinchAndPanControllerLocal.js";import{InputHandler as s}from"../../../input/InputHandler.js";import{eventMatchesMousePointerActions as r}from"../../../input/handlers/support.js";class i extends s{constructor(t,e,s){super(!0),this._view=t,this.pointerActions=e,this._lastEndTimestamp=0,this._lastTimestamp=0,this.registerIncoming("drag",s,t=>this._handleDrag(t))}_handleDrag(t){if("mouse"===t.data.pointerType&&!r(t.data,this.pointerActions))return;const e=t.timestamp-this._lastEndTimestamp,s=40,i=this._momentum&&this._momentum.running&&e<s;switch(t.data.action){case"start":case"update":if(i)break;this._controller&&this._controller.running?t.data.timestamp-this._lastTimestamp>2&&(this._controller.update(t.data),this._lastTimestamp=t.timestamp):this._startController(t);break;case"end":case"removed":this._endController(t,!0);break;case"added":this._endController(t,!1),this._startController(t)}t.stopPropagation()}_endController(t,e){if(this._controller?.running){this._lastEndTimestamp=t.timestamp;const s=this._controller.end(t.data);e&&s&&(this._momentum=s,this._view.state.switchCameraController(this._momentum))}this._controller=null}_startController(t){this._controller=this._createController(),this._view.state.switchCameraController(this._controller),this._controller.begin(t.data),this._lastTimestamp=t.timestamp}_createController(){return this._view.state.isGlobal?new t({view:this._view}):new e({view:this._view})}}export{i as PinchAndPanNavigation};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as n,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as h,isFloat32Array as u,isUint32Array as m,isUint16Array as p}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as f,convertUnit as g}from"../../../core/units.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as _,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as w,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as j,sub as E,dot as M,set as R}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as S,clone as V,ZEROS as U,fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as H,clone as I,ONES as D}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as k,getReferenceEllipsoid as A,SphericalECEFSpatialReferenceLike as F}from"../../../geometry/ellipsoidUtils.js";import G from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as z}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as B}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as N}from"../../../geometry/projection/projectVectorToVector.js";import{create as q}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as W}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as X,isWebMercator as $,equals as Z,isGeographic as Y,isCGCS2000 as J}from"../../../geometry/support/spatialReferenceUtils.js";import K from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as Q,BufferViewVec3u8 as ee,BufferViewVec2f as te,BufferViewVec3f as ie,BufferViewUint32 as re,BufferViewUint16 as se}from"../../../geometry/support/buffer/BufferView.js";import{nullId as ae}from"../../../layers/ILyr3DWasmPerSceneView.js";import oe from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as ne,validateEntity3D as le,makeCacheKey as ce}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as de}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as he}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as ue}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as me}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as pe,removeLayerViewFromWasm as fe,getLyr3DWasm as ge}from"./Lyr3DWasm.js";import{toWasmModification as ye}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as _e}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ve,alphaModeConversion as we,faceCullingConversion as Ce,wrapModeConversion as Te}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as xe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as je}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ee}from"../state/Frustum.js";import{ElevationRange as Me}from"../support/ElevationRange.js";import{toBoundingRect as Re}from"../support/extentUtils.js";import{Obb as Oe}from"../support/orientedBoundingBox.js";import{glLayout as Se}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Ve}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ue,SourceGeometry as Pe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as He}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ie}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as De}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Le}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as ke}from"../webgl-engine/materials/pbrUtils.js";import Ae from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Fe,isInEffectiveScaleRange as Ge,validateScaleRange as ze}from"../../support/layerViewUtils.js";import{TaskPriority as Be}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ne}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as qe,SizedPixelFormat as We}from"../../webgl/enums.js";import{alphaCutoff as Xe}from"../../../webscene/support/AlphaCutoff.js";var $e;function Ze(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return qe.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return qe.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx"===t)return"Etc1"===i?qe.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return We.RG8;case 6407:return We.RGB8;case 6408:return We.RGBA8;case 6403:return We.R8;default:return null}}let Ye=class extends(ue(Ae)){static{$e=_e}constructor(e){super(e),this[$e]=!0,this.type="integrated-mesh-3dtiles",this.freeze=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ne,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Be.TILES3D,this),this._frustum=new Ee(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new he(xe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),n),!this._canProjectWithoutEngine())throw Fe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=pe(this,this._initializationController.signal).then(t=>{a(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new je(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>this.view.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),n),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),n),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),n),l(()=>this.freeze,e=>{e?this._wasm?.incrementFrozenLayerViewCount(this):(this._wasm?.decrementFrozenLayerViewCount(this),this._cameraChanged())})]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this.freeze=!1,this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),fe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get opaque(){return 0===this._groundTransparencyMode}get invisible(){return 3===this._groundTransparencyMode}get _groundTransparencyMode(){return this.layer.replacesTerrain?Ve(this.fullOpacity,this.view.overlayManager.renderer.isEmpty):0}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return Xe;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(i=>this._collection.updateObjectOpacity(i,e,t))}_cameraChanged(){if(this.freeze)return;const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=ye(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=q();this._layerClippingArea=Re(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,de(e))}get _wasm(){return ge(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Ge(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ze(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,s++):(i+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new me(this.usedMemory,s,a,Qe(t),Qe(e),Qe(r),Qe(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(X(this.view.renderSpatialReference)||$(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&Z(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=ne(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!Y(t)&&t.wkid&&-1!==t.wkid&&(i=f(K.units[K[t.wkid]])),i&&(e=new G({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===W(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=g(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return de(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Me(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new Me;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||J(i)||L(i)||k(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=A(i).radius,{eye:a,viewForward:o,near:n}=t.state.contentCamera,l=j(O(),o),c=500,d=Math.max(a[2],c),h=d+s,u=Math.sqrt(h**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=d>.5*s?.5*Math.PI*s:m,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;E(f,r,a);const s=M(f,l);Math.abs(s)<p&&s+i>n&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return!this.freeze&&this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!le(t))throw new Error("entity3D not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(a){throw i.forEach(e=>this._stage?.removeTexture(e)),a}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:a,componentObjects:o,elevationRange:n}=s;let l=0,c=0,d=0;for(const e of o){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:a}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(a?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Ke(e.handle,o,h,d,c,l,a,e.stableNodeId,e.nodeDepth,n);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(ce(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(a){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),a}}_createPrimitiveTextureBundles(e,t){const i=new Array;try{const r=e.desc.geometry;for(const s of e.validPrimitiveIndices){const a=r.prims[s].materialId,o=e.desc.materials?.materials&&null!=a&&a!==ae?e.desc.materials.materials[a]:null;let n=Promise.resolve(tt),l=null,c=null,d=null,h=null,u=null;if(o){const i="Pbr"===o.lightingModel;l=this._getTexture(o.baseColorTex,e,t),c=i?this._getTexture(o.metalTex,e,t):null,d=i?this._getTexture(o.emissiveTex,e,t):null,h=i?this._getTexture(o.occlusionTex,e,t):null,u=i?this._getTexture(o.normalTex,e,t):null;const r=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(r)}i.push(new it(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=S(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal;let n=C;if(o){const e=T();z(F,s,e,a),n=_(w(),e)}const l=et(r.obb),c=o?A(this.view.spatialReference).radius:0,d=new Array;try{let h=-1;for(const i of e.validPrimitiveIndices){h+=1;const s=r.geometry.prims[i],a=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(s));if(null==ve[s.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+s.ptype+"). Skipping primitive."),a.cleanup();continue}const{positionView:o,normalsData:n,colorView:l,texCoord0Data:c,indicesView:u}=this._getBufferViews(s,e);if(null==o||null==u){a.cleanup();continue}const m=o.count,p=(e,t)=>null==e||e===m||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);p(null!=c?c.length/2:void 0,"numTexcoord")&&p(l?.count,"numColors")&&p(n?.length,"normals")?d.push({componentIndex:h,positionView:o,indicesView:u,texCoord0Data:c,colorView:l,normalsData:n}):a.cleanup()}const u=n!==C,m=u?v(w(),n)??C:C,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:g}=await this._workerHandle.processTiles3DVertices(d,s,c,o,n,l,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const y=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&l.setHalfSize(f);for(const o of p){const{componentIndex:n,positionView:c,indicesView:d,layout:h,textureCoordinateType:p,interleavedVertexData:f,indices:g}=o,b=e.validPrimitiveIndices[n],_=r.geometry.prims[b],v=t[n],w=l.clone(),C=Se(h),T=new Uint32Array([0,d.typedBuffer.length]),x=new Ue(C,this._imShading?2:0,p,u?2:0),j=new Pe({interleavedVertexData:f,vertexCount:f.byteLength/C[0].stride,indexData:g},{positions:c.typedBuffer,indices:d.typedBuffer},T,x),E=this.view.renderSpatialReference,M=O(),R=[1,1,1];B(s,E,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),N(s,E,M,a);const S=this._createComponentMaterialInitParameters(y,_.materialId,v);S.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:H(M[0],M[1],R[0],R[1]),transform:new He(s,m),obb:w,geometry:j,elevationAlignable:!1},S);i.push(V)}const{fullExtent:b}=this.layer;return b?.hasZ&&b.zmax&&b.zmin&&(g.minElevation=Math.max(g.minElevation,b.zmin),g.maxElevation=Math.min(g.maxElevation,b.zmax)),{tileObb:l,componentObjects:i,elevationRange:g}}catch(h){throw i.forEach(e=>this._collection.destroyObject(e)),h}}_createComponentMaterialInitParameters(e,t,i){const r=null!=e?.materials&&null!=t&&t!==ae?e.materials[t]:null;let s=1;const a=r?.baseColorTex?.imageId;if(null!=a&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){const t=e.images[a];t.alpha&&(s=we[t.alpha])}const o="Pbr"===(null!=r?r.lightingModel:"Unlit");let n=D,l=Xe,c=!1,d=2,h=P(0,0,0);const u=V(ke),m=i.baseColorTexture,p=i.metallicRoughnessTexture,f=i.emissionTexture,g=i.occlusionTexture,y=i.normalTexture;return r&&(n=I(r.baseColorFactor),l=r.alphaCutoff??Xe,o&&(R(u,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(h=r.emissiveFactor)),c=r.isDoubleSided,d=Ce[r.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:n,textureAlphaCutoff:l,mrrFactors:u,baseColorTexture:m,metallicRoughnessTexture:p,normalTexture:y,occlusionTexture:g,emissionTexture:f,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:s,doubleSided:c,cullFace:d,isGround:this.layer.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:h,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ce(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let a=!1,o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}a=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ce(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ce(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}a&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc.materials?.images?.[e.imageId];if(!r||null==r.data||r.data===ae)return null;const s=t.assets[r.data];if(!s||s.byteCount<1||"U8"!==s.dataType)return null;const a=i.get(r)??this._createTexture(e,r,s,i);return a?new Ie(this._stage.renderView.textures,a.id):null}_createTexture(e,t,i,r){const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!t.mipCount||s>1,o=Te[e.wrapMode??"None"];let n=t.alpha?6408:6407;const l=new Uint8Array(i.data.buffer,0,i.byteCount);let c=null,d=null,h=null;switch(t.format){case"Raw":"R8"===t.pixelFormat?(c=l,n=6403,d=""):"Rg8"===t.pixelFormat||"Ga8"===t.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===t.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===t.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Etc1":c=l,n=6407,d="image/ktx";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,i=Ze(n,d,t.format),l=new De(c,{mipmap:a,maxAnisotropy:s,encoding:d,wrap:o,pixelFormat:n,internalFormat:i??void 0,immutable:null!=i,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(l),r.set(t,l),l}return null}_getBufferViews(e,t){let i,r,s,a,o;for(let c=0;c<e.atrbs.length;c++){const o=e.atrbs[c],n=t.assets[o.assetId];if(!n)continue;const d=n.data.buffer,m=void 0,p=0,f=n.byteCount;try{switch(o.sem){case"Position":3===n.ncomp&&"F32"===n.dataType&&u(n.data)?i=new ie(d,p,m,f):this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+n+")");break;case"Normal":if(3===n.ncomp&&"F32"===n.dataType&&u(n.data)){const e=new ie(d,p,m,f);a=new Uint32Array(e.count),Le(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,2*a.length))}else this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+n+")");break;case"TexCoord":2===n.ncomp&&"F32"===n.dataType&&u(n.data)?void 0===s&&(s=new te(d,p,m,f).typedBuffer):this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+n+")");break;case"Color":"U8"===n.dataType&&h(n.data)&&(4===n.ncomp?r=new Q(d,p,m,f):3===n.ncomp&&(r=new ee(d,p,m,f))),null==r&&this._dbg(3,"[Unsupported Feature] Unsupported view for Color ("+n+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+o.sem+"). Skipping vertex attribute.")}}catch(l){this._dbg(2,"Error Creating buffer ("+l+"). Skipping vertex attribute.")}}let n=!1;if(null!=e.index&&e.index!==ae){const i=t.assets[e.index];if(i){const e=void 0,t=0,r=i.byteCount;switch(i.dataType){case"U16":1===i.ncomp&&p(i.data)&&(o=new se(i.data.buffer,t,e,r));break;case"U32":1===i.ncomp&&m(i.data)&&(o=new re(i.data.buffer,t,e,r))}n=!o}else n=!0}if(!n&&null==o&&null!=i){const e=i.count;o=o=e<65535?new se(new Uint16Array(e).buffer):new re(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},n),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([y()],Ye.prototype,"freeze",void 0),e([y()],Ye.prototype,"fullOpacity",null),e([y()],Ye.prototype,"opaque",null),e([y()],Ye.prototype,"invisible",null),e([y({readOnly:!0})],Ye.prototype,"ready",null),e([y({type:[oe]})],Ye.prototype,"_modifications",void 0),e([y()],Ye.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],Ye.prototype,"layer",void 0),e([y({readOnly:!0})],Ye.prototype,"visibleAtCurrentScale",null),e([y({readOnly:!0})],Ye.prototype,"_collection",null),e([y()],Ye.prototype,"elevationOffset",null),e([y({readOnly:!0})],Ye.prototype,"visibleElevationRange",null),e([y()],Ye.prototype,"fullExtentInLocalViewSpatialReference",void 0),Ye=e([b("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ye);const Je=Ye;class Ke{constructor(e,t,i,r,s,a,o,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=O();o?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=o?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(O()):U}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,a=i-e[0],o=r-e[1],n=s-e[2],l=a*t[0]+o*t[1]+n*t[2];return a*a+o*o+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,a=this._obbCenterX-i[0];if(a>s)return!1;const o=this._obbCenterY-i[1];if(o>s)return!1;const n=this._obbCenterZ-i[2];if(n>s)return!1;const l=a*a+o*o+n*n;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Qe(e){return Math.round(e/1048.576)/1e3}function et(e){return new Oe(e.center,e.halfSize,x(...e.quaternion))}const tt=new Array;class it{constructor(e,t,i,r,s,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{Je as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import t from"../../../core/Logger.js";import{abortMaybe as i,destroyMaybe as r,removeMaybe as s}from"../../../core/maybe.js";import{throwIfAborted as a,createAbortError as o}from"../../../core/promiseUtils.js";import{initial as n,watch as l,when as c}from"../../../core/reactiveUtils.js";import{schedule as d}from"../../../core/scheduling.js";import{isUint8Array as h,isFloat32Array as u,isUint32Array as m,isUint16Array as p}from"../../../core/typedArrayUtil.js";import{unitFromRESTJSON as f,convertUnit as g}from"../../../core/units.js";import{property as y,subclass as b}from"../../../core/accessorSupport/decorators.js";import{fromMat4 as _,invert as v}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{create as w,IDENTITY as C}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as T}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as x}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{normalize as j,sub as E,dot as M,set as R}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as O,freeze as S,clone as V,ZEROS as U,fromValues as P}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as H,clone as I,ONES as D}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMoon as L,isMars as A,getReferenceEllipsoid as k,SphericalECEFSpatialReferenceLike as F}from"../../../geometry/ellipsoidUtils.js";import G from"../../../geometry/HeightModelInfo.js";import{computeTranslationToOriginAndRotation as z}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as B}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as N}from"../../../geometry/projection/projectVectorToVector.js";import{create as q}from"../../../geometry/support/aaBoundingRect.js";import{isCompatible as W}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as X,isWebMercator as $,equals as Z,isGeographic as Y,isCGCS2000 as J}from"../../../geometry/support/spatialReferenceUtils.js";import K from"../../../geometry/support/WKIDUnitConversion.js";import{BufferViewVec4u8 as Q,BufferViewVec3u8 as ee,BufferViewVec2f as te,BufferViewVec3f as ie,BufferViewUint32 as re,BufferViewUint16 as se}from"../../../geometry/support/buffer/BufferView.js";import{nullId as ae}from"../../../layers/ILyr3DWasmPerSceneView.js";import oe from"../../../layers/support/SceneModification.js";import{getHeightModelInfoFromVCS as ne,validateEntity3D as le,makeCacheKey as ce}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as de}from"../../../support/elevationInfoUtils.js";import{IntegratedMesh3DTilesLayerWorkerHandle as he}from"./IntegratedMesh3DTilesLayerWorkerHandle.js";import{LayerView3D as ue}from"./LayerView3D.js";import{Lyr3DViewPerformanceInfo as me}from"./Lyr3DViewPerformanceInfo.js";import{addLayerViewToWasm as pe,removeLayerViewFromWasm as fe,getLyr3DWasm as ge}from"./Lyr3DWasm.js";import{toWasmModification as ye}from"./SceneLayerWorkerHandle.js";import{LayerElevationProvider as be}from"./i3s/LayerElevationProvider.js";import{IntegratedMesh3DTilesLayerView3DSymbol as _e}from"./support/integratedMesh3DTilesLayerViewInstanceUtils.js";import{primTypeConversion as ve,alphaModeConversion as we,faceCullingConversion as Ce,wrapModeConversion as Te}from"./support/lyr3dTypeConversions.js";import{makeScheduleFunction as xe}from"./support/makeScheduleFunction.js";import{Tiles3DMeshIntersectionHandler as je}from"./support/Tiles3DMeshIntersectionHandler.js";import{Frustum as Ee}from"../state/Frustum.js";import{ElevationRange as Me}from"../support/ElevationRange.js";import{toBoundingRect as Re}from"../support/extentUtils.js";import{Obb as Oe}from"../support/orientedBoundingBox.js";import{glLayout as Se}from"../support/buffer/glUtil.js";import{getGroundTransparencyModeFromOpacity as Ve}from"../terrain/TransparencyMode.js";import{ComponentGeometryParameters as Ue,SourceGeometry as Pe}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as He}from"../webgl-engine/collections/Component/Transform.js";import{RenderTexture as Ie}from"../webgl-engine/core/material/RenderTexture.js";import{ManagedTexture as De}from"../webgl-engine/lib/ManagedTexture.js";import{compressNormals as Le}from"../webgl-engine/lib/Normals.js";import{advancedMRRFactors as Ae}from"../webgl-engine/materials/pbrUtils.js";import ke from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as Fe,isInEffectiveScaleRange as Ge,validateScaleRange as ze}from"../../support/layerViewUtils.js";import{TaskPriority as Be}from"../../support/Scheduler.js";import{TextureCompressionTracker as Ne}from"../../support/TextureCompressionTracker.js";import{CompressedTextureFormat as qe,SizedPixelFormat as We}from"../../webgl/enums.js";import{alphaCutoff as Xe}from"../../../webscene/support/AlphaCutoff.js";var $e;function Ze(e,t,i){if("image/vnd-ms.dds"===t)switch(i){case"Dxt1":return qe.COMPRESSED_RGB_S3TC_DXT1_EXT;case"Dxt5":return qe.COMPRESSED_RGBA_S3TC_DXT5_EXT;default:return null}if("image/ktx"===t)return"Etc1"===i?qe.COMPRESSED_RGB8_ETC2:null;switch(e){case 33319:return We.RG8;case 6407:return We.RGB8;case 6408:return We.RGBA8;case 6403:return We.R8;default:return null}}let Ye=class extends(ue(ke)){static{$e=_e}constructor(e){super(e),this[$e]=!0,this.type="integrated-mesh-3dtiles",this.freeze=!1,this._modifications=new Array,this._visibleGeometryChangedSchedulerHandle=null,this._initializationController=null,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this.ignoresMemoryFactor=!1,this._usedMemory=0,this._cacheMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._replacesTerrain=!1,this._isUsedAsGroundLayer=!1,this._applySSAO=!has("disable-feature:im-ssao"),this._imShading=!!has("enable-feature:im-shading"),this._imVertexNormals=!!has("enable-feature:im-vertex-normals"),this._lyrHandleToObjects=new Map,this._visibleObjects=new Set,this._loadedObjects=new Set,this._compressionTracker=new Ne,this._dbgFlags=new Set;const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`IM3DTiles-${this.uid}`,e=>this._deletePerObjectData(e)),this._replacesTerrain=e.layer.replacesTerrain,this._isUsedAsGroundLayer=e.layer.isUsedAsGroundLayer,this._frameTask=t.scheduler.registerTask(Be.TILES3D,this),this._frustum=new Ee(e.view.renderCoordsHelper)}tryRecycleWith(e,t){return this.canRecycleWith(e)?e.load(t).then(()=>{a(t);const i=this.layer.queryElevationCallback;this.layer=e,this.layer.queryElevationCallback=i}):null}canRecycleWith(e){return e.url===this.layer.url&&"integrated-mesh-3dtiles"===e.type&&e.replacesTerrain===this._replacesTerrain&&e.isUsedAsGroundLayer===this._isUsedAsGroundLayer}initialize(){this._dbg(2,"Tiles3DLayerView3D initialize() called");const{view:e}=this;if(this._workerHandle=new he(xe(e.resourceController)),this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),n),!this._canProjectWithoutEngine())throw Fe("layer",this.layer.spatialReference.wkid,e.renderSpatialReference?.wkid);this._initializationController=new AbortController;const t=pe(this,this._initializationController.signal).then(t=>{a(this._initializationController.signal),this._wasmLayerId=t,this._intersectionHandler=new je(this),e.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChange(e)),this._updatingHandles.add(()=>this._modifications,()=>this._modificationsChanged()),this._updatingHandles.add(()=>this.fullOpacity,()=>this._opacityChange()),this._updatingHandles.add(()=>this.view.overlayManager.renderer.isEmpty,()=>this._opacityChange()),this._updatingHandles.add(()=>e.clippingArea,()=>this._clippingAreaChanged(),n),this._updatingHandles.add(()=>e.state.contentCamera,()=>this._cameraChanged(),n),this._elevationProvider=new be({view:e,layerElevationSource:this,intersectionHandler:this._intersectionHandler});const i=this._replacesTerrain?0:1;e.elevationProvider.register(i,this._elevationProvider),e.overlayManager.registerDrapeTarget(this),this.addHandles([l(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),c(()=>this.fullOpacity,()=>this._opacityChange()),l(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),n),l(()=>this.freeze,e=>{e?this._wasm?.incrementFrozenLayerViewCount(this):(this._wasm?.decrementFrozenLayerViewCount(this),this._cameraChanged())})]),this._initializationController=null,this.addHandles(c(()=>this._replacesTerrain&&this._wasm?.isTerrainReady,()=>{this.layer.queryElevationCallback=(e,t)=>this._queryElevation(e,t)}))});this.addResolvingPromise(t)}destroy(){if(this.freeze=!1,this._initializationController=i(this._initializationController),this._dbg(2,"Tiles3DLayerView3D destroy() called"),this._workerHandle?.destroyContextAndSelf(this.uid),fe(this),this.layer.queryElevationCallback=null,this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler.destroy(),this._intersectionHandler=null),this._elevationProvider){const e=Array.from(this._lyrHandleToObjects.values()),t=e.reduce((e,{componentObjects:t})=>e+t.length,0);this._elevationProvider.notifyObjectsChangedFunctional(t,t=>{for(const{componentObjects:i}of e)for(const{obb:e}of i)if(!t(e))return}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null}this.view.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach(e=>this.freeObject(e)),this._lyrHandleToObjects.clear(),this._visibleObjects.clear(),this._loadedObjects.clear(),this._usedMemory=0,this._cacheMemory=0,this._memCache.destroy(),this._frameTask.remove(),this._updatingHandles=r(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=s(this._visibleGeometryChangedSchedulerHandle)}get usedAsGround(){return this._isUsedAsGroundLayer}get fullOpacity(){return this.layer.replacesTerrain?this.view.map.ground.opacity:1}get opaque(){return 0===this._groundTransparencyMode}get invisible(){return 3===this._groundTransparencyMode}get _groundTransparencyMode(){return this.layer.replacesTerrain?Ve(this.fullOpacity,this.view.overlayManager.renderer.isEmpty):0}get _renderOpacity(){switch(this._groundTransparencyMode){case 3:return 0;case 2:return Xe;default:return this.fullOpacity}}get hasModifications(){return this._modifications&&this._modifications.length>0}_opacityChange(){const e=this._renderOpacity,t=this._groundTransparencyMode;this.forEachComponentObject(i=>this._collection.updateObjectOpacity(i,e,t))}_cameraChanged(){if(this.freeze)return;const e=this._frustum;e.update(this.view.state.contentCamera);const t=this._visibleObjects;let i=!1;this._loadedObjects.forEach(r=>{const s=r.obb?.intersectsFrustum(e)??!1;s!==r.isVisible&&(r.isVisible=s,s?t.add(r):t.delete(r),r.componentObjects.forEach(e=>this._collection.setObjectVisibility(e,s)),i||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(s,r.elevationRange))}),i&&this._setVisibleElevationRangeDirty()}intersect(e,t,i,r){this._intersectionHandler.intersectRay(e,t,i,r,null,!1)}get ready(){return!this.layer.replacesTerrain||!!this._wasm?.isTerrainReady}_modificationsChanged(){const e=this.useEsriCrs?this.layer.supportedSpatialReferences[1]:this.layer.supportedSpatialReferences[0],t=ye(this._layerClippingArea,this._modifications,e,this.view.state.isGlobal);this._wasm?.setMeshModifications(this,t)}_clippingAreaChanged(){const e=this.layer.spatialReference,t=q();this._layerClippingArea=Re(this.view.clippingArea,t,e)?t:null,this._modificationsChanged()}_visibleGeometryChanged(){this._visibleGeometryChangedSchedulerHandle??=d(()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e&&!this.layer.replacesTerrain),this.forEachComponentObject(t=>t.updateMaterial({slicePlaneEnabled:e}))}_elevationInfoChanged(e){this._wasm?.setLayerOffset(this,de(e))}get _wasm(){return ge(this.view)}_queryElevation(e,t){return this.destroying||this.destroyed?Promise.reject(o()):this._wasm?.queryElevation(this,e,t)??Promise.reject(o())}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get usedMemory(){return this._usedMemory}get unloadedMemory(){return 0}get cachedMemory(){return this._cacheMemory}get useEsriCrs(){return this._useEsriCrs}get visibleAtCurrentScale(){return this.layer.isUsedAsGroundLayer||Ge(this.layer.effectiveScaleRange,this.view.scale)}canResume(){const e=this.layer&&"effectiveScaleRange"in this.layer?this.layer.effectiveScaleRange:null;return this.visible&&this.layer?.loaded&&this.parent&&!this.parent.suspended&&this.view?.ready&&(this.layer.isUsedAsGroundLayer||ze(e)&&this.visibleAtCurrentScale)&&this.visibleAtCurrentTimeExtent||!1}get performanceInfo(){let e=0,t=0,i=0,r=0,s=0,a=0;return this._lyrHandleToObjects.forEach(o=>{o.isLoaded?(e+=o.textureMemoryUsage,t+=o.vboMemoryUsage,s++):(i+=o.textureMemoryUsage,r+=o.vboMemoryUsage,a++)}),new me(this.usedMemory,s,a,Qe(t),Qe(e),Qe(r),Qe(i))}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(X(this.view.renderSpatialReference)||$(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&Z(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=ne(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!Y(t)&&t.wkid&&-1!==t.wkid&&(i=f(K.units[K[t.wkid]])),i&&(e=new G({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===W(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=g(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}get _stage(){return this.view.stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return de(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new Me(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get visibleElevationRange(){const e=new Me;0===this._visibleObjects.size?e.setElevationRangeValues(0,0):(e.setElevationRangeValues(1/0,-1/0),this._forEachRelevantVisibleTile(t=>e.expandElevationRange(t.elevationRange)),e.minElevation===1/0&&e.setElevationRangeValues(0,0));const t=this._get("visibleElevationRange");return t&&t.minElevation===e.minElevation&&t.maxElevation===e.maxElevation?t:e}_setVisibleElevationRangeDirty(){this.notifyChange("visibleElevationRange")}_forEachRelevantVisibleTile(e){const{view:t}=this,{spatialReference:i}=t,r=i.isWGS84||i.isWebMercator||J(i)||L(i)||A(i);if(this.view.state.isGlobal||!r)return this.forEachVisibleTile(e);const s=k(i).radius,{eye:a,viewForward:o,near:n}=t.state.contentCamera,l=j(O(),o),c=500,d=Math.max(a[2],c),h=d+s,u=Math.sqrt(h**2-s**2),m=Math.abs(Math.atan2(u,s))*s,p=d>.5*s?.5*Math.PI*s:m,f=O();this.forEachVisibleTile(t=>{const{mbsRadius:i,mbsCenter:r}=t;if(i<0)return;E(f,r,a);const s=M(f,l);Math.abs(s)<p&&s+i>n&&s-i<p&&e(t)})}get fullExtent(){return this.layer.fullExtent}forEachComponentObject(e){this._forEachObject(this._lyrHandleToObjects.values(),e)}forEachVisibleTile(e){for(const t of this._visibleObjects)e(t)}forEachTile(e){for(const t of this._loadedObjects)e(t)}forEachVisibleComponentObject(e){this._forEachObject(this._visibleObjects,e)}_forEachObject(e,t){for(const{componentObjects:i}of e)for(const e of i)t(e)}get drapeTargetType(){return this._replacesTerrain?0:1}isUpdating(){const e=this._wasm;return!this.freeze&&this._wasmLayerId>=0&&null!=e&&(e.isUpdating(this._wasmLayerId)||this._compressionTracker.compressing)}get readyToRun(){return!!this._frameTask?.readyToRun}runTask(e){this._frameTask.processQueue(e)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{entity3d:t}=e;if(!le(t))throw new Error("entity3D not valid");const i=new Map;let r;try{r=this._createPrimitiveTextureBundles(t,i)}catch(a){throw i.forEach(e=>this._stage?.removeTexture(e)),a}let s=null;try{if(s=await this._createRenderableMain(t,r),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable aborted due to destroyed instance");const{tileObb:a,componentObjects:o,elevationRange:n}=s;let l=0,c=0,d=0;for(const e of o){const{texture:t,textureMetallicRoughness:i,textureEmissive:r,textureOcclusion:s,textureNormal:a}=e.renderable.drawParameters;l+=(t?.usedMemory??0)+(i?.usedMemory??0)+(r?.usedMemory??0)+(s?.usedMemory??0)+(a?.usedMemory??0),c+=this._collection.getObjectGPUMemoryUsage(e),d+=e.intersectionGeometry.usedMemory}const h=Array.from(i.values()),u=new Ke(e.handle,o,h,d,c,l,a,e.stableNodeId,e.nodeDepth,n);return this._lyrHandleToObjects.set(e.handle,u),()=>{this._memCache.put(ce(u.handle),u);const{usedMemory:e}=u;return this._cacheMemory+=e,{memUsageBytes:e}}}catch(a){throw r.forEach(e=>e.cleanup()),s?.componentObjects.forEach(e=>this._collection.destroyObject(e)),i.forEach(e=>this._stage?.removeTexture(e)),a}}_createPrimitiveTextureBundles(e,t){const i=new Array;try{const r=e.desc.geometry;for(const s of e.validPrimitiveIndices){const a=r.prims[s].materialId,o=e.desc.materials?.materials&&null!=a&&a!==ae?e.desc.materials.materials[a]:null;let n=Promise.resolve(tt),l=null,c=null,d=null,h=null,u=null;if(o){const i="Pbr"===o.lightingModel;l=this._getTexture(o.baseColorTex,e,t),c=i?this._getTexture(o.metalTex,e,t):null,d=i?this._getTexture(o.emissiveTex,e,t):null,h=i?this._getTexture(o.occlusionTex,e,t):null,u=i?this._getTexture(o.normalTex,e,t):null;const r=[l,c,d,h,u].map(e=>e?.loadPromise??null);n=Promise.all(r)}i.push(new it(n,l,c,d,h,u))}}catch(r){throw i.forEach(e=>e.cleanup()),r}return i}async _createRenderableMain(e,t){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain called after destroy");const i=new Array,r=e.desc,s=S(...e.origin),a=this.view.groundView.spatialReference,o=this.view.state.isGlobal;let n=C;if(o){const e=T();z(F,s,e,a),n=_(w(),e)}const l=et(r.obb),c=o?k(this.view.spatialReference).radius:0,d=new Array;try{let h=-1;for(const i of e.validPrimitiveIndices){h+=1;const s=r.geometry.prims[i],a=t[h];this._dbgFlags.has(2)&&this._dbg(2,JSON.stringify(s));if(null==ve[s.ptype]){this._dbg(2,"[Unsupported Feature] Unsupported primitive mode ("+s.ptype+"). Skipping primitive."),a.cleanup();continue}const{positionView:o,normalsData:n,colorView:l,texCoord0Data:c,indicesView:u}=this._getBufferViews(s,e);if(null==o||null==u){a.cleanup();continue}const m=o.count,p=(e,t)=>null==e||e===m||(this._dbg(3,`${t} !== numPos. Skipping primitive.`),!1);p(null!=c?c.length/2:void 0,"numTexcoord")&&p(l?.count,"numColors")&&p(n?.length,"normals")?d.push({componentIndex:h,positionView:o,indicesView:u,texCoord0Data:c,colorView:l,normalsData:n}):a.cleanup()}const u=n!==C,m=u?v(w(),n)??C:C,{vertexProcessingOutputs:p,obbHalfSizeAccumulator:f,elevationRange:g}=await this._workerHandle.processTiles3DVertices(d,s,c,o,n,l,this._imVertexNormals&&!this._isUsedAsGroundLayer);if(this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");const y=r.materials;if(await Promise.all(t.map(e=>e.materialPromise)),this.destroyed)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderableMain aborted due to destroyed instance");p.length>0&&l.setHalfSize(f);for(const o of p){const{componentIndex:n,positionView:c,indicesView:d,layout:h,textureCoordinateType:p,interleavedVertexData:f,indices:g}=o,b=e.validPrimitiveIndices[n],_=r.geometry.prims[b],v=t[n],w=l.clone(),C=Se(h),T=new Uint32Array([0,d.typedBuffer.length]),x=new Ue(C,this._imShading?2:0,p,u?2:0),j=new Pe({interleavedVertexData:f,vertexCount:f.byteLength/C[0].stride,indexData:g},{positions:c.typedBuffer,indices:d.typedBuffer},T,x),E=this.view.renderSpatialReference,M=O(),R=[1,1,1];B(s,E,R,a)||this._dbg(3,"Unsupported coordinate system for IM overlay"),N(s,E,M,a);const S=this._createComponentMaterialInitParameters(y,_.materialId,v);S.baseColorTexture||this._dbg(3,"No colour texture 1");const V=this._collection.createObject({toMapSpace:H(M[0],M[1],R[0],R[1]),transform:new He(s,m),obb:w,geometry:j,elevationAlignable:!1},S);i.push(V)}const{fullExtent:b}=this.layer;return b?.hasZ&&b.zmax&&b.zmin&&(g.minElevation=Math.max(g.minElevation,b.zmin),g.maxElevation=Math.min(g.maxElevation,b.zmax)),{tileObb:l,componentObjects:i,elevationRange:g}}catch(h){throw i.forEach(e=>this._collection.destroyObject(e)),h}}_createComponentMaterialInitParameters(e,t,i){const r=null!=e?.materials&&null!=t&&t!==ae?e.materials[t]:null;let s=1;const a=r?.baseColorTex?.imageId;if(null!=a&&e&&Array.isArray(e.images)&&a>=0&&a<e.images.length){const t=e.images[a];t.alpha&&(s=we[t.alpha])}const o="Pbr"===(null!=r?r.lightingModel:"Unlit");let n=D,l=Xe,c=!1,d=2,h=P(0,0,0);const u=V(Ae),m=i.baseColorTexture,p=i.metallicRoughnessTexture,f=i.emissionTexture,g=i.occlusionTexture,y=i.normalTexture;return r&&(n=I(r.baseColorFactor),l=r.alphaCutoff??Xe,o&&(R(u,r.metallicFactor,r.roughnessFactor,0),r.emissiveFactor&&(h=r.emissiveFactor)),c=r.isDoubleSided,d=Ce[r.faceCulling??"NotSet"]),{isIntegratedMesh:!0,baseColor:n,textureAlphaCutoff:l,mrrFactors:u,baseColorTexture:m,metallicRoughnessTexture:p,normalTexture:y,occlusionTexture:g,emissionTexture:f,hasParametersFromSource:!1,sphereDepthInterpolate:this.layer.hasGoogleUrl,alphaDiscardMode:s,doubleSided:c,cullFace:d,isGround:this.layer.replacesTerrain,groundTransparencyMode:this._groundTransparencyMode,emissiveBaseColor:h,usePBR:o,slicePlaneEnabled:this.slicePlaneEnabled,opacity:this._renderOpacity,polygonOffset:0,ellipsoidMode:1,applySSAO:this._applySSAO}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t?(t.isLoaded?(this._loadedObjects.delete(t),this._visibleObjects.delete(t),this._intersectionHandler.removeTile(t),this._usedMemory-=t.usedMemory):this._cacheMemory-=t.usedMemory,this.freeObject(t),this._lyrHandleToObjects.delete(e)):this._dbg(3,`freeRendedrable on non-existent renderable ${e}`)}freeObject(e){const t=ce(e.handle);this._memCache.pop(t),e.textures.forEach(e=>this._stage.removeTexture(e)),e.componentObjects.forEach(e=>this._collection.destroyObject(e))}setRenderableVisibility(e,t,i){if(this.destroyed||this.destroying)return;const r=this._frustum,s=new Array;let a=!1,o=!1;for(let n=0;n<i;++n){if(!t[n])continue;const i=e[n],l=this._lyrHandleToObjects.get(i);if(l){if(l.isLoaded){this._dbg(3,`Already loaded object marked loaded again ${l.stableNodeId}`);continue}a=!0,l.isLoaded=!0,this._loadedObjects.add(l),this._intersectionHandler.addTile(l),this._usedMemory+=l.usedMemory,this._cacheMemory-=l.usedMemory;const e=l.obb?.intersectsFrustum(r)??!0;l.isVisible=e,e&&(this._visibleObjects.add(l),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(e,l.elevationRange)),s.push(l.obb),l.componentObjects.forEach(t=>{this._collection.setObjectVisibility(t,e)}),this._memCache.pop(ce(i))}else this._dbg(3,`Tried to mark Non existent object ${i} as loaded`)}for(let n=0;n<i;++n){const i=e[n];if(t[n])continue;const r=this._lyrHandleToObjects.get(i);if(r){if(!r.isLoaded){this._dbg(3,`Tried to unload not-loaded object ${r.stableNodeId}`);continue}const e=r.isVisible;this._visibleObjects.delete(r),r.isVisible=!1,r.isLoaded=!1,this._loadedObjects.delete(r),this._intersectionHandler.removeTile(r),e&&(this._visibleGeometryChanged(),o||=this._isVisibileElevationRangeModifiedByChangedTileVisbility(!1,r.elevationRange)),this._usedMemory-=r.usedMemory,this._cacheMemory+=r.usedMemory,s.push(r.obb),r.componentObjects.forEach(e=>{this._collection.setObjectVisibility(e,!1)}),this._memCache.put(ce(i),r)}else this._dbg(3,`Tried to mark Non existent object ${i} as not loaded`)}a&&this._visibleGeometryChanged(),s.length>0&&this._elevationProvider.notifyObjectsChanged(s),o&&this._setVisibleElevationRangeDirty()}setLodPixelThreshold(e){this._wasm?.setLodPixelThreshold(this,e)}_isVisibileElevationRangeModifiedByChangedTileVisbility(e,t){const{visibleElevationRange:i}=this,{minElevation:r,maxElevation:s}=t;return e?r<i.minElevation||s>i.maxElevation:r===i.minElevation||s===i.maxElevation}_getTexture(e,t,i){const r=e&&t.desc.materials?.images?.[e.imageId];if(!r||null==r.data||r.data===ae)return null;const s=t.assets[r.data];if(!s||s.byteCount<1||"U8"!==s.dataType)return null;const a=i.get(r)??this._createTexture(e,r,s,i);return a?new Ie(this._stage.renderView.textures,a.id):null}_createTexture(e,t,i,r){const s=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,a=!!t.mipCount||s>1,o=Te[e.wrapMode??"None"];let n=t.alpha?6408:6407;const l=new Uint8Array(i.data.buffer,0,i.byteCount);let c=null,d=null,h=null;switch(t.format){case"Raw":"R8"===t.pixelFormat?(c=l,n=6403,d=""):"Rg8"===t.pixelFormat||"Ga8"===t.pixelFormat?(c=l,n=33319,d=""):"Rgb8"===t.pixelFormat?(c=l,n=6407,d=""):"Rgba8"===t.pixelFormat&&(c=l,n=6408,d="");break;case"Dxt1":c=l,n=6407,d="image/vnd-ms.dds";break;case"Dxt5":c=l,n=6408,d="image/vnd-ms.dds";break;case"Basis":c=l,n=6407,d="image/ktx2";break;case"Etc1":c=l,n=6407,d="image/ktx";break;case"Png":d="image/png",h=document.createElement("img");break;case"Jpeg":d="image/jpeg",h=document.createElement("img");break;case"Etc2":d="image/ktx",h=document.createElement("img");break;case"Astc":this._dbg(3,"Astc texture not supported");break;case"Pvrtc":this._dbg(3,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([l],{type:d});h.src=URL.createObjectURL(e),c=h}if(c&&null!=d){const e=has("enable-feature:esri-compress-IM-textures")?{compressionTracker:this._compressionTracker}:void 0,i=Ze(n,d,t.format),l=new De(c,{mipmap:a,maxAnisotropy:s,encoding:d,wrap:o,pixelFormat:n,internalFormat:i??void 0,immutable:null!=i,compressionOptions:e,noUnpackFlip:!0,width:t.mip0Width,height:t.mip0Height});return this._stage.addTexture(l),r.set(t,l),l}return null}_getBufferViews(e,t){let i,r,s,a,o;for(let c=0;c<e.atrbs.length;c++){const o=e.atrbs[c],n=t.assets[o.assetId];if(!n)continue;const d=n.data.buffer,m=void 0,p=0,f=n.byteCount;try{switch(o.sem){case"Position":3===n.ncomp&&"F32"===n.dataType&&u(n.data)?i=new ie(d,p,m,f):this._dbg(3,"[Unsupported Feature] Unsupported view for Position ("+n+")");break;case"Normal":if(3===n.ncomp&&"F32"===n.dataType&&u(n.data)){const e=new ie(d,p,m,f);a=new Uint32Array(e.count),Le(e.typedBuffer,new Int16Array(a.buffer,a.byteOffset,2*a.length))}else this._dbg(3,"[Unsupported Feature] Unsupported view for Normal ("+n+")");break;case"TexCoord":2===n.ncomp&&"F32"===n.dataType&&u(n.data)?void 0===s&&(s=new te(d,p,m,f).typedBuffer):this._dbg(3,"[Unsupported Feature] Unsupported view for Texcoord ("+n+")");break;case"Color":"U8"===n.dataType&&h(n.data)&&(4===n.ncomp?r=new Q(d,p,m,f):3===n.ncomp&&(r=new ee(d,p,m,f))),null==r&&this._dbg(3,"[Unsupported Feature] Unsupported view for Color ("+n+")");break;case"FeatureIndex":break;default:this._dbg(2,"[Unsupported Feature] Unsupported semantic ("+o.sem+"). Skipping vertex attribute.")}}catch(l){this._dbg(2,"Error Creating buffer ("+l+"). Skipping vertex attribute.")}}let n=!1;if(null!=e.index&&e.index!==ae){const i=t.assets[e.index];if(i){const e=void 0,t=0,r=i.byteCount;switch(i.dataType){case"U16":1===i.ncomp&&p(i.data)&&(o=new se(i.data.buffer,t,e,r));break;case"U32":1===i.ncomp&&m(i.data)&&(o=new re(i.data.buffer,t,e,r))}n=!o}else n=!0}if(!n&&null==o&&null!=i){const e=i.count;o=o=e<65535?new se(new Uint16Array(e).buffer):new re(new Uint32Array(e).buffer);for(let t=0;t<e;t++)o.set(t,t)}return{positionView:i,colorView:r,texCoord0Data:s,indicesView:o,normalsData:a}}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>{this._modifications=e.filter(e=>!(this.layer.isUsedAsGroundLayer&&"replace"!==e.type)).toArray(),this._modifications.length<e.length&&t.getLogger(this).info("Ground layers only support replace modifications. Other modification types have been ignored.")},n),"modifications")}_deletePerObjectData(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}_dbg(e,i){this._dbgFlags.has(e)&&(3===e?t.getLogger(this).error(i):t.getLogger(this).warn(i))}};e([y()],Ye.prototype,"freeze",void 0),e([y()],Ye.prototype,"fullOpacity",null),e([y()],Ye.prototype,"opaque",null),e([y()],Ye.prototype,"invisible",null),e([y({readOnly:!0})],Ye.prototype,"ready",null),e([y({type:[oe]})],Ye.prototype,"_modifications",void 0),e([y()],Ye.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([y()],Ye.prototype,"layer",void 0),e([y({readOnly:!0})],Ye.prototype,"visibleAtCurrentScale",null),e([y({readOnly:!0})],Ye.prototype,"_collection",null),e([y()],Ye.prototype,"elevationOffset",null),e([y({readOnly:!0})],Ye.prototype,"visibleElevationRange",null),e([y()],Ye.prototype,"fullExtentInLocalViewSpatialReference",void 0),Ye=e([b("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ye);const Je=Ye;class Ke{constructor(e,t,i,r,s,a,o,n,l,c){this.handle=e,this.componentObjects=t,this.textures=i,this.cpuMemoryUsage=r,this.vboMemoryUsage=s,this.textureMemoryUsage=a,this.obb=o,this.stableNodeId=n,this.nodeDepth=l,this.elevationRange=c,this.bvhIntersectionGeneration=0,this.isLoaded=!1,this.isVisible=!1;const d=O();o?.getCenter(d),this._obbCenterX=d[0],this._obbCenterY=d[1],this._obbCenterZ=d[2];const h=o?.radius??-1;this._obbRadius=h,this._obbRadiusSquared=h*h,this._obbShortestHalfsize=o?Math.min(o.halfSizeX,o.halfSizeY,o.halfSizeZ):0,this._mbsCenter=o?o.getCenter(O()):U}get usedMemory(){return this.textureMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}get mbsRadius(){return this._obbRadius}get mbsCenter(){return this._mbsCenter}boundingVolumeIntersectsRay(e,t){if(!this.obb)return!0;const{_obbCenterX:i,_obbCenterY:r,_obbCenterZ:s}=this,a=i-e[0],o=r-e[1],n=s-e[2],l=a*t[0]+o*t[1]+n*t[2];return a*a+o*o+n*n-l*l<=this._obbRadiusSquared&&this.obb.intersectRay(e,t)}boundingVolumeIntersectsSphere(e){const t=this._obbRadius;if(t<0)return!0;const i=e.center,r=e.radius,s=t+r,a=this._obbCenterX-i[0];if(a>s)return!1;const o=this._obbCenterY-i[1];if(o>s)return!1;const n=this._obbCenterZ-i[2];if(n>s)return!1;const l=a*a+o*o+n*n;if(l>s*s)return!1;if(l<=(this._obbShortestHalfsize+r)**2)return!0;const c=r-t;return c>0&&l<=c*c||(this.obb?.intersectSphere(e)??!0)}}function Qe(e){return Math.round(e/1048.576)/1e3}function et(e){return new Oe(e.center,e.halfSize,x(...e.quaternion))}const tt=new Array;class it{constructor(e,t,i,r,s,a){this.materialPromise=e,this.baseColorTexture=t,this.metallicRoughnessTexture=i,this.emissionTexture=r,this.occlusionTexture=s,this.normalTexture=a}cleanup(){this.baseColorTexture?.dispose(),this.metallicRoughnessTexture?.dispose(),this.emissionTexture?.dispose(),this.occlusionTexture?.dispose(),this.normalTexture?.dispose()}}export{Je as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let u=class extends(o(s(n))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this.visibleElevationRange=new a(1/0,-1/0),this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this.drapeTargetType=1}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.meshLoDFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get visibleAtCurrentScale(){return p(this.layer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get opaque(){return!0}get invisible(){return!1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],u.prototype,"layer",void 0),e([r(l)],u.prototype,"updatingProgress",void 0),e([r()],u.prototype,"updatingProgressValue",null),e([r()],u.prototype,"lodFactor",null),e([r({readOnly:!0})],u.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],u.prototype,"visibleAtCurrentScale",null),e([r({readOnly:!0})],u.prototype,"visibleElevationRange",void 0),e([r()],u.prototype,"fullOpacity",null),e([r()],u.prototype,"opaque",null),e([r()],u.prototype,"invisible",null),u=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],u);const c=u;export{c as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{initial as t}from"../../../core/reactiveUtils.js";import{property as r,subclass as i}from"../../../core/accessorSupport/decorators.js";import{I3SMeshView3D as o}from"./I3SMeshView3D.js";import{LayerView3D as s}from"./LayerView3D.js";import{ElevationRange as a}from"../support/ElevationRange.js";import{updatingProgress as l}from"../support/updatingProperties.js";import n from"../../layers/LayerView.js";import{isInEffectiveScaleRange as p}from"../../support/layerViewUtils.js";const d=.2;let u=class extends(o(s(n))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this.usedAsGround=!1,this.visibleElevationRange=new a(1/0,-1/0),this._elevationContext=1,this._supportsLabeling=!1,this._applySSAO=!has("disable-feature:im-ssao"),this.drapeTargetType=1}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.meshLoDFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get visibleAtCurrentScale(){return p(this.layer.effectiveScaleRange,this.view.scale)}get fullOpacity(){return 1}get opaque(){return!0}get invisible(){return!1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add(()=>this.layer.modifications,()=>this._loadModifications(),t),this.view.overlayManager.registerDrapeTarget(this)}destroy(){this.view.overlayManager.unregisterDrapeTarget(this)}get ready(){return this.layer.loaded}_createLayerGraphic(){}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange(()=>e,()=>this._modifications=e.toArray(),t),"modifications")}};e([r()],u.prototype,"layer",void 0),e([r(l)],u.prototype,"updatingProgress",void 0),e([r()],u.prototype,"updatingProgressValue",null),e([r()],u.prototype,"lodFactor",null),e([r({readOnly:!0})],u.prototype,"progressiveLoadFactor",null),e([r({readOnly:!0})],u.prototype,"visibleAtCurrentScale",null),e([r({readOnly:!0})],u.prototype,"visibleElevationRange",void 0),e([r()],u.prototype,"fullOpacity",null),e([r()],u.prototype,"opaque",null),e([r()],u.prototype,"invisible",null),u=e([i("esri.views.3d.layers.IntegratedMeshLayerView3D")],u);const c=u;export{c as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as h}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as m,negate as c,length as _,subtract as p,normalize as l,add as u,scale as d,dot as P}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as S}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as C,fromPositionAndNormal as w,getNormal as b}from"../../../../geometry/support/plane.js";import{Sphere as M}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as f,applyAll as z}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as E}from"../../input/util.js";import{InteractiveController as A}from"./InteractiveController.js";import{PanPlanarMomentumController as k}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as y}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as R}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as x}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as O}from"./momentum/ZoomSphericalMomentumController.js";import{inferNavigationMode as H,pickPointAndInitSphere as F,excludeTerrain as Y,sphereOrPlanePointFromScreenPoint as L,maxPanDistanceModifier as T,minPinchAndPanCameraHeight as D,pivotSearchAreaSize as U,intersectPlaneFromScreenPointAtEye as G,applyZoomOnSphere as I,findSphereHorizonY as V,computeHorizonDownLimitScreenY as Z,shouldClampScreenY as q,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as J,applyPanSphericalDirectRotation as K,computeHorizonUpLimitScreenY as N,normalizeRotationDelta as Q,applyRotation as W,applyPanPlanar as X,applyZoomToPoint as $}from"../utils/navigationUtils.js";import tt from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as it}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as et}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as nt}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as st}from"../../../navigation/ZoomMomentumEstimator.js";let rt=class extends A{constructor(t){super(t),this.forceHorizontalPan=!1,this._smoothRotation=new E(.05),this._rotationAxis=g(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=C(),this._beginRadius=0,this._smoothScaling=new E(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new st,this._rotationMomentumEstimator=new nt,this._panSphericalMomentumEstimator=new et,this._panPlanarMomentumEstimator=new it,this._adjustedSphere=new M,this._referenceSphere=new M,this._tmp3d=g(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=g(),this._screenPickPoint=n(),this._clampedScreenPoint=n(),this._scenePickPoint=g(),this._horizonScreenY=null,this._panLimitScreenY=null,this._panLimitFromAbove=!1,this._navigationMode=1,this._sphere=new M,this._pointerCount=0,this._tmpInteractionDirection=g(),this._beginCamera=new tt,this._constraintOptions=new j(15,0,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._beginAngle=t.angle,this._pointerCount=t.pointers.size,this._smoothRotation.reset(),this._referenceSphere.radius=S(this.view.spatialReference).radius,s(t.center,this._screenPickPoint),this.forceHorizontalPan?this._navigationMode=1:this._navigationMode=H(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode&&(this._initClampValues(),a(this._screenPickPoint,this._clampScreenPointToHorizonPaddingRegion(this._screenPickPoint))),a(this._beginScreenPoint,this._screenPickPoint);const n=F(this._intersectionHelper,this.startCamera,this._screenPickPoint,this._referenceSphere.radius,1,this.view.groundView.invisible?Y:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,m(this._beginScenePoint,this._scenePickPoint),0===this._navigationMode?this._preparePlanarPanMode(t,n.hasGeometryIntersection):this._prepareSphericalPanMode(),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navigationMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navigationMode?new O({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new x({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new R({view:this.view,momentum:e,center:this._sphere.center,axis:this._rotationAxis});if(1===this._navigationMode){const t=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new y({view:this.view,momentum:t})}else{const t=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);w(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),o=g(),a=_(this.startCamera.eye);this._adjustedSphere.radius=a<this._sphere.radius?a-100:this._sphere.radius,L(this._adjustedSphere,this.startCamera,r,o);const h=g(),S=g(),v=g();p(h,this._scenePickPoint,this.currentCamera.eye);const C=_(h);l(h,h);const M=T*Math.max(Math.abs(this.view.camera.position.z),D),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,U);let z=null!=f?f:M;i&&(z=Math.min(z,C)),m(v,u(S,this.currentCamera.eye,d(S,h,z))),this._panningPlane[3]=-P(b(this._panningPlane),v),this.startCamera.center=u(S,this.startCamera.eye,d(S,this.startCamera.viewForward,z));const j=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.startCamera,j,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),I(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_initClampValues(){this._horizonScreenY=V(this.startCamera,this._referenceSphere,this._screenPickPoint);const t=null!=this._horizonScreenY;this._panLimitFromAbove=t&&this._screenPickPoint[1]<this._horizonScreenY,this._panLimitScreenY=t?Z(this.startCamera,this._horizonScreenY):null}_prepareSphericalPanMode(){null!=this._panLimitScreenY&&q(this._screenPickPoint[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._screenPickPoint[1]=this._panLimitScreenY,L(this._sphere,this.startCamera,this._screenPickPoint,this._beginScenePoint),m(this._scenePickPoint,this._beginScenePoint)),a(this._clampedScreenPoint,this._screenPickPoint)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray),e=this._clampScreenPointToHorizonPaddingRegion(i);L(this._sphere,this.currentCamera,e,this._tmp3d),B(this._beginScenePoint,P(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(J(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(K(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(e,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._screenPickPoint,e)),z(this.view,this.currentCamera,this._constraintOptions)}_clampScreenPointToHorizonPaddingRegion(t){if(a(this._clampedScreenPoint,t),null==this._panLimitScreenY)return this._clampedScreenPoint;const i=V(this.currentCamera,this._referenceSphere,t);return null!=i&&(this._horizonScreenY=i,this._panLimitScreenY=this._panLimitFromAbove?Z(this.currentCamera,i):N(this.currentCamera,i)),q(t[1],this._panLimitFromAbove,this._panLimitScreenY)&&(this._clampedScreenPoint[1]=this._panLimitScreenY,this._panSphericalMomentumEstimator.reset()),this._clampedScreenPoint}_rotateSpherical(t){l(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+Q(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*e),z(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);G(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(X(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=f(h(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),z(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),$(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=f(t.radius-this._beginRadius),z(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){m(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=Q(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const r=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(r,.001*t.timestamp),W(this.currentCamera,this._sphere.center,v(this._rotationAxis,r)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=f(t.radius*r),z(this.view,this.currentCamera,this._constraintOptions)}};t([r()],rt.prototype,"forceHorizontalPan",void 0),rt=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],rt);export{rt as PinchAndPanControllerGlobal};
|
|
2
|
+
import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import{subclass as o}from"../../../../core/accessorSupport/decorators.js";import{copy as a,distance as r}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as m,negate as h,length as c,subtract as _,normalize as p,add as u,scale as l,dot as d}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as P}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as w,fromPositionAndNormal as C,getNormal as M}from"../../../../geometry/support/plane.js";import{Sphere as b}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as S,applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as j}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as E}from"../../input/util.js";import{InteractiveController as y}from"./InteractiveController.js";import{PanPlanarMomentumController as x}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as A}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as O}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as R}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as z}from"./momentum/ZoomSphericalMomentumController.js";import{pickPointAndInitSphere as k,excludeTerrain as F,inferNavigationMode as H,sphereOrPlanePointFromScreenPoint as D,maxPanDistanceModifier as U,minPinchAndPanCameraHeight as T,pivotSearchAreaSize as G,intersectPlaneFromScreenPointAtEye as I,applyZoomOnSphere as Z,shouldPreserveHeading as V,applyPanSphericalPreserveHeading as q,applyPanSphericalDirectRotation as B,normalizeRotationDelta as J,applyRotation as K,applyPanPlanar as L,applyZoomToPoint as N}from"../utils/navigationUtils.js";import Q from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as W}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as X}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as Y}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as $}from"../../../navigation/ZoomMomentumEstimator.js";let tt=class extends y{constructor(t){super(t),this._smoothRotation=new E(.05),this._rotationAxis=g(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=w(),this._beginRadius=0,this._smoothScaling=new E(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new $,this._rotationMomentumEstimator=new Y,this._panSphericalMomentumEstimator=new X,this._panPlanarMomentumEstimator=new W,this._adjustedSphere=new b,this._tmp3d=g(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=g(),this._screenPickPoint=n(),this._scenePickPoint=g(),this._navigationMode=1,this._sphere=new b,this._pointerCount=0,this._tmpInteractionDirection=g(),this._beginCamera=new Q,this._constraintOptions=new j(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._beginAngle=t.angle,this._pointerCount=t.pointers.size,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=k(this.view,this.startCamera,this._screenPickPoint,P(this.view.spatialReference).radius,1,this.view.groundView.invisible?F:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,m(this._beginScenePoint,this._scenePickPoint),this._navigationMode=H(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),0===this._navigationMode&&this._preparePlanarPanMode(t,n.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navigationMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navigationMode?new z({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere.radius}):new R({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new O({view:this.view,momentum:e,center:this._sphere.center,axis:this._rotationAxis});if(1===this._navigationMode){const t=this.view.animationsEnabled&&this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new A({view:this.view,momentum:t})}else{const t=this.view.animationsEnabled&&this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=h(this._tmp3d,this.startCamera.viewForward);C(this._scenePickPoint,e,this._panningPlane);const o=n(this._screenPickPoint[0],0),a=g(),r=c(this.startCamera.eye);this._adjustedSphere.radius=r<this._sphere.radius?r-100:this._sphere.radius,D(this._adjustedSphere,this.startCamera,o,a);const P=g(),v=g(),w=g();_(P,this._scenePickPoint,this.currentCamera.eye);const b=c(P);p(P,P);const S=U*Math.max(Math.abs(this.view.camera.position.z),T),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,G);let j=null!=f?f:S;i&&(j=Math.min(j,b)),m(w,u(v,this.currentCamera.eye,l(v,P,j))),this._panningPlane[3]=-d(M(this._panningPlane),w),this.startCamera.center=u(v,this.startCamera.eye,l(v,this.startCamera.viewForward,j));const E=s(t.center,this._tmpScreenPointArray);I(this._panningPlane,this.startCamera,E,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),Z(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=S(t.radius-this._beginRadius),f(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);D(this._sphere,this.currentCamera,i,this._tmp3d),V(this._beginScenePoint,d(this.currentCamera.up,this._beginScenePoint),this._sphere.radius,this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(q(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(B(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere.radius,this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=S(r(this._screenPickPoint,i)),f(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){p(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||h(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+J(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),K(this.currentCamera,this._sphere.center,v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=S(t.radius*e),f(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);I(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(L(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=S(r(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),f(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),N(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=S(t.radius-this._beginRadius),f(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){m(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||h(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=J(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),K(this.currentCamera,this._sphere.center,v(this._rotationAxis,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=S(t.radius*o),f(this.view,this.currentCamera,this._constraintOptions)}};tt=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],tt);export{tt as PinchAndPanControllerGlobal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{
|
|
2
|
+
import{__decorate as t}from"tslib";import{createScreenPointArray as i,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{subclass as n}from"../../../../core/accessorSupport/decorators.js";import{distance as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{negate as s,copy as a,dot as r,subtract as m,length as h,normalize as l,scale as c,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{wrapAxisAngle as d}from"../../../../geometry/support/axisAngle.js";import{create as g,fromNormalAndOffset as C,setOffsetFromPoint as v,negate as b,getNormal as w}from"../../../../geometry/support/plane.js";import{pixelDistanceToInteractionFactor as M,applyAll as f}from"../../camera/constraintUtils.js";import{ConstraintOptions as V}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as P}from"../../input/util.js";import{getVoxelWasm as z}from"../../layers/VoxelWasm.js";import{InteractiveController as S}from"./InteractiveController.js";import{PanPlanarMomentumController as j}from"./momentum/PanPlanarMomentumController.js";import{RotationMomentumController as E}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as H}from"./momentum/ZoomPlanarMomentumController.js";import{inferNavigationMode as x,excludeTerrain as y,getTiltScaleFactor as O,maxPanDistanceModifier as F,minPinchAndPanCameraHeight as R,pivotSearchAreaSize as A,centroid as U,applyZoomToPoint as T,applyPanPlanar as D,normalizeRotationDelta as I,applyRotation as Z,intersectPlaneFromScreenPointAtEye as k}from"../utils/navigationUtils.js";import G from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as L}from"../../../navigation/PanPlanarMomentumEstimator.js";import{RotationMomentumEstimator as W}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as q}from"../../../navigation/ZoomMomentumEstimator.js";const B=u(0,0,1);let J=class extends S{constructor(t){super(t),this._rotationValueSmooth=new P(.05),this._scalingValueSmooth=new P(.05),this._planeHorizontal=g(),this._planeVertical=g(),this._rotationMomentumEstimator=new W,this._panMomentumEstimator=new L(300,12,.9),this._zoomMomentumEstimator=new q,this._beginRadius=0,this._beginCenter=_(),this._beginAngle=0,this._tmpPoints=[],this._navigationMode=1,this._beginCenterScreen=i(),this._tmpCentroid3d=_(),this._tmpCentroid2d=i(),this._tmp2d=i(),this._pointerCount=0,this._beginCamera=new G,this._constraintOptions=new V(15,0,0,this._beginCamera)}begin(t){if(!this.running)return;const i=this.view.navigation.momentumEnabled;this._zoomMomentumEstimator.enabled=i,this._rotationMomentumEstimator.enabled=i,this._panMomentumEstimator.enabled=i,this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._rotationValueSmooth.reset(),this._scalingValueSmooth.reset(),e(t.center,this._beginCenterScreen),C(B,0,this._planeHorizontal);const n=_();s(n,this.startCamera.viewForward);const o=_();a(o,B);const u=r(n,o);this._navigationMode=x(this.startCamera,this._beginCenterScreen,this.view.renderCoordsHelper,this.view.viewingMode);const d=_(),g=this._intersectionHelper.intersectScreenFreePointFallback(this._beginCenterScreen,d,this.view.groundView.invisible?y:{}),M=O(o,this.startCamera.viewForward,F)*Math.max(Math.abs(this.view.camera.position.z),R);v(this._planeHorizontal,this._planeHorizontal,d),this.startCamera.aboveGround||b(this._planeHorizontal,this._planeHorizontal);const f=_(),V=_(),P=_();m(f,d,this.currentCamera.eye);const S=h(f);if(l(f,f),0===this._navigationMode){c(o,o,u),m(w(this._planeVertical),n,o),l(w(this._planeVertical),w(this._planeVertical)),v(this._planeVertical,this._planeVertical,d);const i=this.view.stage.renderView.getMinimalDepthForArea(z(this.view),this._beginCenterScreen[0],this._beginCenterScreen[1],this.view.state.camera,A);let e=null!=i?i:M;g&&(e=Math.min(e,S)),a(P,p(V,this.currentCamera.eye,c(V,f,e))),this._planeVertical[3]=-r(w(this._planeVertical),P),this._computePlanePoints(t.pointers,this._planeVertical,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}else{const i=g?S:M;a(P,p(V,this.currentCamera.eye,c(V,f,i))),this._planeHorizontal[3]=-r(w(this._planeHorizontal),P),this._computePlanePoints(t.pointers,this._planeHorizontal,this.startCamera,this._tmpPoints),U(this._tmpPoints,this._beginCenter)}this._beginCamera.copyFrom(this.startCamera)}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1,n=1===this._navigationMode?this._planeHorizontal:this._planeVertical,s=this._beginCenter;if(i){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._scalingValueSmooth.gain=e,this._scalingValueSmooth.update(i),T(this.currentCamera,s,this._scalingValueSmooth.value,this.view.state.constraints.minimumPoiDistance),this._zoomMomentumEstimator.add(this._scalingValueSmooth.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=M(Math.abs(t.radius-this._beginRadius)),f(this.view,this.currentCamera,this._constraintOptions)}if(this._computePlanePoints(t.pointers,n,this.currentCamera,this._tmpPoints),U(this._tmpPoints,this._tmpCentroid3d),e(t.center,this._tmpCentroid2d),D(this.currentCamera,s,this._tmpCentroid3d),this._panMomentumEstimator.add(this._tmpCentroid2d,this._tmpCentroid3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=M(o(this._beginCenterScreen,this._tmpCentroid2d)),f(this.view,this.currentCamera,this._constraintOptions),i){const i=s,e=this._rotationValueSmooth.value,n=e+I(t.angle-e),o=.00125*Math.min(Math.max(t.radius,40),120);this._rotationValueSmooth.gain=o,this._rotationValueSmooth.update(n);const a=this._rotationValueSmooth.value-this._beginAngle;this._rotationMomentumEstimator.add(a,.001*t.timestamp);const r=w(this._planeHorizontal);Z(this.currentCamera,i,d(r,a)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=M(Math.abs(t.radius*a)),f(this.view,this.currentCamera,this._constraintOptions)}this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this.view.animationsEnabled&&this._zoomMomentumEstimator.evaluateMomentum();if(i)return new H({view:this.view,momentum:i,zoomCenter:this._beginCenter});const e=this.view.animationsEnabled&&this._rotationMomentumEstimator.evaluateMomentum();if(e)return new E({view:this.view,momentum:e,center:this._beginCenter,axis:w(this._planeHorizontal)});const n=this.view.animationsEnabled&&this._panMomentumEstimator.evaluateMomentum();return n?new j({view:this.view,momentum:n}):null}_computePlanePoints(t,i,e,n){n.length=t.size;const o=this._tmp2d;let s=0;return t.forEach(t=>{o[0]=t.x,o[1]=t.y,void 0===n[s]&&(n[s]=_()),k(i,e,o,n[s]),s+=1}),n}get _intersectionHelper(){return this.view.sceneIntersectionHelper}};J=t([n("esri.views.3d.state.controllers.PinchAndPanControllerLocal")],J);export{J as PinchAndPanControllerLocal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as o,subtract as h,length as c,scale as m,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{create as u,fromPoints as P}from"../../../../geometry/support/axisAngle.js";import{Sphere as
|
|
2
|
+
import{__decorate as t}from"tslib";import{clamp as i}from"../../../../core/mathUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{subclass as e}from"../../../../core/accessorSupport/decorators.js";import{copy as s,distance as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{normalize as o,subtract as h,length as c,scale as m,add as p}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as _}from"../../../../geometry/ellipsoidUtils.js";import{create as u,fromPoints as P}from"../../../../geometry/support/axisAngle.js";import{Sphere as y}from"../../../../geometry/support/sphere.js";import{pixelDistanceToInteractionFactor as C,applyAll as g}from"../../camera/constraintUtils.js";import{ConstraintOptions as d}from"../../camera/constraintUtils/ConstraintOptions.js";import{applySurfaceCollisionConstraint as f}from"../../camera/constraintUtils/surfaceCollision.js";import{InteractiveController as v}from"./InteractiveController.js";import{normalizeCoordinate as R,pickPointAndInitSphere as w,excludeTerrain as D,inferNavigationMode as k,zoomPivotDistanceClamp as j,getTiltScaleFactor as A,pivotSearchAreaSize as b,distanceComparisonTolerance as x,sphereOrPlanePointFromScreenPoint as M,applyRotation as O,maxZoomPivotDistanceModifier as U}from"../utils/navigationUtils.js";import{fromScreenAtEye as z}from"../../support/geometryUtils/ray.js";const B=12;let S=class extends v{constructor(){super(...arguments),this._pickPoint=l(),this._tmpP0=a(),this._panAxisAngle=u(),this._tmpRayDir=l(),this._tmpRayDirPick=l(),this._targetOnSphere=l(),this._navigationMode=1,this._tmpRay={origin:l(),direction:l()},this.dragBeginPoint=r(),this._normalizedAnchorPoint=a(),this._constraintOptions=new d(7,1,0,this.startCamera),this._sphere=new y,this._hasPickPoint=!1}begin(t){if(!this.running)return;s(this.dragBeginPoint,t),R(this.startCamera,t,this._normalizedAnchorPoint);const r=_(this.view.spatialReference),e=w(this.view,this.startCamera,t,r.radius,0,this.view.groundView.invisible?D:{});if(this._navigationMode=k(this.startCamera,t,this.view.renderCoordsHelper,this.view.viewingMode),1===this._navigationMode)this._hasPickPoint=!!e.scenePickPoint,this._pickPoint=e.scenePickPoint??this._pickPoint,this._sphere=e.sphere;else{let r;z(this.startCamera,t,this._tmpRay),o(this._tmpRay.direction,this._tmpRay.direction),null!=e.scenePickPoint&&(h(this._tmpRayDirPick,this.startCamera.eye,e.scenePickPoint),r=c(this._tmpRayDirPick));const s=Math.abs(this.view.camera.position.z);this.view.renderCoordsHelper.worldUpAtPosition(this.startCamera.eye,H);const n=i(A(H,this._tmpRay.direction,U)*s,j[0],j[1]),a=this.view.stage.renderView.getMinimalDepthForArea(null,t[0],t[1],this.view.state.camera,b);let l=null!=a?a:n;null!=r&&(l=Math.min(l,r)),this._hasPickPoint=!0,m(this._tmpRay.direction,this._tmpRay.direction,l),p(this._pickPoint,this._tmpRay.origin,this._tmpRay.direction)}}update(t){if(this.running){if(this.currentCamera.eye=this.startCamera.eye,this.currentCamera.center=this.startCamera.center,this.currentCamera.up=this.startCamera.up,1===this._navigationMode){h(this._tmpRayDir,this.currentCamera.center,this.currentCamera.eye);const i=c(this._tmpRayDir);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*B;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;if(this._hasPickPoint&&e<i){const t=1-(1-e/i)*(1-this._sphere.radius/c(this.currentCamera.center));this.currentCamera.center=m(F,this.currentCamera.center,t)}m(this._tmpRayDir,this._tmpRayDir,-e/i),this.currentCamera.eye=p(F,this.currentCamera.center,this._tmpRayDir),this._constraintOptions.interactionFactor=C(n(this.dragBeginPoint,t)),g(this.view,this.currentCamera,this._constraintOptions),this._hasPickPoint&&(M(this._sphere,this.currentCamera,this.dragBeginPoint,this._targetOnSphere),P(this._pickPoint,this._targetOnSphere,this._panAxisAngle),O(this.currentCamera,this._sphere.center,this._panAxisAngle))}else{const i=c(this._tmpRay.direction);R(this.currentCamera,t,this._tmpP0);const r=(this._normalizedAnchorPoint[1]-this._tmpP0[1])*B;let e=i*2**r;const s=this.view.state.constraints.minimumPoiDistance;if(r<0&&e<s&&(e=s),Math.abs(i-e)<x)return;m(this._tmpRayDir,this._tmpRay.direction,1-e/i),this.currentCamera.eye=p(F,this.currentCamera.eye,this._tmpRayDir),this.currentCamera.center=p(F,this.currentCamera.center,this._tmpRayDir),o(this._tmpRayDir,this._tmpRayDir),this._constraintOptions.interactionDirection=this._tmpRayDir,g(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null}f(this.view,null,this.currentCamera),this.commitCamera()}}finish(){this.running&&this.finishController()}};S=t([e("esri.views.3d.state.controllers.ZoomControllerGlobal")],S);const F=l(),H=l();export{S as ZoomControllerGlobal};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as r,asinClamped as o}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as a,exactEquals as s,rotate as c,multiply as u}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as l,create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as h,length as M,dot as g,subtract as y,normalize as d,squaredDistance as b,copy as x,transformMat4 as j,add as v,distance as w,cross as P,scale as z,lerp as I,crossAndNormalize as S,scaleAndAdd as T,set as R}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as q}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,axis as F,fromPoints as H,wrapAxisAngle as U}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as E,vectorCoordinates as G}from"../../../../geometry/support/coordinateSystem.js";import{create as k,fromNormalAndOffset as C,intersectRay as O,fromPositionAndNormal as W,distance as B,projectPoint as D,projectVector as J}from"../../../../geometry/support/plane.js";import{create as K}from"../../../../geometry/support/ray.js";import{Sphere as L}from"../../../../geometry/support/sphere.js";import{sm4d as N,sv3d as Q}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as V,fromScreen as X}from"../../support/geometryUtils/ray.js";import{intersectScreen as Y}from"../../support/geometryUtils/sphere.js";import Z from"../../webgl/RenderCamera.js";import{terrainId as $}from"../../webgl-engine/lib/verticalOffsetUtils.js";const _=30,tt=[1,3e8],et=8,nt=[200,1508e5],rt=5,ot=50,it=5,at=10,st=80,ct=90,ut=1e-6,lt={exclude:new Set([$])};function mt(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ft(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function pt(t,e,n){const r=a(N.get(),n[3],F(n));null==r||s(r,l)||(y(Ee,t.eye,e),j(Ee,Ee,r),t.eye=v(Ee,Ee,e),y(Ee,t.center,e),j(Ee,Ee,r),t.center=v(Ee,Ee,e),t.up=j(Ee,t.up,r))}function ht(t,e,n,r){return O(t,X(e,n,Be),r)}function Mt(t,e,n,r){return O(t,V(e,n,Be),r)}function gt(t,e,n,r){const o=Q.get();let i=1-n;y(o,e,t.eye);const a=M(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<ut||(z(o,o,i),t.eye=v(Ee,t.eye,o),t.center=I(Ee,t.center,e,i))}function yt(t,e,n){e.getScreenCenter(dt),Y(t,e,dt,Ee)&&(e.center=Ee);const r=e.distance,o=r*n;if(Math.abs(r-o)<ut)return;const i=z(Q.get(),e.viewForward,o);e.eye=y(Ee,e.center,i)}const dt=i();function bt(t,e){R(e,0,0,0);for(const n of t)v(e,e,n);z(e,e,1/t.length)}function xt(t,e,n,r){return Math.sin(t/M(e))*(n+r.radius)}function jt(t,e,n,r){return xt(Math.PI/2,e,n,r)+(t-Math.PI/2)}const vt={Elevation:3e4,Angle:e(16)},wt=e(80);function Pt(t,e,n,r,o,i){const a=q(),s=new L;let c=!0,u=!0;const{eye:l}=e;return t.intersectScreen(n,a,i)&&!h(l,a)&&xe(l,a,r)?s.radius=M(a):(u=!1,e.aboveGround&&0!==o?s.radius=Math.max(M(e.center),.9*r):s.radius=M(e.eye)-e.relativeElevation,1===o?Tt(s,e,n,a):c=Y(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:u}}function zt(t,e,n,r){const o=t.relativeElevation;if(o>vt.Elevation&&"global"===r)return 1;V(t,e,De);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,Ee);return-i*g(a,De.direction)<Math.sin(vt.Angle)*M(De.direction)?0:1}function It(t,e,n){y(St,n,e),t.eye=y(Ee,t.eye,St),t.center=y(Ee,t.center,St)}const St=q();function Tt(t,e,n,r){const o=V(e,n,Be);return null!=o&&(t.closestPointOnSilhouette(o,Rt),t.intersectRay(o,r)?!(b(Rt,o.origin)<b(r,o.origin))||(x(r,Rt),!1):(y(qt,e.eye,e.center),d(qt,qt),C(qt,-g(d(qt,qt),Rt),At),O(At,o,r),!1))}const Rt=q(),qt=q(),At=k(),Ft=q(),Ht=q(),Ut=i();function Et(t,e){return J(e,t.viewForward,Ft),v(Ht,t.eye,Ft),t.projectToScreen(Ht,Ut),Ut[1]}const Gt=q(),kt=k(),Ct=q(),Ot=q(),Wt=q(),Bt=q(),Dt=q(),Jt=q(),Kt=q(),Lt=q(),Nt=q(),Qt=q(),Vt=i(),Xt=K();function Yt(t,e,n){const r=t.eye;if(w(e.center,r)<e.radius)return d(Dt,r),P(Jt,Dt,t.viewRight),v(Ht,r,Jt),t.projectToScreen(Ht,Vt),Vt[1];const o=t.up;V(t,n,Xt);const i=e.radius;if(S(Gt,o,Xt.direction),W(r,Gt,kt),B(kt,e.center)>i)return null;D(kt,e.center,Ct);const a=w(e.center,Ct),s=Math.sqrt(i**2-a**2);y(Ot,r,Ct),d(Wt,Ot),S(Bt,Gt,Wt);const c=g(Ot,Wt),u=g(Ot,Bt),l=Math.sqrt(c**2+u**2),m=s**2/l**2,f=s/l**2*Math.sqrt(l**2-s**2),p=m*c,h=f*-u,M=m*u,b=f*c,x=p-h,j=M+b,I=M-b;v(Kt,Ct,T(Kt,z(Kt,Wt,p+h),Bt,j)),v(Lt,Ct,T(Lt,z(Lt,Wt,x),Bt,I)),y(Nt,Kt,r),d(Nt,Nt),y(Qt,Lt,r),d(Qt,Qt);return g(t.viewForward,Nt)>=g(t.viewForward,Qt)?t.projectToScreen(Kt,Vt):t.projectToScreen(Lt,Vt),Vt[1]}function Zt(t,e,n){return e?t>n:t<n}const $t=.05,_t=12;function te(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(_t,$t*r)}function ee(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+te(t,e))}function ne(t,e){return Math.max(0,e-te(t,e))}function re(i,a,s,c,u,l){let m=0;if(P(Ce,i,a),y(Ge,i,a),M(i)<=u||!c.aboveGround){P(s,Ge,c.eye);const f=g(i,a)/(M(i)*M(a));if(f<.9999)m=r(f);else{const t=M(P(q(),i,a))/(M(i)*M(a));m=o(t)}const p=Math.cos(n(t.normalize(e(l)),0,wt));m=-m-Math.max(0,M(a)-u)/(p*u)}else y(oe,c.eye,c.center),P(s,Ge,oe),m=-M(Ge)/u;return d(s,s),z(s,s,M(Ce)),m}const oe=q();function ie(o,i,a,s){let c,u;const l=Math.cos(n(t.normalize(e(s)),0,wt));return c=i>a?-(i-a)/(l*a):i<-a?Math.PI-(i+a)/(l*a):r(i/a),u=o>a?-(o-a)/(l*a):o<-a?Math.PI-(o+a)/(l*a):r(o/a),(u-c)*a}function ae(t,e,n,r,o,i,a,s,c,u){const l=ie(t[2],e[2],i.radius,s),m=c?ie(t[0],e[0],i.radius,180):e[0]-t[0],p=Math.sin(a)*m-Math.cos(a)*l,h=Math.cos(a)*m+Math.sin(a)*l;d(Ee,o);const M=c?p/Math.sqrt(Math.abs(i.radius**2-g(n,Ee)**2)):p/i.radius,y=h/Math.sqrt(Math.abs(i.radius**2-g(n,r)**2));f(u,M,y)}function se(t,e,n,r,o,i,a,s,c,u){P(Ce,t,e),E(i.up,i.eye,Pe,ze,Ie),E([0,0,1],i.eye,je,ve,we),x(n,ve),x(r,je),d(n,n),z(n,n,M(Ce)),G(t,d(ze,ze),d(Ie,Ie),d(Pe,Pe),Se),G(e,ze,Ie,Pe,Te),ae(Se,Te,t,je,ve,a,s,c,u,o)}function ce(t,e,n,r,o,i,s){a(Ae,o,r),a(Fe,s,i),u(He,Ae,Fe),y(e,t,n),j(e,e,He),v(e,e,n)}function ue(t,e,n,r,o,i){a(Ae,r,n),a(Fe,i,o),u(He,Ae,Fe),y(Ee,t.eye,e),j(Ee,Ee,He),t.eye=v(Ee,Ee,e),y(Ee,t.center,e),j(Ee,Ee,He),t.center=v(Ee,Ee,e),y(Ee,t.up,e),j(Ee,Ee,He),t.up=v(Ee,Ee,e)}const le={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let me=!1;function fe(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-le.Angle||Math.abs(r)<le.Angle,s=(Math.abs(t[2])<n*le.Pole||Math.abs(e)>n)&&i;return a&&s?!me&&o<le.Tilt-le.TiltHysteresisMargin?me=!0:me&&o>le.Tilt+le.TiltHysteresisMargin&&(me=!1):me=!1,me}function pe(t,e,n,r,o,i){if(i)H(n,r,qe),pt(e,t.center,qe);else{const i=re(n,r,Oe,e,t.radius,o);pt(e,t.center,U(Oe,i))}}function he(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let u,l;x(Ue,r),ke.copyFrom(e);for(let m=0;m<s&&b(n,Ue)>c&&(u=b(n,Ue),se(n,Ue,ve,je,Re,ke,t,o,i,a),ue(ke,t.center,je,Re[1],ve,Re[0]),ce(Ue,Ue,t.center,je,Re[1],ve,Re[0]),l=b(n,Ue),l<u||0===m);m++)e.copyFrom(ke)}function Me(n,r,o,i,a,s,c){fe(o,g(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?he(n,r,o,i,-t.normalize(e(a)),s,c):pe(n,r,o,i,s,c)}function ge(t,e,n,r,o,i){const{eye:a}=t;E([0,0,1],a,je,ve,we);const s=e.translation[0]*n.pan,u="zoom"===o.mode?0:e.translation[1]*n.pan,l=Math.max(Math.sqrt(Math.abs(1-g(t.center,je)**2/M(t.center)**2)),.5),m=(Math.sin(i)*u+Math.cos(i)*s)/l,f=-Math.cos(i)*u+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,je),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,f,ve),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function ye(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(Q.get(),a,i),u=e.translation[0]*n.pan;switch(0!==u&&(c(r.pan.matrix,r.pan.matrix,-u,s),r.pan.enabled=!0),o.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(r.pan.matrix,r.pan.matrix,t,a),r.pan.enabled=!0);break}case"zoom":r.zoom=-e.translation[1]*n.zoom}}function de(n,r,o,i,a,s,c,u,l){fe(n.center,g(n.up,n.center),M(n.center),-t.normalize(e(s)),c,r.aboveGround)?ge(r,o,i,u,l,-t.normalize(e(a))):ye(r,o,i,u,l)}function be(t,e,n=1/0){const r=Math.abs(g(t,e));return Math.min(n,1/r)}function xe(t,e,n){const r=w(t,e),o=M(t);return r<Math.max(o,n)}const je=q(),ve=q(),we=q(),Pe=q(),ze=q(),Ie=q(),Se=q(),Te=q(),Re=p(),qe=A(),Ae=m(),Fe=m(),He=m(),Ue=q(),Ee=q(),Ge=q();let ke=new Z;const Ce=q(),Oe=q();function We(){ke=new Z}const Be={origin:q(),direction:q()},De={origin:q(),direction:q()};export{wt as TiltThresholdPanningSpeed,vt as VerticalPanTresholds,It as applyPanPlanar,pe as applyPanSphericalDirectRotation,he as applyPanSphericalPreserveHeading,pt as applyRotation,ue as applyRotationWithTwoAxes,yt as applyZoomOnSphere,gt as applyZoomToPoint,bt as centroid,We as cleanupNavigationUtils,ne as computeHorizonDownLimitScreenY,te as computeHorizonPadding,ee as computeHorizonUpLimitScreenY,ut as distanceComparisonTolerance,lt as excludeTerrain,Et as findPlaneHorizonY,Yt as findSphereHorizonY,be as getTiltScaleFactor,zt as inferNavigationMode,ht as intersectPlaneFromScreenPoint,Mt as intersectPlaneFromScreenPointAtEye,xe as isHitOnSamePlanetSide,ie as lengthFromPoints,rt as maxPanDistanceModifier,it as maxRotatePivotDistanceModifier,_ as maxZoomPivotDistanceModifier,et as maxZoomStepDistanceModifier,ot as minPinchAndPanCameraHeight,at as minRotatePivotDistance,mt as normalizeCoordinate,ft as normalizeRotationDelta,jt as offSurfaceTiltToEyeTiltGlobal,xt as onSurfaceTiltToEyeTiltGlobal,de as panMotionToRotationMatrix,Me as panToPosition,Pt as pickPointAndInitSphere,st as pivotSearchAreaSize,le as preservingHeadingThresholds,$t as relativeHorizonPanPadding,ct as rotatePivotSearchAreaSize,ce as rotatePointAroundTwoAxes,re as rotationAngleAndAxisDirectRotation,se as rotationAnglesAndAxesHeadingPreserving,ae as rotationAnglesHeadingPreserving,Zt as shouldClampScreenY,fe as shouldPreserveHeading,Tt as sphereOrPlanePointFromScreenPoint,tt as zoomPivotDistanceClamp,nt as zoomStepDistanceClamp};
|
|
2
|
+
import{cyclicalPI as t}from"../../../../core/Cyclical.js";import{deg2rad as e,clamp as n,acosClamped as r,asinClamped as o}from"../../../../core/mathUtils.js";import{createScreenPointArray as i}from"../../../../core/screenUtils.js";import{fromRotation as a,exactEquals as s,rotate as c,multiply as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as u,create as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as p}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{exactEquals as h,length as M,dot as g,subtract as d,normalize as y,squaredDistance as b,copy as x,transformMat4 as j,add as v,distance as w,cross as P,scale as I,lerp as z,set as T,crossAndNormalize as S,scaleAndAdd as R}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{clone as q,create as A}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as H,axis as F,fromPoints as U,wrapAxisAngle as E}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as G,vectorCoordinates as k}from"../../../../geometry/support/coordinateSystem.js";import{create as C,fromNormalAndOffset as O,intersectRay as W,projectVector as B,fromPositionAndNormal as D,distance as J,projectPoint as K}from"../../../../geometry/support/plane.js";import{create as L}from"../../../../geometry/support/ray.js";import{Sphere as N}from"../../../../geometry/support/sphere.js";import{sm4d as Q,sv3d as V}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as X,fromScreen as Y}from"../../support/geometryUtils/ray.js";import{intersectScreen as Z}from"../../support/geometryUtils/sphere.js";import $ from"../../webgl/RenderCamera.js";import{Intersector as _}from"../../webgl-engine/lib/Intersector.js";import{terrainId as tt}from"../../webgl-engine/lib/verticalOffsetUtils.js";const et=30,nt=[1,3e8],rt=8,ot=[200,1508e5],it=5,at=50,st=5,ct=10,lt=80,ut=90,mt=1e-6,pt={exclude:new Set([tt])};function ft(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function ht(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function Mt(t,e,n){const r=a(Q.get(),n[3],F(n));null==r||s(r,u)||(d(ke,t.eye,e),j(ke,ke,r),t.eye=v(ke,ke,e),d(ke,t.center,e),j(ke,ke,r),t.center=v(ke,ke,e),t.up=j(ke,t.up,r))}function gt(t,e,n,r){return W(t,Y(e,n,Je),r)}function dt(t,e,n,r){return W(t,X(e,n,Je),r)}function yt(t,e,n,r){const o=V.get();let i=1-n;d(o,e,t.eye);const a=M(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<mt||(I(o,o,i),t.eye=v(ke,t.eye,o),t.center=z(ke,t.center,e,i))}function bt(t,e,n){e.getScreenCenter(xt),Z(t,e,xt,ke)&&(e.center=ke);const r=e.distance,o=r*n;if(Math.abs(r-o)<mt)return;const i=I(V.get(),e.viewForward,o);e.eye=d(ke,e.center,i)}const xt=i();function jt(t,e){T(e,0,0,0);for(const n of t)v(e,e,n);I(e,e,1/t.length)}function vt(t,e,n,r){return Math.sin(t/M(e))*(n+r.radius)}function wt(t,e,n,r){return vt(Math.PI/2,e,n,r)+(t-Math.PI/2)}const Pt={Elevation:3e4,Angle:e(16)},It=e(80);function zt(t,e,n,r,o,i){const a=t.sceneIntersectionHelper,s=new _(t.state.viewingMode);s.options.selectionMode=!0,s.options.store=0,s.options.hud=!1,s.options.normalRequired=!0;let c=null;const l=A(),u=new N;let m=!0,p=!0;const{eye:f}=e;a.intersectIntersectorScreen(n,s,i);const g=s.results.min;return g.getIntersectionPoint(l)&&!h(f,l)&&ve(f,l,r)?(c=q(g.normal),u.radius=M(l)):(p=!1,e.aboveGround&&0!==o?u.radius=Math.max(M(e.center),.9*r):u.radius=M(e.eye)-e.relativeElevation,1===o?qt(u,e,n,l):m=Z(u,e,n,l)),{sphere:u,scenePickPoint:m?l:null,hasGeometryIntersection:p,intersectorType:g.intersector,normal:c}}function Tt(t,e,n,r){const o=t.relativeElevation;if(o>Pt.Elevation&&"global"===r)return 1;X(t,e,Ke);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,ke);return-i*g(a,Ke.direction)<Math.sin(Pt.Angle)*M(Ke.direction)?0:1}function St(t,e,n){d(Rt,n,e),t.eye=d(ke,t.eye,Rt),t.center=d(ke,t.center,Rt)}const Rt=A();function qt(t,e,n,r){const o=X(e,n,Je);return null!=o&&(t.closestPointOnSilhouette(o,At),t.intersectRay(o,r)?!(b(At,o.origin)<b(r,o.origin))||(x(r,At),!1):(d(Ht,e.eye,e.center),y(Ht,Ht),O(Ht,-g(y(Ht,Ht),At),Ft),W(Ft,o,r),!1))}const At=A(),Ht=A(),Ft=C(),Ut=A(),Et=A(),Gt=i();function kt(t,e){return B(e,t.viewForward,Ut),v(Et,t.eye,Ut),t.projectToScreen(Et,Gt),Gt[1]}const Ct=A(),Ot=C(),Wt=A(),Bt=A(),Dt=A(),Jt=A(),Kt=A(),Lt=A(),Nt=A(),Qt=A(),Vt=A(),Xt=A(),Yt=i(),Zt=L();function $t(t,e,n){const r=t.eye;if(w(e.center,r)<e.radius)return y(Kt,r),P(Lt,Kt,t.viewRight),v(Et,r,Lt),t.projectToScreen(Et,Yt),Yt[1];const o=t.up;X(t,n,Zt);const i=e.radius;if(S(Ct,o,Zt.direction),D(r,Ct,Ot),J(Ot,e.center)>i)return null;K(Ot,e.center,Wt);const a=w(e.center,Wt),s=Math.sqrt(i**2-a**2);d(Bt,r,Wt),y(Dt,Bt),S(Jt,Ct,Dt);const c=g(Bt,Dt),l=g(Bt,Jt),u=Math.sqrt(c**2+l**2),m=s**2/u**2,p=s/u**2*Math.sqrt(u**2-s**2),f=m*c,h=p*-l,M=m*l,b=p*c,x=f-h,j=M+b,z=M-b;v(Nt,Wt,R(Nt,I(Nt,Dt,f+h),Jt,j)),v(Qt,Wt,R(Qt,I(Qt,Dt,x),Jt,z)),d(Vt,Nt,r),y(Vt,Vt),d(Xt,Qt,r),y(Xt,Xt);return g(t.viewForward,Vt)>=g(t.viewForward,Xt)?t.projectToScreen(Nt,Yt):t.projectToScreen(Qt,Yt),Yt[1]}function _t(t,e,n){return e?t>n:t<n}const te=.05,ee=12;function ne(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(ee,te*r)}function re(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+ne(t,e))}function oe(t,e){return Math.max(0,e-ne(t,e))}function ie(i,a,s,c,l,u){let m=0;if(P(We,i,a),d(Ce,i,a),M(i)<=l||!c.aboveGround){P(s,Ce,c.eye);const p=g(i,a)/(M(i)*M(a));if(p<.9999)m=r(p);else{const t=M(P(A(),i,a))/(M(i)*M(a));m=o(t)}const f=Math.cos(n(t.normalize(e(u)),0,It));m=-m-Math.max(0,M(a)-l)/(f*l)}else d(ae,c.eye,c.center),P(s,Ce,ae),m=-M(Ce)/l;return y(s,s),I(s,s,M(We)),m}const ae=A();function se(o,i,a,s){let c,l;const u=Math.cos(n(t.normalize(e(s)),0,It));return c=i>a?-(i-a)/(u*a):i<-a?Math.PI-(i+a)/(u*a):r(i/a),l=o>a?-(o-a)/(u*a):o<-a?Math.PI-(o+a)/(u*a):r(o/a),(l-c)*a}function ce(t,e,n,r,o,i,a,s,c,l){const u=se(t[2],e[2],i.radius,s),m=c?se(t[0],e[0],i.radius,180):e[0]-t[0],f=Math.sin(a)*m-Math.cos(a)*u,h=Math.cos(a)*m+Math.sin(a)*u;y(ke,o);const M=c?f/Math.sqrt(Math.abs(i.radius**2-g(n,ke)**2)):f/i.radius,d=h/Math.sqrt(Math.abs(i.radius**2-g(n,r)**2));p(l,M,d)}function le(t,e,n,r,o,i,a,s,c,l){P(We,t,e),G(i.up,i.eye,ze,Te,Se),G([0,0,1],i.eye,we,Pe,Ie),x(n,Pe),x(r,we),y(n,n),I(n,n,M(We)),k(t,y(Te,Te),y(Se,Se),y(ze,ze),Re),k(e,Te,Se,ze,qe),ce(Re,qe,t,we,Pe,a,s,c,l,o)}function ue(t,e,n,r,o,i,s){a(Fe,o,r),a(Ue,s,i),l(Ee,Fe,Ue),d(e,t,n),j(e,e,Ee),v(e,e,n)}function me(t,e,n,r,o,i){a(Fe,r,n),a(Ue,i,o),l(Ee,Fe,Ue),d(ke,t.eye,e),j(ke,ke,Ee),t.eye=v(ke,ke,e),d(ke,t.center,e),j(ke,ke,Ee),t.center=v(ke,ke,e),d(ke,t.up,e),j(ke,ke,Ee),t.up=v(ke,ke,e)}const pe={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let fe=!1;function he(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-pe.Angle||Math.abs(r)<pe.Angle,s=(Math.abs(t[2])<n*pe.Pole||Math.abs(e)>n)&&i;return a&&s?!fe&&o<pe.Tilt-pe.TiltHysteresisMargin?fe=!0:fe&&o>pe.Tilt+pe.TiltHysteresisMargin&&(fe=!1):fe=!1,fe}function Me(t,e,n,r,o,i){if(i)U(n,r,He),Mt(e,t.center,He);else{const i=ie(n,r,Be,e,t.radius,o);Mt(e,t.center,E(Be,i))}}function ge(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let l,u;x(Ge,r),Oe.copyFrom(e);for(let m=0;m<s&&b(n,Ge)>c&&(l=b(n,Ge),le(n,Ge,Pe,we,Ae,Oe,t,o,i,a),me(Oe,t.center,we,Ae[1],Pe,Ae[0]),ue(Ge,Ge,t.center,we,Ae[1],Pe,Ae[0]),u=b(n,Ge),u<l||0===m);m++)e.copyFrom(Oe)}function de(n,r,o,i,a,s,c){he(o,g(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?ge(n,r,o,i,-t.normalize(e(a)),s,c):Me(n,r,o,i,s,c)}function ye(t,e,n,r,o,i){const{eye:a}=t;G([0,0,1],a,we,Pe,Ie);const s=e.translation[0]*n.pan,l="zoom"===o.mode?0:e.translation[1]*n.pan,u=Math.max(Math.sqrt(Math.abs(1-g(t.center,we)**2/M(t.center)**2)),.5),m=(Math.sin(i)*l+Math.cos(i)*s)/u,p=-Math.cos(i)*l+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,we),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,p,Pe),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function be(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(V.get(),a,i),l=e.translation[0]*n.pan;switch(0!==l&&(c(r.pan.matrix,r.pan.matrix,-l,s),r.pan.enabled=!0),o.mode){case"pan":{const t=e.translation[1]*n.pan;0!==t&&(c(r.pan.matrix,r.pan.matrix,t,a),r.pan.enabled=!0);break}case"zoom":r.zoom=-e.translation[1]*n.zoom}}function xe(n,r,o,i,a,s,c,l,u){he(n.center,g(n.up,n.center),M(n.center),-t.normalize(e(s)),c,r.aboveGround)?ye(r,o,i,l,u,-t.normalize(e(a))):be(r,o,i,l,u)}function je(t,e,n=1/0){const r=Math.abs(g(t,e));return Math.min(n,1/r)}function ve(t,e,n){const r=w(t,e),o=M(t);return r<Math.max(o,n)}const we=A(),Pe=A(),Ie=A(),ze=A(),Te=A(),Se=A(),Re=A(),qe=A(),Ae=f(),He=H(),Fe=m(),Ue=m(),Ee=m(),Ge=A(),ke=A(),Ce=A();let Oe=new $;const We=A(),Be=A();function De(){Oe=new $}const Je={origin:A(),direction:A()},Ke={origin:A(),direction:A()};export{It as TiltThresholdPanningSpeed,Pt as VerticalPanTresholds,St as applyPanPlanar,Me as applyPanSphericalDirectRotation,ge as applyPanSphericalPreserveHeading,Mt as applyRotation,me as applyRotationWithTwoAxes,bt as applyZoomOnSphere,yt as applyZoomToPoint,jt as centroid,De as cleanupNavigationUtils,oe as computeHorizonDownLimitScreenY,ne as computeHorizonPadding,re as computeHorizonUpLimitScreenY,mt as distanceComparisonTolerance,pt as excludeTerrain,kt as findPlaneHorizonY,$t as findSphereHorizonY,je as getTiltScaleFactor,Tt as inferNavigationMode,gt as intersectPlaneFromScreenPoint,dt as intersectPlaneFromScreenPointAtEye,ve as isHitOnSamePlanetSide,se as lengthFromPoints,it as maxPanDistanceModifier,st as maxRotatePivotDistanceModifier,et as maxZoomPivotDistanceModifier,rt as maxZoomStepDistanceModifier,at as minPinchAndPanCameraHeight,ct as minRotatePivotDistance,ft as normalizeCoordinate,ht as normalizeRotationDelta,wt as offSurfaceTiltToEyeTiltGlobal,vt as onSurfaceTiltToEyeTiltGlobal,xe as panMotionToRotationMatrix,de as panToPosition,zt as pickPointAndInitSphere,lt as pivotSearchAreaSize,pe as preservingHeadingThresholds,te as relativeHorizonPanPadding,ut as rotatePivotSearchAreaSize,ue as rotatePointAroundTwoAxes,ie as rotationAngleAndAxisDirectRotation,le as rotationAnglesAndAxesHeadingPreserving,ce as rotationAnglesHeadingPreserving,_t as shouldClampScreenY,he as shouldPreserveHeading,qt as sphereOrPlanePointFromScreenPoint,nt as zoomPivotDistanceClamp,ot as zoomStepDistanceClamp};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__decorate as e}from"tslib";import{EventedAccessor as t}from"../../../core/Evented.js";import{on as o}from"../../../core/reactiveUtils.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import{subclass as r}from"../../../core/accessorSupport/decorators/subclass.js";import{isIntegratedMeshLayerView as i}from"../../support/layerViewUtils.js";let a=class extends t{constructor(e){super(e),this._integratedMeshElevationUpdateHandles=new Map}initialize(){const e=this._integratedMeshElevationUpdateHandles;this.addHandles([o(()=>this.view.groundView,"elevation-change",e=>this._elevationChange(e)),this.view.allLayerViews.on("change",t=>{t.added.forEach(t=>{if(!i(t)||t.usedAsGround)return;const o=t.elevationProvider.on("elevation-change",e=>this._elevationChange(e));e.set(t,o),this.addHandles(o,t)}),t.removed.forEach(t=>{i(t)&&(this.removeHandles(t),e.delete(t))})})])}intersect(e,t,o,s){this.view.groundView.intersect(e,t,o,s);for(const r of this._integratedMeshElevationUpdateHandles.keys())r.intersect(e,t,o,s)}_elevationChange(e){this.emit("elevation-change",e)}};e([s({constructOnly:!0})],a.prototype,"view",void 0),a=e([r("esri.views.3d.support.GroundAndIMSurface")],a);export{a as GroundAndIMSurface};
|