@arcgis/core 5.2.0-next.22 → 5.2.0-next.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/04070767356c12026369.js +1 -0
- package/assets/esri/core/workers/chunks/10112bf4b385f1955a3d.js +1 -0
- package/assets/esri/core/workers/chunks/{b0b3c67b7d37bd854d95.js → 1040bce57ea63a6dbca4.js} +2 -2
- package/assets/esri/core/workers/chunks/{3b74749db78bcba2bc16.js → 126a8c26618425790804.js} +1 -1
- package/assets/esri/core/workers/chunks/{d4e0346209fabc58f929.js → 15fd30908d5db7f7136e.js} +3 -3
- package/assets/esri/core/workers/chunks/{1a4bec464daa9662ab2a.js → 1a7c0a1dc6ecc93ea03a.js} +1 -1
- package/assets/esri/core/workers/chunks/{73b0edabddbb72fe1104.js → 1b5001bdfeecf78c33ce.js} +1 -1
- package/assets/esri/core/workers/chunks/{57e04b7ec238f7b24274.js → 1f03e34520746e432719.js} +1 -1
- package/assets/esri/core/workers/chunks/218e2d8d6cd147c769ce.js +1 -0
- package/assets/esri/core/workers/chunks/{2c4f10eaf02ef090ee8f.js → 23f81f4a3d7a983eef23.js} +1 -1
- package/assets/esri/core/workers/chunks/{a856ae928273f9d6792f.js → 268ee59800e64baa9682.js} +1 -1
- package/assets/esri/core/workers/chunks/26a2d4b95cda0a41d980.js +1 -0
- package/assets/esri/core/workers/chunks/{f02a9408ba3893484c6c.js → 2d6d01913096f7cb5ff8.js} +1 -1
- package/assets/esri/core/workers/chunks/2e7b83c8ba78cb06d611.js +1 -0
- package/assets/esri/core/workers/chunks/{7fc8516111bd869256fc.js → 30298f84bd414f9dea64.js} +1 -1
- package/assets/esri/core/workers/chunks/316a3d5c7842b445e29e.js +1 -0
- package/assets/esri/core/workers/chunks/{84a0bb53fcbd99b5aa0c.js → 33e86dd1a54e447fa0e3.js} +1 -1
- package/assets/esri/core/workers/chunks/{5fab14c5f1febebb75f1.js → 34eb22ee13df24271532.js} +1 -1
- package/assets/esri/core/workers/chunks/353c67da4b25c29360db.js +2 -0
- package/assets/esri/core/workers/chunks/{3d83ac791212b81c9d11.js → 36b904912cea1744d1c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{f8cfd0045d06aa24beec.js → 3b7060d264888bf298b1.js} +1 -1
- package/assets/esri/core/workers/chunks/{f9b44ff9bb4f7a88ab56.js → 3d1021f7ea9617a76ccf.js} +1 -1
- package/assets/esri/core/workers/chunks/{60d4a3f770bb1e01cd10.js → 3e4b379a6a197b9c4e6b.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f51963815b0d53ffbd9.js → 3e94ed4d57ee7d870cba.js} +1 -1
- package/assets/esri/core/workers/chunks/{7d220f574ebf2740c208.js → 41aca863324387576cf8.js} +1 -1
- package/assets/esri/core/workers/chunks/{a54773c9bbc751619b3f.js → 47948c72bc01bd173c20.js} +2 -2
- package/assets/esri/core/workers/chunks/{cbe8adc100582e746a8c.js → 4adfe7f8a8efe2cd8e80.js} +1 -1
- package/assets/esri/core/workers/chunks/{e29c8c10331edfa83277.js → 502464c4eab7667f6566.js} +1 -1
- package/assets/esri/core/workers/chunks/{e9acc05b0cf9e05f31a8.js → 50b34e246f8eef2f6e07.js} +1 -1
- package/assets/esri/core/workers/chunks/52993a9dc0c56e9bda19.js +1 -0
- package/assets/esri/core/workers/chunks/5b654e0dc901a7f06a9f.js +1 -0
- package/assets/esri/core/workers/chunks/{dd795c95cdc3812b5b49.js → 6adc17e6e287a365ad8d.js} +1 -1
- package/assets/esri/core/workers/chunks/{40df6ffeb61fea80aae3.js → 7849cf0352c0a604e164.js} +1 -1
- package/assets/esri/core/workers/chunks/{6c0c77de1934f35dc45f.js → 7c34eb94e2c74602aeab.js} +1 -1
- package/assets/esri/core/workers/chunks/{8579eba21f40630d073d.js → 7dbaa089c7472825b80c.js} +1 -1
- package/assets/esri/core/workers/chunks/{66c2cfe11161d5dc989a.js → 7dec8c453fdee1968d12.js} +1 -1
- package/assets/esri/core/workers/chunks/7e4093f42795ba2f8cfd.js +1 -0
- package/assets/esri/core/workers/chunks/856cf872d29eeaf11a71.js +1 -0
- package/assets/esri/core/workers/chunks/88b08b386926ec889573.js +1 -0
- package/assets/esri/core/workers/chunks/{1b0765403b06294b3e1d.js → 89dd1b1acb0d69264c93.js} +1 -1
- package/assets/esri/core/workers/chunks/{5d710b3e50f2211a765d.js → 8b526ca2dd6fc6a7e921.js} +1 -1
- package/assets/esri/core/workers/chunks/{50345dfc00380b158c96.js → 8ba3e0462a9bdaae5f40.js} +1 -1
- package/assets/esri/core/workers/chunks/{c86d388d216adbb15a05.js → 8bd4c43c34aacf3b07da.js} +1 -1
- package/assets/esri/core/workers/chunks/{69e98de578f467a35054.js → a0b78cbeb0e53107d819.js} +1 -1
- package/assets/esri/core/workers/chunks/{fee50ab6c92ef0327255.js → a454df829a72ab02c860.js} +1 -1
- package/assets/esri/core/workers/chunks/{5481af25fd46914498df.js → a6dc01847f39413f78b8.js} +1 -1
- package/assets/esri/core/workers/chunks/{44e32ed3a570593a7245.js → a8310f55de4749f973d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{5dd441db1e74dc9b56e9.js → acc733b4881c3e4e503e.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b45d34938fa7862f746.js → affc972757798b6db002.js} +1 -1
- package/assets/esri/core/workers/chunks/{9f93c29af2a18f7cb160.js → b45e91249a8ea1559a2b.js} +1 -1
- package/assets/esri/core/workers/chunks/{f955b35337a08f9f747d.js → c610ccbfdb1c5b06c217.js} +1 -1
- package/assets/esri/core/workers/chunks/{fb9f8b6cc2b4ae5b60df.js → c9ce408675dae6a0edd1.js} +1 -1
- package/assets/esri/core/workers/chunks/cd88e6f02bc2e5b67abf.js +1 -0
- package/assets/esri/core/workers/chunks/d374cb2d17a2d11c500f.js +1 -0
- package/assets/esri/core/workers/chunks/{5b42f8aa0247adc2d065.js → d41eed41916ed0422059.js} +1 -1
- package/assets/esri/core/workers/chunks/{8eda85fc01a71aedd9e4.js → dadf85890961bcc205eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{2255a21c7b959f04d941.js → db90fb8ac96579259566.js} +1 -1
- package/assets/esri/core/workers/chunks/{ef94d25d1cceb25ea9fe.js → dd0acd0f8b96839b4f24.js} +2 -2
- package/assets/esri/core/workers/chunks/e3623e557ab463580fd2.js +1 -0
- package/assets/esri/core/workers/chunks/{d523af1db620b5381c99.js → e8e7cd26c43f231cdea2.js} +1 -1
- package/assets/esri/core/workers/chunks/{162dada6a199d1efdf86.js → f859c53432f258af77e3.js} +2 -2
- package/chunks/OITBlendEmission.glsl.js +5 -2
- package/config.d.ts +9 -2
- package/config.js +1 -1
- package/form/elements/AttachmentElement.d.ts +4 -4
- package/kernel.js +1 -1
- package/layers/OrientedImageryLayer.d.ts +20 -2
- package/layers/orientedImagery/types.d.ts +4 -1
- package/layers/save/featureLayerUtils.js +1 -1
- package/layers/save/utils.js +1 -1
- package/layers/support/fetchService.js +1 -1
- package/package.json +3 -3
- package/portal/support/portalItemUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/CIMSymbol.d.ts +2 -3
- package/symbols/cim/types.d.ts +58 -2
- package/views/2d/engine/webgl/shaderGraph/graph/ShaderGraphContext.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/graph/glsl.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartShader.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/pieChart/PieChartTechnique.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/2d/layers/features/schema/processor/symbols/SymbolSchema.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedEditTool.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSnappingController.js +1 -1
- package/views/3d/analysis/Viewshed/ViewshedSubTool.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/utils/navigationUtils.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/support/pointsOfInterest/Focus.js +1 -1
- package/views/3d/webgl/RenderCamera.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/EmissionDimming.glsl.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js +4 -4
- package/views/PopupView.d.ts +3 -0
- package/widgets/BatchAttributeForm/templates/support/createBatchFormTemplate.js +1 -1
- package/widgets/BatchAttributeForm/types.d.ts +0 -7
- package/widgets/BatchAttributeForm.d.ts +7 -9
- package/widgets/BatchAttributeForm.js +1 -1
- package/widgets/Editor/EditorViewModel.d.ts +12 -2
- package/widgets/Editor/EditorViewModel.js +1 -1
- package/widgets/Editor/compatibilityAdapters.js +2 -0
- package/widgets/Editor/components/PendingFeatureList.js +1 -1
- package/widgets/Editor/components/UpdateFeaturePanelContent.js +1 -1
- package/widgets/Editor/legacy/AddAssociationWorkflow.js +2 -0
- package/widgets/Editor/legacy/AddAssociationWorkflowData.js +2 -0
- package/widgets/Editor/legacy/CreateFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/CreateFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/MergeFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/MergeFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/SplitFeatureWorkflow.js +2 -0
- package/widgets/Editor/legacy/SplitFeatureWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateFeatureWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateFeatureWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateFeaturesWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateFeaturesWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateRecordWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateRecordWorkflowData.js +2 -0
- package/widgets/Editor/legacy/UpdateWorkflow.js +2 -0
- package/widgets/Editor/legacy/UpdateWorkflowData.js +2 -0
- package/widgets/Editor/legacy/Workflow.js +2 -0
- package/widgets/Editor/legacy/workflowUtils.js +2 -0
- package/widgets/Editor/workflowUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm/FeatureFormViewModel.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.d.ts +2 -1
- package/widgets/FeatureTable/Grid/GridViewModel.d.ts +3 -0
- package/widgets/Sketch/SketchViewModel.d.ts +8 -1
- package/widgets/Sketch/types.d.ts +12 -0
- package/assets/esri/core/workers/chunks/0eb0ce43b4813cae968f.js +0 -2
- package/assets/esri/core/workers/chunks/0fb685f385e91d0f0601.js +0 -1
- package/assets/esri/core/workers/chunks/277718031c903da2b3b9.js +0 -1
- package/assets/esri/core/workers/chunks/47d630561f3fce5c63c4.js +0 -1
- package/assets/esri/core/workers/chunks/58c79e15ca95238a4b43.js +0 -1
- package/assets/esri/core/workers/chunks/5b238f9c345f10c5c2fa.js +0 -1
- package/assets/esri/core/workers/chunks/9ad36947bb42ed7f97d3.js +0 -1
- package/assets/esri/core/workers/chunks/9e0ea6c34940b1acf3c6.js +0 -1
- package/assets/esri/core/workers/chunks/aec46ec486912dca549d.js +0 -1
- package/assets/esri/core/workers/chunks/be4275a4b8977ec3eb61.js +0 -1
- package/assets/esri/core/workers/chunks/d6bb8db22ba85ad05fd7.js +0 -1
- package/assets/esri/core/workers/chunks/d8329c2000c0cc597adc.js +0 -1
- package/assets/esri/core/workers/chunks/dee339774131d7274137.js +0 -1
- package/assets/esri/core/workers/chunks/f3fe865506fd7428eb6d.js +0 -1
- package/assets/esri/core/workers/chunks/fccc34b86454c56f27ab.js +0 -1
- /package/assets/esri/core/workers/chunks/{b0b3c67b7d37bd854d95.js.LICENSE.txt → 1040bce57ea63a6dbca4.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{0eb0ce43b4813cae968f.js.LICENSE.txt → 353c67da4b25c29360db.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{a54773c9bbc751619b3f.js.LICENSE.txt → 47948c72bc01bd173c20.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{ef94d25d1cceb25ea9fe.js.LICENSE.txt → dd0acd0f8b96839b4f24.js.LICENSE.txt} +0 -0
- /package/assets/esri/core/workers/chunks/{162dada6a199d1efdf86.js.LICENSE.txt → f859c53432f258af77e3.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
|
|
2
|
+
import{__decorate as e}from"tslib";import n from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as t,subclass as i}from"../../../../core/accessorSupport/decorators.js";import{UpdatingHandles as r}from"../../../../core/support/UpdatingHandles.js";import{SnappingVisualizer3D as a}from"../../interactive/SnappingVisualizer3D.js";import{createCoordinateHelper as p}from"../../../interactive/coordinateHelper.js";import{EditGeometry as s}from"../../../interactive/editGeometry/EditGeometry.js";import{EditGeometryOperations as o}from"../../../interactive/editGeometry/EditGeometryOperations.js";import{SnappingContext as g}from"../../../interactive/snapping/SnappingContext.js";import{createSnapDragEventPipelineStep as l}from"../../../interactive/snapping/SnappingDragPipelineStep.js";import{acquire as d}from"../../../interactive/snapping/SnappingManagerPool.js";let u=class extends n{constructor(e){super(e),this._updatingHandles=new r,this._snappingManagerResult=null}get updating(){return this._updatingHandles.updating||!!this._snappingManager?.updating}get _snappingManager(){return this._snappingManagerResult?.snappingManager}destroy(){this._updatingHandles.destroy()}createObserverMoveSnappingPipeline(e,n,t){if(0!==e)return null;const i=new g({elevationInfo:t,pointer:n,editGeometryOperations:new o(new s("point",p(!0,!1,this.view.spatialReference)),this.view.state.viewingMode),visualizer:new a});return l({snappingContext:i,snappingManager:this._ensureSnappingManager(),updatingHandles:this._updatingHandles,useZ:!1})}_ensureSnappingManager(){if(null==this._snappingManagerResult){const e=d(this.view);this._snappingManagerResult=e,this.addHandles(e)}return this._snappingManagerResult.snappingManager}get test(){}};e([t({constructOnly:!0})],u.prototype,"view",void 0),e([t()],u.prototype,"updating",null),e([t()],u.prototype,"_snappingManager",null),e([t()],u.prototype,"_snappingManagerResult",void 0),u=e([i("esri.views.3d.analysis.Viewshed.ViewshedSnappingController")],u);export{u as ViewshedSnappingController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as n,Cyclical as o}from"../../../../core/Cyclical.js";import{handlesGroup as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as c,initial as v}from"../../../../core/reactiveUtils.js";import{property as g,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{sub as f,len as b,dot as M}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{viewingModeFromString as O}from"../../../ViewingMode.js";import{viewshedToolManipulatorConfiguration as V}from"./ViewshedConfiguration.js";import{ViewshedFieldOfViewManipulation as y,isSideHorizontal as T,flipSide as D}from"./ViewshedFieldOfViewManipulation.js";import{ViewshedScaleOrientManipulation as H}from"./ViewshedScaleOrientManipulation.js";import{ViewshedObserverManipulator as S}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as C}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as j}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as F,sceneSnappingAtProjectedLocation as x,dragManipulatedObject as A}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as P}from"../../../interactive/editGeometry/EditGeometryOperations.js";const k=Symbol("dragHandles"),E=Symbol("hideManipulators"),z=Symbol("hideFoVManipulators"),U=Symbol("hideObserverManipulator");let R=class extends i{constructor(e){super(e),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new y({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new H({view:this.view,tool:this.parentTool}),this._observerManipulator=new S(this.view,this.parentTool),this.addHandles([d(()=>this.elevationAlignedObserverRenderSpace,e=>{null!=e&&(this._moveManipulation.renderLocation=e,this._observerManipulator.renderLocation=e)},c),d(()=>this.viewshedComputedData?.heading,e=>{e&&(this._moveManipulation.angle=s(90-e))},v),d(()=>{const{viewshedComputedData:e}=this;return{viewshedComputedData:e,observer:this.elevationAlignedObserverRenderSpace}},({viewshedComputedData:e,observer:i},a)=>{this._grabbing&&i!==a?.observer||(this.removeHandles(k),e?.valid&&this.addHandles([this._buildObserverDragPipeline(e),this._buildFOVDragPipeline(e),this._buildScaleOrientDragPipeline(e)].filter(t),k))},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,target:e.elevationAlignedTargetRenderSpace,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorsTransform(e.viewshedCompData)},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView,tilt:e.tilt}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorVisuals(e.viewshedCompData)},v),d(()=>{const e=this.analysisViewData.visible&&(this.viewshedComputedData?.valid??!1),i=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData,{creating:t,isPlacingTarget:a}=this.parentTool;return{fovManipulationAvailable:e&&!a,nonFOVManipulationAvailable:e&&(!t||i)}},({fovManipulationAvailable:e,nonFOVManipulationAvailable:i})=>{this._moveManipulation.available=i,this._scaleOrientManipulation.available=i,this._observerManipulator.available=i,this._fieldOfViewManipulation.available=e},v),d(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const{observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}=e;return{viewshedCompData:e,observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}},e=>{null!=e&&this._scaleOrientManipulation.updateManipulators(e.viewshedCompData)},v)]);const e=e=>{this.addHandles([e.events.on("focus-changed",()=>{const e=this._someManipulatorHovering();e&&this.parentTool.subToolHandles.forEach(({subTool:e})=>{e._resetHoveringTask()}),this._someManipulatorSelected()||e||(this._forceHoveringTask=a(async e=>{await(this._forceHoveringTestPromise??h(V.hoverTimeoutMilliseconds,e)),u(e),this._forceHoveringTask=null,this._updateManipulatorVisibility()}))}),e.events.on("grab-changed",i=>{this._grabbing="start"===i.action,"end"===i.action&&this.parentTool.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach(({subTool:e})=>{e!==this&&e._setInteractive(!this._grabbing)}),this._setInteractive(i=>i.hasManipulator(e)||!this._grabbing)}),e.events.on("drag",e=>{"start"===e.action&&this.parentTool.updateInteractionVisualsVisibility()})])};this._forEachManipulator(e)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get updating(){return null!=this._forceHoveringTask&&!this._forceHoveringTask.finished}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(e){const i=this.viewshed;null!=i&&(i.observer=e)}get elevationAlignedObserverRenderSpace(){return this.viewshedComputedData?.elevationAlignedObserverRenderSpace}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:e,grabbing:i}=this._moveManipulation;return{dragging:e,grabbing:i}}get scaleOrientInteractionState(){const{dragging:e,grabbing:i}=this._scaleOrientManipulation;return{dragging:e,grabbing:i}}_setInteractive(e){const i="boolean"==typeof e;this._forEachManipulation(t=>t.interactive=i?e:e(t))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(e){let i=!1;return this._forEachManipulator(t=>{i=i||t===e}),i}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new j({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:C})}_buildObserverDragPipeline(e){const i={mode:"absolute-height",offset:0},t=e.observer;if(null==t)return null;const a=this.view.spatialReference;return this._moveManipulation.createDragPipeline((n,o,r,s,l)=>{s=s.next(F(this,["observer"]));const p=w(t,a),h=w(e.elevationAlignedObserver,a);if(null==p||null==h)return{steps:r,cancel:s};const u=P.fromGeometry(p,O(this.view.viewingMode)),d=P.fromGeometry(h,O(this.view.viewingMode)),c=this.parentTool.createObserverMoveSnappingPipeline?.(n,d,l);if(null!=c){const{snappingStep:e,cancelSnapping:t}=c,{coordinateHelper:a}=d.data;s=s.next(t);return{steps:r.next(e=>({...e,snapOrigin:a.pointToVector(h)})).next(x(this.view,i)).next(...e).next(A({operations:u})).next(e=>(this.observer=u.data.geometry,e)),cancel:s}}return{steps:r.next(A({operations:u})).next(e=>(this.observer=u.data.geometry,e)),cancel:s}},i,a,void 0)}_buildFOVDragPipeline(e){let i=0,t=0;return this._fieldOfViewManipulation.createDragPipeline((a,o,r)=>{if(null==e)return{steps:o,cancel:r};const s=e.viewshed;let l=null;r=r.next(F(s,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:o.next(a=>{"start"===a.action&&(l=null,i=e.horizontalFieldOfView,t=e.verticalFieldOfView);const o=a.deltaAngle;if(null==l&&0!==o){const e="bottom"===a.side||"left"===a.side?o>0:o<0;l=T(a.side)?0===i&&e||360===i&&!e:0===t&&e}const r=l?D(a.side):a.side;let p=0;switch(r){case"left":p=i/2-o;break;case"right":p=i/2+o;break;case"top":p=t+2*o;break;case"bottom":p=t-2*o}return T(r)?(p=n.normalize(p),p=p>270?0:p>180?180:p,s.horizontalFieldOfView=2*p):s.verticalFieldOfView=p,a}),cancel:r}},e)}_buildScaleOrientDragPipeline(e){let i=0,t=0;const a=(i,t)=>(a,n,o)=>{if(null==e)return{steps:n,cancel:o};const r=e.viewshed;return o=o.next(F(r,[i])),{steps:n=n.next(t(r,e)),cancel:o}};return r([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",(i,a)=>a=>("start"===a.action&&(t=e.heading),i.heading=n.normalize(t+a.deltaAngle),a)),e),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",(t,a)=>a=>{"start"===a.action&&(i=e.tilt);let n=i+a.deltaAngle;return n<-90?n=180:n>270&&(n=0),t.tilt=G.clamp(n),a}),e),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",(e,i)=>t=>{const a=f(I,t.renderEnd,i.elevationAlignedObserverRenderSpace),n=b(a)*i.metersPerUnit,o=M(a,i.targetDirection)<0?V.scaleOrientMinDistance:n;return e.farDistance=o,t}),e)])}_updateManipulatorVisibility(){const e=this._someManipulatorSelected(),i=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let n=[];const o=e=>{n.push(e.disableDisplay())};e||!a&&i?this.removeHandles(E):(this._scaleOrientManipulation.forEachManipulator(o),this._moveManipulation.forEachManipulator(o),this.addHandles(n,E),n=[]),e||!a&&i||a&&t?this.removeHandles(z):(this._fieldOfViewManipulation.forEachManipulator(o),this.addHandles(n,z)),e||!a?this.removeHandles(U):this.addHandles(this._observerManipulator.disableDisplay(),U)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(e){this._forEachManipulation(i=>{i.forEachManipulator(e)}),e(this._observerManipulator)}_forEachManipulation(e){e(this._moveManipulation),e(this._fieldOfViewManipulation),e(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:e=>{this._forceHoveringTestPromise=e}}}};e([g({constructOnly:!0})],R.prototype,"analysis",void 0),e([g({constructOnly:!0})],R.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],R.prototype,"parentTool",void 0),e([g({constructOnly:!0,nonNullable:!0})],R.prototype,"view",void 0),e([g()],R.prototype,"_forceHoveringTask",void 0),e([g()],R.prototype,"updating",null),e([g()],R.prototype,"viewshed",null),e([g()],R.prototype,"_grabbing",void 0),e([g()],R.prototype,"grabbing",null),e([g()],R.prototype,"viewshedComputedData",void 0),e([g()],R.prototype,"observer",null),e([g()],R.prototype,"elevationAlignedObserverRenderSpace",null),R=e([m("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],R);const I=_(),G=new o(0,180);export{R as ViewshedSubTool};
|
|
2
|
+
import{__decorate as e}from"tslib";import i from"../../../../core/Accessor.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{createTask as a}from"../../../../core/asyncUtils.js";import{cyclicalDegrees as n,Cyclical as o}from"../../../../core/Cyclical.js";import{handlesGroup as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{deg2rad as s}from"../../../../core/mathUtils.js";import{abortMaybe as l,destroyMaybe as p}from"../../../../core/maybe.js";import{after as h,throwIfAborted as u}from"../../../../core/promiseUtils.js";import{watch as d,syncAndInitial as c,initial as v}from"../../../../core/reactiveUtils.js";import{property as g,subclass as m}from"../../../../core/accessorSupport/decorators.js";import{sub as f,len as b,dot as M}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{tryProject as w}from"../../../../geometry/projectionUtils.js";import{viewshedToolManipulatorConfiguration as O}from"./ViewshedConfiguration.js";import{ViewshedFieldOfViewManipulation as V,isSideHorizontal as y,flipSide as T}from"./ViewshedFieldOfViewManipulation.js";import{ViewshedScaleOrientManipulation as D}from"./ViewshedScaleOrientManipulation.js";import{ViewshedObserverManipulator as H}from"./viewshedToolManipulatorUtils.js";import{discRadiusSmall as S}from"../../interactive/editingTools/manipulations/config.js";import{MoveManipulation as C}from"../../interactive/editingTools/manipulations/MoveManipulation.js";import{resetProperties as F,sceneSnappingAtProjectedLocation as j,dragManipulatedObject as x}from"../../../interactive/dragEventPipeline.js";import{EditGeometryOperations as A}from"../../../interactive/editGeometry/EditGeometryOperations.js";const P=Symbol("dragHandles"),k=Symbol("hideManipulators"),E=Symbol("hideFoVManipulators"),z=Symbol("hideObserverManipulator");let U=class extends i{constructor(e){super(e),this._moveManipulation=null,this._observerManipulator=null,this._fieldOfViewManipulation=null,this._scaleOrientManipulation=null,this._forceHoveringTask=null,this._forceHoveringTestPromise=null,this._grabbing=!1,this.viewshedComputedData=null}initialize(){this._moveManipulation=this._createMoveManipulation(),this._fieldOfViewManipulation=new V({view:this.view,tool:this.parentTool}),this._scaleOrientManipulation=new D({view:this.view,tool:this.parentTool}),this._observerManipulator=new H(this.view,this.parentTool),this.addHandles([d(()=>this.elevationAlignedObserverRenderSpace,e=>{null!=e&&(this._moveManipulation.renderLocation=e,this._observerManipulator.renderLocation=e)},c),d(()=>this.viewshedComputedData?.heading,e=>{e&&(this._moveManipulation.angle=s(90-e))},v),d(()=>{const{viewshedComputedData:e}=this;return{viewshedComputedData:e,observer:this.elevationAlignedObserverRenderSpace}},({viewshedComputedData:e,observer:i},a)=>{this._grabbing&&i!==a?.observer||(this.removeHandles(P),e?.valid&&this.addHandles([this._buildObserverDragPipeline(e),this._buildFOVDragPipeline(e),this._buildScaleOrientDragPipeline(e)].filter(t),P))},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,target:e.elevationAlignedTargetRenderSpace,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorsTransform(e.viewshedCompData)},v),d(()=>{const e=this.viewshedComputedData;return e?.valid?{viewshedCompData:e,hFOV:e.horizontalFieldOfView,vFOV:e.verticalFieldOfView,tilt:e.tilt}:null},e=>{null!=e&&this._fieldOfViewManipulation.updateManipulatorVisuals(e.viewshedCompData)},v),d(()=>{const e=this.analysisViewData.visible&&(this.viewshedComputedData?.valid??!1),i=this.parentTool.selectedViewshedComputedData===this.viewshedComputedData,{creating:t,isPlacingTarget:a}=this.parentTool;return{fovManipulationAvailable:e&&!a,nonFOVManipulationAvailable:e&&(!t||i)}},({fovManipulationAvailable:e,nonFOVManipulationAvailable:i})=>{this._moveManipulation.available=i,this._scaleOrientManipulation.available=i,this._observerManipulator.available=i,this._fieldOfViewManipulation.available=e},v),d(()=>{const e=this.viewshedComputedData;if(!e?.valid)return null;const{observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}=e;return{viewshedCompData:e,observer:i,target:t,verticalFieldOfView:a,horizontalFieldOfView:n}},e=>{null!=e&&this._scaleOrientManipulation.updateManipulators(e.viewshedCompData)},v)]);const e=e=>{this.addHandles([e.events.on("focus-changed",()=>{const e=this._someManipulatorHovering();e&&this.parentTool.subToolHandles.forEach(({subTool:e})=>{e._resetHoveringTask()}),this._someManipulatorSelected()||e||(this._forceHoveringTask=a(async e=>{await(this._forceHoveringTestPromise??h(O.hoverTimeoutMilliseconds,e)),u(e),this._forceHoveringTask=null,this._updateManipulatorVisibility()}))}),e.events.on("grab-changed",i=>{this._grabbing="start"===i.action,"end"===i.action&&this.parentTool.updateInteractionVisualsVisibility(),this.parentTool.subToolHandles.forEach(({subTool:e})=>{e!==this&&e._setInteractive(!this._grabbing)}),this._setInteractive(i=>i.hasManipulator(e)||!this._grabbing)}),e.events.on("drag",e=>{"start"===e.action&&this.parentTool.updateInteractionVisualsVisibility()})])};this._forEachManipulator(e)}destroy(){this._forceHoveringTask=l(this._forceHoveringTask),this._moveManipulation=p(this._moveManipulation),this._fieldOfViewManipulation=p(this._fieldOfViewManipulation),this._scaleOrientManipulation=p(this._scaleOrientManipulation),this.parentTool.manipulators.remove(this._observerManipulator),this._observerManipulator=p(this._observerManipulator)}get updating(){return null!=this._forceHoveringTask&&!this._forceHoveringTask.finished}get viewshed(){return this.viewshedComputedData?.viewshed}get grabbing(){return this._grabbing}get observer(){return this.viewshed?.observer}set observer(e){const i=this.viewshed;null!=i&&(i.observer=e)}get elevationAlignedObserverRenderSpace(){return this.viewshedComputedData?.elevationAlignedObserverRenderSpace}get discManipulator(){return this._moveManipulation.xyManipulation.discManipulator}get moveInteractionState(){const{dragging:e,grabbing:i}=this._moveManipulation;return{dragging:e,grabbing:i}}get scaleOrientInteractionState(){const{dragging:e,grabbing:i}=this._scaleOrientManipulation;return{dragging:e,grabbing:i}}_setInteractive(e){const i="boolean"==typeof e;this._forEachManipulation(t=>t.interactive=i?e:e(t))}onManipulatorSelectionChanged(){if(this._updateManipulatorVisibility(),!this._someManipulatorSelected()){this.analysisViewData.selectedViewshed===this.viewshed&&(this.analysisViewData.selectedViewshed=null),this._resetHoveringTask()}}hasManipulator(e){let i=!1;return this._forEachManipulator(t=>{i=i||t===e}),i}_someManipulatorSelected(){return this._moveManipulation.selected||this._fieldOfViewManipulation.selected||this._scaleOrientManipulation.selected}_someManipulatorHovering(){return this._moveManipulation.hovering||this._fieldOfViewManipulation.hovering||this._scaleOrientManipulation.hovering}_createMoveManipulation(){return new C({view:this.view,tool:this.parentTool,snapToScene:!1,xyAvailable:!0,xyAxisAvailable:!0,zAvailable:!0,radius:S})}_buildObserverDragPipeline(e){const{observer:i,effectiveElevationInfo:t}=e,a=this.view.spatialReference;return this._moveManipulation.createDragPipeline((e,n,o,r,s)=>{r=r.next(F(this,["observer"]));const l=w(i,a);if(null==l)return{steps:o,cancel:r};const p=A.fromGeometry(l,this.view.state.viewingMode),h=this.parentTool.createObserverMoveSnappingPipeline?.(e,s,t);if(null!=h){const{snappingStep:e,cancelSnapping:i}=h;return r=r.next(i),{steps:o=o.next(j(this.view,t)).next(...e).next(x({operations:p})).next(e=>(this.observer=p.data.geometry,e)),cancel:r}}return{steps:o=o.next(x({operations:p})).next(e=>(this.observer=p.data.geometry,e)),cancel:r}},t,a,void 0)}_buildFOVDragPipeline(e){let i=0,t=0;return this._fieldOfViewManipulation.createDragPipeline((a,o,r)=>{if(null==e)return{steps:o,cancel:r};const s=e.viewshed;let l=null;r=r.next(F(s,["horizontalFieldOfView","verticalFieldOfView"]));return{steps:o.next(a=>{"start"===a.action&&(l=null,i=e.horizontalFieldOfView,t=e.verticalFieldOfView);const o=a.deltaAngle;if(null==l&&0!==o){const e="bottom"===a.side||"left"===a.side?o>0:o<0;l=y(a.side)?0===i&&e||360===i&&!e:0===t&&e}const r=l?T(a.side):a.side;let p=0;switch(r){case"left":p=i/2-o;break;case"right":p=i/2+o;break;case"top":p=t+2*o;break;case"bottom":p=t-2*o}return y(r)?(p=n.normalize(p),p=p>270?0:p>180?180:p,s.horizontalFieldOfView=2*p):s.verticalFieldOfView=p,a}),cancel:r}},e)}_buildScaleOrientDragPipeline(e){let i=0,t=0;const a=(i,t)=>(a,n,o)=>{if(null==e)return{steps:n,cancel:o};const r=e.viewshed;return o=o.next(F(r,[i])),{steps:n=n.next(t(r,e)),cancel:o}};return r([this._scaleOrientManipulation.createHeadingDragPipeline(a("heading",(i,a)=>a=>("start"===a.action&&(t=e.heading),i.heading=n.normalize(t+a.deltaAngle),a)),e),this._scaleOrientManipulation.createTiltDragPipeline(a("tilt",(t,a)=>a=>{"start"===a.action&&(i=e.tilt);let n=i+a.deltaAngle;return n<-90?n=180:n>270&&(n=0),t.tilt=R.clamp(n),a}),e),this._scaleOrientManipulation.createDistanceDragPipeline(a("farDistance",(e,i)=>t=>{const a=f(I,t.renderEnd,i.elevationAlignedObserverRenderSpace),n=b(a)*i.metersPerUnit,o=M(a,i.targetDirection)<0?O.scaleOrientMinDistance:n;return e.farDistance=o,t}),e)])}_updateManipulatorVisibility(){const e=this._someManipulatorSelected(),i=null!=this._forceHoveringTask||this._someManipulatorHovering(),t=this._fieldOfViewManipulation.hovering,a=this.parentTool.creating;let n=[];const o=e=>{n.push(e.disableDisplay())};e||!a&&i?this.removeHandles(k):(this._scaleOrientManipulation.forEachManipulator(o),this._moveManipulation.forEachManipulator(o),this.addHandles(n,k),n=[]),e||!a&&i||a&&t?this.removeHandles(E):(this._fieldOfViewManipulation.forEachManipulator(o),this.addHandles(n,E)),e||!a?this.removeHandles(z):this.addHandles(this._observerManipulator.disableDisplay(),z)}_resetHoveringTask(){this._forceHoveringTask=l(this._forceHoveringTask),this._updateManipulatorVisibility()}_forEachManipulator(e){this._forEachManipulation(i=>{i.forEachManipulator(e)}),e(this._observerManipulator)}_forEachManipulation(e){e(this._moveManipulation),e(this._fieldOfViewManipulation),e(this._scaleOrientManipulation)}get test(){return{moveManipulation:this._moveManipulation,fieldOfViewManipulation:this._fieldOfViewManipulation,scaleOrientManipulation:this._scaleOrientManipulation,viewshedComputedData:this.viewshedComputedData,setHoveringTimeoutPromise:e=>{this._forceHoveringTestPromise=e}}}};e([g({constructOnly:!0})],U.prototype,"analysis",void 0),e([g({constructOnly:!0})],U.prototype,"analysisViewData",void 0),e([g({constructOnly:!0})],U.prototype,"parentTool",void 0),e([g({constructOnly:!0,nonNullable:!0})],U.prototype,"view",void 0),e([g()],U.prototype,"_forceHoveringTask",void 0),e([g()],U.prototype,"updating",null),e([g()],U.prototype,"viewshed",null),e([g()],U.prototype,"_grabbing",void 0),e([g()],U.prototype,"grabbing",null),e([g()],U.prototype,"viewshedComputedData",void 0),e([g()],U.prototype,"observer",null),e([g()],U.prototype,"elevationAlignedObserverRenderSpace",null),U=e([m("esri.views.3d.analysis.Viewshed.ViewshedSubTool")],U);const I=_(),R=new o(0,180);export{U as ViewshedSubTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as s}from"../../../core/maybe.js";import{watch as r,initial as a}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as n,convertUnit as l}from"../../../core/units.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{fromValues as d}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as u}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/HeightModelInfo.js";import{create as p}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as f}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as g,equals as y,isGeographic as _}from"../../../geometry/support/spatialReferenceUtils.js";import w from"../../../geometry/support/WKIDUnitConversion.js";import{validateMeshData as v,makeCacheKey as b,getHeightModelInfoFromVCS as S}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as C}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as M}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as x}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as T}from"./LayerView3D.js";import{addLayerViewToWasm as I,getLyr3DWasm as H,removeLayerViewFromWasm as A}from"./Lyr3DWasm.js";import{LayerElevationProvider as P}from"./i3s/LayerElevationProvider.js";import{ElevationRange as F}from"../support/ElevationRange.js";import{projectToBoundingBox as R}from"../support/extentUtils.js";import{Obb as V}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as j,gaussiansPerPage as E,packedGaussianSizeInU32 as G,splatAtlasTextureWidth as O}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as U}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as D}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as L}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as B}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as z}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as k}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import N from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as q,isInEffectiveScaleRange as W}from"../../support/layerViewUtils.js";import{TaskPriority as $}from"../../support/Scheduler.js";var X;const Z=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),K=3,Y=K*K,J=255,Q=(()=>{const e=new Int16Array(J+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/J));return e})();let ee=class extends(T(N)){static{X=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(j),this._tmpTilesWithChangedVisibility=new Array,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask($.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=p();return R(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw q("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=I(this).then(e=>{this._wasmLayerId=e,this._renderNode=new z({view:this.view,layerView:this}),this.data=new U(this._renderNode,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadowRenderNode=new k({view:this.view,layerView:this}),this.fadeHelper=new D(this),this._intersectionHandler=new L(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new P({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([r(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),r(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),a)]),this._suspendedHandle=r(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),a),this.addHandles([r(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,a)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([r(()=>this.view.qualitySettings.fadeDuration,e=>{const t=this.data;t&&(this.fadeHelper.onFadeDurationChanged(e),t.fadingTexture.updateTexture(t.textureAtlas.pageAllocator.pageCount))}),r(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),r(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return H(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return C(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new F(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return W(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!v(t))throw new Error("meshData not valid");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return Z().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});const r=i.atrbs[0].view,a=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==r.type)throw new Error("unexpected meshData.data format");l=new Uint32Array(t.data.buffer,n,a/4);const o=this.extractHeader(l),h=2.048,c=o.tileOrigin.x*h,p=o.tileOrigin.y*h,f=o.tileOrigin.z*h,m=t.desc;if(null==m.obb)throw new Error("meshData.desc.obb undefined");const g=m.obb.quaternion,y=new V(m.obb.center,m.obb.halfSize,d(...g)),_=this.view.state.isGlobal,w=_?u(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:p,z:f},invPosScale:o.invPosScale,obb:y,origin:{x:y.centerX,y:y.centerY,z:y.centerZ},isGlobal:_,ellipsoidRadius:w},S=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal);return()=>S}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:r,packedHeader:a,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,f=n.z,m=h.x,g=h.y,y=h.z,_=new Uint32Array(r),w=new Float32Array(3*r),v=new Uint32Array(r),b=new Uint32Array(r),S=new Array,C=Math.ceil(r/E);for(let F=0;F<C;F++){let e=this.data.textureAtlas.requestPage();if(null===e&&(this._freeInvisibleTiles(),e=this.data.textureAtlas.requestPage()),null===e)throw new Error("ran out of gaussian splat memory");S.push(e);const i=r-F*E,n=Math.min(i,E),l=F*E,o=e*E;for(let t=0;t<n;t++)_[l+t]=o+t;const h=F*j,d=n*G;this._pageBuffer.set(s.subarray(h,h+d));const u=o%O,c=Math.floor(o/O);this.data.textureAtlas.update(u,c,this._pageBuffer),this.data.headerTexture.update(e,a),t.madeProgress()&&(t=yield)}let M=1/0,x=-1/0,T=1/0,I=-1/0,H=0,A=-1,P=0;for(let F=0;F<r;F++){const e=F*G,i=s[e],r=s[e+1],a=s[e+2],n=s[e+3],o=16383&r,h=r>>>14&16383,u=r>>>28&15|(1023&a)<<4,_=Q[n>>>24],S=(a>>>10&255)+_,C=(a>>>18&255)+_,R=(a>>>26&63|(3&n)<<6)+_,V=S>0?S:0,j=C>0?C:0,E=R>0?R:0,O=V|j<<8|E<<16,U=Math.max(V,j,E),D=o*l+c,L=h*l+p,B=u*l+f;if(w[H]=D-m,w[H+1]=L-g,w[H+2]=B-y,d){const e=D*D+L*L+B*B;T=Math.min(T,e),I=Math.max(I,e)}else M=Math.min(M,B),x=Math.max(x,B);v[F]=i,b[F]=O,U>A&&(A=U),H+=3,P++,P===X.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(M=Math.sqrt(T)-u,x=Math.sqrt(I)-u);const R=this._extractGaussianSplatMbsRadiusSquared(A),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(M=Math.max(M,V.zmin),x=Math.min(x,V.zmax));const U=new F(M,x),D=new B(i,o,_,S,w,v,b,r,R,U);return this._memCache.put(`${D.handle}`,D),this._tileHandles.set(i,D),this._cacheTileMemory+=D.usedMemory,{memUsageBytes:D.usedMemory,numGaussians:r}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Y}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,r=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,r);let a=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,r):this._prepareTileFadeOut(i,s);a||=l}a?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let a=0;a<e.length;a++){const t=e[a];s.add(t.handle)}this._triggerFadeIns(t,s,i);const r=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),r&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,r]of this._tileFadeInsAwaitingInitialSort){if(r>e||!t.has(s))continue;const a=this._tileHandles.get(s);if(!a){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(r),l=0===a.lifecycleState;2!==a.lifecycleState&&(a.lifecycleState=2,l&&this._popTileFromCache(a),i.push(a)),this.fadeHelper.fadeTile(a,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,r]of this._tileFadeOutsAwaitingInitialSort){if(r>e)continue;const a=this._tileHandles.get(s);if(a){const e=2===a.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(r);this.fadeHelper.fadeTile(a,1,s),e&&0===a.lifecycleState&&(t.push(a),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(b(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(b(e.handle),e)}destroy(){this._createRenderableAbortController.abort(),A(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode=s(this._shadowRenderNode),this._renderNode=s(this._renderNode),this._memCache.destroy(),this.data=s(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||g(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&y(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=S(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!_(t)&&t.wkid&&-1!==t.wkid&&(i=n(w.units[w[t.wkid]])),i&&(e=new c({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===f(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=l(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=M(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,C(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0===e.lifecycleState&&this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),r=this.reinterpretU32AsFloat(e[t+2]),a=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:r},invPosScale:a}}_deleteTile(e){this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.headerTextureMemory??0,r=this.data?.orderTextureMemory??0,a=this.data?.fadingTextureMemory??0,n=this.data?.sortBufferMemory??0;return new x(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,r,a,n)}get test(){}};e([o()],ee.prototype,"layer",void 0),e([o({readOnly:!0})],ee.prototype,"_clippingBox",null),e([o()],ee.prototype,"elevationOffset",null),e([o({readOnly:!0})],ee.prototype,"visibleAtCurrentScale",null),e([o()],ee.prototype,"fullExtentInLocalViewSpatialReference",void 0),ee=X=e([h("esri.views.3d.layers.GaussianSplatLayerView3D")],ee);const te=ee;export{te as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import"../../../core/has.js";import t from"../../../core/Logger.js";import{removeMaybe as i,destroyMaybe as s}from"../../../core/maybe.js";import{watch as a,initial as r}from"../../../core/reactiveUtils.js";import{unitFromRESTJSON as n,convertUnit as l}from"../../../core/units.js";import{property as o,subclass as h}from"../../../core/accessorSupport/decorators.js";import{fromValues as d}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{getReferenceEllipsoid as u}from"../../../geometry/ellipsoidUtils.js";import c from"../../../geometry/HeightModelInfo.js";import{create as p}from"../../../geometry/support/aaBoundingBox.js";import{isCompatible as f}from"../../../geometry/support/heightModelInfoUtils.js";import{isPlateCarree as m,isWebMercator as g,equals as _,isGeographic as y}from"../../../geometry/support/spatialReferenceUtils.js";import w from"../../../geometry/support/WKIDUnitConversion.js";import{validateMeshData as v,makeCacheKey as b,getHeightModelInfoFromVCS as S}from"../../../layers/support/tiles3DUtils.js";import{getElevationOffsetInMeters as C}from"../../../support/elevationInfoUtils.js";import{getMetersPerUnit as M}from"../../../symbols/support/unitConversionUtils.js";import{GaussianSplatLayerViewPerformanceInfo as x}from"./GaussianSplatLayerViewPerformanceInfo.js";import{LayerView3D as T}from"./LayerView3D.js";import{addLayerViewToWasm as I,getLyr3DWasm as H,removeLayerViewFromWasm as A}from"./Lyr3DWasm.js";import{LayerElevationProvider as P}from"./i3s/LayerElevationProvider.js";import{ElevationRange as F}from"../support/ElevationRange.js";import{projectToBoundingBox as R}from"../support/extentUtils.js";import{Obb as V}from"../support/orientedBoundingBox.js";import{splatPageSizeInU32 as j,gaussiansPerPage as E,packedGaussianSizeInU32 as G,splatAtlasTextureWidth as O}from"../support/gaussianSplatting/GaussianSplatAtlasPages.js";import{GaussianSplatDataStore as U}from"../support/gaussianSplatting/GaussianSplatDataStore.js";import{GaussianSplatFadeHelper as D}from"../support/gaussianSplatting/GaussianSplatFadeHelper.js";import{GaussianSplatIntersectionHandler as B}from"../support/gaussianSplatting/GaussianSplatIntersectionHandler.js";import{GaussianTile as L}from"../support/gaussianSplatting/GaussianTile.js";import{GaussianSplatRenderNode as z}from"../webgl-engine/lib/GaussianSplatRenderNode.js";import{GaussianSplatShadowRenderNode as k}from"../webgl-engine/lib/GaussianSplatShadowRenderNode.js";import N from"../../layers/LayerView.js";import{spatialReferenceIncompatibleError as q,isInEffectiveScaleRange as W}from"../../support/layerViewUtils.js";import{TaskPriority as $}from"../../support/Scheduler.js";var X;const Z=()=>t.getLogger("esri.views.3d.layers.GaussianSplatLayerView3D"),K=3,Y=K*K,J=255,Q=(()=>{const e=new Int16Array(J+1);e[0]=-255;for(let t=1;t<e.length;t++)e[t]=Math.round(16*Math.log(t/J));return e})();let ee=class extends(T(N)){static{X=this}static{this.createRenderableBatchSize=64}constructor(e){super(e),this.type="gaussian-splat-3d",this.ignoresMemoryFactor=!1,this._tileHandles=new Map,this._pageBuffer=new Uint32Array(j),this._tmpTilesWithChangedVisibility=new Array,this._renderablesBeingCreated=new Set,this._currentLyr3dVisibilityChange=0,this._tileFadeInsAwaitingInitialSort=new Map,this._tileFadeOutsAwaitingInitialSort=new Map,this._fadeDurationPerVisibilityChange=new Map,this._tmpSortedTileHandles=new Set,this._createRenderableAbortController=new AbortController,this._wasmLayerId=-1,this._metersPerVCSUnit=1,this._usedTileMemory=0,this._cacheTileMemory=0,this._useEsriCrs=!1,this.fullExtentInLocalViewSpatialReference=null,this._suspendedHandle=null,this._conversionBuffer=new ArrayBuffer(4),this._u32View=new Uint32Array(this._conversionBuffer),this._f32View=new Float32Array(this._conversionBuffer);const t=e.view.resourceController;this._memCache=t.memoryController.newCache(`GaussianSplat-${this.uid}`,e=>this._deleteTile(e)),this._frameTask=t.scheduler.registerTask($.GAUSSIAN_SPLAT_TEXTURE_ATLAS)}get _clippingBox(){if(!this.view?.clippingArea)return null;const e=p();return R(this.view.clippingArea,e,this.view.renderSpatialReference)?e:null}get clippingBox(){return this._renderNode?.clippingBox??null}initialize(){if(!this._canProjectWithoutEngine())throw q("layer",this.layer.spatialReference.wkid,this.view.renderSpatialReference?.wkid);const e=I(this).then(e=>{this._wasmLayerId=e,this._renderNode=new z({view:this.view,layerView:this}),this.data=new U(this._renderNode,(e,t)=>this._onSortComplete(e,t),()=>this._freeInvisibleTiles()),this._shadowRenderNode=new k({view:this.view,layerView:this}),this.fadeHelper=new D(this),this._intersectionHandler=new B(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._elevationProvider=new P({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register(2,this._elevationProvider),this.addHandles([a(()=>this.layer.elevationInfo,e=>this._elevationInfoChanged(e)),a(()=>this.slicePlaneEnabled,e=>this._slicePlaneEnabledChanged(e),r)]),this._suspendedHandle=a(()=>this.suspended,e=>this._wasm?.setEnabled(this,!e),r),this.addHandles([a(()=>this._clippingBox,e=>this._renderNode.clippingBox=e,r)]),this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians)});this.addHandles([a(()=>this.view.qualitySettings.fadeDuration,e=>{const t=this.data;t&&(this.fadeHelper.onFadeDurationChanged(e),t.fadingTexture.updateTexture(t.textureAtlas.pageAllocator.pageCount))}),a(()=>this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians,e=>this.setMaximumGaussianCount(e*this.view.quality)),a(()=>this.view.quality,e=>this.setMaximumGaussianCount(this.view.qualitySettings.gaussianSplat.maximumNumberOfGaussians*e))]),this.addResolvingPromise(e)}get wasmLayerId(){return this._wasmLayerId}get metersPerVCSUnit(){return this._metersPerVCSUnit}get tileHandles(){return this._tileHandles}get _wasm(){return H(this.view)}get usedMemory(){return this._usedTileMemory+(this.data?.usedMemory??0)}get cachedMemory(){return this._cacheTileMemory}get unloadedMemory(){return 0}get useEsriCrs(){return this._useEsriCrs}get elevationProvider(){return this._elevationProvider}get elevationOffset(){return C(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new F(e.zmin,e.zmax):null}getElevationRange(e){return this._intersectionHandler.getElevationRange(e)}get fullExtent(){return this.layer.fullExtent}get visibleAtCurrentScale(){return W(this.layer.effectiveScaleRange,this.view.scale)}isUpdating(){const e=this._wasm;return!(this._wasmLayerId<0||null==e)&&(e.isUpdating(this._wasmLayerId)||this.data.updating||this.fadeHelper.updating)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){if(this.destroyed||this.destroying)throw new Error("IntegratedMesh3DTilesLayerView3D: createRenderable called after destroy");const{meshData:t}=e;if(!v(t))throw new Error("meshData not valid");const i=t.desc.prims[0],s=i.vertexCount;if(0===s)return Z().warnOnce("encountered tile with zero Gaussians"),()=>({memUsageBytes:0,numGaussians:0});const a=i.atrbs[0].view,r=i.atrbs[0].view.byteCount,n=i.atrbs[0].view.byteOffset;let l=null;if("U32"!==a.type)throw new Error("unexpected meshData.data format");l=new Uint32Array(t.data.buffer,n,r/4);const o=this.extractHeader(l),h=2.048,c=o.tileOrigin.x*h,p=o.tileOrigin.y*h,f=o.tileOrigin.z*h,m=t.desc;if(null==m.obb)throw new Error("meshData.desc.obb undefined");const g=m.obb.quaternion,_=new V(m.obb.center,m.obb.halfSize,d(...g)),y=this.view.state.isGlobal,w=y?u(this.view.spatialReference).radius:0,b={handle:e.handle,bufferView:l,totalGaussians:s,packedHeader:o.packedHeader,tileOrigin:{x:c,y:p,z:f},invPosScale:o.invPosScale,obb:_,origin:{x:_.centerX,y:_.centerY,z:_.centerZ},isGlobal:y,ellipsoidRadius:w};let S;this._renderablesBeingCreated.add(e.handle);try{S=await this._frameTask.scheduleGenerator(e=>this._createRenderableTask(b,e),this._createRenderableAbortController.signal)}catch(C){throw this._renderablesBeingCreated.delete(e.handle),C}return this._renderablesBeingCreated.delete(e.handle),()=>S}*_createRenderableTask(e,t){const{handle:i,bufferView:s,totalGaussians:a,packedHeader:r,tileOrigin:n,invPosScale:l,obb:o,origin:h,isGlobal:d,ellipsoidRadius:u}=e,c=n.x,p=n.y,f=n.z,m=h.x,g=h.y,_=h.z,y=new Uint32Array(a),w=new Float32Array(3*a),v=new Uint32Array(a),b=new Uint32Array(a),S=new Array,C=Math.ceil(a/E);let M=1/0,x=-1/0,T=1/0,I=-1/0,H=0,A=-1,P=0;for(let F=0;F<a;F++){const e=F*G,i=s[e],a=s[e+1],r=s[e+2],n=s[e+3],o=16383&a,h=a>>>14&16383,u=a>>>28&15|(1023&r)<<4,y=Q[n>>>24],S=(r>>>10&255)+y,C=(r>>>18&255)+y,R=(r>>>26&63|(3&n)<<6)+y,V=S>0?S:0,j=C>0?C:0,E=R>0?R:0,O=V|j<<8|E<<16,U=Math.max(V,j,E),D=o*l+c,B=h*l+p,L=u*l+f;if(w[H]=D-m,w[H+1]=B-g,w[H+2]=L-_,d){const e=D*D+B*B+L*L;T=Math.min(T,e),I=Math.max(I,e)}else M=Math.min(M,L),x=Math.max(x,L);v[F]=i,b[F]=O,U>A&&(A=U),H+=3,P++,P===X.createRenderableBatchSize&&(P=0,t.madeProgress()&&(t=yield))}P>0&&t.madeProgress(),d&&(M=Math.sqrt(T)-u,x=Math.sqrt(I)-u);const R=this._extractGaussianSplatMbsRadiusSquared(A),{fullExtent:V}=this.layer;V?.hasZ&&V.zmax&&V.zmin&&(M=Math.max(M,V.zmin),x=Math.min(x,V.zmax));const U=new F(M,x);try{for(let e=0;e<C;e++){let t=this.data.textureAtlas.allocatePage();if(null===t&&(this._freeInvisibleTiles(),t=this.data.textureAtlas.allocatePage()),null===t)throw new Error("ran out of gaussian splat memory");S.push(t);const i=a-e*E,n=Math.min(i,E),l=e*E,o=t*E;for(let e=0;e<n;e++)y[l+e]=o+e;const h=e*j,d=n*G;this._pageBuffer.set(s.subarray(h,h+d));const u=o%O,c=Math.floor(o/O);this.data.textureAtlas.update(u,c,this._pageBuffer),this.data.headerTexture.update(t,r)}}catch(B){throw this.data.textureAtlas.freePages(S),B}const D=new L(i,o,y,S,w,v,b,a,R,U);return this._tileHandles.set(i,D),this._cacheTileMemory+=D.usedMemory,this._memCache.put(`${D.handle}`,D),{memUsageBytes:D.usedMemory,numGaussians:a}}_extractGaussianSplatMbsRadiusSquared(e){return Math.exp(e/8-20)*Y}freeRenderable(e){this._tileFadeInsAwaitingInitialSort.delete(e),this._tileFadeOutsAwaitingInitialSort.delete(e);const t=this.data?.textureAtlas;let i=!1;const s=this._tileHandles.get(e);if(s){0!==s.lifecycleState?(i=!0,this.fadeHelper.onTileDiscarded(s),this._usedTileMemory-=s.usedMemory,this._intersectionHandler.removeTile(s)):this._cacheTileMemory-=s.usedMemory,t&&s.pageIds.forEach(e=>t.freePage(e)),this.freeObject(s),this._tileHandles.delete(e)}i&&this.updateGaussians()}freeObject(e){this._memCache.pop(`${e.handle}`)}notifyTileObbsChanged(e){this._elevationProvider&&this._elevationProvider.notifyObjectsChangedFunctional(t=>{for(const i of e)t(i.obb)})}setRenderableVisibility(e,t,i){const s=this._currentLyr3dVisibilityChange+1,a=this.fadeHelper.updateFadeDuration();this._fadeDurationPerVisibilityChange.set(s,a);let r=!1;for(let n=0;n<i;n++){const i=this._tileHandles.get(e[n]);if(!i)continue;const l=t[n]?this._prepareTileFadeIn(i,s,a):this._prepareTileFadeOut(i,s);r||=l}r?(this._currentLyr3dVisibilityChange=s,this.updateGaussians()):this._fadeDurationPerVisibilityChange.delete(s)}_prepareTileFadeIn(e,t,i){const s=this._tileFadeOutsAwaitingInitialSort.delete(e.handle);return 2===e.lifecycleState?(this.fadeHelper.fadeTile(e,0,i),!1):this._tileFadeInsAwaitingInitialSort.get(e.handle)!==t?(0===e.lifecycleState&&this._popTileFromCache(e),e.lifecycleState=1,this._tileFadeInsAwaitingInitialSort.set(e.handle,t),!0):s}_prepareTileFadeOut(e,t){const i=this._tileFadeInsAwaitingInitialSort.delete(e.handle);return i&&1===e.lifecycleState&&(this.moveTileToCache(e),e.lifecycleState=0),2!==e.lifecycleState?i:this._tileFadeOutsAwaitingInitialSort.get(e.handle)!==t?(this._tileFadeOutsAwaitingInitialSort.set(e.handle,t),!0):i}_onSortComplete(e,t){const i=this._tmpTilesWithChangedVisibility;i.length=0;const s=this._tmpSortedTileHandles;s.clear();for(let r=0;r<e.length;r++){const t=e[r];s.add(t.handle)}this._triggerFadeIns(t,s,i);const a=this._triggerFadeOuts(t,i);s.clear(),i.length>0&&this.notifyTileObbsChanged(i),a&&this.updateGaussians(),this._cleanupVisibilityChangeFadeDurations(t)}_triggerFadeIns(e,t,i){for(const[s,a]of this._tileFadeInsAwaitingInitialSort){if(a>e||!t.has(s))continue;const r=this._tileHandles.get(s);if(!r){this._tileFadeInsAwaitingInitialSort.delete(s);continue}const n=this._getFadeDurationForPendingVisibilityChange(a),l=0===r.lifecycleState;2!==r.lifecycleState&&(r.lifecycleState=2,l&&this._popTileFromCache(r),i.push(r)),this.fadeHelper.fadeTile(r,0,n),this._tileFadeInsAwaitingInitialSort.delete(s)}}_triggerFadeOuts(e,t){let i=!1;for(const[s,a]of this._tileFadeOutsAwaitingInitialSort){if(a>e)continue;const r=this._tileHandles.get(s);if(r){const e=2===r.lifecycleState,s=this._getFadeDurationForPendingVisibilityChange(a);this.fadeHelper.fadeTile(r,1,s),e&&0===r.lifecycleState&&(t.push(r),i=!0)}this._tileFadeOutsAwaitingInitialSort.delete(s)}return i}_getFadeDurationForPendingVisibilityChange(e){return this._fadeDurationPerVisibilityChange.get(e)??this.fadeHelper.baseFadeDuration}_cleanupVisibilityChangeFadeDurations(e){if(0!==this._fadeDurationPerVisibilityChange.size)for(const t of this._fadeDurationPerVisibilityChange.keys())t<=e&&this._fadeDurationPerVisibilityChange.delete(t)}_popTileFromCache(e){this._usedTileMemory+=e.usedMemory,this._cacheTileMemory-=e.usedMemory,this._intersectionHandler.addTile(e),this._memCache.pop(b(e.handle))}moveTileToCache(e){this._usedTileMemory-=e.usedMemory,this._cacheTileMemory+=e.usedMemory,this._intersectionHandler.removeTile(e),this._memCache.put(b(e.handle),e)}destroy(){this._createRenderableAbortController.abort(),A(this),this._suspendedHandle&&(this._suspendedHandle=i(this._suspendedHandle)),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&this.view.elevationProvider&&(this._elevationProvider.notifyObjectsChangedFunctional(e=>{for(const t of this._tileHandles.values())e(t.obb)}),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this._frameTask.remove(),this._shadowRenderNode=s(this._shadowRenderNode),this._renderNode=s(this._renderNode),this._memCache.destroy(),this.data=s(this.data)}_canProjectWithoutEngine(){if(1===this.view.state.viewingMode)return!0;if(m(this.view.renderSpatialReference)||g(this.view.renderSpatialReference))return!0;if(this.layer.esriCrsSpatialReference&&_(this.layer.esriCrsSpatialReference,this.view.renderSpatialReference)){if(115700===this.layer.esriCrsSpatialReference.vcsWkid)return!1;let e=S(this.layer.esriCrsSpatialReference);if(!e){const t=this.layer.esriCrsSpatialReference;let i="meters";!y(t)&&t.wkid&&-1!==t.wkid&&(i=n(w.units[w[t.wkid]])),i&&(e=new c({heightModel:"gravity-related-height",heightUnit:i}))}const t=this.view.heightModelInfo;return this._useEsriCrs=0===f(e,t,!1),this._useEsriCrs&&(e&&(this._metersPerVCSUnit=l(1,e.heightUnit,"meters")),this.fullExtentInLocalViewSpatialReference=this.layer.esriCrsFullExtent),this._useEsriCrs}return!1}_elevationInfoChanged(e){if(e?.offset)if(this._useEsriCrs){const t=M(e?.unit)/this._metersPerVCSUnit,i=e?.offset??0;this._wasm?.setLayerOffset(this,i*t)}else this._wasm?.setLayerOffset(this,C(e));else this._wasm?.setLayerOffset(this,0)}_slicePlaneEnabledChanged(e){this._renderNode&&(this._renderNode.slicePlaneEnabled=e),this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e)}updateGaussians(){const e=new Array;for(const t of this._tileHandles.values())0!==t.lifecycleState&&e.push(t);this.data.updateGaussianVisibility(e,this._currentLyr3dVisibilityChange),this.notifyChange("updating")}setMaximumGaussianCount(e){this._wasm?.setMaximumGaussianSplatCount(e)}_freeInvisibleTiles(){for(const e of this._tileHandles.values())0!==e.lifecycleState||this._renderablesBeingCreated.has(e.handle)||this._deleteTile(e)}extractHeader(e){const t=e.length-4,i=this.reinterpretU32AsFloat(e[t]),s=this.reinterpretU32AsFloat(e[t+1]),a=this.reinterpretU32AsFloat(e[t+2]),r=1/(1<<(255&e[t+3]));return{packedHeader:e.subarray(t,t+4),tileOrigin:{x:i,y:s,z:a},invPosScale:r}}_deleteTile(e){this._renderablesBeingCreated.has(e.handle)||this._wasm?.onRenderableEvicted(this,e.handle,e.usedMemory),this.freeRenderable(e.handle)}reinterpretU32AsFloat(e){return this._u32View[0]=e,this._f32View[0]}get performanceInfo(){let e=0,t=0;this._tileHandles.forEach(i=>{0===i.lifecycleState?t++:e++});const i=this.data?.textureAtlasMemory??0,s=this.data?.headerTextureMemory??0,a=this.data?.orderTextureMemory??0,r=this.data?.fadingTextureMemory??0,n=this.data?.sortBufferMemory??0;return new x(this.usedMemory,e,this._usedTileMemory,t,this._cacheTileMemory,i,s,a,r,n)}get test(){}};e([o()],ee.prototype,"layer",void 0),e([o({readOnly:!0})],ee.prototype,"_clippingBox",null),e([o()],ee.prototype,"elevationOffset",null),e([o({readOnly:!0})],ee.prototype,"visibleAtCurrentScale",null),e([o()],ee.prototype,"fullExtentInLocalViewSpatialReference",void 0),ee=X=e([h("esri.views.3d.layers.GaussianSplatLayerView3D")],ee);const te=ee;export{te 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 b,getNormal as w}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,findHorizonScreenY 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 $,intersectsSphereAtScreenPoint as tt}from"../utils/navigationUtils.js";import it from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as et}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as nt}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as st}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as rt}from"../../../navigation/ZoomMomentumEstimator.js";let ot=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 rt,this._rotationMomentumEstimator=new st,this._panSphericalMomentumEstimator=new nt,this._panPlanarMomentumEstimator=new et,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 it,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.basemapTerrain.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);b(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(w(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,t=>tt(this._referenceSphere,this.startCamera,this._screenPickPoint[0],t));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.startCamera,i=>tt(this._referenceSphere,this.currentCamera,t[0],i));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()],ot.prototype,"forceHorizontalPan",void 0),ot=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],ot);export{ot 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{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 b,getNormal as w}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.basemapTerrain.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);b(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(w(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};
|
|
@@ -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 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 f}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{length as h,dot as M,subtract as g,normalize as y,squaredDistance as d,copy as b,transformMat4 as x,add as j,distance as v,cross as P,scale as w,lerp as z,set as I}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,axis as H,fromPoints as S,wrapAxisAngle as T}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as U,vectorCoordinates as G}from"../../../../geometry/support/coordinateSystem.js";import{create as k,fromNormalAndOffset as E,intersectRay as F,projectVector as q}from"../../../../geometry/support/plane.js";import{Sphere as C}from"../../../../geometry/support/sphere.js";import{sm4d as O,sv3d as W}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as B,fromScreen as D}from"../../support/geometryUtils/ray.js";import{intersectScreen as J}from"../../support/geometryUtils/sphere.js";import K from"../../webgl/RenderCamera.js";import{terrainId as L}from"../../webgl-engine/lib/verticalOffsetUtils.js";const N=30,Q=[1,3e8],V=8,X=[200,1508e5],Y=5,Z=50,$=5,_=10,tt=80,et=90,nt=1e-6,rt={exclude:new Set([L])};function ot(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function it(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function at(t,e,n){const r=a(O.get(),n[3],H(n));null==r||s(r,u)||(g(ye,t.eye,e),x(ye,ye,r),t.eye=j(ye,ye,e),g(ye,t.center,e),x(ye,ye,r),t.center=j(ye,ye,e),t.up=x(ye,t.up,r))}function st(t,e,n,r){return F(t,D(e,n,Pe),r)}function ct(t,e,n,r){return F(t,B(e,n,Pe),r)}function lt(t,e,n,r){const o=W.get();let i=1-n;g(o,e,t.eye);const a=h(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<nt||(w(o,o,i),t.eye=j(ye,t.eye,o),t.center=z(ye,t.center,e,i))}function ut(t,e,n){e.getScreenCenter(mt),J(t,e,mt,ye)&&(e.center=ye);const r=e.distance,o=r*n;if(Math.abs(r-o)<nt)return;const i=w(W.get(),e.viewForward,o);e.eye=g(ye,e.center,i)}const mt=i();function ft(t,e){I(e,0,0,0);for(const n of t)j(e,e,n);w(e,e,1/t.length)}function pt(t,e,n,r){return Math.sin(t/h(e))*(n+r.radius)}function ht(t,e,n,r){return pt(Math.PI/2,e,n,r)+(t-Math.PI/2)}const Mt={Elevation:3e4,Angle:e(16)},gt=.05,yt=12,dt=12,bt=e(80);function xt(t,e,n,r,o,i){const a=R(),s=new C;let c=!0,l=!0;const{eye:u}=e;return t.intersectScreen(n,a,i)&&ne(u,a,r)?s.radius=h(a):(l=!1,e.aboveGround&&0!==o?s.radius=Math.max(h(e.center),.9*r):s.radius=h(e.eye)-e.relativeElevation,1===o?wt(s,e,n,a):c=J(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:l}}function jt(t,e,n,r){const o=t.relativeElevation;if(o>Mt.Elevation&&"global"===r)return 1;B(t,e,we);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,ye);return-i*M(a,we.direction)<Math.sin(Mt.Angle)*h(we.direction)?0:1}function vt(t,e,n){g(Pt,n,e),t.eye=g(ye,t.eye,Pt),t.center=g(ye,t.center,Pt)}const Pt=R();function wt(t,e,n,r){const o=B(e,n,Pe);return null!=o&&(t.closestPointOnSilhouette(o,zt),t.intersectRay(o,r)?!(d(zt,o.origin)<d(r,o.origin))||(b(r,zt),!1):(g(It,e.eye,e.center),y(It,It),E(It,-M(y(It,It),zt),Rt),F(Rt,o,r),!1))}const zt=R(),It=R(),Rt=k();function At(t,e){const n=t.fullHeight/t.pixelRatio,r=e(0),o=e(n);if(r||!o)return null;let i=0,a=n;for(let s=0;s<dt;s++){const t=.5*(i+a);e(t)?a=t:i=t}return a}const Ht=R(),St=R(),Tt=i();function Ut(t,e){return q(e,t.viewForward,Ht),j(St,t.eye,Ht),t.projectToScreen(St,Tt),Tt[1]}function Gt(t,e,n){return e?t>n:t<n}function kt(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(yt,gt*r)}function Et(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+kt(t,e))}function Ft(t,e){return Math.max(0,e-kt(t,e))}function qt(t,e,n,r){return ze[0]=n,ze[1]=r,t.intersectRay(B(e,ze,Pe),ye)}function Ct(t,e,n,r){return ze[0]=n,ze[1]=r,F(t,B(e,ze,Pe),ye)}function Ot(i,a,s,c,l,u){let m=0;if(P(xe,i,a),g(de,i,a),h(i)<=l||!c.aboveGround){P(s,de,c.eye);const f=M(i,a)/(h(i)*h(a));if(f<.9999)m=r(f);else{const t=h(P(R(),i,a))/(h(i)*h(a));m=o(t)}const p=Math.cos(n(t.normalize(e(u)),0,bt));m=-m-Math.max(0,h(a)-l)/(p*l)}else g(Wt,c.eye,c.center),P(s,de,Wt),m=-h(de)/l;return y(s,s),w(s,s,h(xe)),m}const Wt=R();function Bt(o,i,a,s){let c,l;const u=Math.cos(n(t.normalize(e(s)),0,bt));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 Dt(t,e,n,r,o,i,a,s,c,l){const u=Bt(t[2],e[2],i.radius,s),m=c?Bt(t[0],e[0],i.radius,180):e[0]-t[0],p=Math.sin(a)*m-Math.cos(a)*u,h=Math.cos(a)*m+Math.sin(a)*u;y(ye,o);const g=c?p/Math.sqrt(Math.abs(i.radius**2-M(n,ye)**2)):p/i.radius,d=h/Math.sqrt(Math.abs(i.radius**2-M(n,r)**2));f(l,g,d)}function Jt(t,e,n,r,o,i,a,s,c,l){P(xe,t,e),U(i.up,i.eye,ae,se,ce),U([0,0,1],i.eye,re,oe,ie),b(n,oe),b(r,re),y(n,n),w(n,n,h(xe)),G(t,y(se,se),y(ce,ce),y(ae,ae),le),G(e,se,ce,ae,ue),Dt(le,ue,t,re,oe,a,s,c,l,o)}function Kt(t,e,n,r,o,i,s){a(pe,o,r),a(he,s,i),l(Me,pe,he),g(e,t,n),x(e,e,Me),j(e,e,n)}function Lt(t,e,n,r,o,i){a(pe,r,n),a(he,i,o),l(Me,pe,he),g(ye,t.eye,e),x(ye,ye,Me),t.eye=j(ye,ye,e),g(ye,t.center,e),x(ye,ye,Me),t.center=j(ye,ye,e),g(ye,t.up,e),x(ye,ye,Me),t.up=j(ye,ye,e)}const Nt={Pole:.95,Angle:e(18),Tilt:45,TiltHysteresisMargin:1e-7};let Qt=!1;function Vt(t,e,n,r,o,i){const a=Math.abs(r)>Math.PI-Nt.Angle||Math.abs(r)<Nt.Angle,s=(Math.abs(t[2])<n*Nt.Pole||Math.abs(e)>n)&&i;return a&&s?!Qt&&o<Nt.Tilt-Nt.TiltHysteresisMargin?Qt=!0:Qt&&o>Nt.Tilt+Nt.TiltHysteresisMargin&&(Qt=!1):Qt=!1,Qt}function Xt(t,e,n,r,o,i){if(i)S(n,r,fe),at(e,t.center,fe);else{const i=Ot(n,r,je,e,t.radius,o);at(e,t.center,T(je,i))}}function Yt(t,e,n,r,o,i,a){const s=a?20:1,c=1e-12;let l,u;b(ge,r),be.copyFrom(e);for(let m=0;m<s&&d(n,ge)>c&&(l=d(n,ge),Jt(n,ge,oe,re,me,be,t,o,i,a),Lt(be,t.center,re,me[1],oe,me[0]),Kt(ge,ge,t.center,re,me[1],oe,me[0]),u=d(n,ge),u<l||0===m);m++)e.copyFrom(be)}function Zt(n,r,o,i,a,s,c){Vt(o,M(r.up,o),n.radius,-t.normalize(e(a)),s,r.aboveGround)?Yt(n,r,o,i,-t.normalize(e(a)),s,c):Xt(n,r,o,i,s,c)}function $t(t,e,n,r,o,i){const{eye:a}=t;U([0,0,1],a,re,oe,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-M(t.center,re)**2/h(t.center)**2)),.5),m=(Math.sin(i)*l+Math.cos(i)*s)/u,f=-Math.cos(i)*l+Math.sin(i)*s;switch(c(r.pan.matrix,r.pan.matrix,m,re),r.pan.enabled=!0,o.mode){case"pan":c(r.pan.matrix,r.pan.matrix,f,oe),r.pan.enabled=!0;break;case"zoom":r.zoom=-e.translation[1]*n.zoom}}function _t(t,e,n,r,o){const{eye:i,viewRight:a}=t,s=P(W.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 te(n,r,o,i,a,s,c,l,u){Vt(n.center,M(n.up,n.center),h(n.center),-t.normalize(e(s)),c,r.aboveGround)?$t(r,o,i,l,u,-t.normalize(e(a))):_t(r,o,i,l,u)}function ee(t,e,n=1/0){const r=Math.abs(M(t,e));return Math.min(n,1/r)}function ne(t,e,n){const r=v(t,e),o=h(t);return r<Math.max(o,n)}const re=R(),oe=R(),ie=R(),ae=R(),se=R(),ce=R(),le=R(),ue=R(),me=p(),fe=A(),pe=m(),he=m(),Me=m(),ge=R(),ye=R(),de=R();let be=new K;const xe=R(),je=R();function ve(){be=new K}const Pe={origin:R(),direction:R()},we={origin:R(),direction:R()},ze=i();export{bt as TiltThresholdPanningSpeed,Mt as VerticalPanTresholds,vt as applyPanPlanar,Xt as applyPanSphericalDirectRotation,Yt as applyPanSphericalPreserveHeading,at as applyRotation,Lt as applyRotationWithTwoAxes,ut as applyZoomOnSphere,lt as applyZoomToPoint,ft as centroid,ve as cleanupNavigationUtils,Ft as computeHorizonDownLimitScreenY,kt as computeHorizonPadding,Et as computeHorizonUpLimitScreenY,nt as distanceComparisonTolerance,rt as excludeTerrain,At as findHorizonScreenY,Ut as findPlaneHorizonY,ee as getTiltScaleFactor,jt as inferNavigationMode,st as intersectPlaneFromScreenPoint,ct as intersectPlaneFromScreenPointAtEye,Ct as intersectsPlaneAtScreenPoint,qt as intersectsSphereAtScreenPoint,ne as isHitOnSamePlanetSide,Bt as lengthFromPoints,Y as maxPanDistanceModifier,$ as maxRotatePivotDistanceModifier,N as maxZoomPivotDistanceModifier,V as maxZoomStepDistanceModifier,Z as minPinchAndPanCameraHeight,_ as minRotatePivotDistance,ot as normalizeCoordinate,it as normalizeRotationDelta,ht as offSurfaceTiltToEyeTiltGlobal,pt as onSurfaceTiltToEyeTiltGlobal,te as panMotionToRotationMatrix,Zt as panToPosition,xt as pickPointAndInitSphere,tt as pivotSearchAreaSize,Nt as preservingHeadingThresholds,gt as relativeHorizonPanPadding,et as rotatePivotSearchAreaSize,Kt as rotatePointAroundTwoAxes,Ot as rotationAngleAndAxisDirectRotation,Jt as rotationAnglesAndAxesHeadingPreserving,Dt as rotationAnglesHeadingPreserving,Gt as shouldClampScreenY,Vt as shouldPreserveHeading,wt as sphereOrPlanePointFromScreenPoint,Q as zoomPivotDistanceClamp,X 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 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{length as h,dot as M,subtract as g,normalize as y,squaredDistance as d,copy as b,transformMat4 as x,add as j,distance as v,cross as P,scale as w,lerp as z,crossAndNormalize as I,scaleAndAdd as S,set as T}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as R}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as A,axis as q,fromPoints as H,wrapAxisAngle as U}from"../../../../geometry/support/axisAngle.js";import{coordinateSystemFromOneAxisAndNormalVector as G,vectorCoordinates as k}from"../../../../geometry/support/coordinateSystem.js";import{create as E,fromNormalAndOffset as F,intersectRay as C,fromPositionAndNormal as O,distance as W,projectPoint as B,projectVector as D}from"../../../../geometry/support/plane.js";import{create as J}from"../../../../geometry/support/ray.js";import{Sphere as K}from"../../../../geometry/support/sphere.js";import{sm4d as L,sv3d as N}from"../../../../geometry/support/vectorStacks.js";import{fromScreenAtEye as Q,fromScreen as V}from"../../support/geometryUtils/ray.js";import{intersectScreen as X}from"../../support/geometryUtils/sphere.js";import Y from"../../webgl/RenderCamera.js";import{terrainId as Z}from"../../webgl-engine/lib/verticalOffsetUtils.js";const $=30,_=[1,3e8],tt=8,et=[200,1508e5],nt=5,rt=50,ot=5,it=10,at=80,st=90,ct=1e-6,ut={exclude:new Set([Z])};function lt(t,e,n){return n[0]=e[0]/(t.fullWidth/t.pixelRatio),n[1]=e[1]/(t.fullHeight/t.pixelRatio),n}function mt(t){for(;t>Math.PI;)t-=2*Math.PI;for(;t<-Math.PI;)t+=2*Math.PI;return t}function ft(t,e,n){const r=a(L.get(),n[3],q(n));null==r||s(r,l)||(g(ke,t.eye,e),x(ke,ke,r),t.eye=j(ke,ke,e),g(ke,t.center,e),x(ke,ke,r),t.center=j(ke,ke,e),t.up=x(ke,t.up,r))}function pt(t,e,n,r){return C(t,V(e,n,Be),r)}function ht(t,e,n,r){return C(t,Q(e,n,Be),r)}function Mt(t,e,n,r){const o=N.get();let i=1-n;g(o,e,t.eye);const a=h(o);let s=a*(1-i);i>=0&&s<r&&(s=r,i=-(s-a)/a),Math.abs(a-s)<ct||(w(o,o,i),t.eye=j(ke,t.eye,o),t.center=z(ke,t.center,e,i))}function gt(t,e,n){e.getScreenCenter(yt),X(t,e,yt,ke)&&(e.center=ke);const r=e.distance,o=r*n;if(Math.abs(r-o)<ct)return;const i=w(N.get(),e.viewForward,o);e.eye=g(ke,e.center,i)}const yt=i();function dt(t,e){T(e,0,0,0);for(const n of t)j(e,e,n);w(e,e,1/t.length)}function bt(t,e,n,r){return Math.sin(t/h(e))*(n+r.radius)}function xt(t,e,n,r){return bt(Math.PI/2,e,n,r)+(t-Math.PI/2)}const jt={Elevation:3e4,Angle:e(16)},vt=e(80);function Pt(t,e,n,r,o,i){const a=R(),s=new K;let c=!0,u=!0;const{eye:l}=e;return t.intersectScreen(n,a,i)&&xe(l,a,r)?s.radius=h(a):(u=!1,e.aboveGround&&0!==o?s.radius=Math.max(h(e.center),.9*r):s.radius=h(e.eye)-e.relativeElevation,1===o?St(s,e,n,a):c=X(s,e,n,a)),{sphere:s,scenePickPoint:c?a:null,hasGeometryIntersection:u}}function wt(t,e,n,r){const o=t.relativeElevation;if(o>jt.Elevation&&"global"===r)return 1;Q(t,e,De);const i=Math.sign(o),a=n.worldUpAtPosition(t.eye,ke);return-i*M(a,De.direction)<Math.sin(jt.Angle)*h(De.direction)?0:1}function zt(t,e,n){g(It,n,e),t.eye=g(ke,t.eye,It),t.center=g(ke,t.center,It)}const It=R();function St(t,e,n,r){const o=Q(e,n,Be);return null!=o&&(t.closestPointOnSilhouette(o,Tt),t.intersectRay(o,r)?!(d(Tt,o.origin)<d(r,o.origin))||(b(r,Tt),!1):(g(Rt,e.eye,e.center),y(Rt,Rt),F(Rt,-M(y(Rt,Rt),Tt),At),C(At,o,r),!1))}const Tt=R(),Rt=R(),At=E(),qt=R(),Ht=R(),Ut=i();function Gt(t,e){return D(e,t.viewForward,qt),j(Ht,t.eye,qt),t.projectToScreen(Ht,Ut),Ut[1]}const kt=R(),Et=E(),Ft=R(),Ct=R(),Ot=R(),Wt=R(),Bt=R(),Dt=R(),Jt=R(),Kt=R(),Lt=i(),Nt=i(),Qt=J();function Vt(t,e,n){const r=t.eye;if(v(e.center,r)<e.radius)return null;const o=t.up;Q(t,n,Qt);const i=e.radius;if(I(kt,o,Qt.direction),O(r,kt,Et),W(Et,e.center)>i)return null;B(Et,e.center,Ft);const a=v(e.center,Ft),s=Math.sqrt(i**2-a**2);g(Ct,r,Ft),y(Ot,Ct),I(Wt,kt,Ot);const c=M(Ct,Ot),u=M(Ct,Wt),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,d=m*u,b=f*c,x=p-h,P=d+b,z=d-b;return j(Bt,Ft,S(Bt,w(Bt,Ot,p+h),Wt,P)),j(Dt,Ft,S(Dt,w(Dt,Ot,x),Wt,z)),g(Jt,Bt,r),g(Kt,Dt,r),t.projectToScreen(Bt,Lt),t.projectToScreen(Dt,Nt),Math.min(Lt[1],Nt[1])}function Xt(t,e,n){return e?t>n:t<n}const Yt=.05,Zt=12;function $t(t,e){const n=t.fullHeight/t.pixelRatio,r=Math.max(e,n-e);return Math.max(Zt,Yt*r)}function _t(t,e){const n=t.fullHeight/t.pixelRatio;return Math.min(n,e+$t(t,e))}function te(t,e){return Math.max(0,e-$t(t,e))}function ee(t,e,n,r){return Je[0]=n,Je[1]=r,t.intersectRay(Q(e,Je,Be),ke)}function ne(t,e,n,r){return Je[0]=n,Je[1]=r,C(t,Q(e,Je,Be),ke)}function re(i,a,s,c,u,l){let m=0;if(P(Ce,i,a),g(Ee,i,a),h(i)<=u||!c.aboveGround){P(s,Ee,c.eye);const f=M(i,a)/(h(i)*h(a));if(f<.9999)m=r(f);else{const t=h(P(R(),i,a))/(h(i)*h(a));m=o(t)}const p=Math.cos(n(t.normalize(e(l)),0,vt));m=-m-Math.max(0,h(a)-u)/(p*u)}else g(oe,c.eye,c.center),P(s,Ee,oe),m=-h(Ee)/u;return y(s,s),w(s,s,h(Ce)),m}const oe=R();function ie(o,i,a,s){let c,u;const l=Math.cos(n(t.normalize(e(s)),0,vt));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;y(ke,o);const g=c?p/Math.sqrt(Math.abs(i.radius**2-M(n,ke)**2)):p/i.radius,d=h/Math.sqrt(Math.abs(i.radius**2-M(n,r)**2));f(u,g,d)}function se(t,e,n,r,o,i,a,s,c,u){P(Ce,t,e),G(i.up,i.eye,we,ze,Ie),G([0,0,1],i.eye,je,ve,Pe),b(n,ve),b(r,je),y(n,n),w(n,n,h(Ce)),k(t,y(ze,ze),y(Ie,Ie),y(we,we),Se),k(e,ze,Ie,we,Te),ae(Se,Te,t,je,ve,a,s,c,u,o)}function ce(t,e,n,r,o,i,s){a(qe,o,r),a(He,s,i),u(Ue,qe,He),g(e,t,n),x(e,e,Ue),j(e,e,n)}function ue(t,e,n,r,o,i){a(qe,r,n),a(He,i,o),u(Ue,qe,He),g(ke,t.eye,e),x(ke,ke,Ue),t.eye=j(ke,ke,e),g(ke,t.center,e),x(ke,ke,Ue),t.center=j(ke,ke,e),g(ke,t.up,e),x(ke,ke,Ue),t.up=j(ke,ke,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,Ae),ft(e,t.center,Ae);else{const i=re(n,r,Oe,e,t.radius,o);ft(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;b(Ge,r),Fe.copyFrom(e);for(let m=0;m<s&&d(n,Ge)>c&&(u=d(n,Ge),se(n,Ge,ve,je,Re,Fe,t,o,i,a),ue(Fe,t.center,je,Re[1],ve,Re[0]),ce(Ge,Ge,t.center,je,Re[1],ve,Re[0]),l=d(n,Ge),l<u||0===m);m++)e.copyFrom(Fe)}function Me(n,r,o,i,a,s,c){fe(o,M(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;G([0,0,1],a,je,ve,Pe);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-M(t.center,je)**2/h(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(N.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,M(n.up,n.center),h(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(M(t,e));return Math.min(n,1/r)}function xe(t,e,n){const r=v(t,e),o=h(t);return r<Math.max(o,n)}const je=R(),ve=R(),Pe=R(),we=R(),ze=R(),Ie=R(),Se=R(),Te=R(),Re=p(),Ae=A(),qe=m(),He=m(),Ue=m(),Ge=R(),ke=R(),Ee=R();let Fe=new Y;const Ce=R(),Oe=R();function We(){Fe=new Y}const Be={origin:R(),direction:R()},De={origin:R(),direction:R()},Je=i();export{vt as TiltThresholdPanningSpeed,jt as VerticalPanTresholds,zt as applyPanPlanar,pe as applyPanSphericalDirectRotation,he as applyPanSphericalPreserveHeading,ft as applyRotation,ue as applyRotationWithTwoAxes,gt as applyZoomOnSphere,Mt as applyZoomToPoint,dt as centroid,We as cleanupNavigationUtils,te as computeHorizonDownLimitScreenY,$t as computeHorizonPadding,_t as computeHorizonUpLimitScreenY,ct as distanceComparisonTolerance,ut as excludeTerrain,Gt as findPlaneHorizonY,Vt as findSphereHorizonY,be as getTiltScaleFactor,wt as inferNavigationMode,pt as intersectPlaneFromScreenPoint,ht as intersectPlaneFromScreenPointAtEye,ne as intersectsPlaneAtScreenPoint,ee as intersectsSphereAtScreenPoint,xe as isHitOnSamePlanetSide,ie as lengthFromPoints,nt as maxPanDistanceModifier,ot as maxRotatePivotDistanceModifier,$ as maxZoomPivotDistanceModifier,tt as maxZoomStepDistanceModifier,rt as minPinchAndPanCameraHeight,it as minRotatePivotDistance,lt as normalizeCoordinate,mt as normalizeRotationDelta,xt as offSurfaceTiltToEyeTiltGlobal,bt as onSurfaceTiltToEyeTiltGlobal,de as panMotionToRotationMatrix,Me as panToPosition,Pt as pickPointAndInitSphere,at as pivotSearchAreaSize,le as preservingHeadingThresholds,Yt as relativeHorizonPanPadding,st as rotatePivotSearchAreaSize,ce as rotatePointAroundTwoAxes,re as rotationAngleAndAxisDirectRotation,se as rotationAnglesAndAxesHeadingPreserving,ae as rotationAnglesHeadingPreserving,Xt as shouldClampScreenY,fe as shouldPreserveHeading,St as sphereOrPlanePointFromScreenPoint,_ as zoomPivotDistanceClamp,et as zoomStepDistanceClamp};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{has}from"../../../../applications/Components/baUtils.js";import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,gaussiansPerPage as a}from"./GaussianSplatAtlasPages.js";import{PixelType as i,SizedPixelFormat as
|
|
2
|
+
import{has}from"../../../../applications/Components/baUtils.js";import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import{initialSplatAtlasTextureHeight as e,GaussianSplatAtlasPages as s,splatAtlasTextureWidth as r,gaussiansPerPage as a}from"./GaussianSplatAtlasPages.js";import{PixelType as i,SizedPixelFormat as o}from"../../../webgl/enums.js";import{DisposableFramebufferObject as l}from"../../../webgl/FramebufferObject.js";import h from"../../../webgl/Texture.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class c{constructor(t,r,a,i){this._splatAtlasTextureHeight=e,this.texture=null,this._rctx=t,this._fboCache=a,this._onCachedTextureEvicted=i,this.pageAllocator=new s,this._cache=r.newCache("gaussian texture cache",t=>{t.dispose(),this._onCachedTextureEvicted()})}get usedMemory(){return this.texture?.usedMemory??0}ensureTextureAtlas(){if(this.texture?.hasWebGLTextureObject)return;this.texture=null;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new u;e.height=this._splatAtlasTextureHeight,e.width=r,e.pixelFormat=36249,e.dataType=i.UNSIGNED_INT,e.internalFormat=o.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,e.isImmutable=!0,this.texture=new h(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const e=Math.floor(this._splatAtlasTextureHeight*t);if(e>Math.min(has("esri-mobile")?1024:4096,this._rctx.parameters.maxTextureSize))return!1;const s=new l(this._rctx,this.texture),a=this._fboCache.acquire(r,e,"gaussian splat atlas resize",12);return this._rctx.blitFramebuffer(s,a.fbo,16384,9728,0,0,r,this._splatAtlasTextureHeight,0,0,r,this._splatAtlasTextureHeight),this.texture=a.fbo?.detachColorTexture(),s.dispose(),a.dispose(),this._splatAtlasTextureHeight=e,this._updatePageAllocator(),!0}allocatePage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}freePages(t){for(const e of t)this.freePage(e)}update(t,e,s){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,a,1,s)}_updatePageAllocator(){const t=r*this._splatAtlasTextureHeight/a;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._onCachedTextureEvicted=()=>{},this._cache.destroy(),this.texture?.dispose(),this.texture=null}}export{c as GaussianSplatTextureAtlas};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as n,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{exactEquals as a,dot as c,
|
|
2
|
+
import{__decorate as e}from"tslib";import{clamp as t}from"../../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../../core/maybe.js";import{watch as o}from"../../../../core/reactiveUtils.js";import{createRenderScreenPointArray3 as i}from"../../../../core/screenUtils.js";import{property as n,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{exactEquals as a,dot as c,copy as d,lerp as p,subtract as l,normalize as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import m from"../../../../geometry/Point.js";import{wrap as f}from"../../../../geometry/support/ray.js";import{PointOfInterest as y}from"./PointOfInterest.js";import{PropertiesPool as g}from"../../../support/PropertiesPool.js";import{TaskPriority as P}from"../../../support/Scheduler.js";import{Yield as _}from"../../../support/Yield.js";let L=class extends y{constructor(e){super(e),this._propertiesPool=new g({location:()=>new m,renderLocation:()=>h()},this),this._dirty=!0,this.renderLocation=this._propertiesPool.get("renderLocation")}initialize(){this.addHandles([o(()=>this.centerOnSurface.renderLocation,()=>this.updateRenderLocation(),{equals:a}),o(()=>this.state.contentCamera,()=>this.updateRenderLocation())]),this.scheduler&&this.addHandles(this.scheduler.registerTask(P.POINT_OF_INTEREST_FREQUENT,this))}destroy(){this._propertiesPool=r(this._propertiesPool)}get updating(){return this._dirty||this.centerOnSurface.updating}get location(){const e=this._propertiesPool.get("location");return e.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,e),e}get worldUnitsPerContentPixel(){const{camera:e,contentPixelRatio:t}=this.state;return e.computeRenderPixelSizeAt(this.renderLocation)*(e.pixelRatio/t)}get readyToRun(){return this._dirty}runTask(){const e=this._get("renderLocation"),r=this.centerOnSurface.renderLocation,o=this.renderCoordsHelper,i=this.state.contentCamera;this._dirty=!1,o.worldUpAtPosition(r,R);const n=Math.max(0,(Math.acos(c(R,i.viewForward))-.5*Math.PI)*(i.aboveGround?1:-1));if(Number.isNaN(n)){if(!e||!a(e,r)){const e=this._propertiesPool.get("renderLocation");d(e,r),this._set("renderLocation",e)}return _}const s=1-t(n/(.5*Math.PI),0,1),l=s*s*s;this._calculateScreenHorizontalEdgeOnSurface(j);const u=this._propertiesPool.get("renderLocation");return p(u,r,j,l),e&&a(e,u)||this._set("renderLocation",u),_}_calculateScreenHorizontalEdgeOnSurface(e){const t=this.state.contentCamera,r=t.getRenderCenter(i());if(r[1]=t.aboveGround?t.padding[2]:t.fullHeight-t.padding[0],this.estimateSurfaceIntersectionAtRenderPoint(r,e))return e;const o=this.renderCoordsHelper.getAltitude(this.centerOnSurface.renderLocation);if(t.unprojectFromRenderScreen(r,S)){l(S,S,t.eye);const r=u(S,S);if(this.renderCoordsHelper.intersectInfiniteManifold(f(t.eye,r),o,e))return e}return this.renderCoordsHelper.setAltitude(e,o,t.eye)}updateRenderLocation(){this._dirty=!0}};e([n()],L.prototype,"_dirty",void 0),e([n({constructOnly:!0})],L.prototype,"scheduler",void 0),e([n({constructOnly:!0})],L.prototype,"centerOnSurface",void 0),e([n({constructOnly:!0})],L.prototype,"estimateSurfaceIntersectionAtRenderPoint",void 0),e([n()],L.prototype,"updating",null),e([n()],L.prototype,"location",null),e([n()],L.prototype,"renderLocation",void 0),e([n()],L.prototype,"worldUnitsPerContentPixel",null),L=e([s("esri.views.3d.support.pointsOfInterest.Focus")],L);const R=h(),S=h(),j=h();export{L as Focus};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,multiply as p,invert as u,transpose as l,frustum as _,equals as c,lookAt as v}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as y}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as m,set as f,distance as x,copy as M,exactEquals as D,sub as j,dot as R,sqrLen as P,sqrDist as V,scale as F,length as C,cross as b,normalize as S,direction as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as I,UNIT_Z as A}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as E,equals as O,exactEquals as U,copy as H,squaredDistance as z,transformMat4 as W}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as q,copy as L,fromMatrix as X}from"../../../geometry/support/frustum.js";import{create as G}from"../../../geometry/support/ray.js";import{projectPointSignedLength as N}from"../../../geometry/support/vector.js";import{viewAngle as B}from"../state/utils/viewUtils.js";import{fovd2fovx as J,fovx2fovd as K,fovd2fovy as Q,fovy2fovd as Z}from"../webgl-engine/lib/fov.js";var $;let tt=$=class extends i{constructor(t){super(t),this._ray=G(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=q(),this._fullViewport=k(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=I(),this._up=I(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return m(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),f(I(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),f(I(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),f(I(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=E(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&O(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=E(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&O(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){U(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return u(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return J(this._fov,this.width,this.height)}set fovX(t){this._fov=K(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Q(this._fov,this.width,this.height)}set fovY(t){this._fov=Z(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return x(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(u(this._viewInverseTransposeMatrix,this.viewMatrix),l(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=_(w(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){M(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(L(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new $).copyFrom(this)}equals(t){return D(this.eye,t.eye)&&D(this.center,t.center)&&D(this.up,t.up)&&U(this._viewport,t.viewport)&&U(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||z(t.screenPadding,this.screenPadding)>=i||z(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;j(rt,t.eye,t.center),j(st,this.eye,this.center);const e=R(rt,st),r=P(rt),s=P(st),o=5e-4;return e*e>=(1-1e-10)*r*s&&V(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(N(this.viewForward,m(rt,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==it&&M(it,t),it[3]=1,W(it,it,this.projectionMatrix);const e=Math.abs(it[3]);F(it,it,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*it[0]),i[1]=r(0,s[1]+s[3],.5+.5*it[1]),i[2]=.5*(it[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;it[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],it[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],it[2]=(2*t[2]-1)*t[3],it[3]=t[3],null!=this.inverseProjectionMatrix&&(W(it,it,this.inverseProjectionMatrix),i[0]=it[0],i[1]=it[1],i[2]=it[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,ot),this.renderToScreen(ot,i),i}projectToRenderScreen(t,i){if(it[0]=t[0],it[1]=t[1],it[2]=t[2],it[3]=1,W(it,it,this.viewProjectionMatrix),0===it[3])return null;const e=it;F(e,e,1/Math.abs(it[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,ot),i)}unprojectFromRenderScreen(t,i){if(p(et,this.projectionMatrix,this.viewMatrix),!u(et,et))return null;const e=this.fullViewport;return it[0]=2*(t[0]-e[0])/e[2]-1,it[1]=2*(t[1]-e[1])/e[3]-1,it[2]=2*t[2]-1,it[3]=1,W(it,it,et),0===it[3]?null:(i[0]=it[0]/it[3],i[1]=it[1]/it[3],i[2]=it[2]/it[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-B(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){m(rt,this.center,this.eye);const t=C(this.center);t<1?D(this._up,A)&&(M(this._up,A),this._markViewDirty(),this.notifyChange("_up")):Math.abs(R(rt,this.center))>.9999*C(rt)*t||(b(st,rt,this.center),b(st,st,rt),S(st,st),D(this._up,st)||(M(this._up,st),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){T(rt,this.eye,this.center),Math.abs(rt[2])<=.9999&&(F(rt,rt,rt[2]),f(rt,-rt[0],-rt[1],1-rt[2]),S(rt,rt),D(this._up,rt)||(M(this._up,rt),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?D(t,i)||(M(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(X(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(v(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],tt.prototype,"_viewport",void 0),t([n()],tt.prototype,"_padding",void 0),t([n()],tt.prototype,"_fov",void 0),t([n()],tt.prototype,"_nearFar",void 0),t([n()],tt.prototype,"_viewDirty",void 0),t([n()],tt.prototype,"_viewMatrix",void 0),t([n()],tt.prototype,"_pixelRatio",void 0),t([n()],tt.prototype,"pixelRatio",null),t([n()],tt.prototype,"row",void 0),t([n()],tt.prototype,"column",void 0),t([n()],tt.prototype,"_rows",void 0),t([n()],tt.prototype,"rows",null),t([n()],tt.prototype,"_columns",void 0),t([n()],tt.prototype,"columns",null),t([n()],tt.prototype,"eye",null),t([n()],tt.prototype,"center",null),t([n()],tt.prototype,"_center",void 0),t([n()],tt.prototype,"up",null),t([n()],tt.prototype,"_up",void 0),t([n()],tt.prototype,"viewMatrix",null),t([n({readOnly:!0})],tt.prototype,"viewForward",null),t([n({readOnly:!0})],tt.prototype,"viewUp",null),t([n({readOnly:!0})],tt.prototype,"viewRight",null),t([n({readOnly:!0})],tt.prototype,"nearFar",null),t([n()],tt.prototype,"near",null),t([n()],tt.prototype,"far",null),t([n()],tt.prototype,"viewport",null),t([n({readOnly:!0})],tt.prototype,"screenViewport",null),t([n({readOnly:!0})],tt.prototype,"screenPadding",null),t([n()],tt.prototype,"x",null),t([n()],tt.prototype,"y",null),t([n()],tt.prototype,"width",null),t([n()],tt.prototype,"height",null),t([n()],tt.prototype,"fullWidth",null),t([n()],tt.prototype,"fullHeight",null),t([n({readOnly:!0})],tt.prototype,"_aspect",null),t([n()],tt.prototype,"padding",null),t([n({readOnly:!0})],tt.prototype,"projectionMatrix",null),t([n({readOnly:!0})],tt.prototype,"inverseProjectionMatrix",null),t([n()],tt.prototype,"fov",null),t([n()],tt.prototype,"fovX",null),t([n()],tt.prototype,"fovY",null),t([n()],tt.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],tt.prototype,"_projectionMatrixInternal",null),t([n()],tt.prototype,"relativeElevation",void 0),tt=$=t([h("esri.views.3d.webgl.RenderCamera")],tt);const it=k(),et=w(),rt=I(),st=I(),ot=o();export{tt as default};
|
|
2
|
+
import{__decorate as t}from"tslib";import i from"../../../core/Accessor.js";import e from"../../../core/Logger.js";import{lerp as r}from"../../../core/mathUtils.js";import{createScreenPointArray as s,createRenderScreenPointArray3 as o}from"../../../core/screenUtils.js";import{property as n,subclass as h}from"../../../core/accessorSupport/decorators.js";import{copy as a,multiply as p,invert as u,transpose as l,frustum as _,exactEquals as c,lookAt as v}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as w}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{copy as d,exactEquals as y}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{subtract as m,set as f,distance as x,copy as M,exactEquals as D,sub as j,dot as R,sqrLen as P,sqrDist as V,scale as F,length as C,cross as b,normalize as S,direction as T}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{create as I,UNIT_Z as E}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{scale as A,equals as O,exactEquals as U,copy as H,squaredDistance as z,transformMat4 as W}from"../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as Y,create as k}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as q,copy as L,fromMatrix as X}from"../../../geometry/support/frustum.js";import{create as G}from"../../../geometry/support/ray.js";import{projectPointSignedLength as N}from"../../../geometry/support/vector.js";import{viewAngle as B}from"../state/utils/viewUtils.js";import{fovd2fovx as J,fovx2fovd as K,fovd2fovy as Q,fovy2fovd as Z}from"../webgl-engine/lib/fov.js";var $;let tt=$=class extends i{constructor(t){super(t),this._ray=G(),this._viewport=Y(0,0,1,1),this._padding=Y(0,0,0,0),this._fov=55/180*Math.PI,this._nearFar=g(1,1e3),this._viewDirty=!0,this._viewMatrix=w(),this._viewProjectionDirty=!0,this._viewProjectionMatrix=w(),this._viewInverseTransposeMatrixDirty=!0,this._viewInverseTransposeMatrix=w(),this._frustumDirty=!0,this._frustum=q(),this._fullViewport=k(),this._pixelRatio=1,this.row=0,this.column=0,this._rows=1,this._columns=1,this._center=I(),this._up=I(),this.relativeElevation=0}get pixelRatio(){return this._pixelRatio}set pixelRatio(t){this._pixelRatio=t>0?t:1}get rows(){return this._rows}set rows(t){this._rows=Math.max(1,t)}get columns(){return this._columns}set columns(t){this._columns=Math.max(1,t)}get eye(){return this._ray.origin}set eye(t){this._compareAndSetView(t,this._ray.origin)}get center(){return this._center}set center(t){this._compareAndSetView(t,this._center,"_center")}get ray(){return m(this._ray.direction,this.center,this.eye),this._ray}get up(){return this._up}set up(t){this._compareAndSetView(t,this._up,"_up")}get viewMatrix(){return this._ensureViewClean(),this._viewMatrix}set viewMatrix(t){a(this._viewMatrix,t),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0,this._viewProjectionDirty=!0,this._frustumDirty=!0}get viewForward(){return this._ensureViewClean(),f(I(),-this._viewMatrix[2],-this._viewMatrix[6],-this._viewMatrix[10])}get viewUp(){return this._ensureViewClean(),f(I(),this._viewMatrix[1],this._viewMatrix[5],this._viewMatrix[9])}get viewRight(){return this._ensureViewClean(),f(I(),this._viewMatrix[0],this._viewMatrix[4],this._viewMatrix[8])}get nearFar(){return this._nearFar}get near(){return this._nearFar[0]}set near(t){this._nearFar[0]!==t&&(this._nearFar[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get far(){return this._nearFar[1]}set far(t){this._nearFar[1]!==t&&(this._nearFar[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_nearFar"))}get viewport(){return this._viewport}set viewport(t){this.x=t[0],this.y=t[1],this.width=t[2],this.height=t[3]}get screenViewport(){if(1===this.pixelRatio)return this._viewport;const t=A(k(),this._viewport,1/this.pixelRatio),i=this._get("screenViewport");return i&&O(t,i)?i:t}get screenPadding(){if(1===this.pixelRatio)return this._padding;const t=A(k(),this._padding,1/this.pixelRatio),i=this._get("screenPadding");return i&&O(t,i)?i:t}get x(){return this._viewport[0]}set x(t){t+=this._padding[3],this._viewport[0]!==t&&(this._viewport[0]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get y(){return this._viewport[1]}set y(t){t+=this._padding[2],this._viewport[1]!==t&&(this._viewport[1]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get width(){return this._viewport[2]}set width(t){this._viewport[2]!==t&&(this._viewport[2]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get height(){return this._viewport[3]}set height(t){this._viewport[3]!==t&&(this._viewport[3]=t,this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_viewport"))}get fullWidth(){return this._viewport[2]+this._padding[1]+this._padding[3]}set fullWidth(t){this.width=t-(this._padding[1]+this._padding[3])}get fullHeight(){return this._viewport[3]+this._padding[0]+this._padding[2]}set fullHeight(t){this.height=t-(this._padding[0]+this._padding[2])}get fullViewport(){return this._fullViewport[0]=this._viewport[0]-this._padding[3],this._fullViewport[1]=this._viewport[1]-this._padding[2],this._fullViewport[2]=this.fullWidth,this._fullViewport[3]=this.fullHeight,this._fullViewport}get _aspect(){return this.width/this.height}get padding(){return this._padding}set padding(t){U(this._padding,t)||(this._viewport[0]+=t[3]-this._padding[3],this._viewport[1]+=t[2]-this._padding[2],this._viewport[2]-=t[1]+t[3]-(this._padding[1]+this._padding[3]),this._viewport[3]-=t[0]+t[2]-(this._padding[0]+this._padding[2]),H(this._padding,t),this._viewProjectionDirty=!0,this._frustumDirty=!0,this.notifyChange("_padding"),this.notifyChange("_viewport"))}get viewProjectionMatrix(){return this._viewProjectionDirty&&(p(this._viewProjectionMatrix,this.projectionMatrix,this.viewMatrix),this._viewProjectionDirty=!1),this._viewProjectionMatrix}get projectionMatrix(){return this._projectionMatrixInternal}get inverseProjectionMatrix(){return u(w(),this.projectionMatrix)||this._get("inverseProjectionMatrix")||w()}get fov(){return this._fov}set fov(t){this._fov=t,this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovX(){return J(this._fov,this.width,this.height)}set fovX(t){this._fov=K(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get fovY(){return Q(this._fov,this.width,this.height)}set fovY(t){this._fov=Z(t,this.width,this.height),this._viewProjectionDirty=!0,this._frustumDirty=!0}get distance(){return x(this.center,this.eye)}get frustum(){return this._recomputeFrustum(),this._frustum}get viewInverseTransposeMatrix(){return(this._viewInverseTransposeMatrixDirty||this._viewDirty)&&(u(this._viewInverseTransposeMatrix,this.viewMatrix),l(this._viewInverseTransposeMatrix,this._viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),this._viewInverseTransposeMatrix}depthNDCToWorld(t){const{near:i,far:e}=this;return 2*i*e/(e+i-t*(e-i))}get perRenderPixelRatio(){return Math.tan(this.fovX/2)/(this.width/2)}get perScreenPixelRatio(){return this.perRenderPixelRatio*this.pixelRatio}get aboveGround(){return null!=this.relativeElevation&&this.relativeElevation>=0}get _projectionMatrixInternal(){const t=this.width,i=this.height,e=this.near*Math.tan(this.fovY/2)*2,r=e*this._aspect,s=e/this.rows,o=r/this.columns,n=-r/2+this.column*o,h=n+o,a=-e/2+this.row*s,p=a+s,u=_(w(),n*(1+2*this._padding[3]/t),h*(1+2*this._padding[1]/t),a*(1+2*this._padding[2]/i),p*(1+2*this._padding[0]/i),this.near,this.far),l=this._get("projectionMatrix");return l&&c(l,u)?l:u}copyFrom(t){M(this._ray.origin,t.eye),this.center=t.center,this.up=t.up,H(this._viewport,t.viewport),this.notifyChange("_viewport"),H(this._padding,t.padding),this.notifyChange("_padding"),d(this._nearFar,t.nearFar),this.notifyChange("_nearFar"),this._fov=t.fov,this.row=t.row,this.column=t.column,this.rows=t.rows,this.columns=t.columns,this.relativeElevation=t.relativeElevation;const i=t;return this._viewDirty=i._viewDirty,this._viewDirty||(a(this._viewMatrix,t.viewMatrix),this.notifyChange("_viewMatrix")),this._viewProjectionDirty=!0,this._frustumDirty=i._frustumDirty,this._frustumDirty||(L(this._frustum,t.frustum),this._frustumDirty=!1),i._viewInverseTransposeMatrixDirty?this._viewInverseTransposeMatrixDirty=!0:(a(this._viewInverseTransposeMatrix,t.viewInverseTransposeMatrix),this._viewInverseTransposeMatrixDirty=!1),H(this._fullViewport,t.fullViewport),this.pixelRatio=t.pixelRatio,this}copyViewFrom(t){this.eye=t.eye,this.center=t.center,this.up=t.up,this.fov=t.fov}clone(){return(new $).copyFrom(this)}equals(t){return D(this.eye,t.eye)&&D(this.center,t.center)&&D(this.up,t.up)&&U(this._viewport,t.viewport)&&U(this._padding,t.padding)&&y(this.nearFar,t.nearFar)&&this._fov===t.fov&&this.pixelRatio===t.pixelRatio&&this.relativeElevation===t.relativeElevation&&this.row===t.row&&this.column===t.column&&this.rows===t.rows&&this.columns===t.columns}almostEquals(t){const i=Math.max(1,1/this.pixelRatio,1/t.pixelRatio);if(Math.abs(t.fov-this._fov)>=.001||z(t.screenPadding,this.screenPadding)>=i||z(this.screenViewport,t.screenViewport)>=i||this.row!==t.row||this.column!==t.column||this.rows!==t.rows||this.columns!==t.columns)return!1;j(rt,t.eye,t.center),j(st,this.eye,this.center);const e=R(rt,st),r=P(rt),s=P(st),o=5e-4;return e*e>=(1-1e-10)*r*s&&V(t.eye,this.eye)<Math.max(r,s)*o*o}computeRenderPixelSizeAt(t){return this.computeRenderPixelSizeAtDist(this._viewDirectionDistance(t))}computeRenderPixelSizeAtDist(t){return t*this.perRenderPixelRatio}computeScreenPixelSizeAt(t){return this.computeScreenPixelSizeAtDist(this._viewDirectionDistance(t))}_viewDirectionDistance(t){return Math.abs(N(this.viewForward,m(rt,t,this.eye)))}computeScreenPixelSizeAtDist(t){return t*this.perScreenPixelRatio}computeDistanceFromRadius(t,i){return t/Math.tan(Math.min(this.fovX,this.fovY)/(2*(i||1)))}getScreenCenter(t=s()){return t[0]=(this.padding[3]+this.width/2)/this.pixelRatio,t[1]=(this.padding[0]+this.height/2)/this.pixelRatio,t}getRenderCenter(t,i=.5,e=.5){return t[0]=this.padding[3]+this.width*i,t[1]=this.padding[2]+this.height*e,t[2]=.5,t}setGLViewport(t){const i=this.viewport,e=this.padding;t.setViewport(i[0]-e[3],i[1]-e[2],i[2]+e[1]+e[3],i[3]+e[0]+e[2])}applyProjection(t,i){t!==it&&M(it,t),it[3]=1,W(it,it,this.projectionMatrix);const e=Math.abs(it[3]);F(it,it,1/e);const s=this.fullViewport;i[0]=r(0,s[0]+s[2],.5+.5*it[0]),i[1]=r(0,s[1]+s[3],.5+.5*it[1]),i[2]=.5*(it[2]+1),i[3]=e}unapplyProjection(t,i){const e=this.fullViewport;it[0]=(t[0]/(e[0]+e[2])*2-1)*t[3],it[1]=(t[1]/(e[1]+e[3])*2-1)*t[3],it[2]=(2*t[2]-1)*t[3],it[3]=t[3],null!=this.inverseProjectionMatrix&&(W(it,it,this.inverseProjectionMatrix),i[0]=it[0],i[1]=it[1],i[2]=it[2])}projectToScreen(t,i){return this.projectToRenderScreen(t,ot),this.renderToScreen(ot,i),i}projectToRenderScreen(t,i){if(it[0]=t[0],it[1]=t[1],it[2]=t[2],it[3]=1,W(it,it,this.viewProjectionMatrix),0===it[3])return null;const e=it;F(e,e,1/Math.abs(it[3]));const s=this.fullViewport,o=r(0,s[0]+s[2],.5+.5*e[0]),n=r(0,s[1]+s[3],.5+.5*e[1]);return"x"in i?(i.x=o,i.y=n):(i[0]=o,i[1]=n,i.length>2&&(i[2]=.5*(e[2]+1))),i}unprojectFromScreen(t,i){return this.unprojectFromRenderScreen(this.screenToRender(t,ot),i)}unprojectFromRenderScreen(t,i){if(p(et,this.projectionMatrix,this.viewMatrix),!u(et,et))return null;const e=this.fullViewport;return it[0]=2*(t[0]-e[0])/e[2]-1,it[1]=2*(t[1]-e[1])/e[3]-1,it[2]=2*t[2]-1,it[3]=1,W(it,it,et),0===it[3]?null:(i[0]=it[0]/it[3],i[1]=it[1]/it[3],i[2]=it[2]/it[3],i)}constrainWindowSize(t,i,e,r){const s=t*this.pixelRatio,o=i*this.pixelRatio,n=Math.max(s-e/2,0),h=Math.max(this.fullHeight-o-r/2,0),a=-Math.min(s-e/2,0),p=-Math.min(this.fullHeight-o-r/2,0),u=e-a- -Math.min(this.fullWidth-s-e/2,0),l=r-p- -Math.min(o-r/2,0);return[Math.round(n),Math.round(h),Math.round(u),Math.round(l)]}computeUp(t){1===t?this._computeUpGlobal():this._computeUpLocal()}screenToRender(t,i){const e=t[0]*this.pixelRatio,r=this.fullHeight-t[1]*this.pixelRatio;return i[0]=e,i[1]=r,i}renderToScreen(t,i){const e=t[0]/this.pixelRatio,r=(this.fullHeight-t[1])/this.pixelRatio;i[0]=e,i[1]=r}sphereFrustumCoverage(t,i){const{center:e,eye:r,distance:s,fovY:o}=this,n=Math.abs(Math.PI/2-B(i,e,r));return t.frustumCoverage(n,s,o)}_computeUpGlobal(){m(rt,this.center,this.eye);const t=C(this.center);t<1?D(this._up,E)&&(M(this._up,E),this._markViewDirty(),this.notifyChange("_up")):Math.abs(R(rt,this.center))>.9999*C(rt)*t||(b(st,rt,this.center),b(st,st,rt),S(st,st),D(this._up,st)||(M(this._up,st),this.notifyChange("_up"),this._markViewDirty()))}_computeUpLocal(){T(rt,this.eye,this.center),Math.abs(rt[2])<=.9999&&(F(rt,rt,rt[2]),f(rt,-rt[0],-rt[1],1-rt[2]),S(rt,rt),D(this._up,rt)||(M(this._up,rt),this.notifyChange("_up"),this._markViewDirty()))}_compareAndSetView(t,i,r=""){"number"==typeof t[0]&&isFinite(t[0])&&"number"==typeof t[1]&&isFinite(t[1])&&"number"==typeof t[2]&&isFinite(t[2])?D(t,i)||(M(i,t),this._markViewDirty(),r.length&&this.notifyChange(r)):e.getLogger("esri.views.3d.webgl-engine.lib.RenderCamera").warn("RenderCamera vector contains invalid number, ignoring value")}_markViewDirty(){this._viewDirty=!0,this._frustumDirty=!0,this._viewProjectionDirty=!0}_recomputeFrustum(){this._frustumDirty&&(X(this.viewMatrix,this.projectionMatrix,this._frustum),this._frustumDirty=!1)}_ensureViewClean(){this._viewDirty&&(v(this._viewMatrix,this.eye,this.center,this.up),this.notifyChange("_viewMatrix"),this._viewDirty=!1,this._viewInverseTransposeMatrixDirty=!0)}};t([n()],tt.prototype,"_viewport",void 0),t([n()],tt.prototype,"_padding",void 0),t([n()],tt.prototype,"_fov",void 0),t([n()],tt.prototype,"_nearFar",void 0),t([n()],tt.prototype,"_viewDirty",void 0),t([n()],tt.prototype,"_viewMatrix",void 0),t([n()],tt.prototype,"_pixelRatio",void 0),t([n()],tt.prototype,"pixelRatio",null),t([n()],tt.prototype,"row",void 0),t([n()],tt.prototype,"column",void 0),t([n()],tt.prototype,"_rows",void 0),t([n()],tt.prototype,"rows",null),t([n()],tt.prototype,"_columns",void 0),t([n()],tt.prototype,"columns",null),t([n()],tt.prototype,"eye",null),t([n()],tt.prototype,"center",null),t([n()],tt.prototype,"_center",void 0),t([n()],tt.prototype,"up",null),t([n()],tt.prototype,"_up",void 0),t([n()],tt.prototype,"viewMatrix",null),t([n({readOnly:!0})],tt.prototype,"viewForward",null),t([n({readOnly:!0})],tt.prototype,"viewUp",null),t([n({readOnly:!0})],tt.prototype,"viewRight",null),t([n({readOnly:!0})],tt.prototype,"nearFar",null),t([n()],tt.prototype,"near",null),t([n()],tt.prototype,"far",null),t([n()],tt.prototype,"viewport",null),t([n({readOnly:!0})],tt.prototype,"screenViewport",null),t([n({readOnly:!0})],tt.prototype,"screenPadding",null),t([n()],tt.prototype,"x",null),t([n()],tt.prototype,"y",null),t([n()],tt.prototype,"width",null),t([n()],tt.prototype,"height",null),t([n()],tt.prototype,"fullWidth",null),t([n()],tt.prototype,"fullHeight",null),t([n({readOnly:!0})],tt.prototype,"_aspect",null),t([n()],tt.prototype,"padding",null),t([n({readOnly:!0})],tt.prototype,"projectionMatrix",null),t([n({readOnly:!0})],tt.prototype,"inverseProjectionMatrix",null),t([n()],tt.prototype,"fov",null),t([n()],tt.prototype,"fovX",null),t([n()],tt.prototype,"fovY",null),t([n()],tt.prototype,"viewInverseTransposeMatrix",null),t([n({readOnly:!0})],tt.prototype,"_projectionMatrixInternal",null),t([n()],tt.prototype,"relativeElevation",void 0),tt=$=t([h("esri.views.3d.webgl.RenderCamera")],tt);const it=k(),et=w(),rt=I(),st=I(),ot=o();export{tt as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{ColorConversion as o}from"./ColorConversion.glsl.js";import{oitResolution as r}from"../../../shaders/oitResolution.glsl.js";function
|
|
2
|
+
import{ColorConversion as o}from"./ColorConversion.glsl.js";import{oitResolution as r}from"../../../shaders/oitResolution.glsl.js";function l(l,c){l.include(o),l.include(r,c),l.code.add("\n vec3 emissionDimming(in vec3 srcColor, float srcAlpha) {\n vec3 color = min(srcColor + vec3(1.0 - srcAlpha), 1.0);\n float m = max(color.r, max(color.g, color.b));\n return m > 0.0 ? color / m : vec3(1.0);\n }\n ")}export{l as emissionDimming};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as s,filterInPlace as o}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{getOrCreateMapValue as n}from"../../../../../core/MapUtils.js";import{NestedMap as r}from"../../../../../core/NestedMap.js";import{nullUid as a}from"../../../../../core/uid.js";import{property as i,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{assert as c}from"../../lib/Util.js";import{bufferRangePool as f,mergeAdjacentRanges as u}from"./BufferRange.js";import{PerBaseInstanceData as d}from"./PerBaseInstanceData.js";import{PerBufferData as h,hasVao as m}from"./PerBufferData.js";import{PerOriginData as p}from"./PerOriginData.js";import{VaoWriter as g}from"./VaoWriter.js";let y=class extends t{constructor(e){super(e),this._vaoWriter=null,this._useMetalWorkaround=!1,this._hasOccludees=!1}destroy(){for(const e of this.dataByBaseInstance.values()){for(const t of e.dataByOrigin.values())for(const e of t.buffers)this._vaoWriter?.deleteBuffer(e);e.dispose()}this.dataByBaseInstance.clear(),this.uninitializeRenderContext()}initializeRenderContext(e){this._useMetalWorkaround=e.renderContext.rctx.isAssumedMetalDriver,this._vaoWriter=new g(this.material,e.renderContext.rctx)}uninitializeRenderContext(){this._useMetalWorkaround=!1,this._vaoWriter=null}get hasOccludees(){return this._hasOccludees}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())if(t.buffers.some(e=>e.holes.geometry.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const o of this.dataByBaseInstance.values())for(const n of o.dataByOrigin.values()){const r=new Array;for(let t=0;t<n.buffers.length&&!e.done;){const o=n.buffers[t];o.holes.geometry.length<=1?++t:(o.instances.forEach(({geometry:e})=>r.push(e)),this._vaoWriter?.deleteBuffer(o),s(n.buffers,o,void 0,{last:t}),e.madeProgress())}if(r.length>0){const{baseInstanceData:e}=o;n.buffers
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as s,filterInPlace as o}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{getOrCreateMapValue as n}from"../../../../../core/MapUtils.js";import{NestedMap as r}from"../../../../../core/NestedMap.js";import{nullUid as a}from"../../../../../core/uid.js";import{property as i,subclass as l}from"../../../../../core/accessorSupport/decorators.js";import{assert as c}from"../../lib/Util.js";import{bufferRangePool as f,mergeAdjacentRanges as u}from"./BufferRange.js";import{PerBaseInstanceData as d}from"./PerBaseInstanceData.js";import{PerBufferData as h,hasVao as m}from"./PerBufferData.js";import{PerOriginData as p}from"./PerOriginData.js";import{VaoWriter as g}from"./VaoWriter.js";let y=class extends t{constructor(e){super(e),this._vaoWriter=null,this._useMetalWorkaround=!1,this._hasOccludees=!1}destroy(){for(const e of this.dataByBaseInstance.values()){for(const t of e.dataByOrigin.values())for(const e of t.buffers)this._vaoWriter?.deleteBuffer(e);e.dispose()}this.dataByBaseInstance.clear(),this.uninitializeRenderContext()}initializeRenderContext(e){this._useMetalWorkaround=e.renderContext.rctx.isAssumedMetalDriver,this._vaoWriter=new g(this.material,e.renderContext.rctx)}uninitializeRenderContext(){this._useMetalWorkaround=!1,this._vaoWriter=null}get hasOccludees(){return this._hasOccludees}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())if(t.buffers.some(e=>e.holes.geometry.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const o of this.dataByBaseInstance.values())for(const n of o.dataByOrigin.values()){const r=new Array;for(let t=0;t<n.buffers.length&&!e.done;){const o=n.buffers[t];o.holes.geometry.length<=1?++t:(o.instances.forEach(({geometry:e})=>r.push(e)),this._vaoWriter?.deleteBuffer(o),s(n.buffers,o,void 0,{last:t}),e.madeProgress())}if(r.length>0){const{baseInstanceData:e}=o;for(const t of n.buffers)this._applyAdds(e,t,r),t.updateDirtyDrawCommands(this.highlightOrderMap);const s=null!=e;for(;r.length>0;)n.buffers.push(this._applyAndRebuild(e,new h(s,this._vaoWriter.targetBuffers),r,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e;for(const t of this.dataByBaseInstance.values())for(const s of t.dataByOrigin.values())for(const t of s.buffers)t.updateHighlights(e)}_applyUpdates(e,t){const o=this._vaoWriter;if(null==o)return void e.clearUpdates();let n;const r=this._useMetalWorkaround?(e,t)=>{n??=new Map;let s=n.get(t);s||(s=[],n.set(t,s)),s.push(e)}:(e,t)=>o.updateInstance(e,t);for(const i of e.updates){if(t.done)return;const{renderGeometry:o,updateType:n}=i;s(e.pending.updates,i),t.madeProgress();const l=this.dataByBaseInstance.get(o.geometry.baseGeometry?.id??a),c=l?.dataByOrigin.get(o.localOrigin.id)?.findBuffer(o.id);if(null==c)return;const f=c.instances.get(o.id);6&n&&r(f,c),25&n&&(c.drawCommandsDirty=!0)}n&&o.updateInstancesMetal(n)}_computeDeltas(e,t){const s=new Map;for(const o of e){const e=o.localOrigin;if(null==e)continue;const t=o.geometry.baseGeometry,r=n(s,t??null,_);let a=r.get(e,null);null==a&&(a=new v(e.vec3,t),r.set(e,null,a)),a.changes.push(o)}for(const o of t){const e=o.localOrigin;if(null==e)continue;const t=o.geometry.baseGeometry,r=this.dataByBaseInstance.get(t?.id??a),i=r?.dataByOrigin.get(e.id)?.findBuffer(o.id);if(null==i)continue;const l=n(s,t??null,_);let c=l.get(e,i);null==c&&(c=new v(e.vec3,t),l.set(e,i,c)),c.changes.push(o)}return s}_applyAddsAndRemoves(e){const{_vaoWriter:t,dataByBaseInstance:o}=this;if(null==t)return void e.clearAddsAndRemoves();const r=this._computeDeltas(e.adds,e.removes);for(const[i,l]of r){const e=n(o,i?.id??a,()=>new d(t.createBaseInstanceData(i)));for(const[o,r]of l.outerMap()){const a=r.get(null),i=a?.changes??[];l.delete(o,null);const f=n(e.dataByOrigin,o.id,()=>new p(o.vec3));for(const[n,u]of r){if(l.delete(o,n),null==n&&c(!1,"No VAO for removed geometries"),n.instances.size===u.changes.length){t.deleteBuffer(n),s(f.buffers,n),0===f.buffers.length&&0===i.length&&e.dataByOrigin.delete(o.id);continue}switch(t.evaluateBufferAllocation(n.numElements.geometry,i,u.changes,n)){case 0:u.changes.forEach(({id:e})=>n.deleteInstance(e)),n.instances.forEach(({geometry:e})=>i.push(e)),t.deleteBuffer(n),s(f.buffers,n);break;case 1:this._applyAndRebuild(e.baseInstanceData,n,i,u);break;case 2:this._applyRemoves(n,u)}}if(i.length>0){const{baseInstanceData:s}=e,o=null!=s;for(const e of f.buffers)this._applyAdds(s,e,i);const{targetBuffers:n}=t;for(;i.length>0;)f.buffers.push(this._applyAndRebuild(s,new h(o,n),i,null))}}0===e.dataByOrigin.size&&(e.dispose(),o.delete(e.id))}e.clearAddsAndRemoves()}_updateDrawCommands(){this._hasOccludees=!1;for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())for(const e of t.buffers)e.updateDirtyDrawCommands(this.highlightOrderMap),this._hasOccludees||=e.hasOccludees}_applyAndRebuild(e,t,s,o){if(o)for(const c of o.changes)t.deleteInstance(c.id);const n=this._vaoWriter,{targetBuffers:r}=n,a={},i={};for(const c of r)a[c]=n.maxElements(c),i[c]=t.numElements[c];for(;s.length>0;){const e=s.pop(),o={};for(const t of r)o[t]=n.elementCount(e.geometry,t);if(r.some(e=>i[e]+o[e]>a[e]&&i[e]>0)){s.push(e);break}for(const t of r)i[t]+=o[t];t.createInstance(e,this.highlightOrderMap)}t.resetInstanceSummary(),n.reallocateBuffer(e,t,i);const l=n.rebuildInstances(i,t.writeableInstances.values(),t);t.updateInstances(),t.clearHoles();for(const c of r)t.holes[c].push(f.acquire(l[c],t.endElements[c]));return t.updateDrawCommands(this.highlightOrderMap),t}_applyRemoves(e,t){const{_vaoWriter:s}=this;if(0===t.changes.length||null==s)return;const{targetBuffers:o}=s,n={},r={};for(const a of o)n[a]=[],r[a]=f.acquire(1/0,-1/0);for(const a of t.changes){const t=a.id,s=e.instances.get(t);if(s){if(this._useMetalWorkaround)for(const e of o){const t=s.targetRanges[e],o=r[e];o.from=Math.min(o.from,t.from),o.to=Math.max(o.to,t.to)}for(const e of o){const t=s.targetRanges[e],o=n[e],r=o.at(-1);r?.to===t.from?r.to=t.to:r?.from===t.to?r.from=t.from:o.push(f.acquire(t.from,t.to))}e.deleteInstance(t)}}for(const a of o)u(n[a]);this._useMetalWorkaround?s.clearHolesMetal(e.instances.values(),r,e):s.clearHoles(n,e);for(const a of o)f.release(r[a]);for(const a of o){const t=e.holes[a];for(const e of n[a])t.push(e)}e.drawCommandsDirty=!0}_applyAdds(e,t,s){if(0===s.length||null==this._vaoWriter)return;if(!m(t))return void this._applyAndRebuild(e,t,s,null);const n=this._vaoWriter,{targetBuffers:r}=n,a={};for(const o of r){const e=t.numElements[o],r=s.reduce((e,{geometry:t})=>e+n.elementCount(t,o),0);a[o]=Math.min(e+r,n.maxElements(o))}if(n.canGrow(t,a))return void this._applyAndRebuild(e,t,s,null);t.mergeHoles();const i={},l={};for(const o of r)i[o]=[],l[o]=f.acquire(1/0,-1/0);for(const{geometry:o}of s){const e={},s={};for(const a of r)e[a]=n.elementCount(o,a),s[a]=B(t.holes[a],e[a]);if(r.every(e=>null!=s[e]))for(const t of r){const o=s[t];if(i[t].push(o),this._useMetalWorkaround){const s=l[t];s.from=Math.min(s.from,o),s.to=Math.max(s.to,o+e[t])}}else for(const t of r)i[t].push(null)}const c=this._addInstances(s,t,i);if(this._useMetalWorkaround){if(r.some(e=>!Number.isFinite(l[e].from)||!Number.isFinite(l[e].to)))return;for(const e of c);n.writeInstanceRangeMetal(l,t.instances.values(),t)}else n.writeRandomInstances(a,c,t);o(s,(e,t)=>r.some(e=>null==i[e][t]))}*_addInstances(e,t,s){const o=e.length,n=this._vaoWriter,{targetBuffers:r}=n;for(let a=0;a<o;++a){const o=e[a];if(r.some(e=>null==s[e][a]))continue;const i={};for(const e of r){const t=s[e][a];i[e]=f.acquire(t,t+n.elementCount(o.geometry,e))}const l=t.createInstance(o,this.highlightOrderMap,i);t.drawCommandsDirty=!0,yield l}}static prune(){g.prune()}get test(){}};e([i({constructOnly:!0})],y.prototype,"dataByBaseInstance",void 0),e([i({constructOnly:!0})],y.prototype,"material",void 0),e([i()],y.prototype,"highlightOrderMap",void 0),y=e([l("esri.views.3d.webgl-engine.materials.renderers.MergedBuffer")],y);class v{constructor(e,t){this.origin=e,this.baseInstance=t,this.changes=new Array}}function B(e,t){if(0===t)return 0;const o=e.find(e=>e.numElements>=t);if(null==o)return null;const n=o.from;return o.from+=t,o.numElements<=0&&(s(e,o),f.release(o)),n}function _(){return new r}export{y as MergedBuffer};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{isColor as o,isOITColorAlpha as i,isOITFrontFace as l}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as r}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as s}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as a}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{emissionDimming as e}from"../core/shaderLibrary/util/EmissionDimming.glsl.js";import{If as n,glsl as t}from"../core/shaderModules/glsl.js";import{alphaCutoff as f}from"./alphaCutoff.glsl.js";import{ditherNoise as m}from"./ditherNoise.glsl.js";import{oitResolution as u}from"./oitResolution.glsl.js";function
|
|
3
|
-
void outputColorHighlightOLID(vec4 finalColor, vec3 emissiveSymbolColor ${n(
|
|
2
|
+
import{isColor as o,isOITColorAlpha as i,isOITFrontFace as l}from"../core/shaderLibrary/ShaderOutput.js";import{Emissions as r}from"../core/shaderLibrary/output/Emissions.glsl.js";import{OutputHighlight as s}from"../core/shaderLibrary/output/OutputHighlight.glsl.js";import{ColorConversion as a}from"../core/shaderLibrary/util/ColorConversion.glsl.js";import{emissionDimming as e}from"../core/shaderLibrary/util/EmissionDimming.glsl.js";import{If as n,glsl as t}from"../core/shaderModules/glsl.js";import{alphaCutoff as f}from"./alphaCutoff.glsl.js";import{ditherNoise as m}from"./ditherNoise.glsl.js";import{oitResolution as u}from"./oitResolution.glsl.js";function g(g,d){g.include(s,d),g.include(r,d);const{fragment:p,outputs:c}=g;p.include(a);const{output:C,hasEmission:h,oitPremultipliedAlpha:b,snowCover:E,emissionDimmingPass:v,renderOccluded:y}=d,j=11===C,O=i(C),$=l(C),A=o(C)&&!O,L=0!==C||y;let S=0;(A||O)&&c.add("fragColor","vec4",S++),O&&c.add("fragAlpha","float",S++),h&&c.add("fragEmission","vec4",S++),p.include(a),p.include(f),p.include(u,d),p.include(m,d),v&&p.include(e,d),p.code.add(t`
|
|
3
|
+
void outputColorHighlightOLID(vec4 finalColor, vec3 emissiveSymbolColor ${n(E,", float snow")}) {
|
|
4
4
|
${n(j,"finalColor.a = 1.0;")}
|
|
5
5
|
${n(L,"if (finalColor.a < alphaCutoff) discard;")}
|
|
6
6
|
|
|
7
7
|
${n(O,`float noise = ditherNoise(finalColor);\n fragColor = ${n(b,"finalColor","premultiplyAlpha(finalColor)")};\n fragColor.rgb = fragColor.rgb * floatBlendOutputScale + noise;\n fragAlpha = finalColor.a * floatBlendOutputScale + noise;\n `)}
|
|
8
8
|
${n($&&b,"finalColor.rgb /= finalColor.a;")}
|
|
9
9
|
${n(A,"fragColor = finalColor;")}
|
|
10
|
-
${n(h,
|
|
10
|
+
${n(h,v?"fragEmission = vec4(emissionDimming(premultiplyAlpha(finalColor).rgb, finalColor.a), 0.0);":`fragEmission = ${n(E,"mix(finalColor.a * getEmissions(emissiveSymbolColor), vec4(0.0), snow);","finalColor.a * getEmissions(emissiveSymbolColor);")}\n float emissionNoise = ditherNoise(fragEmission);\n fragEmission.rgb = fragEmission.rgb * floatBlendOutputScale + emissionNoise;\n fragEmission.a = finalColor.a;\n fragEmission = premultiplyAlpha(fragEmission);\n `)}
|
|
11
11
|
calculateOcclusionAndOutputHighlight();
|
|
12
12
|
${n(j,"outputObjectAndLayerIdColor();")}
|
|
13
13
|
}
|
|
14
|
-
`)}export{
|
|
14
|
+
`)}export{g as outputColorHighlightOLID};
|
package/views/PopupView.d.ts
CHANGED
|
@@ -127,6 +127,9 @@ export abstract class PopupView {
|
|
|
127
127
|
* an end user's click location. This method allows a developer to
|
|
128
128
|
* control how the input location is handled, and then subsequently, what to do with the results.
|
|
129
129
|
*
|
|
130
|
+
* > [!WARNING]
|
|
131
|
+
* > Using [ScreenRect](https://developers.arcgis.com/javascript/latest/references/core/core/types/#ScreenRect) as the hit target is considered **[beta](https://developers.arcgis.com/javascript/latest/faq/#what-does-the-beta-tag-mean)** functionality.
|
|
132
|
+
*
|
|
130
133
|
* @param hitTarget
|
|
131
134
|
* @param options
|
|
132
135
|
* @returns An async generator of features ready to be displayed by the popup,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import
|
|
2
|
+
import{createArcadeProfile as e,createArcadeExecutor as t}from"../../../../arcade.js";import r from"../../../../core/Error.js";import o from"../../../../core/Logger.js";import{getEffectiveFieldAlias as n}from"../../../../editing/fieldUtils.js";import i from"../../../../form/ExpressionInfo.js";import s from"../../../../form/elements/AttachmentElement.js";import{isMultipleChoiceInput as a}from"../../../../form/elements/inputs/inputUtils.js";import{isAttachmentElement as l,isFieldElement as m,isGroupElement as c,isRelationshipElement as d,isTextElement as p,isUtilityNetworkAssociationsElement as f}from"../../../../form/support/formUtils.js";import{getLowerCaseEditTrackingFields as u,isFieldVisibleByDefault as x}from"../../../../layers/support/fieldUtils.js";import{isNumber as y}from"../../../../support/guards.js";import{layerSupportsQueryAttachments as h,getLayerTimeZone as E}from"../../batchAttributeFormUtils.js";import{makeExpressionInfosMap as w,makeExecutorSetForFormElement as T}from"../../expressions/expressionUtils.js";import{AttachmentElementTemplate as v}from"../AttachmentElementTemplate.js";import b from"../BatchFormTemplate.js";import{FieldElementTemplate as I}from"../FieldElementTemplate.js";import{GroupElementTemplate as j}from"../GroupElementTemplate.js";import{RelationshipElementTemplate as P}from"../RelationshipElementTemplate.js";import{TextElementTemplate as g}from"../TextElementTemplate.js";import{UtilityNetworkAssociationsElementTemplate as Z}from"../UtilityNetworkAssociationsElementTemplate.js";import{isGroupElementTemplate as F}from"./templateUtils.js";import{compileTextElementMarkdownToHTML as A}from"./textElementTemplateUtils.js";const U="expression/dea57012-47ca4b55a000-8df62742ed0c",C=e("form-attachment-filename-calculation"),L=()=>o.getLogger("esri.widgets.BatchAttributeForm.templates.templateUtils");async function B(e,t,r=e.formTemplate){return await e.load(),r?.elements&&r.elements.length>0?S(r,e,t):H(e,t)}async function H(e,{arcadeExecutorProvider:t,attachmentsEnabled:r,formTimeZone:o}){const n=new Set(u(e)),i={arcadeExecutorProvider:t,formTimeZone:o,layer:e},s=[];for(const l of e.fields)z(l,e,n)&&s.push(q(l,i));const a=await Promise.all(s);return r&&await R(a,{arcadeExecutorProvider:t,expressionInfos:w(void 0),layer:e}),new b({elements:a,title:e.formTemplate?.title,preserveFieldValuesWhenHidden:!0})}function N(e,t){for(const r of e??[])if("group"!==r.type){if("field"===r.type&&!1===r.editable&&!r.editableExpression)return!0}else if(N(r.elements??[]))return!0;return!1}async function R(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:o}){if(!h(o))return;const n=await V(new s({displayFilename:!0}),{arcadeExecutorProvider:t,expressionInfos:r,layer:o});e.push(n)}async function S(e,t,r){let o=null;N(e.elements??[])&&(o=new i({title:"",name:U,expression:"false"}));const n=w(o?[...e.expressionInfos??[],o]:e.expressionInfos),s={description:e.description,elements:new Array,title:e.title,preserveFieldValuesWhenHidden:e.preserveFieldValuesWhenHidden,supportsAttachmentElements:e.supportsAttachmentElements},{elements:a}=e;if(!a)return new b(s);let l=!1;const{arcadeExecutorProvider:m,formTimeZone:c}=r;for(const i of a){const e=await W(i,{arcadeExecutorProvider:m,expressionInfos:n,layer:t,formTimeZone:c});if(e){if(s.elements.push(e),l)continue;"attachment"===e.type&&(l=!0),F(e)&&e.elements.some(e=>("attachment"===e.type&&(l=!0),l))}}return e.supportsAttachmentElements||!r.attachmentsEnabled||l||await R(s.elements,{arcadeExecutorProvider:m,expressionInfos:n,layer:t}),new b(s)}async function V(e,{arcadeExecutorProvider:r,expressionInfos:o,layer:n}){let i=null;if(e.filenameExpression)try{i=await t(e.filenameExpression,C)}catch(l){L().error("Failed to compile attachment filename expression",l)}const s=new v({allowUserRename:e.allowUserRename,attachmentKeyword:e.attachmentKeyword,description:e.description,displayFilename:e.displayFilename,filenameExpressionExecutor:i,input:e.input,label:e.label,maxAttachmentCount:e.maxAttachmentCount,minAttachmentCount:e.minAttachmentCount,useOriginalFilename:e.useOriginalFilename}),a=await T({element:e,expressionInfos:o,provider:r});return s.addLayer(n,a),s}async function W(e,t){return l(e)?V(e,{arcadeExecutorProvider:t.arcadeExecutorProvider,expressionInfos:t.expressionInfos,layer:t.layer}):m(e)?k(e,t):c(e)?K(e,t):d(e)?O(e,t):p(e)?G(e,t):f(e)?$(e,t):null}async function k(e,{arcadeExecutorProvider:t,expressionInfos:o,layer:n,formTimeZone:i}){const{fieldsIndex:s}=n,{description:l,domain:m,fieldName:c,hint:d,input:p,label:f}=e;if(null==c||!s.has(c))return L().warn(new r("batch-attribute-form:invalid-form-element-field",`Field element with label '${f}' does not refer to a valid field`)),null;if(!1!==e.editable||e.editableExpression||((e=e.clone()).editableExpression=U),p&&a(p)&&p.otherChoice){const e=p.otherChoice.fieldName,t=s.get(e);t&&t.name!==e&&(p.otherChoice=p.otherChoice.clone(),p.otherChoice.fieldName=t.name)}const u=new I({description:l,domain:m,field:s.get(c),hint:d,input:p,formTimeZone:i,layerTimeZone:E(n),label:f}),x=await T({element:e,expressionInfos:o,provider:t});return u.addLayer(n,x),u}async function K(e,t){const{arcadeExecutorProvider:r,expressionInfos:o,layer:n}=t,{description:i,label:s,initialState:a}=e,l=[];for(const d of e.elements){const e=await W(d,t);e&&l.push(e)}const m=new j({description:i,elements:l,label:s,initialState:a??"expanded"}),c=await T({element:e,expressionInfos:o,provider:r});return m.addLayer(n,c),m}async function O(e,t){const{description:r,label:o,displayCount:n,displayType:i,orderByFields:s,relationshipId:a}=e,{arcadeExecutorProvider:l,expressionInfos:m,layer:c,formTimeZone:d}=t,p=new P({description:r,...y(n)&&{displayCount:n},displayType:i,formTimeZone:d,label:o,layerTimeZone:E(c),orderByFields:s,relationshipId:a}),f=await T({element:e,expressionInfos:m,provider:l});return p.addLayer(c,f),p}async function G(e,{arcadeExecutorProvider:t,expressionInfos:r,layer:o,formTimeZone:n}){const{description:i,label:s,text:a,textFormat:l}=e,{fieldsIndex:m}=o,c=a&&"markdown"===l?await A(a):a,d=new g({compiledText:c,description:i,fieldsIndex:m,formTimeZone:n,label:s,layerTimeZone:E(o)}),p=await T({element:e,expressionInfos:r,provider:t}),{expressionParts:f}=d;if(f.length){const e=await Promise.all(f.map(e=>{const o=r.get(e)?.expression??e;return t.getArcadeExecutor(o)}));p.textExpressions=e}return d.addLayer(o,p),d}async function $(e,t){const{associationTypes:r,description:o,label:n}=e,{arcadeExecutorProvider:i,expressionInfos:s,formTimeZone:a,layer:l}=t,m=new Z({associationTypes:r,description:o,formTimeZone:a,label:n,layerTimeZone:E(l)}),c=await T({element:e,expressionInfos:s,provider:i});return m.addLayer(l,c),m}async function q(e,{arcadeExecutorProvider:t,layer:r,formTimeZone:o}){const i=n(e,r)||e.name,s=new I({field:e,formTimeZone:o,label:i,layerTimeZone:E(r)}),a={};return e.editable&&r.userHasUpdateItemPrivileges&&(a.editableExpression=await t.getArcadeExecutor("true")),s.addLayer(r,a),s}function z(e,t,r){return!r.has(e.name.toLowerCase())&&x(e,t)}export{B as createBatchFormTemplate,H as createBatchFormTemplateFromFields};
|
|
@@ -393,13 +393,6 @@ export type AssociationsLayerUnion = FeatureLayer | SubtypeSublayer;
|
|
|
393
393
|
*/
|
|
394
394
|
export interface FooterButtonInfo {}
|
|
395
395
|
|
|
396
|
-
/**
|
|
397
|
-
* Configuration information needed to render a notice in the BatchAttributeForm footer.
|
|
398
|
-
*
|
|
399
|
-
* @internal
|
|
400
|
-
*/
|
|
401
|
-
export interface FooterNoticeInfo {}
|
|
402
|
-
|
|
403
396
|
/**
|
|
404
397
|
* Valid types of pages that can be displayed by the Batch Attribute Form.
|
|
405
398
|
*
|