@arcgis/core 6.0.0-next.25 → 6.0.0-next.27
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/{6f1d6453184e0a1530ad.js → 00580a68835aac653038.js} +22 -22
- package/assets/esri/core/workers/chunks/0363d29fc665d169ebc4.js +1 -0
- package/assets/esri/core/workers/chunks/037c67ef5c4398d5954d.js +1 -0
- package/assets/esri/core/workers/chunks/07b726a46864501b90a0.js +1 -0
- package/assets/esri/core/workers/chunks/0864da8f8f147016cf1c.js +1 -0
- package/assets/esri/core/workers/chunks/0bd04bcd4b2710838d48.js +1 -0
- package/assets/esri/core/workers/chunks/{768389f7f8dba6080df7.js → 0cc7fba402a93e6d2455.js} +2 -2
- package/assets/esri/core/workers/chunks/0cfdeb53fb7d5532cf01.js +1 -0
- package/assets/esri/core/workers/chunks/112ed86f812e4400a7e0.js +1 -0
- package/assets/esri/core/workers/chunks/177f353ce72133e2eeed.js +1 -0
- package/assets/esri/core/workers/chunks/1dc6f093028530a492e6.js +1 -0
- package/assets/esri/core/workers/chunks/2294254af2c6afb560ee.js +1 -0
- package/assets/esri/core/workers/chunks/23a4806b4cdf7cc32e4d.js +1 -0
- package/assets/esri/core/workers/chunks/2447d2e2a4a3ab8fcf94.js +1 -0
- package/assets/esri/core/workers/chunks/271ae7deccb94112c2df.js +1 -0
- package/assets/esri/core/workers/chunks/2df37a9a95ceebb87a5f.js +1 -0
- package/assets/esri/core/workers/chunks/2e00c155e447e4930442.js +1 -0
- package/assets/esri/core/workers/chunks/2e9a1673b1d51aa082b6.js +1 -0
- package/assets/esri/core/workers/chunks/344f5334ad95c7974349.js +1 -0
- package/assets/esri/core/workers/chunks/348f1def9cd2ddf92e87.js +1 -0
- package/assets/esri/core/workers/chunks/{8e4206068c6953bb7df2.js → 3a47fc97c400fca2c736.js} +1 -1
- package/assets/esri/core/workers/chunks/47c97640ec525676918b.js +1 -0
- package/assets/esri/core/workers/chunks/50763ea061d5fb3f2e49.js +1 -0
- package/assets/esri/core/workers/chunks/518ab22f80c3300bcfff.js +1 -0
- package/assets/esri/core/workers/chunks/58609bf94f72bc4f1952.js +1 -0
- package/assets/esri/core/workers/chunks/586a929bc037e23857af.js +1 -0
- package/assets/esri/core/workers/chunks/58d10e0b35968680fd9f.js +1 -0
- package/assets/esri/core/workers/chunks/59bc55880e6fd8ce20c0.js +1 -0
- package/assets/esri/core/workers/chunks/62a0abcf45a2bd14ecbe.js +1 -0
- package/assets/esri/core/workers/chunks/63c4412c16d8a44a5668.js +1 -0
- package/assets/esri/core/workers/chunks/6b4c3411f63a9ad9354c.js +1 -0
- package/assets/esri/core/workers/chunks/{f528ac5c648ca6a98582.js → 711cfb84659cb4437679.js} +1 -1
- package/assets/esri/core/workers/chunks/77463141652bf1ca6fb2.js +1 -0
- package/assets/esri/core/workers/chunks/7d3f7940815fa5dc244e.js +1 -0
- package/assets/esri/core/workers/chunks/914a0b5d9fef683cdf9c.js +1 -0
- package/assets/esri/core/workers/chunks/96f87c8efd4b11b37686.js +1 -0
- package/assets/esri/core/workers/chunks/97ec46605f16333144b7.js +1 -0
- package/assets/esri/core/workers/chunks/{7b482afb9fd1229f5707.js → 9934e8e19f94e9169eea.js} +1 -1
- package/assets/esri/core/workers/chunks/99f51d5d9da6e9bfc430.js +1 -0
- package/assets/esri/core/workers/chunks/9aebe876b1a2fb075f9c.js +1 -0
- package/assets/esri/core/workers/chunks/9c3db7a7c05fa0e81f0a.js +1 -0
- package/assets/esri/core/workers/chunks/a2cc53ad1a514167e4b8.js +1 -0
- package/assets/esri/core/workers/chunks/a33ba23aee3f8f40200f.js +1 -0
- package/assets/esri/core/workers/chunks/{45ba4aa87a4732198596.js → b13d8f4e4e80ef00b1bd.js} +1 -1
- package/assets/esri/core/workers/chunks/b3801d58c024224917df.js +1 -0
- package/assets/esri/core/workers/chunks/b3aa29589dcfb5b93106.js +1 -0
- package/assets/esri/core/workers/chunks/b3dbcf43f136ba2dadc5.js +1 -0
- package/assets/esri/core/workers/chunks/b9596d862da1ec342cd3.js +1 -0
- package/assets/esri/core/workers/chunks/bc1fcc9c897461e68e29.js +1 -0
- package/assets/esri/core/workers/chunks/{8b4e9fd88c0c313416d4.js → be04f40f8b403befd0ef.js} +1 -1
- package/assets/esri/core/workers/chunks/c29091fe157564cffcf7.js +1 -0
- package/assets/esri/core/workers/chunks/{150e7a7bd5df25693da7.js → c90388932a7825d9d933.js} +1 -1
- package/assets/esri/core/workers/chunks/ca21786e519c914fc9e1.js +1 -0
- package/assets/esri/core/workers/chunks/cdb5c26fed7d9a97db49.js +1 -0
- package/assets/esri/core/workers/chunks/cdf0c7706d3e1221f49b.js +1 -0
- package/assets/esri/core/workers/chunks/d63e181f0e48bde73395.js +1 -0
- package/assets/esri/core/workers/chunks/d77888c84a8b49478807.js +1 -0
- package/assets/esri/core/workers/chunks/d7f2f1708d2a2668676c.js +1 -0
- package/assets/esri/core/workers/chunks/ec1c4d66142b6efb0e8b.js +1 -0
- package/assets/esri/core/workers/chunks/ef2c3febcceedc44b3ac.js +1 -0
- package/assets/esri/core/workers/chunks/f08a2a262a3b55149396.js +1 -0
- package/assets/esri/core/workers/chunks/f2d56f5c15d5977e1d19.js +1 -0
- package/assets/esri/core/workers/chunks/ffe2077a9df7c838ea27.js +1 -0
- package/assets/esri/layers/raster/formats/lerc-wasm.wasm +0 -0
- package/chunks/GlobalIllumination.glsl.js +15 -30
- package/chunks/RibbonLine.glsl.js +2 -2
- package/config.js +1 -1
- package/core/ReentrantObjectPool.js +1 -1
- package/core/memoryEstimations.js +1 -1
- package/core/workers/workers.js +2 -2
- package/core/workers.d.ts +1 -1
- package/form/elements/inputs.d.ts +126 -25
- package/form/elements/inputs.js +1 -1
- package/form/elements.d.ts +1 -0
- package/geometry/support/Indices.js +1 -1
- package/graphic/MapNotesGraphicOrigin.d.ts +1 -0
- package/kernel.js +1 -1
- package/layers/GeospatialPDFLayer.js +1 -1
- package/layers/MapNotesLayer.d.ts +3 -2
- package/layers/VectorTileLayer.d.ts +10 -1
- package/layers/buildingSublayers/BuildingGroupSublayer.d.ts +2 -1
- package/layers/geospatialPDF/CIM2DLayerview.js +2 -0
- package/layers/geospatialPDF/GeospatialPDFFrame.js +1 -1
- package/layers/graphics/sources/support/ParquetSourceWorker.js +1 -1
- package/layers/mixins/SublayersOwner.js +1 -1
- package/layers/orientedImagery/transformations/imageToWorld.js +1 -1
- package/layers/orientedImagery/transformations/rectifyMapPoint.js +1 -1
- package/layers/support/Sublayer.d.ts +2 -2
- package/layers/support/Sublayer.js +1 -1
- package/layers/support/SubtypeSublayer.js +1 -1
- package/layers/support/layerUtils.js +1 -1
- package/package.json +3 -3
- package/rest/support/AttributeBinsQuery.d.ts +3 -2
- package/rest/support/ImageGPSInfoParameters.d.ts +2 -1
- package/rest/support/OutDistance.d.ts +2 -1
- package/rest/support/Query.d.ts +3 -2
- package/rest/support/TopFeaturesQuery.d.ts +2 -1
- package/rest/support/types.d.ts +10 -1
- package/smartMapping/raster/renderers/flow.d.ts +2 -1
- package/smartMapping/renderers/color.d.ts +11 -8
- package/smartMapping/renderers/location.d.ts +7 -4
- package/smartMapping/renderers/predominance.d.ts +7 -4
- package/smartMapping/renderers/relationship.d.ts +7 -4
- package/smartMapping/renderers/size.d.ts +6 -4
- package/smartMapping/renderers/type.d.ts +7 -4
- package/smartMapping/renderers/types.d.ts +15 -0
- package/smartMapping/renderers/univariateColorSize.d.ts +4 -2
- package/smartMapping/symbology/flow.d.ts +2 -1
- package/smartMapping/symbology/types.d.ts +2 -1
- package/symbols/cim/CIMCursor.js +1 -1
- package/tables/elements.d.ts +1 -0
- package/views/2d/engine/vectorTiles/TileHandler3D.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/animated/AnimatedMarkerMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/mesh/MeshWriterVertexPack.js +1 -1
- package/views/2d/engine/webgl/textureUtils.js +1 -1
- package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
- package/views/2d/layers/MediaLayerView2D.js +1 -1
- package/views/2d/layers/TileLayerView2D.js +1 -1
- package/views/3d/layers/GeospatialPDFLayerView3D.js +1 -1
- package/views/3d/layers/ImageryTileLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DBufferGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DDrapedGraphicLayerBase.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DFeatureStore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphic.js +1 -1
- package/views/3d/layers/graphics/Graphics3DGraphicCreationContext.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLodInstanceGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DStageObjectGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbol.js +1 -1
- package/views/3d/layers/graphics/Labeler.js +1 -1
- package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
- package/views/3d/layers/support/StageLayerElevationProvider.js +1 -1
- package/views/3d/layers/support/featureReference.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainData.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TextureFader.js +1 -1
- package/views/3d/terrain/TextureReference.js +1 -1
- package/views/3d/terrain/TileCompositor.js +1 -1
- package/views/3d/terrain/TileRenderInfo.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/terrain/terrainUtils.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +25 -25
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIllumination.js +1 -1
- package/views/3d/webgl-engine/effects/globalIllumination/GlobalIlluminationTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/BufferGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/BufferObject3D.js +1 -1
- package/views/3d/webgl-engine/lib/DirtyEvents.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/ManagedTexture.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/TextureBackedBuffer/TextureBuffer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/geometryMemoryUtils.js +2 -0
- package/views/VideoView.js +1 -1
- package/views/selection/SelectionOperation.js +1 -1
- package/views/selection/types.d.ts +43 -3
- package/views/support/layerViewUtils.js +1 -1
- package/views/support/selectionUtils.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
- package/widgets/OrientedImageryViewer/services/SuperimposeService.js +1 -1
- package/widgets/OrientedImageryViewer.js +2 -2
- package/widgets/Print.js +1 -1
- package/widgets/support/SelectionList/GroupLayerItem.d.ts +6 -0
- package/widgets/support/SelectionList/GroupLayerItem.js +1 -1
- package/widgets/support/SelectionList/ItemBase.js +1 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.d.ts +6 -1
- package/widgets/support/SelectionToolbar/SelectionToolbarViewModel.js +1 -1
- package/widgets/support/SelectionToolbar.d.ts +8 -1
- package/widgets/support/SelectionToolbar.js +1 -1
- package/widgets/support/Selector2D/selectorUtils.js +1 -1
- package/assets/esri/core/workers/chunks/0320cbd825f9a4222042.js +0 -1
- package/assets/esri/core/workers/chunks/067de1910190da228291.js +0 -1
- package/assets/esri/core/workers/chunks/09bd5df07eab80ae7b15.js +0 -1
- package/assets/esri/core/workers/chunks/164e74d586297946a717.js +0 -1
- package/assets/esri/core/workers/chunks/1c0c5cb13c2590aae906.js +0 -1
- package/assets/esri/core/workers/chunks/1c77de1e79860f8d2228.js +0 -1
- package/assets/esri/core/workers/chunks/24dac4970526a4e0ae63.js +0 -1
- package/assets/esri/core/workers/chunks/2acf2952cef69e382a35.js +0 -1
- package/assets/esri/core/workers/chunks/30dcf2cfb31cb70de7df.js +0 -1
- package/assets/esri/core/workers/chunks/371e2ddb88cc6b9a41e8.js +0 -1
- package/assets/esri/core/workers/chunks/42f6194633c2d879c8da.js +0 -1
- package/assets/esri/core/workers/chunks/44f90e75c1dc3d726a95.js +0 -1
- package/assets/esri/core/workers/chunks/4abd3753cd9b80e4d937.js +0 -1
- package/assets/esri/core/workers/chunks/4bb9a5f4ca944d3fc206.js +0 -1
- package/assets/esri/core/workers/chunks/4c389472b8cdb0c55154.js +0 -1
- package/assets/esri/core/workers/chunks/4d93bed14945e3d34d5c.js +0 -1
- package/assets/esri/core/workers/chunks/4e3f651ac76fcd53df2b.js +0 -1
- package/assets/esri/core/workers/chunks/505227797bcf2a1d908d.js +0 -1
- package/assets/esri/core/workers/chunks/58da3f8cf0f7f6a7e4fa.js +0 -1
- package/assets/esri/core/workers/chunks/5a19a9c3e01d3d415188.js +0 -1
- package/assets/esri/core/workers/chunks/5a830bc35adbedd33783.js +0 -1
- package/assets/esri/core/workers/chunks/6db0f8fe1402643fbe1a.js +0 -1
- package/assets/esri/core/workers/chunks/7124ad8dc5ad40dc66f3.js +0 -1
- package/assets/esri/core/workers/chunks/7446d0dfebf93e86c098.js +0 -1
- package/assets/esri/core/workers/chunks/7c631e2947243e2c9bde.js +0 -1
- package/assets/esri/core/workers/chunks/7f0f9dddc44b1f1600f0.js +0 -1
- package/assets/esri/core/workers/chunks/7fb7493f483cd9878bfa.js +0 -1
- package/assets/esri/core/workers/chunks/8e310e9cb9d84ac3ca2f.js +0 -1
- package/assets/esri/core/workers/chunks/950d4578dc450467404c.js +0 -1
- package/assets/esri/core/workers/chunks/99a0a434ea2162166754.js +0 -1
- package/assets/esri/core/workers/chunks/9afc87474cef1fc4fe4a.js +0 -1
- package/assets/esri/core/workers/chunks/9cbde13e536676767900.js +0 -1
- package/assets/esri/core/workers/chunks/9cd3fcb5fca6f9dbbcd8.js +0 -1
- package/assets/esri/core/workers/chunks/a025ee38d402504193df.js +0 -1
- package/assets/esri/core/workers/chunks/a4b822ee45810c4c292a.js +0 -1
- package/assets/esri/core/workers/chunks/a51576d84edca88e41dd.js +0 -1
- package/assets/esri/core/workers/chunks/ac24b4370dc7194a3107.js +0 -1
- package/assets/esri/core/workers/chunks/ace41659a5ca0e5abfc3.js +0 -1
- package/assets/esri/core/workers/chunks/b01804aa6c47a220a603.js +0 -1
- package/assets/esri/core/workers/chunks/b3273f847405799e3362.js +0 -1
- package/assets/esri/core/workers/chunks/ba3d5abff65aefcb8dee.js +0 -1
- package/assets/esri/core/workers/chunks/bca6b469940b7b954123.js +0 -1
- package/assets/esri/core/workers/chunks/c0d7ae314ebfad1e3791.js +0 -1
- package/assets/esri/core/workers/chunks/c337fc0e6dc69c233e6d.js +0 -1
- package/assets/esri/core/workers/chunks/cd9aa950cb74b09008fe.js +0 -1
- package/assets/esri/core/workers/chunks/e0d9dc97985561320bd4.js +0 -1
- package/assets/esri/core/workers/chunks/e2775b4b753306dc8477.js +0 -1
- package/assets/esri/core/workers/chunks/eaddffcc7004101fc230.js +0 -1
- package/assets/esri/core/workers/chunks/ebbf425af348e6ede814.js +0 -1
- package/assets/esri/core/workers/chunks/efc53007cd2e4991d7d4.js +0 -1
- package/assets/esri/core/workers/chunks/f46e92c67986c8c09bdd.js +0 -1
- package/assets/esri/core/workers/chunks/f8bc474434fd365ab174.js +0 -1
- package/assets/esri/core/workers/chunks/f8d2225f333524ce1d88.js +0 -1
- package/assets/esri/core/workers/chunks/f95a1f878c9c1146180e.js +0 -1
- package/assets/esri/core/workers/chunks/fb37f0848196c28b7fd7.js +0 -1
- /package/assets/esri/core/workers/chunks/{768389f7f8dba6080df7.js.LICENSE.txt → 0cc7fba402a93e6d2455.js.LICENSE.txt} +0 -0
package/views/VideoView.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../Color.js";import n from"../Viewpoint.js";import r from"../core/Accessor.js";import{EventedMixin as i}from"../core/Evented.js";import{destroyMaybe as a}from"../core/maybe.js";import{EsriPromiseMixin as o}from"../core/Promise.js";import{watch as s,syncAndInitial as c,whenOnce as l,when as u}from"../core/reactiveUtils.js";import{property as d,cast as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import{create as h,fromValues as g}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import _ from"../geometry/Extent.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{projectLoad as b,projectExecute as x}from"../geometry/operators/projectOperator.js";import S from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as C}from"../layers/support/MediaElementView.js";import w from"../layers/support/TileInfo.js";import T from"../layers/support/VideoElement.js";import{DOMContainer as E}from"./DOMContainer.js";import{Viewport2DBaseMixin as D}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as O}from"./Viewport2DMixin.js";import k from"./2d/AnimationManager.js";import A from"./2d/MapViewConstraints.js";import"./2d/engine/Stage.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"../core/RandomLCG.js";import"../core/has.js";import"../core/Logger.js";import"./2d/engine/transitions/FadeTransition.js";import"./webgl/BufferObject.js";import"./webgl/FramebufferObject.js";import"./webgl/Program.js";import"./webgl/Renderbuffer.js";import"./webgl/Texture.js";import"./webgl/enums.js";import"./webgl/Util.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import{Container as j}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"../geometry/Polygon.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"./webgl/UniformBufferLayout.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import M from"./2d/navigation/MapViewNavigation.js";import"../request.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"../core/mathUtils.js";import"../core/urlUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"../geometry/support/spatialReferenceUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as N}from"./2d/ViewStateManager.js";import P from"./2d/engine/webgl/Overlay.js";import F from"./2d/engine/webgl/OverlayContainer.js";import I from"./navigation/Navigation.js";import L from"./ui/DefaultUI.js";import R from"./ui/video/DefaultUIVideo.js";const z=new t(`#000`);let B;async function V(){let[,{ParentStage:e}]=await Promise.all([import(`./2d/webglDeps.js`),import(`./2d/mapViewDeps.js`)]);B=e}const H=.01,U=[`feature`,`geojson`,`csv`,`stream`,`ogc-feature`,`catalog`,`wfs`,`parquet`,`graphics`,`group`];let W=class extends O(D(E(i(o(r))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new I,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new N({constraints:new A({view:this,minScale:1,maxScale:H})}),this.type=`2d`,this.ui=new R,this.view2dType=`video`,this.addHandles([s(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),s(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),s(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),s(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},c)])}initialize(){this._prevZoomEnabled=this.navigation.actionMap.mouseWheel===`zoom`&&this.ui.components.includes(`zoom`),this._prevRotationEnabled=this.navigation.actionMap.dragSecondary===`rotate`&&this.ui.components.includes(`compass`),this.addHandles([s(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?`none`:`zoom`,this.navigation.actionMap.dragPrimary=this.operationalDataVisible?`none`:`pan`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`zoom`):[...new Set([...this.ui.components,`zoom`])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?`none`:`rotate`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`compass`):[...new Set([...this.ui.components,`compass`])])))},c)]),this.addResolvingPromise(V().then(()=>(this._isValid=!0,l(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set(`preconditionsReady`,!1),this.frameTask=a(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set(`inputManager`,null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get focusRegion(){return super.focusRegion}get layer(){return this._get(`layer`)}set layer(e){e!==this._get(`layer`)&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(l(()=>this.ready))),this._set(`layer`,e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||this.width===0||this.height===0||this.videoSize[0]===0||this.videoSize[1]===0)}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];let[e,t]=this.size,n=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),r=e/t,i=t*n,a=e/n;return r>=1?n>=1?i<=e?[i,t]:[e,a]:a<=t?[e,a]:[i,t]:n>=1?a<=t?[e,a]:[i,t]:i<=e?[i,t]:[e,a]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};let n=this._operationalDataView.videoToMap(e);if(!n)return{screenPoint:e,results:[]};let r=this._operationalDataView.state.toScreen(h(),n);return this._operationalDataView.hitTest({x:r[0],y:r[1]},t)}_startup(){if(!this.layer)return;let e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);let t={renderingOptions:this.renderingOptions,backgroundColor:z,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},n=new B(this._getOrCreateRenderCanvas(),t);this.stage=n,this._prepareStage(this.stage),this.childStage=n.childStage,this._prepareChildStage(this.childStage);let r=new k({view:this});this._set(`animationManager`,r);let i=new M({view:this,animationManager:r});this._set(`mapViewNavigation`,i),this._updateConstraints(),this.frameTask.start(),this._set(`ready`,!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles(`video-view`),this._set(`ready`,!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new n({targetGeometry:new v({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([s(()=>this.stationary,t=>e.stationary=t,c),s(()=>this.state.id,()=>e.state=this.state,c),s(()=>this.renderingOptions,t=>e.renderingOptions=t,c)],`video-view`),this._extent=new _({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new C({element:new T({video:this.layer?.videoElement,georeference:new S({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});let t=new P(this._videoElementView);this._overlayContainer=new F,this._overlayContainer.addChild(t),this._effectsContainer=new j,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);let n=document.createElement(`div`);n.classList.add(`esri-video-poster`),this.container?.classList.add(`esri-video-view`),this.container?.appendChild(n)}_prepareChildStage(e){this.addHandles([s(()=>this.map,async t=>{if(!t)return;let{default:n}=await import(`./video/VideoOperationalDataView.js`);this._operationalDataView=new n({stage:e,layerViewFilter:e=>new Set(U).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>g(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),l(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},c),s(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;let t=this.layer.groundControlPoints,n=t?.length;if(!n)return;await b();let r=Array(n),i=e.state.spatialReference;for(let e=0;e<n;e++){let{lat:n,lon:a}=t[e];r[e]=x(new v(a,n),i)}let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e of r)a=Math.min(a,e.x),o=Math.min(o,e.y),s=Math.max(s,e.x),c=Math.max(c,e.y);let l=_.fromJSON({xmin:a,ymin:o,xmax:s,ymax:c,spatialReference:i});await this._operationalDataView?.goTo(l,{animate:!1}).catch(()=>{})},c)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){let e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),n=[];for(let e=t;e>H;e/=2)n.push(e);n.push(H);let{lods:r}=w.create({scales:n});this.constraints.set({lods:r,minScale:t})}_updatePanConstraints(){let e=e=>{if(!e.targetGeometry)return e;let[t,n]=this.videoSize,r=t*e.scale/2,i=n*e.scale/2,a=e.targetGeometry.clone();return a.x=Math.max(r,Math.min(t-r,a.x)),a.y=Math.max(i,Math.min(n-i,a.y)),e.targetGeometry=a,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(u(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([d()],W.prototype,`_overlayContainer`,void 0),e([d()],W.prototype,`_isValid`,void 0),e([d()],W.prototype,`_readyCycleForced`,void 0),e([d()],W.prototype,`_effectsContainer`,void 0),e([d()],W.prototype,`constraintsInfo`,null),e([d()],W.prototype,`operationalDataVisible`,void 0),e([d()],W.prototype,`layer`,null),e([d()],W.prototype,`map`,void 0),e([d({type:I,nonNullable:!0})],W.prototype,`navigation`,void 0),e([d({readOnly:!0})],W.prototype,`preconditionsReady`,null),e([d({readOnly:!0})],W.prototype,`ready`,void 0),e([d({readOnly:!0})],W.prototype,`rendering`,null),e([d()],W.prototype,`scale`,null),e([d()],W.prototype,`spatialReference`,void 0),e([d()],W.prototype,`stateManager`,void 0),e([d()],W.prototype,`type`,void 0),e([d(),f(e=>e instanceof L?e:m(R,e))],W.prototype,`ui`,void 0),e([d({readOnly:!0})],W.prototype,`videoSize`,null),e([d({readOnly:!0})],W.prototype,`view2dType`,void 0),W=e([p(`esri.views.VideoView`)],W);const G=W;export{G as default};
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../Color.js";import n from"../Viewpoint.js";import r from"../core/Accessor.js";import{EventedMixin as i}from"../core/Evented.js";import{destroyMaybe as a}from"../core/maybe.js";import{EsriPromiseMixin as o}from"../core/Promise.js";import{watch as s,syncAndInitial as c,whenOnce as l,when as u}from"../core/reactiveUtils.js";import{property as d,cast as f,subclass as p}from"../core/accessorSupport/decorators.js";import{ensureClass as m}from"../core/accessorSupport/ensureType.js";import{create as h,fromValues as g}from"../core/libs/gl-matrix-2/factories/vec2f64.js";import _ from"../geometry/Extent.js";import v from"../geometry/Point.js";import y from"../geometry/SpatialReference.js";import{projectLoad as b,projectExecute as x}from"../geometry/operators/projectOperator.js";import S from"../layers/support/ExtentAndRotationGeoreference.js";import{MediaElementView as C}from"../layers/support/MediaElementView.js";import w from"../layers/support/TileInfo.js";import T from"../layers/support/VideoElement.js";import{DOMContainer as E}from"./DOMContainer.js";import{Viewport2DBaseMixin as D}from"./Viewport2DBaseMixin.js";import{Viewport2DMixin as O}from"./Viewport2DMixin.js";import k from"./2d/AnimationManager.js";import A from"./2d/MapViewConstraints.js";import"./2d/engine/Stage.js";import"../core/libs/gl-matrix-2/factories/vec4f32.js";import"../core/RandomLCG.js";import"../core/has.js";import"../core/Logger.js";import"./2d/engine/transitions/FadeTransition.js";import"./webgl/BufferObject.js";import"./webgl/FramebufferObject.js";import"./webgl/Program.js";import"./webgl/Renderbuffer.js";import"./webgl/Texture.js";import"../core/memoryEstimations.js";import"./webgl/enums.js";import"./webgl/Util.js";import"./2d/engine/webgl/meshing/definitions.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/VideoScreenShader.js";import"./2d/LabelManager.js";import"./2d/layers/graphics/GraphicsView2D.js";import{Container as j}from"./2d/engine/Container.js";import"./2d/engine/webgl/shaderGraph/techniques/clip/ClipTechnique.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileInfo.js";import"./2d/engine/webgl/AFeatureTile.js";import"./2d/engine/webgl/DisplayEntity.js";import"../geometry/Polygon.js";import"../core/libs/gl-matrix-2/factories/vec2f32.js";import"./2d/engine/webgl/number.js";import"./2d/engine/webgl/shaderGraph/techniques/featureTechniqueUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileDebugInfoShader.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/TileStencilShader.js";import"./webgl/UniformBufferLayout.js";import"./2d/engine/webgl/shaderGraph/techniques/TechniqueRegistry.js";import"../core/libs/gl-matrix-2/factories/vec3f32.js";import"../geometry/support/normalizeUtils.js";import"./2d/layers/support/util.js";import M from"./2d/navigation/MapViewNavigation.js";import"../request.js";import"../core/asyncUtils.js";import"../core/support/UpdatingHandles.js";import"../core/mathUtils.js";import"../core/urlUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/MagnifierShader.js";import"../core/units.js";import"../geometry/ellipsoidUtils.js";import"../geometry/Geometry.js";import"../geometry/Multipoint.js";import"../geometry/Polyline.js";import"../geometry/spatialReferenceEllipsoidUtils.js";import"../geometry/operators/support/GeographicTransformation.js";import"../geometry/projection/projectors.js";import"../geometry/support/spatialReferenceUtils.js";import"./2d/engine/webgl/shaderGraph/techniques/shaders/GridShader.js";import"../geometry/support/geodesicConstants.js";import"../geometry/support/Ellipsoid.js";import{ViewStateManager as N}from"./2d/ViewStateManager.js";import P from"./2d/engine/webgl/Overlay.js";import F from"./2d/engine/webgl/OverlayContainer.js";import I from"./navigation/Navigation.js";import L from"./ui/DefaultUI.js";import R from"./ui/video/DefaultUIVideo.js";const z=new t(`#000`);let B;async function V(){let[,{ParentStage:e}]=await Promise.all([import(`./2d/webglDeps.js`),import(`./2d/mapViewDeps.js`)]);B=e}const H=.01,U=[`feature`,`geojson`,`csv`,`stream`,`ogc-feature`,`catalog`,`wfs`,`parquet`,`graphics`,`group`];let W=class extends O(D(E(i(o(r))))){constructor(e){super(e),this._isValid=!1,this._readyCycleForced=!1,this._prevZoomEnabled=!1,this._prevRotationEnabled=!1,this.stage=null,this.childStage=null,this._operationalDataView=null,this.operationalDataVisible=!1,this.map=null,this.navigation=new I,this.ready=!1,this.spatialReference=new y({wkid:0}),this.stateManager=new N({constraints:new A({view:this,minScale:1,maxScale:H})}),this.type=`2d`,this.ui=new R,this.view2dType=`video`,this.addHandles([s(()=>this.preconditionsReady,e=>e?this._startup():this._teardown()),s(()=>this.videoSize,([e,t])=>{this._extent&&e&&t&&(this._extent.xmax=e,this._extent.ymax=t)}),s(()=>this.size,e=>{this._operationalDataView&&this._operationalDataView.stateManager.resize(e[0],e[1])}),s(()=>[this.layer?.frameEffect,this._effectsContainer],()=>{this._effectsContainer&&(this._effectsContainer.effect=this.layer?.frameEffect??null)},c)])}initialize(){this._prevZoomEnabled=this.navigation.actionMap.mouseWheel===`zoom`&&this.ui.components.includes(`zoom`),this._prevRotationEnabled=this.navigation.actionMap.dragSecondary===`rotate`&&this.ui.components.includes(`compass`),this.addHandles([s(()=>[this.operationalDataVisible,this.childStage],()=>{this.childStage&&(this.childStage.videoScreenRenderer.visible=this.operationalDataVisible),this.operationalDataVisible&&(this.scale=1,this.rotation=0),this.navigation&&(this._prevZoomEnabled&&(this.navigation.actionMap.mouseWheel=this.operationalDataVisible?`none`:`zoom`,this.navigation.actionMap.dragPrimary=this.operationalDataVisible?`none`:`pan`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`zoom`):[...new Set([...this.ui.components,`zoom`])])),this._prevRotationEnabled&&(this.navigation.actionMap.dragSecondary=this.operationalDataVisible?`none`:`rotate`,this.ui.components&&(this.ui.components=this.operationalDataVisible?this.ui.components.filter(e=>e!==`compass`):[...new Set([...this.ui.components,`compass`])])))},c)]),this.addResolvingPromise(V().then(()=>(this._isValid=!0,l(()=>this.ready))))}destroy(){this._teardown(),this.removeAllHandles(),this._set(`preconditionsReady`,!1),this.frameTask=a(this.frameTask),this.goToManager.destroy(),this.inputManager.destroy(),this._set(`inputManager`,null)}get constraintsInfo(){return{lods:null,spatialReference:this.spatialReference}}get focusRegion(){return super.focusRegion}get layer(){return this._get(`layer`)}set layer(e){e!==this._get(`layer`)&&(this.constructed&&!this.destroyed&&(this._forceReadyCycle(),this.addResolvingPromise(l(()=>this.ready))),this._set(`layer`,e))}get preconditionsReady(){return!(!this._isValid||this._readyCycleForced||this.width===0||this.height===0||this.videoSize[0]===0||this.videoSize[1]===0)}get rendering(){return this.stage?.renderRequested??!1}get scale(){return this.stateManager?.scale??0}set scale(e){this.stateManager&&(this.stateManager.scale=e)}get videoSize(){if(!this.layer?.videoWidth||!this.layer?.videoHeight)return[0,0];let[e,t]=this.size,n=(this.layer?.videoWidth||0)/(this.layer?.videoHeight||0),r=e/t,i=t*n,a=e/n;return r>=1?n>=1?i<=e?[i,t]:[e,a]:a<=t?[e,a]:[i,t]:n>=1?a<=t?[e,a]:[i,t]:i<=e?[i,t]:[e,a]}async hitTest(e,t){if(!this._operationalDataView||!this._operationalDataView.ready)return{screenPoint:e,results:[]};let n=this._operationalDataView.videoToMap(e);if(!n)return{screenPoint:e,results:[]};let r=this._operationalDataView.state.toScreen(h(),n);return this._operationalDataView.hitTest({x:r[0],y:r[1]},t)}_startup(){if(!this.layer)return;let e=this._getViewpoint();this.stateManager.startup(e,this.size,e.targetGeometry.spatialReference);let t={renderingOptions:this.renderingOptions,backgroundColor:z,groundControlPoints:()=>this._groundControlPoints(),getSize:()=>this.videoSize},n=new B(this._getOrCreateRenderCanvas(),t);this.stage=n,this._prepareStage(this.stage),this.childStage=n.childStage,this._prepareChildStage(this.childStage);let r=new k({view:this});this._set(`animationManager`,r);let i=new M({view:this,animationManager:r});this._set(`mapViewNavigation`,i),this._updateConstraints(),this.frameTask.start(),this._set(`ready`,!0)}_teardown(){this.frameTask?.stop(),this.stationaryManager?.clear(),this.stage?.destroy(),this.stage=null,this._videoElementView=null,this._overlayContainer?.removeAllChildren(),this._overlayContainer=null,this.removeHandles(`video-view`),this._set(`ready`,!1),this.stateManager?.ready&&this.stateManager.teardown()}_getViewpoint(){return new n({targetGeometry:new v({x:this.videoSize[0]/2,y:this.videoSize[1]/2,spatialReference:this.spatialReference}),scale:1})}_prepareStage(e){this.addHandles([s(()=>this.stationary,t=>e.stationary=t,c),s(()=>this.state.id,()=>e.state=this.state,c),s(()=>this.renderingOptions,t=>e.renderingOptions=t,c)],`video-view`),this._extent=new _({xmin:0,ymin:0,xmax:this.videoSize[0],ymax:this.videoSize[1],spatialReference:{wkid:0}}),this._videoElementView=new C({element:new T({video:this.layer?.videoElement,georeference:new S({extent:this._extent}),autoplay:!1}),spatialReference:this.spatialReference});let t=new P(this._videoElementView);this._overlayContainer=new F,this._overlayContainer.addChild(t),this._effectsContainer=new j,this._effectsContainer.addChild(this._overlayContainer),this.stage.addChild(this._effectsContainer);let n=document.createElement(`div`);n.classList.add(`esri-video-poster`),this.container?.classList.add(`esri-video-view`),this.container?.appendChild(n)}_prepareChildStage(e){this.addHandles([s(()=>this.map,async t=>{if(!t)return;let{default:n}=await import(`./video/VideoOperationalDataView.js`);this._operationalDataView=new n({stage:e,layerViewFilter:e=>new Set(U).has(e.type),width:this.size[0],height:this.size[1],map:t,groundControlPoints:()=>this._groundControlPoints(),getVideoResolution:()=>g(this.layer?.videoWidth||0,this.layer?.videoHeight||0),getSize:()=>this.size}),l(()=>this._operationalDataView?.ready).then(()=>{e.videoScreenRenderer.visible=this.operationalDataVisible})},c),s(()=>this.layer?.groundControlPoints,async()=>{if(!this.layer?.groundControlPoints||!e.state)return;let t=this.layer.groundControlPoints,n=t?.length;if(!n)return;await b();let r=Array(n),i=e.state.spatialReference;for(let e=0;e<n;e++){let{lat:n,lon:a}=t[e];r[e]=x(new v(a,n),i)}let a=1/0,o=1/0,s=-1/0,c=-1/0;for(let e of r)a=Math.min(a,e.x),o=Math.min(o,e.y),s=Math.max(s,e.x),c=Math.max(c,e.y);let l=_.fromJSON({xmin:a,ymin:o,xmax:s,ymax:c,spatialReference:i});await this._operationalDataView?.goTo(l,{animate:!1}).catch(()=>{})},c)])}_updateConstraints(){this._updateZoomConstraints(),this._updatePanConstraints()}_updateZoomConstraints(){let e=this.videoSize,t=Math.max(e[0]/this.size[0],e[1]/this.size[1]),n=[];for(let e=t;e>H;e/=2)n.push(e);n.push(H);let{lods:r}=w.create({scales:n});this.constraints.set({lods:r,minScale:t})}_updatePanConstraints(){let e=e=>{if(!e.targetGeometry)return e;let[t,n]=this.videoSize,r=t*e.scale/2,i=n*e.scale/2,a=e.targetGeometry.clone();return a.x=Math.max(r,Math.min(t-r,a.x)),a.y=Math.max(i,Math.min(n-i,a.y)),e.targetGeometry=a,e};this.constraints.customConstraints.add({constrain:e,applyPanConstraint:e})}_forceReadyCycle(){this.ready&&(u(()=>this.destroyed||this.preconditionsReady===!1,()=>this._readyCycleForced=!1,{once:!0}),this._readyCycleForced=!0)}_groundControlPoints(){return this.layer?.groundControlPoints}};e([d()],W.prototype,`_overlayContainer`,void 0),e([d()],W.prototype,`_isValid`,void 0),e([d()],W.prototype,`_readyCycleForced`,void 0),e([d()],W.prototype,`_effectsContainer`,void 0),e([d()],W.prototype,`constraintsInfo`,null),e([d()],W.prototype,`operationalDataVisible`,void 0),e([d()],W.prototype,`layer`,null),e([d()],W.prototype,`map`,void 0),e([d({type:I,nonNullable:!0})],W.prototype,`navigation`,void 0),e([d({readOnly:!0})],W.prototype,`preconditionsReady`,null),e([d({readOnly:!0})],W.prototype,`ready`,void 0),e([d({readOnly:!0})],W.prototype,`rendering`,null),e([d()],W.prototype,`scale`,null),e([d()],W.prototype,`spatialReference`,void 0),e([d()],W.prototype,`stateManager`,void 0),e([d()],W.prototype,`type`,void 0),e([d(),f(e=>e instanceof L?e:m(R,e))],W.prototype,`ui`,void 0),e([d({readOnly:!0})],W.prototype,`videoSize`,null),e([d({readOnly:!0})],W.prototype,`view2dType`,void 0),W=e([p(`esri.views.VideoView`)],W);const G=W;export{G as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import n from"../../core/Collection.js";import{EventedAccessor as r}from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{debounce as s,onAbort as c,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import{on as
|
|
2
|
+
import{__decorate as e}from"tslib";import{createTask as t}from"../../core/asyncUtils.js";import n from"../../core/Collection.js";import{EventedAccessor as r}from"../../core/Evented.js";import{makeHandle as i}from"../../core/handleUtils.js";import a from"../../core/Logger.js";import{abortMaybe as o}from"../../core/maybe.js";import{debounce as s,onAbort as c,ignoreAbortErrors as l}from"../../core/promiseUtils.js";import u from"../../core/ReactiveMap.js";import{on as d}from"../../core/reactiveUtils.js";import{createScreenPoint as f}from"../../core/screenUtils.js";import{property as p,subclass as m}from"../../core/accessorSupport/decorators.js";import h from"../../geometry/Point.js";import g from"../../geometry/Polygon.js";import{isClockwise as _}from"../../geometry/support/coordsUtils.js";import{sketchKeys as v,selectionKeys as y}from"../interactive/keybindings.js";import{getSelectionFromGeometry as b}from"../../widgets/support/Selector2D/selectorUtils.js";import{getSelectionFromScreenSelector as x}from"../../widgets/support/Selector3D/selectorUtils.js";let S=class extends r{constructor(e){super(e),this._completed=!1,this._isConstraintKeyDown=!1,this._processTask=null,this.createTool=`rectangle`,this.effectiveSourceMap=new u,this.mode=null,this.persistSelection=!0,this.returnFeatureTitleFields=!1,this.returnGeometry=!0,this.selection=new n,this.selectionManager=null,this.selectOnComplete=!0,this.sources=null,this.toolName=``,this.type=`add`,this._process=s(async(e,n)=>{let{callback:r,completed:i}=e,a=t(async t=>{let{effectiveSelectionManager:n,effectiveSourceMap:a,returnFeatureTitleFields:o,returnGeometry:s,selection:c,sources:l,view:u}=this;if(!l?.length&&!n.sources.length||!u){c.removeAll();return}let d=u.type===`3d`&&`screenSelector`in e&&e.screenSelector&&l!=null?await x({selector:e.screenSelector,signal:t,sources:l,view:u}):`selector`in e&&e.selector&&l!=null?await b({effectiveSourceMap:a,returnFeatureTitleFields:o,returnGeometry:s,selector:e.selector,signal:t,sources:l,view:u}):[];if(c.removeAll(),c.addMany(d),i&&this.persistSelection)switch(this.effectiveType){case`remove`:n.updateSelection({current:[],added:[],removed:d});break;case`replace`:n.clear(),n.updateSelection({current:d,added:[],removed:[]});break;default:n.updateSelection({current:d,added:[],removed:[]})}r?.()});return c(n,()=>a.abort()),this._processTask=a,a.promise},C),this._onOperationFinish=this._onOperationFinish.bind(this)}async initialize(){await this._setup()}get _defaultMode(){return this.createTool===`polygon`?`click`:`hybrid`}get _selectionArea(){let e=this._tool.coordinates;if(e.length===0)return;let t=f(),n=this.view.spatialReference,r=e=>{t.x=e[0],t.y=e[1];let n=this.view.toMap(t);return[n?.x??0,n?.y??0]};if(e.length===1||e.every(([t,n])=>t===e[0][0]&&n===e[0][1])){let[t,i]=r(e[0]);return new h({x:t,y:i,spatialReference:n})}let i=e.map(r);return i.length===0?void 0:(_(i)||i.reverse(),new g({spatialReference:n,rings:[i]}))}get _screenSelector(){let e=this._tool.coordinates;if(e.length===0)return;let t=e=>f(e[0],e[1]);return e.length===1||e.every(([t,n])=>t===e[0][0]&&n===e[0][1])?t(e[0]):e.map(t)}get completed(){return this._completed}get effectiveSelectionManager(){return this.selectionManager??this.view.selectionManager}get effectiveType(){let e=this.type??`add`;if(this._isConstraintKeyDown)switch(e){case`add`:return`remove`;case`remove`:return`add`;case`replace`:return`add`;default:return e}return e}get processingFinalSelection(){return!!(this._processTask&&this._tool?.drawOperation?.isCompleted)}cancel(){this.selection.removeAll(),this._onOperationFinish(!0)}destroy(){this._toolImportController=o(this._toolImportController)}async _setup(){let{createTool:e,view:t}=this;if(await t.whenReady(),this.destroyed||this._toolImportController)return;let n=new AbortController;this._toolImportController=n;let r=await import(`../draw/DrawScreenTool.js`);if(n.signal.aborted)return;let o=Symbol();try{this._tool=new r.DrawScreenTool({view:t,mode:this.mode??this._defaultMode,geometryType:e,cursor:e===`point`?`default`:`crosshair`})}finally{this._toolImportController=null}this._tool?(this.selectOnComplete||this.addHandles(this._tool.on([`cursor-update`,`vertex-add`,`vertex-remove`],()=>{this._syncConstraintKeyDown(),l(this._process(this._selectionProcessParams))}),o),this._syncConstraintKeyDown(),this.addHandles([d(()=>t,`key-down`,e=>{if(!e.repeat)switch(this._syncConstraintKeyDown(),e.key){case v.constraint:this._tool.uniformSizeToggled=!0,e.stopPropagation();break;case v.center:this._tool.centeredToggled=!0,e.stopPropagation()}}),d(()=>t,`key-up`,e=>{switch(this._syncConstraintKeyDown(),e.key){case v.constraint:this._tool.uniformSizeToggled=!1,e.stopPropagation();break;case v.center:this._tool.centeredToggled=!1,e.stopPropagation()}}),this.selection.on(`change`,({added:e,removed:t})=>this.emit(`selection-change`,{operationType:this.effectiveType,added:e,removed:t})),this._tool.on(`complete`,async e=>{this._syncConstraintKeyDown(),this.removeHandles(o),e.aborted?this.cancel():(this._tool.cursor=`progress`,await this._process({...this._selectionProcessParams,callback:this._onOperationFinish,completed:!0}))})],o),this.addHandles(i(()=>t.tools.remove(this._tool))),t.addAndActivateTool(this._tool)):a.getLogger(this).warn(`Unable to import Draw module. SelectionOperation failed to load.`)}_syncConstraintKeyDown(){let{inputManager:e}=this.view;this._isConstraintKeyDown=y.invertType.some(t=>e.isModifierKeyDown(t))}get _selectionProcessParams(){return this.view.type===`3d`?{screenSelector:this._screenSelector}:{selector:this._selectionArea}}_onOperationFinish(e=!1){this.removeAllHandles(),this._processTask?.abort(),this._completed=!0,this.emit(`complete`,{aborted:e,operationType:this.effectiveType,selection:this.selection.toArray(),toolName:this.toolName})}};e([p()],S.prototype,`_completed`,void 0),e([p()],S.prototype,`_defaultMode`,null),e([p()],S.prototype,`_isConstraintKeyDown`,void 0),e([p()],S.prototype,`_processTask`,void 0),e([p()],S.prototype,`_selectionArea`,null),e([p()],S.prototype,`_screenSelector`,null),e([p()],S.prototype,`completed`,null),e([p({constructOnly:!0})],S.prototype,`createTool`,void 0),e([p()],S.prototype,`effectiveSelectionManager`,null),e([p()],S.prototype,`effectiveSourceMap`,void 0),e([p()],S.prototype,`effectiveType`,null),e([p({constructOnly:!0})],S.prototype,`mode`,void 0),e([p()],S.prototype,`persistSelection`,void 0),e([p()],S.prototype,`processingFinalSelection`,null),e([p()],S.prototype,`returnFeatureTitleFields`,void 0),e([p()],S.prototype,`returnGeometry`,void 0),e([p({readOnly:!0})],S.prototype,`selection`,void 0),e([p({constructOnly:!0})],S.prototype,`selectionManager`,void 0),e([p({constructOnly:!0})],S.prototype,`selectOnComplete`,void 0),e([p()],S.prototype,`sources`,void 0),e([p({constructOnly:!0})],S.prototype,`toolName`,void 0),e([p()],S.prototype,`type`,void 0),e([p({constructOnly:!0})],S.prototype,`view`,void 0),S=e([m(`esri.views.selection.SelectionOperation`)],S);const C=100,w=S;export{w as default};
|
|
@@ -14,11 +14,13 @@ import type Polyline from "../../geometry/Polyline.js";
|
|
|
14
14
|
import type GraphicsLayer from "../../layers/GraphicsLayer.js";
|
|
15
15
|
import type KnowledgeGraphLayer from "../../layers/KnowledgeGraphLayer.js";
|
|
16
16
|
import type LinkChartLayer from "../../layers/LinkChartLayer.js";
|
|
17
|
+
import type MapImageLayer from "../../layers/MapImageLayer.js";
|
|
17
18
|
import type MapNotesLayer from "../../layers/MapNotesLayer.js";
|
|
18
19
|
import type SketchLayer from "../../layers/SketchLayer.js";
|
|
19
20
|
import type SubtypeGroupLayer from "../../layers/SubtypeGroupLayer.js";
|
|
20
21
|
import type Field from "../../layers/support/Field.js";
|
|
21
22
|
import type FieldsIndex from "../../layers/support/FieldsIndex.js";
|
|
23
|
+
import type Sublayer from "../../layers/support/Sublayer.js";
|
|
22
24
|
import type SubtypeSublayer from "../../layers/support/SubtypeSublayer.js";
|
|
23
25
|
import type FeatureSet from "../../rest/support/FeatureSet.js";
|
|
24
26
|
import type Query from "../../rest/support/Query.js";
|
|
@@ -26,7 +28,7 @@ import type View from "../View.js";
|
|
|
26
28
|
import type LinkChartView from "../LinkChartView.js";
|
|
27
29
|
import type FeatureLikeLayerView from "../layers/FeatureLikeLayerView.js";
|
|
28
30
|
import type { LoadableMixin } from "../../core/Loadable.js";
|
|
29
|
-
import type { FeatureTitleOptions } from "../../layers/types.js";
|
|
31
|
+
import type { FeatureTitleOptions, ScaleRange } from "../../layers/types.js";
|
|
30
32
|
import type { RendererUnion } from "../../renderers/types.js";
|
|
31
33
|
import type { RequestOptions } from "../../request/types.js";
|
|
32
34
|
import type { MapViewOrSceneView } from "../MapViewOrSceneView.js";
|
|
@@ -40,14 +42,21 @@ import type { CreateTool } from "../../widgets/Sketch/types.js";
|
|
|
40
42
|
*
|
|
41
43
|
* @since 5.1
|
|
42
44
|
*/
|
|
43
|
-
export type SelectableParentLayerUnion = MapNotesLayer | KnowledgeGraphLayer | LinkChartLayer | SubtypeGroupLayer;
|
|
45
|
+
export type SelectableParentLayerUnion = MapNotesLayer | KnowledgeGraphLayer | LinkChartLayer | MapImageLayer | SketchLayer | SubtypeGroupLayer;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Sublayer source types from which selections can be determined.
|
|
49
|
+
*
|
|
50
|
+
* @since 5.2
|
|
51
|
+
*/
|
|
52
|
+
export type SelectableSublayerUnion = Sublayer | SubtypeSublayer;
|
|
44
53
|
|
|
45
54
|
/**
|
|
46
55
|
* Layer source types from which selections can be determined.
|
|
47
56
|
*
|
|
48
57
|
* @since 5.1
|
|
49
58
|
*/
|
|
50
|
-
export type SelectableLayerSourceUnion = SelectableLayer |
|
|
59
|
+
export type SelectableLayerSourceUnion = SelectableLayer | SelectableSublayerUnion | SelectableParentLayerUnion;
|
|
51
60
|
|
|
52
61
|
/**
|
|
53
62
|
* Types of sources from which selections can be determined.
|
|
@@ -145,6 +154,19 @@ export interface SelectableLayerBase extends Accessor, LoadableMixin {
|
|
|
145
154
|
type: SelectableLayerType;
|
|
146
155
|
/** **Optional:** The name of the field used to display features in the layer. */
|
|
147
156
|
displayField?: string | null;
|
|
157
|
+
/**
|
|
158
|
+
* **Optional:** The effective scale range of the selectable layer.
|
|
159
|
+
*
|
|
160
|
+
* @since 5.2
|
|
161
|
+
*/
|
|
162
|
+
effectiveScaleRange?: ScaleRange;
|
|
163
|
+
/**
|
|
164
|
+
* **Optional:** Indicates whether the layer is visible, accounting for potential
|
|
165
|
+
* parent layer visibility.
|
|
166
|
+
*
|
|
167
|
+
* @since 5.2
|
|
168
|
+
*/
|
|
169
|
+
effectiveVisible?: boolean | null;
|
|
148
170
|
/** **Optional:** The fields used to create feature titles. It can be a single field name or an array of field names. */
|
|
149
171
|
featureTitleFields?: string[];
|
|
150
172
|
/** **Optional:** The name of the global ID field in the layer. */
|
|
@@ -237,6 +259,12 @@ export interface SelectableLayerViewBase extends Accessor {
|
|
|
237
259
|
* @since 5.1
|
|
238
260
|
*/
|
|
239
261
|
layer: SelectableLayer;
|
|
262
|
+
/**
|
|
263
|
+
* A reference to the where clause currently applied to the layer view.
|
|
264
|
+
*
|
|
265
|
+
* @since 5.2
|
|
266
|
+
*/
|
|
267
|
+
definitionExpression?: string | null;
|
|
240
268
|
/**
|
|
241
269
|
* Indicates the layer view is currently suspended.
|
|
242
270
|
*
|
|
@@ -249,6 +277,18 @@ export interface SelectableLayerViewBase extends Accessor {
|
|
|
249
277
|
* @since 5.1
|
|
250
278
|
*/
|
|
251
279
|
updating: boolean;
|
|
280
|
+
/**
|
|
281
|
+
* Indicates whether the layer view is visible.
|
|
282
|
+
*
|
|
283
|
+
* @since 5.2
|
|
284
|
+
*/
|
|
285
|
+
visible: boolean;
|
|
286
|
+
/**
|
|
287
|
+
* Indicates whether the layer view is visible at the current scale.
|
|
288
|
+
*
|
|
289
|
+
* @since 5.2
|
|
290
|
+
*/
|
|
291
|
+
visibleAtCurrentScale: boolean;
|
|
252
292
|
/**
|
|
253
293
|
* A reference to the view associated with the layer view.
|
|
254
294
|
*
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../core/Error.js";import has from"../../core/has.js";function t(e){return e&&typeof e.highlight==`function`}function n(e){return e&&typeof e.maskOccludee==`function`}const r=()=>!has(`disable-feature:layer-based-scale-visibility`);function i(
|
|
2
|
+
import e from"../../core/Error.js";import has from"../../core/has.js";function t(e){return e&&typeof e.highlight==`function`}function n(e){return e&&typeof e.maskOccludee==`function`}const r=()=>!has(`disable-feature:layer-based-scale-visibility`);function i(t,n,r){return new e(`layerview:spatial-reference-incompatible`,`The spatial reference of this ${t} (wkid: ${n??`undefined`}) is incompatible with the spatial reference of the view (wkid: ${r??`undefined`}).`,{})}function a(e){return e.type===`integrated-mesh-3d`||e.type===`integrated-mesh-3dtiles`}export{r as hasLayerBasedScaleVisibility,t as highlightsSupported,a as isIntegratedMeshLayerView,n as occludeesSupported,i as spatialReferenceIncompatibleError};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
function
|
|
2
|
+
import{isInEffectiveScaleRange as e}from"../../geometry/support/scaleUtils.js";function t(e){return!!(typeof e==`object`&&e&&`id`in e&&`type`in e)}function n(e){return!!(t(e)&&`on`in e&&e.on)}function r(e){return!!(t(e)&&`graphics`in e&&e.graphics)}function i(e){return!!(t(e)&&`fields`in e&&`fieldsIndex`in e&&`objectIdField`in e&&`createQuery`in e&&e.createQuery&&`queryFeatures`in e&&e.queryFeatures)}function a(e){return i(e)||r(e)}function o(e){return!!(typeof e==`object`&&e&&`layer`in e&&e.layer&&t(e.layer)&&`view`in e)}function s(e){return o(e)&&r(e.layer)}function c(e){return!!(o(e)&&`highlight`in e&&e.highlight)}function l(e){return!!(o(e)&&`createQuery`in e&&e.createQuery&&`queryFeatures`in e&&e.queryFeatures)}function u(e){return l(e)||s(e)}function d(e,t){return!!(typeof e==`object`&&e&&`isTable`in e&&e.isTable||t?.map?.allTables.includes(e))}function f(e,t){return u(e)?m(e)&&p(e.layer,t):!a(e)||p(e,t)}function p(t,n){return t.effectiveVisible!==!1&&e(t.effectiveScaleRange,n?.scale)}function m(e){return e.visible!==!1&&e.visibleAtCurrentScale!==!1}export{a as isSelectableLayer,t as isSelectableLayerBase,n as isSelectableLayerBaseWithEditing,u as isSelectableLayerView,o as isSelectableLayerViewBase,m as isSelectableLayerViewVisible,s as isSelectableLayerViewWithGraphics,c as isSelectableLayerViewWithHighlights,l as isSelectableLayerViewWithObjectIds,p as isSelectableLayerVisible,r as isSelectableLayerWithGraphics,i as isSelectableLayerWithObjectIds,f as isSelectionSourceVisible,d as isTableLayer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{clamp as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r,waitTick as i}from"../../../../core/promiseUtils.js";import a from"../../../../geometry/Mesh.js";import o from"../../../../geometry/Point.js";import{projectAsync as s}from"../../../../geometry/projectionUtils.js";import c from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as l,updateFrustum as u}from"../../../../layers/orientedImagery/core/coverageUtils.js";import d from"../../../../layers/orientedImagery/transformations/updateElevation.js";import{getPointerActions as f,eventMatchesMousePointerActions as p}from"../../../../views/input/handlers/support.js";import{fixedImageSize as m,invalidCameraHeading as h}from"../../constants.js";import{createFeatureCoverage as g}from"../../featureCoverage.js";import{activeFrustumSymbol as _,additionalFrustumSymbol as v}from"../../symbols.js";import{getDefaultSuperimposeFov as y,panoramicSuperimposeMaxFov as b,panoramicSuperimposeMinFov as x,panoramicSuperimposeZoomOutFactor as S,panoramicSuperimposeZoomInFactor as C,getViewCameraFieldOfView as w,panoramicSuperimposeMaxTilt as T,panoramicSuperimposeMinTilt as E,panoramicSuperimposeKeyboardAngleStep as D}from"../../support/superimposeUtils.js";class O{constructor(o){this.viewModel=o,this._defaultSuperimposeSecondaryDragAction=null,this._defaultSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null,this._panoramicSuperimposeNavigationHandles=[],this.createFootprints=async n=>{let{coverageFrustums:i,currentBestFeature:o,isAdditionalCoverageVisible:u,view:d}=this.viewModel,f=i.filter(t);for(let t of f){let i=t.clone();if(!d.spatialReference.equals(i.spatialReference)){let{components:e,spatialReference:t,origin:o,vertexAttributes:u,vertexSpace:f}=i;if(f.type===`local`){let e=await s(o,d.spatialReference,n);r(n),i.centerAt(e)}else{let o=u.position,s=Float64Array.from(await l([...o],t.clone(),d.spatialReference.clone(),n));r(n),i=new a({vertexAttributes:new c({position:s}),components:e,spatialReference:d.spatialReference.clone()})}}t.imageID===o.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:i,symbol:_.clone(),visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:i,symbol:v.clone(),visible:u}))}},this.updateFootprint=async(n,i,a)=>{let{bestFeatureFootprint:o,currentBestFeature:c,activeViewer:l,footprintExtent:d,view:f,mode:p}=this.viewModel,h=p===`video`?m:l?.imageSize,g=i??c;if(!c||!o?.geometry||!h||!d||!g||!f?.spatialReference){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:v,location:y,cameraPitch:b,horizontalFieldOfView:x,verticalFieldOfView:S,cameraRoll:C}}=g,w=null;i&&(w=await this._computeFeatureFootprint(i,a));let T=g.attributes.location.toArray(),{vertexAttributes:{position:E},spatialReference:D}=(i&&w?w:o).geometry,O=await k(E,D,y.spatialReference),A=await this.viewModel.getMapPoint(n);r(a);let j=A.filter(t);if(!j.length)return;j[0].spatialReference.equals(y.spatialReference)||(j=await Promise.all(j.map(async e=>{let t=await s(e,y.spatialReference,a);return r(a),t})));let M=await u(n.map(({x:e,y:t})=>[e,t]),j.map(e=>e.toArray()),{cameraHeight:v,cameraLocation:T,cameraPitch:b,frustumVertices:O,horizontalFieldOfView:x,imageHeight:h[1],imageWidth:h[0],inSRS:{wkid:y.spatialReference.wkid},outSRS:{wkid:f.spatialReference.wkid},verticalFieldOfView:S,cameraRoll:C??0,options:a});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:g.attributes.objectId},geometry:M,symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateVideoFootprint=async n=>{let{points:i,feature:a,scale:o,options:c}=n,{bestFeatureFootprint:l,currentBestFeature:d,activeViewer:f,footprintExtent:p,view:h,mode:g}=this.viewModel,v=g===`video`?m:f?.imageSize,y=a??d;if(!d||!l?.geometry||!v||!p||!y||!h?.spatialReference||g===`none`){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:b,location:x,cameraPitch:S,horizontalFieldOfView:C,verticalFieldOfView:w,cameraRoll:T}}=y,E=null;a&&(E=await this._computeFeatureFootprint(a,c));let D=y.attributes.location.toArray(),{vertexAttributes:{position:O},spatialReference:A}=(a&&E?E:l).geometry,M=await k(O,A,x.spatialReference),N={feature:y,mode:g,imageSize:v,footprintExtent:p},P=await this.viewModel.getMapPointForFeature(i,N,c);r(c);let F=P.filter(t);if(!F.length)return;F[0].spatialReference.equals(x.spatialReference)||(F=await Promise.all(F.map(async e=>{let t=await s(e,x.spatialReference,c);return r(c),t})));let I=await u(i.map(({x:e,y:t})=>[e,t]),F.map(e=>e.toArray()),{cameraHeight:b,cameraLocation:D,cameraPitch:S,frustumVertices:M,horizontalFieldOfView:C,imageHeight:v[1],imageWidth:v[0],inSRS:{wkid:x.spatialReference.wkid},outSRS:{wkid:h.spatialReference.wkid},verticalFieldOfView:w,cameraRoll:T??0,options:c});if(o&&I){let e=j(I);I.scale(o,{origin:e})}this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:y.attributes.objectId},geometry:I,symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,n)=>{await i(n);let{horizontalFieldOfView:r,pitch:a,verticalFieldOfView:o,yaw:s,feature:c}=t,l=c?.clone()??this.viewModel.currentBestFeature?.clone();if(!l)return;let{attributes:u}=l;u.orientedImageryType=null,u.cameraHeading=s,u.cameraPitch=a,u.horizontalFieldOfView=r,u.verticalFieldOfView=o,u.cameraRoll=0;let{frustum:d}=g(u);!d||!this.viewModel.view?.spatialReference.equals(d.spatialReference)?this.viewModel.updateCurrentCoveragePolygon(null):this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:u.objectId},geometry:d.clone(),symbol:_.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updatePanoramicSuperimposeCamera=async(e,t)=>{let{camera:n,currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let o=i.attributes.location,c=o.spatialReference.equals(a.spatialReference)?o:await s(o,a.spatialReference,t);if(r(t),!c)return;let l=n.clone();l.position=c.clone(),a.camera=l,this._enablePanoramicSuperimposeNavigation(c)},this.updateDefaultSuperimposeCamera=async(e,t)=>{let{currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let{cameraHeading:o,cameraPitch:c,cameraRoll:l,horizontalFieldOfView:u,location:d,verticalFieldOfView:f}=i.attributes,p=d.spatialReference.equals(a.spatialReference)?d.clone():await s(d,a.spatialReference,t);if(r(t),!p)return;let m=y(a,u,f,l??0),g=a.camera.clone();g.position=p,g.fov=n(g.fov,x,b),o!=null&&o!==h&&(g.heading=o),c!=null&&(g.tilt=c),m!=null&&(g.fov=m),a.camera=g},this.enableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel;if(e?.type!==`3d`)return;let t=e.navigation.actionMap;this._defaultSuperimposeSecondaryDragAction??=t.dragSecondary,t.dragSecondary!==`none`&&(t.dragSecondary=`none`),this._defaultSuperimposeNavigationHandles.length||(this._defaultSuperimposeNavigationHandles=[e.on(`drag`,this._handleDefaultSuperimposeDrag)])},this.disableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel,t=this._defaultSuperimposeSecondaryDragAction;this._defaultSuperimposeNavigationHandles.forEach(e=>e.remove()),this._defaultSuperimposeNavigationHandles=[],e?.type!==`3d`||t==null||(e.navigation.actionMap.dragSecondary=t),this._defaultSuperimposeSecondaryDragAction=null},this.disablePanoramicSuperimposeNavigation=()=>{this._panoramicSuperimposeNavigationHandles.forEach(e=>e.remove()),this._panoramicSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null},this._handleDefaultSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`)return;let n=f(`rotate`,t.navigation.actionMap);p(e,n)&&e.stopPropagation()},this._handlePanoramicSuperimposeDoubleClick=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone(),i=e.native.ctrlKey?S:C;r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*i,x,b),t.camera=r},this._handlePanoramicSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(t&&t.type===`3d`&&this._panoramicSuperimposeAnchor)switch(e.stopPropagation(),e.action){case`start`:this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return;case`update`:{let r=this._panoramicSuperimposeLastScreenPoint;if(!r){this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return}let i=r.x-e.x,a=e.y-r.y;this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};let o=t.camera.clone(),{horizontal:s,vertical:c}=w(t);o.position=this._panoramicSuperimposeAnchor.clone(),o.heading+=s*i/Math.max(t.width,1),o.tilt=n(o.tilt+c*a/Math.max(t.height,1),E,T),t.camera=o;return}case`end`:this._panoramicSuperimposeLastScreenPoint=null;return}},this._handlePanoramicSuperimposeKeyDown=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;let r=t.camera.clone(),i=!0;switch(r.position=this._panoramicSuperimposeAnchor.clone(),e.key){case`ArrowLeft`:r.heading-=D;break;case`ArrowRight`:r.heading+=D;break;case`ArrowUp`:r.tilt=n(r.tilt-D,E,T);break;case`ArrowDown`:r.tilt=n(r.tilt+D,E,T);break;default:i=!1}i&&(e.stopPropagation(),t.camera=r)},this._handlePanoramicSuperimposeWheel=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone();r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*(e.deltaY>0?S:C),x,b),t.camera=r}}async _computeFeatureFootprint(e,t){let{currentBestFeature:n,view:i}=this.viewModel,a=n?.elevationSample;if(a?.extent&&!a.extent.contains(e.geometry)&&(a=await this.viewModel.processFeatureElevation([e],e.geometry.clone(),t)??a),a){let n=await d(e.geometry.clone(),{elevationSample:a},t);r(t),e.attributes.elevation=n.z}return A(e,i.spatialReference,t)}_enablePanoramicSuperimposeNavigation(e){let{view:t}=this.viewModel;t&&t.type===`3d`&&(this.disablePanoramicSuperimposeNavigation(),this._panoramicSuperimposeAnchor=e.clone(),this._panoramicSuperimposeNavigationHandles=[t.on(`drag`,this._handlePanoramicSuperimposeDrag),t.on(`mouse-wheel`,this._handlePanoramicSuperimposeWheel),t.on(`double-click`,this._handlePanoramicSuperimposeDoubleClick),t.on(`key-down`,this._handlePanoramicSuperimposeKeyDown)])}}async function k(e,t,n,r){return Float64Array.from((await Promise.all(e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]=e[r]??[],e[r].push(t),e},[]).map(async e=>(await s(new o(e,t),n,r)).toArray()))).flat())}const A=async(t,n,i)=>{let{frustum:o}=g(t.attributes),u=o.clone();if(!n.equals(u.spatialReference)){let{components:e,spatialReference:t,origin:o,vertexAttributes:d,vertexSpace:f}=u;if(f.type===`local`){let e=await s(o,n,i);r(i),u.centerAt(e)}else{let o=d.position,s=Float64Array.from(await l([...o],t.clone(),n.clone(),i));r(i),u=new a({vertexAttributes:new c({position:s}),components:e,spatialReference:n.clone()})}}return new e({attributes:{imageID:o.imageID},geometry:u,symbol:_.clone(),visible:!1})},j=e=>{let t=e.vertexAttributes.position,n=0,r=0,i=0,a=t.length/3;for(let e=0;e<t.length;e+=3)n+=t[e],r+=t[e+1],i+=t[e+2];return new o({x:n/a,y:r/a,z:i/a,spatialReference:e.spatialReference})};export{O as default};
|
|
2
|
+
import e from"../../../../Graphic.js";import{isSome as t}from"../../../../core/arrayUtils.js";import{clamp as n}from"../../../../core/mathUtils.js";import{throwIfAborted as r,waitTick as i}from"../../../../core/promiseUtils.js";import{subtract as a,length as o,normalize as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import l from"../../../../geometry/Mesh.js";import u from"../../../../geometry/Point.js";import{projectAsync as d}from"../../../../geometry/projectionUtils.js";import{projectPointToVector as f}from"../../../../geometry/projection/projectPointToVector.js";import p from"../../../../geometry/support/MeshVertexAttributes.js";import{projectVertices as m,updateFrustum as h}from"../../../../layers/orientedImagery/core/coverageUtils.js";import g from"../../../../layers/orientedImagery/transformations/updateElevation.js";import{toRenderCamera as _}from"../../../../views/3d/webgl.js";import{directionToHeadingTilt as v}from"../../../../views/3d/support/viewingModeUtils.js";import{getPointerActions as y,eventMatchesMousePointerActions as b}from"../../../../views/input/handlers/support.js";import{fixedImageSize as x,invalidCameraHeading as S}from"../../constants.js";import{createFeatureCoverage as C}from"../../featureCoverage.js";import{activeFrustumSymbol as w,additionalFrustumSymbol as T}from"../../symbols.js";import{getDefaultSuperimposeFov as E,panoramicSuperimposeMaxFov as D,panoramicSuperimposeMinFov as O,panoramicSuperimposeZoomOutFactor as k,panoramicSuperimposeZoomInFactor as A,getViewCameraFieldOfView as j,panoramicSuperimposeMaxTilt as M,panoramicSuperimposeMinTilt as N,panoramicSuperimposeKeyboardAngleStep as P}from"../../support/superimposeUtils.js";class F{constructor(u){this.viewModel=u,this._defaultSuperimposeSecondaryDragAction=null,this._defaultSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null,this._panoramicSuperimposeNavigationHandles=[],this.createFootprints=async n=>{let{coverageFrustums:i,currentBestFeature:a,isAdditionalCoverageVisible:o,view:s}=this.viewModel,c=i.filter(t);for(let t of c){let i=t.clone();if(!s.spatialReference.equals(i.spatialReference)){let{components:e,spatialReference:t,origin:a,vertexAttributes:o,vertexSpace:c}=i;if(c.type===`local`){let e=await d(a,s.spatialReference,n);r(n),i.centerAt(e)}else{let a=o.position,c=Float64Array.from(await m([...a],t.clone(),s.spatialReference.clone(),n));r(n),i=new l({vertexAttributes:new p({position:c}),components:e,spatialReference:s.spatialReference.clone()})}}t.imageID===a.attributes.objectId?this.viewModel.bestFeatureFootprint=new e({attributes:{imageID:t.imageID},geometry:i,symbol:w.clone(),visible:!1}):this.viewModel.additionalFootprints.push(new e({attributes:{imageID:t.imageID},geometry:i,symbol:T.clone(),visible:o}))}},this.updateFootprint=async(n,i,a)=>{let{bestFeatureFootprint:o,currentBestFeature:s,activeViewer:c,footprintExtent:l,view:u,mode:f}=this.viewModel,p=f===`video`?x:c?.imageSize,m=i??s;if(!s||!o?.geometry||!p||!l||!m||!u?.spatialReference){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:g,location:_,cameraPitch:v,horizontalFieldOfView:y,verticalFieldOfView:b,cameraRoll:S}}=m,C=null;i&&(C=await this._computeFeatureFootprint(i,a));let T=m.attributes.location.toArray(),{vertexAttributes:{position:E},spatialReference:D}=(i&&C?C:o).geometry,O=await I(E,D,_.spatialReference),k=await this.viewModel.getMapPoint(n);r(a);let A=k.filter(t);if(!A.length)return;A[0].spatialReference.equals(_.spatialReference)||(A=await Promise.all(A.map(async e=>{let t=await d(e,_.spatialReference,a);return r(a),t})));let j=await h(n.map(({x:e,y:t})=>[e,t]),A.map(e=>e.toArray()),{cameraHeight:g,cameraLocation:T,cameraPitch:v,frustumVertices:O,horizontalFieldOfView:y,imageHeight:p[1],imageWidth:p[0],inSRS:{wkid:_.spatialReference.wkid},outSRS:{wkid:u.spatialReference.wkid},verticalFieldOfView:b,cameraRoll:S??0,options:a});this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:m.attributes.objectId},geometry:j,symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateVideoFootprint=async n=>{let{points:i,feature:a,scale:o,options:s}=n,{bestFeatureFootprint:c,currentBestFeature:l,activeViewer:u,footprintExtent:f,view:p,mode:m}=this.viewModel,g=m===`video`?x:u?.imageSize,_=a??l;if(!l||!c?.geometry||!g||!f||!_||!p?.spatialReference||m===`none`){this.viewModel.updateCurrentCoveragePolygon(null);return}let{attributes:{cameraHeight:v,location:y,cameraPitch:b,horizontalFieldOfView:S,verticalFieldOfView:C,cameraRoll:T}}=_,E=null;a&&(E=await this._computeFeatureFootprint(a,s));let D=_.attributes.location.toArray(),{vertexAttributes:{position:O},spatialReference:k}=(a&&E?E:c).geometry,A=await I(O,k,y.spatialReference),j={feature:_,mode:m,imageSize:g,footprintExtent:f},M=await this.viewModel.getMapPointForFeature(i,j,s);r(s);let N=M.filter(t);if(!N.length)return;N[0].spatialReference.equals(y.spatialReference)||(N=await Promise.all(N.map(async e=>{let t=await d(e,y.spatialReference,s);return r(s),t})));let P=await h(i.map(({x:e,y:t})=>[e,t]),N.map(e=>e.toArray()),{cameraHeight:v,cameraLocation:D,cameraPitch:b,frustumVertices:A,horizontalFieldOfView:S,imageHeight:g[1],imageWidth:g[0],inSRS:{wkid:y.spatialReference.wkid},outSRS:{wkid:p.spatialReference.wkid},verticalFieldOfView:C,cameraRoll:T??0,options:s});if(o&&P){let e=R(P);P.scale(o,{origin:e})}this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:_.attributes.objectId},geometry:P,symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updateFootprintPanorama=async(t,n)=>{await i(n);let{horizontalFieldOfView:r,pitch:a,verticalFieldOfView:o,yaw:s,feature:c}=t,l=c?.clone()??this.viewModel.currentBestFeature?.clone();if(!l)return;let{attributes:u}=l;u.orientedImageryType=null,u.cameraHeading=s,u.cameraPitch=a,u.horizontalFieldOfView=r,u.verticalFieldOfView=o,u.cameraRoll=0;let{frustum:d}=C(u);!d||!this.viewModel.view?.spatialReference.equals(d.spatialReference)?this.viewModel.updateCurrentCoveragePolygon(null):this.viewModel.updateCurrentCoveragePolygon(new e({attributes:{imageID:u.objectId},geometry:d.clone(),symbol:w.clone(),visible:this.viewModel.currentCoverageVisible}))},this.updatePanoramicSuperimposeCamera=async(e,t)=>{let{camera:n,currentBestFeature:i}=e,{view:a}=this.viewModel;if(a?.type!==`3d`)return;let o=i.attributes.location,s=o.spatialReference.equals(a.spatialReference)?o:await d(o,a.spatialReference,t);if(r(t),!s)return;let c=n.clone();c.position=s.clone(),a.camera=c,this._enablePanoramicSuperimposeNavigation(s)},this.updateDefaultSuperimposeCamera=async(e,t)=>{let{currentBestFeature:i,target:l}=e,{view:u}=this.viewModel;if(u?.type!==`3d`)return;let{cameraHeading:p,cameraPitch:m,cameraRoll:h,horizontalFieldOfView:g,location:y,verticalFieldOfView:b}=i.attributes,x=y.spatialReference.equals(u.spatialReference)?y.clone():await d(y,u.spatialReference,t);if(r(t),!x)return;let C=E(u,g,b,h??0),w=u.camera.clone();if(w.position=x,w.fov=n(w.fov,O,D),p!=null&&p!==S&&(w.heading=p),m!=null&&(w.tilt=m),C!=null&&(w.fov=C),l){let e=_(u,w),t=c();if(e&&f(l,t,u.renderSpatialReference)&&(a(t,t,e.eye),o(t)>0)){s(t,t);let{heading:n,tilt:r}=v(u,e.eye,t,e.up);w.heading=n,w.tilt=r}}u.camera=w},this.enableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel;if(e?.type!==`3d`)return;let t=e.navigation.actionMap;this._defaultSuperimposeSecondaryDragAction??=t.dragSecondary,t.dragSecondary!==`none`&&(t.dragSecondary=`none`),this._defaultSuperimposeNavigationHandles.length||(this._defaultSuperimposeNavigationHandles=[e.on(`drag`,this._handleDefaultSuperimposeDrag)])},this.disableDefaultSuperimposeNavigation=()=>{let{view:e}=this.viewModel,t=this._defaultSuperimposeSecondaryDragAction;this._defaultSuperimposeNavigationHandles.forEach(e=>e.remove()),this._defaultSuperimposeNavigationHandles=[],e?.type!==`3d`||t==null||(e.navigation.actionMap.dragSecondary=t),this._defaultSuperimposeSecondaryDragAction=null},this.disablePanoramicSuperimposeNavigation=()=>{this._panoramicSuperimposeNavigationHandles.forEach(e=>e.remove()),this._panoramicSuperimposeNavigationHandles=[],this._panoramicSuperimposeAnchor=null,this._panoramicSuperimposeLastScreenPoint=null},this._handleDefaultSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`)return;let n=y(`rotate`,t.navigation.actionMap);b(e,n)&&e.stopPropagation()},this._handlePanoramicSuperimposeDoubleClick=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone(),i=e.native.ctrlKey?k:A;r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*i,O,D),t.camera=r},this._handlePanoramicSuperimposeDrag=e=>{let{view:t}=this.viewModel;if(t&&t.type===`3d`&&this._panoramicSuperimposeAnchor)switch(e.stopPropagation(),e.action){case`start`:this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return;case`update`:{let r=this._panoramicSuperimposeLastScreenPoint;if(!r){this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};return}let i=r.x-e.x,a=e.y-r.y;this._panoramicSuperimposeLastScreenPoint={x:e.x,y:e.y};let o=t.camera.clone(),{horizontal:s,vertical:c}=j(t);o.position=this._panoramicSuperimposeAnchor.clone(),o.heading+=s*i/Math.max(t.width,1),o.tilt=n(o.tilt+c*a/Math.max(t.height,1),N,M),t.camera=o;return}case`end`:this._panoramicSuperimposeLastScreenPoint=null;return}},this._handlePanoramicSuperimposeKeyDown=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;let r=t.camera.clone(),i=!0;switch(r.position=this._panoramicSuperimposeAnchor.clone(),e.key){case`ArrowLeft`:r.heading-=P;break;case`ArrowRight`:r.heading+=P;break;case`ArrowUp`:r.tilt=n(r.tilt-P,N,M);break;case`ArrowDown`:r.tilt=n(r.tilt+P,N,M);break;default:i=!1}i&&(e.stopPropagation(),t.camera=r)},this._handlePanoramicSuperimposeWheel=e=>{let{view:t}=this.viewModel;if(!t||t.type!==`3d`||!this._panoramicSuperimposeAnchor)return;e.stopPropagation();let r=t.camera.clone();r.position=this._panoramicSuperimposeAnchor.clone(),r.fov=n(r.fov*(e.deltaY>0?k:A),O,D),t.camera=r}}async _computeFeatureFootprint(e,t){let{currentBestFeature:n,view:i}=this.viewModel,a=n?.elevationSample;if(a?.extent&&!a.extent.contains(e.geometry)&&(a=await this.viewModel.processFeatureElevation([e],e.geometry.clone(),t)??a),a){let n=await g(e.geometry.clone(),{elevationSample:a},t);r(t),e.attributes.elevation=n.z}return L(e,i.spatialReference,t)}_enablePanoramicSuperimposeNavigation(e){let{view:t}=this.viewModel;t&&t.type===`3d`&&(this.disablePanoramicSuperimposeNavigation(),this._panoramicSuperimposeAnchor=e.clone(),this._panoramicSuperimposeNavigationHandles=[t.on(`drag`,this._handlePanoramicSuperimposeDrag),t.on(`mouse-wheel`,this._handlePanoramicSuperimposeWheel),t.on(`double-click`,this._handlePanoramicSuperimposeDoubleClick),t.on(`key-down`,this._handlePanoramicSuperimposeKeyDown)])}}async function I(e,t,n,r){return Float64Array.from((await Promise.all(e.reduce((e,t,n)=>{let r=Math.floor(n/3);return e[r]=e[r]??[],e[r].push(t),e},[]).map(async e=>(await d(new u(e,t),n,r)).toArray()))).flat())}const L=async(t,n,i)=>{let{frustum:a}=C(t.attributes),o=a.clone();if(!n.equals(o.spatialReference)){let{components:e,spatialReference:t,origin:a,vertexAttributes:s,vertexSpace:c}=o;if(c.type===`local`){let e=await d(a,n,i);r(i),o.centerAt(e)}else{let a=s.position,c=Float64Array.from(await m([...a],t.clone(),n.clone(),i));r(i),o=new l({vertexAttributes:new p({position:c}),components:e,spatialReference:n.clone()})}}return new e({attributes:{imageID:a.imageID},geometry:o,symbol:w.clone(),visible:!1})},R=e=>{let t=e.vertexAttributes.position,n=0,r=0,i=0,a=t.length/3;for(let e=0;e<t.length;e+=3)n+=t[e],r+=t[e+1],i+=t[e+2];return new u({x:n/a,y:r/a,z:i/a,spatialReference:e.spatialReference})};export{F as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import e from"../../../Graphic.js";import{createTask as t}from"../../../core/asyncUtils.js";import n from"../../../core/Collection.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import a from"../../../geometry/Mesh.js";import{projectAsync as o}from"../../../geometry/projectionUtils.js";import s from"../../../geometry/support/MeshComponent.js";import c from"../../../geometry/support/MeshMaterial.js";import l from"../../../geometry/support/MeshTexture.js";import u from"../../../geometry/support/MeshVertexAttributes.js";import{imageToWorldPanoramic as d}from"../../../layers/orientedImagery/transformations/imageToWorld.js";import f from"../../../symbols/FillSymbol3DLayer.js";import p from"../../../symbols/MeshSymbol3D.js";import{calculateUpdatedWmsf as m}from"../imageMeasurementUtils.js";import{validateTifOrMrfExtension as h}from"../utils.js";import g from"../support/resolveMediaProps.js";import{computeDefaultAreaOfInterest as _,getBaseRasterLevel as v,computePanoramicAreasOfInterest as y,applySphereMeshOffsetInMeters as b,getRasterFetchParameters as x,getRasterLevelSize as S,getViewDependentRasterLevel as C,clampRasterLevelForTextureSize as w,createSuperimposeGridVertexAttributes as T,createSuperimposeSamplePixels as E}from"../support/superimposeUtils.js";const D=[255,255,255,255];class O{constructor(e){this._properties=e,this._cachedBaseTexture=null,this._cachedPanoramicRadiusObjectId=null,this._defaultGraphicProperties=null,this._defaultZOffsetPercentage=0,this._defaultCameraFeature=null,this._graphics=[],this._panoramicRadiusOffsetInMeters=0,this._panoramicRadiusOffsetPercentage=0,this._panoramicRadiusOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache=new Map,this._task=null}clear(){this._destroyGraphics(this._graphics,!0),this._cachedBaseTexture=null,this._cachedPanoramicRadiusObjectId=null,this._defaultGraphicProperties=null,this._defaultZOffsetPercentage=0,this._defaultCameraFeature=null,this._graphics=[],this._panoramicRadiusOffsetInMeters=0,this._panoramicRadiusOffsetPercentage=0,this._panoramicRadiusOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache.clear()}destroy(){this._task=this._task?.abort()??null,this.clear()}update(e){this._task?.abort(),this._task=t(async t=>{if(!this._canUpdate(e)){this._resetInactiveState(e.adapter);return}let n=!1,r=[];try{await this._updateDefaultCameraIfNeeded(e,t),this._resetRasterTextureCacheIfNeeded(e.currentBestFeature);let a=await this._resolveMedia(e,t);if(!a||({graphics:r}=await this._createGraphics(e,a,t),!r.length))return;await this._updateNavigation(e,t),e.mode===`panoramic`&&await this._applyPersistentPanoramicRadiusOffset(r,e.currentBestFeature,e.view,t),i(t),this._replaceGraphics(r,e.mode),n=!0}finally{n||this._destroyGraphics(r,!1)}})}_canUpdate(e){return e.superimposeViewEnabled&&e.state===`image-loaded`&&e.view?.type===`3d`&&!!e.currentBestFeature&&!!e.layer&&[`default`,`panoramic`].includes(e.mode)}_resetInactiveState(e){e?.disableDefaultSuperimposeNavigation?.(),e?.disablePanoramicSuperimposeNavigation?.(),this.clear()}async _updateDefaultCameraIfNeeded(e,t){let{currentBestFeature:n,mode:r}=e;n&&r==="default"&&this._shouldUpdateDefaultCamera(r,n)&&(await e.adapter?.updateDefaultSuperimposeCamera?.({currentBestFeature:n},{signal:t}),i(t),this._defaultCameraFeature=n)}async _resolveMedia(e,t){let{currentBestFeature:n,layer:r,mode:a,view:o}=e;if(!n||!r||!o||a!=="default"&&a!==`panoramic`)return null;let s=await g(n.attributes,r,{signal:t});if(i(t),!s?.mediaUrl)return null;if(!h(s.datasetFormat))return this._resolveNonRasterMedia(s);let c=await this._resolveRasterMedia(s,o,t);if(!c)return null;switch(a){case`default`:{let n=await this._resolveDefaultAreaOfInterest(e,s,t);return this._resolveDefaultRasterMedia(c,n,o,t)}case`panoramic`:return this._resolvePanoramicRasterMedia(c,e,t)}}_resolveNonRasterMedia(e){return{areaOfInterest:null,textureUrl:this._resolveTextureUrl(e)}}async _resolveDefaultAreaOfInterest(e,t,n){let{activeImageSize:r,currentBestFeature:a,mode:o,view:s}=e;if(o!=="default"||!r||!a||!s||!h(t.datasetFormat))return null;let c=await _(a,s,r,this._properties.pointToPixel,{signal:n});return i(n),c}async _resolveRasterMedia(e,t,n){let r=await this._loadRaster(e,{signal:n});if(i(n),!r)return null;let a=v(r,t),o=this._cachedBaseTexture;if(!o){let e=await this._createRasterTexture(r,null,a,{signal:n});i(n),e&&(o=e,this._cachedBaseTexture=e)}return o?{baseLevel:a,baseTexture:o,raster:r}:null}async _resolveDefaultRasterMedia(e,t,n,r){let{baseLevel:a,baseTexture:o,raster:s}=e;if(!t)return{areaOfInterest:null,baseTexture:o,raster:s,texture:o};let c=v(s,n,t),l=await this._createCompositedDefaultRasterTexture(s,t,c,a,{signal:r});return i(r),{areaOfInterest:t,baseTexture:o,overlayTexture:l,raster:s,texture:l??o}}async _resolvePanoramicRasterMedia(e,t,n){let{activeImageSize:r,currentBestFeature:a,view:o}=t,{baseTexture:s,raster:c}=e;if(!r||!a||!o)return{areaOfInterest:null,baseTexture:s,panoramicAreasOfInterest:void 0,raster:c,texture:s};let l=await y(a,o,r,this._properties.pointToPixel,{signal:n});i(n);let u=await this._createPanoramicRasterTexture(c,a,o,r,l,{signal:n})??s;return i(n),{areaOfInterest:null,baseTexture:s,panoramicAreasOfInterest:l,raster:c,texture:u}}async _createGraphics(e,t,n){switch(e.mode){case`default`:return this._createDefaultGraphics(e,t,n);case`panoramic`:return this._createPanoramicGraphics(e,t,n)}return{graphics:[]}}async _createDefaultGraphics(e,t,n){let r=await this._createAndDrapeDefaultGraphic(e,n,{texture:t.texture,textureUrl:t.textureUrl});return{graphics:r?[r]:[]}}async _createAndDrapeDefaultGraphic(e,t,n){let{activeImageSize:r,currentBestFeature:a,depthImageLoaded:o,view:s}=e,{areaOfInterest:c,texture:l,textureUrl:u}=n;if(!r||s?.type!==`3d`||!a)return null;let d=await this._createDefaultGraphic({areaOfInterest:c,currentBestFeature:a,depthImageLoaded:o,imageSize:r,signal:t,texture:l,textureUrl:u,view:s});if(!d)return null;let f=await this._resolveDefaultMeshPosition(d,r,s,a,c,t,100),p=await this._resolveDefaultMeshPosition(d,r,s,a,c,t,0);return i(t),this._defaultGraphicProperties={areaOfInterest:c??null,currentBestFeature:a,farPosition:p??(d.geometry?.type===`mesh`?d.geometry.vertexAttributes.position.slice():new Float64Array),imageSize:r,nearPosition:f,view:s},d}async _createPanoramicGraphics(e,t,n){let r=await this._createPanoramicSuperimposeGraphic(e,t,n,null);return{graphics:r?[r]:[]}}async _createPanoramicSuperimposeGraphic(e,t,n,r){let{activeImageSize:i,currentBestFeature:a,view:o}=e;return o?this._createPanoramicGraphic({areaOfInterest:r,currentBestFeature:a??void 0,imageSize:i,signal:n,texture:t.texture,textureUrl:t.textureUrl,view:o}):null}async _updateNavigation(e,t){let{currentBestFeature:n,mode:r,view:i}=e;if(n&&i&&i.type===`3d`)switch(r){case`default`:this._updateDefaultNavigation(e);return;case`panoramic`:await this._updatePanoramicNavigation(e,n,i,t);return}}_updateDefaultNavigation(e){this._updateDefaultSuperimposeNavigation(e.adapter,e.defaultSuperimposeCameraLockEnabled)}async _updatePanoramicNavigation(e,t,n,r){e.adapter?.disableDefaultSuperimposeNavigation?.();let a=t===this._panoramicNavigationFeature?n.camera:e.panoramicCamera??n.camera;a&&this._shouldUpdatePanoramicCamera(e.mode,t)&&(e.adapter?.disablePanoramicSuperimposeNavigation?.(),await e.adapter?.updatePanoramicSuperimposeCamera?.({camera:a,currentBestFeature:t},{signal:r}),i(r)),this._panoramicNavigationFeature=t}_replaceGraphics(e,t){if(t===`panoramic`&&this._updatePanoramicGraphicInPlace(e))return;let n=this._graphics;this._graphics=e,this._properties.overlays.addMany(e),this._destroyGraphics(n,!0)}_updatePanoramicGraphicInPlace(e){if(this._graphics.length!==1||e.length!==1)return!1;let t=this._graphics[0],n=e[0];return!t||!n?!1:(t.geometry=n.geometry,t.symbol=n.symbol,t.visible=n.visible,n.geometry=null,n.symbol=null,r(n),!0)}_destroyGraphics(e,t){e.length&&(t&&this._properties.overlays.removeMany(e),e.forEach(e=>r(e)))}_updateDefaultSuperimposeNavigation(e,t=!0){t?e?.enableDefaultSuperimposeNavigation?.():e?.disableDefaultSuperimposeNavigation?.(),this._panoramicNavigationFeature&&e?.disablePanoramicSuperimposeNavigation?.(),this._panoramicNavigationFeature=null}_shouldUpdateDefaultCamera(e,t){return e==="default"&&t!==this._defaultCameraFeature}_shouldUpdatePanoramicCamera(e,t){return e===`panoramic`&&t!==this._panoramicNavigationFeature}setDefaultZOffsetPercentage(e){this._defaultZOffsetPercentage=Math.max(0,Math.min(100,e)),this._defaultGraphicProperties&&this._graphics.length===1&&this._rebuildDefaultGraphicForPercentage(this._defaultZOffsetPercentage)}setPanoramicRadiusPercentage(e){let t=Math.max(0,Math.min(100,e)),n=this._panoramicRadiusOffsetRangeInMeters*t/100,r=n-this._panoramicRadiusOffsetInMeters;this._panoramicRadiusOffsetPercentage=t,this._panoramicRadiusOffsetInMeters=n,this._applyPanoramicRadiusOffset(this._graphics,r)}updatePanoramicRadiusOffset(e){e!==0&&(this._panoramicRadiusOffsetInMeters+=e,this._applyPanoramicRadiusOffset(this._graphics,e))}_applyPanoramicRadiusOffset(e,t){t!==0&&e.forEach(e=>{let n=e.geometry;n?.type===`mesh`&&b(n,{radiusOffset:t,minimumRadiusInMeters:10})})}async _applyPersistentPanoramicRadiusOffset(e,t,n,r){this._panoramicRadiusOffsetRangeInMeters=await this._resolvePanoramicRadiusOffsetRangeInMeters(t,n,r),this._panoramicRadiusOffsetInMeters=this._panoramicRadiusOffsetRangeInMeters*this._panoramicRadiusOffsetPercentage/100,this._applyPanoramicRadiusOffset(e,this._panoramicRadiusOffsetInMeters)}_rebuildDefaultGraphicForPercentage(e){let t=this._defaultGraphicProperties,[n]=this._graphics;if(!t||!n||n.geometry?.type!==`mesh`)return;let r=this._createDefaultMeshForPercentage(t,n.geometry,e);r&&(this._applyDefaultMeshAppearance(r,n.geometry),n.geometry=r)}_createDefaultMeshForPercentage(e,t,n){let{farPosition:r,nearPosition:i,view:o}=e;if(!i||i.length!==r.length)return null;let c=new Float64Array(r.length),l=n/100;for(let e=0;e<r.length;e+=1)c[e]=r[e]+(i[e]-r[e])*l;let d=t.vertexAttributes.uv,f=t.components;return!d||!f||f.some(e=>!e.faces)?null:new a({vertexAttributes:new u({position:c,uv:d.slice()}),components:f.map(e=>new s({faces:e.faces.slice()})),spatialReference:o.spatialReference.clone()})}_resolveDefaultSuperimposeDistance(e,t){let n=e.attributes.farDistance,r=Math.max(0,e.attributes.nearDistance??n);if(n>0&&r>=0)return n+(r-n)*t/100}async _resolvePanoramicRadiusOffsetRangeInMeters(e,t,n){let r=e.attributes.objectId;if(this._cachedPanoramicRadiusObjectId!==r){let a=e.attributes.farDistance,s=Math.max(10,e.attributes.nearDistance??a);if(!(a>0)||!(s>=0))return this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=0,0;let c=e.attributes.location,l=c.spatialReference.equals(t.spatialReference)?c:await o(c,t.spatialReference,{signal:n});if(i(n),!l)return this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=0,0;let u=l.spatialReference.isWebMercator?m(l.y):1;this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=(s-a)*u}return this._panoramicRadiusOffsetRangeInMeters}_resolveTextureUrl(e){let t=new URL(e.mediaUrl);return Object.entries(e.searchParams).forEach(([e,n])=>{t.searchParams.has(e)||t.searchParams.set(e,n)}),t.toString()}_resetRasterTextureCacheIfNeeded(e){e&&e!==this._rasterTextureCacheFeature&&(this._cachedBaseTexture=null,this._rasterTextureFetchCache.clear(),this._rasterTextureCacheFeature=e)}_createImageDataFromPixelBlock(e){return new ImageData(e.getAsRGBA(),e.width,e.height)}_copyImageData(e,t,n,r,i=e.width,a=e.height){let o=e.data,s=t.data,c=e.width,l=e.height,u=t.width,d=t.height;for(let e=0;e<a;e+=1){let t=r+e;if(t<0||t>=d)continue;let f=Math.min(l-1,Math.floor(e*l/a));for(let e=0;e<i;e+=1){let r=n+e;if(r<0||r>=u)continue;let a=Math.min(c-1,Math.floor(e*c/i)),l=(f*c+a)*4,d=(t*u+r)*4;s[d]=o[l],s[d+1]=o[l+1],s[d+2]=o[l+2],s[d+3]=o[l+3]}}}_copyImageDataRegion(e,t,n,r,i,a,o,s){let c=e.data,l=t.data,u=e.width,d=t.width;for(let e=0;e<s;e+=1)for(let t=0;t<o;t+=1){let o=((r+e)*u+(n+t))*4,s=((a+e)*d+(i+t))*4;l[s]=c[o],l[s+1]=c[o+1],l[s+2]=c[o+2],l[s+3]=c[o+3]}}async _fetchRasterTextureAtLevel(e,t,n,r){let{offset:a,size:o}=x(e,t,n),s=this._createRasterTextureExtent(a,o),c=this._createRasterTextureLevelCacheKey(e,t),l=this._getOrCreateRasterTextureLevelCache(c),u=this._getUncoveredRasterTextureExtents(s,l.patches);for(let n of u){let a=this._createRasterTextureExtentCacheKey(n),o=l.inflight.get(a);o||(o=this._fetchRasterTexturePatch(e,t,n,r),l.inflight.set(a,o));try{let e=await o;i(r),e&&l.patches.push(e)}finally{l.inflight.delete(a)}}return this._composeRasterTextureFromCachedPatches(s,l.patches)}_getOrCreateRasterTextureLevelCache(e){let t=this._rasterTextureFetchCache.get(e);return t||(t={inflight:new Map,patches:[]},this._rasterTextureFetchCache.set(e,t)),t}_createRasterTextureLevelCacheKey(e,t){return[e.url,e.rasterInfo.width,e.rasterInfo.height,t].join(`:`)}_createRasterTextureExtentCacheKey(e){return[e.xmin,e.ymin,e.xmax,e.ymax].join(`:`)}_createRasterTextureExtent(e,t){return{xmin:e.x,ymin:e.y,xmax:e.x+t.width,ymax:e.y+t.height}}_getUncoveredRasterTextureExtents(e,t){let n=[e];for(let e of t)if(n=n.flatMap(t=>this._subtractRasterTextureExtent(t,e.extent)),!n.length)break;return n}_subtractRasterTextureExtent(e,t){let n=this._intersectRasterTextureExtents(e,t);if(!n)return[e];let r=[];return e.ymin<n.ymin&&r.push({xmin:e.xmin,ymin:e.ymin,xmax:e.xmax,ymax:n.ymin}),n.ymax<e.ymax&&r.push({xmin:e.xmin,ymin:n.ymax,xmax:e.xmax,ymax:e.ymax}),e.xmin<n.xmin&&r.push({xmin:e.xmin,ymin:n.ymin,xmax:n.xmin,ymax:n.ymax}),n.xmax<e.xmax&&r.push({xmin:n.xmax,ymin:n.ymin,xmax:e.xmax,ymax:n.ymax}),r.filter(({xmin:e,ymin:t,xmax:n,ymax:r})=>n>e&&r>t)}_intersectRasterTextureExtents(e,t){let n=Math.max(e.xmin,t.xmin),r=Math.max(e.ymin,t.ymin),i=Math.min(e.xmax,t.xmax),a=Math.min(e.ymax,t.ymax);return i>n&&a>r?{xmin:n,ymin:r,xmax:i,ymax:a}:null}async _fetchRasterTexturePatch(e,t,n,r){let{pixelBlock:a}=await e.fetchRawPixels(t,{x:n.xmin,y:n.ymin},{width:n.xmax-n.xmin,height:n.ymax-n.ymin},r);if(i(r),a)return{extent:n,imageData:this._createImageDataFromPixelBlock(a)}}_composeRasterTextureFromCachedPatches(e,t){let n=t.filter(t=>this._intersectRasterTextureExtents(e,t.extent));if(!n.length)return;let r=new ImageData(e.xmax-e.xmin,e.ymax-e.ymin);for(let t of n){let n=this._intersectRasterTextureExtents(e,t.extent);n&&this._copyImageDataRegion(t.imageData,r,n.xmin-t.extent.xmin,n.ymin-t.extent.ymin,n.xmin-e.xmin,n.ymin-e.ymin,n.xmax-n.xmin,n.ymax-n.ymin)}return r}async _loadRaster(e,t){let{loadRaster:n}=await import(`../../PanoramicViewer/utils.js`),r=await n(this._resolveTextureUrl(e),t);return i(t),r}async _createCompositedDefaultRasterTexture(e,t,n,r,a){let{pyramidScalingFactor:o}=e.rasterInfo.storageInfo,s=o??2,c=S(e.rasterInfo.width,e.rasterInfo.height,n,s),u=await this._fetchRasterTextureAtLevel(e,r,null,a);if(i(a),!u)return;let d=await this._fetchRasterTextureAtLevel(e,n,t,a);if(i(a),!d)return new l({data:u});let f=new ImageData(c.width,c.height);this._copyImageData(u,f,0,0,c.width,c.height);let p=s**n,{x:m,y:h}=this._resolveRasterDrawOrigin(t,p);return this._copyImageData(d,f,m,h),new l({data:f})}async _createRasterTexture(e,t,n,r){let{maximumPyramidLevel:i}=e.rasterInfo.storageInfo,a=await this._fetchRasterTextureAtLevel(e,n??i,t,r);if(a)return new l({data:a})}async _createPanoramicRasterTexture(e,t,n,r,a,o){if(a??=await y(t,n,r,this._properties.pointToPixel,o),i(o),!a?.length)return this._createRasterTexture(e,null,void 0,o);let{baseLevel:s,level:c,scalingFactor:l}=this._resolvePanoramicRasterLevels(e,n,a);return s<=c?this._createRasterTexture(e,null,c,o):this._createCompositedPanoramicRasterTexture(e,a,{baseLevel:s,level:c,scalingFactor:l},o)}_resolvePanoramicRasterLevels(e,t,n){let{maximumPyramidLevel:r,pyramidScalingFactor:i}=e.rasterInfo.storageInfo,a=n.reduce((n,r)=>Math.min(n,C(e,t,r)),r),o=w(e,a),s=i??2;return{baseLevel:Math.min(r,o+2),level:o,scalingFactor:s}}async _createCompositedPanoramicRasterTexture(e,t,n,r){let{baseLevel:a,level:o,scalingFactor:s}=n,c=S(e.rasterInfo.width,e.rasterInfo.height,o,s),u=await this._fetchRasterTextureAtLevel(e,a,null,r);if(i(r),!u)return;let d=new ImageData(c.width,c.height);this._copyImageData(u,d,0,0,c.width,c.height);let f=s**o;for(let n of t){let t=await this._fetchRasterTextureAtLevel(e,o,n,r);if(i(r),!t)continue;let{x:a,y:s}=this._resolveRasterDrawOrigin(n,f);this._copyImageData(t,d,a,s)}return new l({data:d})}_resolveRasterDrawOrigin(e,t){return{x:Math.max(0,Math.floor(e.xmin/t)),y:Math.max(0,Math.floor(e.ymin/t))}}async _createGridMesh(e,t,n,r,c,l,d){if(t.type!==`3d`)return null;let f=await Promise.all(r.map(e=>e.spatialReference.equals(t.spatialReference)?e:o(e,t.spatialReference,d)));if(i(d),f.some(e=>!e))return null;let{faces:p,position:m,uv:h}=T(f,e,n,c);return l?.forEach((t,n)=>{let r=n*2;h[r]=t.x/e[0],h[r+1]=t.y/e[1]}),new a({vertexAttributes:new u({position:m,uv:h}),components:[new s({faces:p})],spatialReference:t.spatialReference.clone()})}async _createFootprintMesh(e,t,n,r,a,o){if(t.type!==`3d`)return null;let s=n?.attributes.farDistance,c=E(e,r),l=a??s,u=typeof l==`number`&&l>0?await this._properties.getPointAtDistance(c,l,o):await this._properties.getMapPoint(c,o);return i(o),this._createGridMesh(e,t,r,u)}async _resolveDefaultMeshPosition(e,t,n,r,a,o,s){let c=e.geometry;if(c?.type===`mesh`&&s===this._defaultZOffsetPercentage)return c.vertexAttributes.position.slice();let l=this._resolveDefaultSuperimposeDistance(r,s),u=await this._createFootprintMesh(t,n,r,a,l,{signal:o});return i(o),u?.vertexAttributes.position.slice()??null}async _createPanoramicGraphic(t){let{areaOfInterest:r,imageSize:i,signal:a,texture:o,textureUrl:s,view:u}=t;if(!o&&!s)throw Error(`Missing texture URL or texture data.`);if(!i)return null;let d=await this._createPanoramicMesh(i,u,r,t.currentBestFeature,a);if(!d)return null;let m=d.vertexAttributes.position,h=[];for(let e=0;e<m.length;e+=3)h.push(...D);d.vertexAttributes.color=new Uint8Array(h);let g=new c({colorTexture:o??new l({url:s})});return d.components?.forEach(e=>{e.shading=`source`,e.material=g}),new e({geometry:d,symbol:new p({symbolLayers:new n([new f({})])})})}async _createPanoramicMesh(e,t,n,r,a){if(t.type!==`3d`||!r)return null;let{attributes:o}=r,{farDistance:s}=o;if(typeof s!=`number`||!(s>0))return null;let c=E(e,n,128),l=this._properties.getPanoramicTransformationState?.();if(!l)return null;let{imageToWorldProperties:u,updateElevationProps:f}=l,p=await d(c.map(e=>({...e,depth:s??u.farDistance})),u,f);return i(a),this._createGridMesh(e,t,n,p,128,c)}async _createDefaultGraphic(t){let{texture:r,textureUrl:i}=t;if(!r&&!i)throw Error(`Missing texture URL or texture data.`);if(!t.imageSize)return null;let a=t.currentBestFeature?this._resolveDefaultSuperimposeDistance(t.currentBestFeature,this._defaultZOffsetPercentage):void 0,o=await this._createFootprintMesh(t.imageSize,t.view,t.currentBestFeature,t.areaOfInterest,a,{signal:t.signal});return o?(this._applyDefaultMeshAppearance(o,r??new l({url:i})),new e({geometry:o,symbol:new p({symbolLayers:new n([new f({})])})})):null}_applyDefaultMeshAppearance(e,t){let n=e.vertexAttributes.position,r=[];for(let e=0;e<n.length;e+=3)r.push(...D);e.vertexAttributes.color=new Uint8Array(r);let i=t instanceof a?t.components?.[0]?.material??null:new c({colorTexture:t});e.components?.forEach((e,n)=>{e.shading=`source`,e.material=t instanceof a?t.components?.[n]?.material??i:i})}}export{O as default};
|
|
2
|
+
import e from"../../../Graphic.js";import{createTask as t}from"../../../core/asyncUtils.js";import n from"../../../core/Collection.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{throwIfAborted as i}from"../../../core/promiseUtils.js";import a from"../../../geometry/Mesh.js";import{projectAsync as o}from"../../../geometry/projectionUtils.js";import s from"../../../geometry/support/MeshComponent.js";import c from"../../../geometry/support/MeshMaterial.js";import l from"../../../geometry/support/MeshTexture.js";import u from"../../../geometry/support/MeshVertexAttributes.js";import{imageToWorldPanoramic as d}from"../../../layers/orientedImagery/transformations/imageToWorld.js";import f from"../../../symbols/FillSymbol3DLayer.js";import p from"../../../symbols/MeshSymbol3D.js";import{calculateUpdatedWmsf as m}from"../imageMeasurementUtils.js";import{validateTifOrMrfExtension as h}from"../utils.js";import g from"../support/resolveMediaProps.js";import{computeDefaultAreaOfInterest as _,getBaseRasterLevel as v,computePanoramicAreasOfInterest as y,applySphereMeshOffsetInMeters as b,getRasterFetchParameters as x,getRasterLevelSize as S,getViewDependentRasterLevel as C,clampRasterLevelForTextureSize as w,createSuperimposeGridVertexAttributes as T,createSuperimposeSamplePixels as E}from"../support/superimposeUtils.js";const D=[255,255,255,255];class O{constructor(e){this._properties=e,this._cachedBaseTexture=null,this._cachedPanoramicRadiusObjectId=null,this._defaultGraphicProperties=null,this._defaultZOffsetPercentage=50,this._defaultCameraFeature=null,this._graphics=[],this._panoramicRadiusOffsetInMeters=0,this._panoramicRadiusOffsetPercentage=50,this._panoramicRadiusOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache=new Map,this._task=null}clear(){this._destroyGraphics(this._graphics,!0),this._cachedBaseTexture=null,this._cachedPanoramicRadiusObjectId=null,this._defaultGraphicProperties=null,this._defaultZOffsetPercentage=50,this._defaultCameraFeature=null,this._graphics=[],this._panoramicRadiusOffsetInMeters=0,this._panoramicRadiusOffsetPercentage=50,this._panoramicRadiusOffsetRangeInMeters=0,this._panoramicNavigationFeature=null,this._rasterTextureCacheFeature=null,this._rasterTextureFetchCache.clear()}destroy(){this._task=this._task?.abort()??null,this.clear()}update(e){this._task?.abort(),this._task=t(async t=>{if(!this._canUpdate(e)){this._resetInactiveState(e.adapter);return}let n=!1,r=[];try{this._resetRasterTextureCacheIfNeeded(e.currentBestFeature);let a=await this._resolveMedia(e,t);if(!a||({graphics:r}=await this._createGraphics(e,a,t),!r.length))return;await this._updateDefaultCameraIfNeeded(e,t),await this._updateNavigation(e,t),e.mode===`panoramic`&&await this._applyPersistentPanoramicRadiusOffset(r,e.currentBestFeature,e.view,t),i(t),this._replaceGraphics(r,e.mode),n=!0}finally{n||this._destroyGraphics(r,!1)}})}_canUpdate(e){return e.superimposeViewEnabled&&e.state===`image-loaded`&&e.view?.type===`3d`&&!!e.currentBestFeature&&!!e.layer&&[`default`,`panoramic`].includes(e.mode)}_resetInactiveState(e){e?.disableDefaultSuperimposeNavigation?.(),e?.disablePanoramicSuperimposeNavigation?.(),this.clear()}async _updateDefaultCameraIfNeeded(e,t){let{activeImageSize:n,currentBestFeature:r,mode:a}=e;if(n&&r&&a==="default"&&this._shouldUpdateDefaultCamera(a,r)){let a=[{x:n[0]/2,y:n[1]/2}],o=this._resolveDefaultSuperimposeDistance(r,this._defaultZOffsetPercentage)??r.attributes.farDistance,[s]=typeof o==`number`&&o>0?await this._properties.getPointAtDistance(a,o,{signal:t}):await this._properties.getMapPoint(a,{signal:t});i(t),await e.adapter?.updateDefaultSuperimposeCamera?.({currentBestFeature:r,target:s??null},{signal:t}),i(t),this._defaultCameraFeature=r}}async _resolveMedia(e,t){let{currentBestFeature:n,layer:r,mode:a,view:o}=e;if(!n||!r||!o||a!=="default"&&a!==`panoramic`)return null;let s=await g(n.attributes,r,{signal:t});if(i(t),!s?.mediaUrl)return null;if(!h(s.datasetFormat))return this._resolveNonRasterMedia(s);let c=await this._resolveRasterMedia(s,o,t);if(!c)return null;switch(a){case`default`:{let n=await this._resolveDefaultAreaOfInterest(e,s,t);return this._resolveDefaultRasterMedia(c,n,o,t)}case`panoramic`:return this._resolvePanoramicRasterMedia(c,e,t)}}_resolveNonRasterMedia(e){return{areaOfInterest:null,textureUrl:this._resolveTextureUrl(e)}}async _resolveDefaultAreaOfInterest(e,t,n){let{activeImageSize:r,currentBestFeature:a,mode:o,view:s}=e;if(o!=="default"||!r||!a||!s||!h(t.datasetFormat))return null;let c=await _(a,s,r,this._properties.pointToPixel,{signal:n});return i(n),c}async _resolveRasterMedia(e,t,n){let r=await this._loadRaster(e,{signal:n});if(i(n),!r)return null;let a=v(r,t),o=this._cachedBaseTexture;if(!o){let e=await this._createRasterTexture(r,null,a,{signal:n});i(n),e&&(o=e,this._cachedBaseTexture=e)}return o?{baseLevel:a,baseTexture:o,raster:r}:null}async _resolveDefaultRasterMedia(e,t,n,r){let{baseLevel:a,baseTexture:o,raster:s}=e;if(!t)return{areaOfInterest:null,baseTexture:o,raster:s,texture:o};let c=v(s,n,t),l=await this._createCompositedDefaultRasterTexture(s,t,c,a,{signal:r});return i(r),{areaOfInterest:t,baseTexture:o,overlayTexture:l,raster:s,texture:l??o}}async _resolvePanoramicRasterMedia(e,t,n){let{activeImageSize:r,currentBestFeature:a,view:o}=t,{baseTexture:s,raster:c}=e;if(!r||!a||!o)return{areaOfInterest:null,baseTexture:s,panoramicAreasOfInterest:void 0,raster:c,texture:s};let l=await y(a,o,r,this._properties.pointToPixel,{signal:n});i(n);let u=await this._createPanoramicRasterTexture(c,a,o,r,l,{signal:n})??s;return i(n),{areaOfInterest:null,baseTexture:s,panoramicAreasOfInterest:l,raster:c,texture:u}}async _createGraphics(e,t,n){switch(e.mode){case`default`:return this._createDefaultGraphics(e,t,n);case`panoramic`:return this._createPanoramicGraphics(e,t,n)}return{graphics:[]}}async _createDefaultGraphics(e,t,n){let r=await this._createAndDrapeDefaultGraphic(e,n,{texture:t.texture,textureUrl:t.textureUrl});return{graphics:r?[r]:[]}}async _createAndDrapeDefaultGraphic(e,t,n){let{activeImageSize:r,currentBestFeature:a,depthImageLoaded:o,view:s}=e,{areaOfInterest:c,texture:l,textureUrl:u}=n;if(!r||s?.type!==`3d`||!a)return null;let d=await this._createDefaultGraphic({areaOfInterest:c,currentBestFeature:a,depthImageLoaded:o,imageSize:r,signal:t,texture:l,textureUrl:u,view:s});if(!d)return null;let f=await this._resolveDefaultMeshPosition(d,r,s,a,c,t,100),p=await this._resolveDefaultMeshPosition(d,r,s,a,c,t,0);return i(t),this._defaultGraphicProperties={areaOfInterest:c??null,currentBestFeature:a,farPosition:p??(d.geometry?.type===`mesh`?d.geometry.vertexAttributes.position.slice():new Float64Array),imageSize:r,nearPosition:f,view:s},d}async _createPanoramicGraphics(e,t,n){let r=await this._createPanoramicSuperimposeGraphic(e,t,n,null);return{graphics:r?[r]:[]}}async _createPanoramicSuperimposeGraphic(e,t,n,r){let{activeImageSize:i,currentBestFeature:a,view:o}=e;return o?this._createPanoramicGraphic({areaOfInterest:r,currentBestFeature:a??void 0,imageSize:i,signal:n,texture:t.texture,textureUrl:t.textureUrl,view:o}):null}async _updateNavigation(e,t){let{currentBestFeature:n,mode:r,view:i}=e;if(n&&i&&i.type===`3d`)switch(r){case`default`:this._updateDefaultNavigation(e);return;case`panoramic`:await this._updatePanoramicNavigation(e,n,i,t);return}}_updateDefaultNavigation(e){this._updateDefaultSuperimposeNavigation(e.adapter,e.defaultSuperimposeCameraLockEnabled)}async _updatePanoramicNavigation(e,t,n,r){e.adapter?.disableDefaultSuperimposeNavigation?.();let a=t===this._panoramicNavigationFeature?n.camera:e.panoramicCamera??n.camera;a&&this._shouldUpdatePanoramicCamera(e.mode,t)&&(e.adapter?.disablePanoramicSuperimposeNavigation?.(),await e.adapter?.updatePanoramicSuperimposeCamera?.({camera:a,currentBestFeature:t},{signal:r}),i(r)),this._panoramicNavigationFeature=t}_replaceGraphics(e,t){if(t===`panoramic`&&this._updatePanoramicGraphicInPlace(e))return;let n=this._graphics;this._graphics=e,this._properties.overlays.addMany(e),this._destroyGraphics(n,!0)}_updatePanoramicGraphicInPlace(e){if(this._graphics.length!==1||e.length!==1)return!1;let t=this._graphics[0],n=e[0];return!t||!n?!1:(t.geometry=n.geometry,t.symbol=n.symbol,t.visible=n.visible,n.geometry=null,n.symbol=null,r(n),!0)}_destroyGraphics(e,t){e.length&&(t&&this._properties.overlays.removeMany(e),e.forEach(e=>r(e)))}_updateDefaultSuperimposeNavigation(e,t=!0){t?e?.enableDefaultSuperimposeNavigation?.():e?.disableDefaultSuperimposeNavigation?.(),this._panoramicNavigationFeature&&e?.disablePanoramicSuperimposeNavigation?.(),this._panoramicNavigationFeature=null}_shouldUpdateDefaultCamera(e,t){return e==="default"&&t!==this._defaultCameraFeature}_shouldUpdatePanoramicCamera(e,t){return e===`panoramic`&&t!==this._panoramicNavigationFeature}setDefaultZOffsetPercentage(e){this._defaultZOffsetPercentage=Math.max(0,Math.min(100,e)),this._defaultGraphicProperties&&this._graphics.length===1&&this._rebuildDefaultGraphicForPercentage(this._defaultZOffsetPercentage)}setPanoramicRadiusPercentage(e){let t=Math.max(0,Math.min(100,e)),n=this._panoramicRadiusOffsetRangeInMeters*t/100,r=n-this._panoramicRadiusOffsetInMeters;this._panoramicRadiusOffsetPercentage=t,this._panoramicRadiusOffsetInMeters=n,this._applyPanoramicRadiusOffset(this._graphics,r)}updatePanoramicRadiusOffset(e){e!==0&&(this._panoramicRadiusOffsetInMeters+=e,this._applyPanoramicRadiusOffset(this._graphics,e))}_applyPanoramicRadiusOffset(e,t){t!==0&&e.forEach(e=>{let n=e.geometry;n?.type===`mesh`&&b(n,{radiusOffset:t,minimumRadiusInMeters:10})})}async _applyPersistentPanoramicRadiusOffset(e,t,n,r){this._panoramicRadiusOffsetRangeInMeters=await this._resolvePanoramicRadiusOffsetRangeInMeters(t,n,r),this._panoramicRadiusOffsetInMeters=this._panoramicRadiusOffsetRangeInMeters*this._panoramicRadiusOffsetPercentage/100,this._applyPanoramicRadiusOffset(e,this._panoramicRadiusOffsetInMeters)}_rebuildDefaultGraphicForPercentage(e){let t=this._defaultGraphicProperties,[n]=this._graphics;if(!t||!n||n.geometry?.type!==`mesh`)return;let r=this._createDefaultMeshForPercentage(t,n.geometry,e);r&&(this._applyDefaultMeshAppearance(r,n.geometry),n.geometry=r)}_createDefaultMeshForPercentage(e,t,n){let{farPosition:r,nearPosition:i,view:o}=e;if(!i||i.length!==r.length)return null;let c=new Float64Array(r.length),l=n/100;for(let e=0;e<r.length;e+=1)c[e]=r[e]+(i[e]-r[e])*l;let d=t.vertexAttributes.uv,f=t.components;return!d||!f||f.some(e=>!e.faces)?null:new a({vertexAttributes:new u({position:c,uv:d.slice()}),components:f.map(e=>new s({faces:e.faces.slice()})),spatialReference:o.spatialReference.clone()})}_resolveDefaultSuperimposeDistance(e,t){let n=e.attributes.farDistance,r=Math.max(0,e.attributes.nearDistance??n);if(n>0&&r>=0)return n+(r-n)*t/100}async _resolvePanoramicRadiusOffsetRangeInMeters(e,t,n){let r=e.attributes.objectId;if(this._cachedPanoramicRadiusObjectId!==r){let a=e.attributes.farDistance,s=Math.max(10,e.attributes.nearDistance??a);if(!(a>0)||!(s>=0))return this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=0,0;let c=e.attributes.location,l=c.spatialReference.equals(t.spatialReference)?c:await o(c,t.spatialReference,{signal:n});if(i(n),!l)return this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=0,0;let u=l.spatialReference.isWebMercator?m(l.y):1;this._cachedPanoramicRadiusObjectId=r,this._panoramicRadiusOffsetRangeInMeters=(s-a)*u}return this._panoramicRadiusOffsetRangeInMeters}_resolveTextureUrl(e){let t=new URL(e.mediaUrl);return Object.entries(e.searchParams).forEach(([e,n])=>{t.searchParams.has(e)||t.searchParams.set(e,n)}),t.toString()}_resetRasterTextureCacheIfNeeded(e){e&&e!==this._rasterTextureCacheFeature&&(this._cachedBaseTexture=null,this._rasterTextureFetchCache.clear(),this._rasterTextureCacheFeature=e)}_createImageDataFromPixelBlock(e){return new ImageData(e.getAsRGBA(),e.width,e.height)}_copyImageData(e,t,n,r,i=e.width,a=e.height){let o=e.data,s=t.data,c=e.width,l=e.height,u=t.width,d=t.height;for(let e=0;e<a;e+=1){let t=r+e;if(t<0||t>=d)continue;let f=Math.min(l-1,Math.floor(e*l/a));for(let e=0;e<i;e+=1){let r=n+e;if(r<0||r>=u)continue;let a=Math.min(c-1,Math.floor(e*c/i)),l=(f*c+a)*4,d=(t*u+r)*4;s[d]=o[l],s[d+1]=o[l+1],s[d+2]=o[l+2],s[d+3]=o[l+3]}}}_copyImageDataRegion(e,t,n,r,i,a,o,s){let c=e.data,l=t.data,u=e.width,d=t.width;for(let e=0;e<s;e+=1)for(let t=0;t<o;t+=1){let o=((r+e)*u+(n+t))*4,s=((a+e)*d+(i+t))*4;l[s]=c[o],l[s+1]=c[o+1],l[s+2]=c[o+2],l[s+3]=c[o+3]}}async _fetchRasterTextureAtLevel(e,t,n,r){let{offset:a,size:o}=x(e,t,n),s=this._createRasterTextureExtent(a,o),c=this._createRasterTextureLevelCacheKey(e,t),l=this._getOrCreateRasterTextureLevelCache(c),u=this._getUncoveredRasterTextureExtents(s,l.patches);for(let n of u){let a=this._createRasterTextureExtentCacheKey(n),o=l.inflight.get(a);o||(o=this._fetchRasterTexturePatch(e,t,n,r),l.inflight.set(a,o));try{let e=await o;i(r),e&&l.patches.push(e)}finally{l.inflight.delete(a)}}return this._composeRasterTextureFromCachedPatches(s,l.patches)}_getOrCreateRasterTextureLevelCache(e){let t=this._rasterTextureFetchCache.get(e);return t||(t={inflight:new Map,patches:[]},this._rasterTextureFetchCache.set(e,t)),t}_createRasterTextureLevelCacheKey(e,t){return[e.url,e.rasterInfo.width,e.rasterInfo.height,t].join(`:`)}_createRasterTextureExtentCacheKey(e){return[e.xmin,e.ymin,e.xmax,e.ymax].join(`:`)}_createRasterTextureExtent(e,t){return{xmin:e.x,ymin:e.y,xmax:e.x+t.width,ymax:e.y+t.height}}_getUncoveredRasterTextureExtents(e,t){let n=[e];for(let e of t)if(n=n.flatMap(t=>this._subtractRasterTextureExtent(t,e.extent)),!n.length)break;return n}_subtractRasterTextureExtent(e,t){let n=this._intersectRasterTextureExtents(e,t);if(!n)return[e];let r=[];return e.ymin<n.ymin&&r.push({xmin:e.xmin,ymin:e.ymin,xmax:e.xmax,ymax:n.ymin}),n.ymax<e.ymax&&r.push({xmin:e.xmin,ymin:n.ymax,xmax:e.xmax,ymax:e.ymax}),e.xmin<n.xmin&&r.push({xmin:e.xmin,ymin:n.ymin,xmax:n.xmin,ymax:n.ymax}),n.xmax<e.xmax&&r.push({xmin:n.xmax,ymin:n.ymin,xmax:e.xmax,ymax:n.ymax}),r.filter(({xmin:e,ymin:t,xmax:n,ymax:r})=>n>e&&r>t)}_intersectRasterTextureExtents(e,t){let n=Math.max(e.xmin,t.xmin),r=Math.max(e.ymin,t.ymin),i=Math.min(e.xmax,t.xmax),a=Math.min(e.ymax,t.ymax);return i>n&&a>r?{xmin:n,ymin:r,xmax:i,ymax:a}:null}async _fetchRasterTexturePatch(e,t,n,r){let{pixelBlock:a}=await e.fetchRawPixels(t,{x:n.xmin,y:n.ymin},{width:n.xmax-n.xmin,height:n.ymax-n.ymin},r);if(i(r),a)return{extent:n,imageData:this._createImageDataFromPixelBlock(a)}}_composeRasterTextureFromCachedPatches(e,t){let n=t.filter(t=>this._intersectRasterTextureExtents(e,t.extent));if(!n.length)return;let r=new ImageData(e.xmax-e.xmin,e.ymax-e.ymin);for(let t of n){let n=this._intersectRasterTextureExtents(e,t.extent);n&&this._copyImageDataRegion(t.imageData,r,n.xmin-t.extent.xmin,n.ymin-t.extent.ymin,n.xmin-e.xmin,n.ymin-e.ymin,n.xmax-n.xmin,n.ymax-n.ymin)}return r}async _loadRaster(e,t){let{loadRaster:n}=await import(`../../PanoramicViewer/utils.js`),r=await n(this._resolveTextureUrl(e),t);return i(t),r}async _createCompositedDefaultRasterTexture(e,t,n,r,a){let{pyramidScalingFactor:o}=e.rasterInfo.storageInfo,s=o??2,c=S(e.rasterInfo.width,e.rasterInfo.height,n,s),u=await this._fetchRasterTextureAtLevel(e,r,null,a);if(i(a),!u)return;let d=await this._fetchRasterTextureAtLevel(e,n,t,a);if(i(a),!d)return new l({data:u});let f=new ImageData(c.width,c.height);this._copyImageData(u,f,0,0,c.width,c.height);let p=s**n,{x:m,y:h}=this._resolveRasterDrawOrigin(t,p);return this._copyImageData(d,f,m,h),new l({data:f})}async _createRasterTexture(e,t,n,r){let{maximumPyramidLevel:i}=e.rasterInfo.storageInfo,a=await this._fetchRasterTextureAtLevel(e,n??i,t,r);if(a)return new l({data:a})}async _createPanoramicRasterTexture(e,t,n,r,a,o){if(a??=await y(t,n,r,this._properties.pointToPixel,o),i(o),!a?.length)return this._createRasterTexture(e,null,void 0,o);let{baseLevel:s,level:c,scalingFactor:l}=this._resolvePanoramicRasterLevels(e,n,a);return s<=c?this._createRasterTexture(e,null,c,o):this._createCompositedPanoramicRasterTexture(e,a,{baseLevel:s,level:c,scalingFactor:l},o)}_resolvePanoramicRasterLevels(e,t,n){let{maximumPyramidLevel:r,pyramidScalingFactor:i}=e.rasterInfo.storageInfo,a=n.reduce((n,r)=>Math.min(n,C(e,t,r)),r),o=w(e,a),s=i??2;return{baseLevel:Math.min(r,o+2),level:o,scalingFactor:s}}async _createCompositedPanoramicRasterTexture(e,t,n,r){let{baseLevel:a,level:o,scalingFactor:s}=n,c=S(e.rasterInfo.width,e.rasterInfo.height,o,s),u=await this._fetchRasterTextureAtLevel(e,a,null,r);if(i(r),!u)return;let d=new ImageData(c.width,c.height);this._copyImageData(u,d,0,0,c.width,c.height);let f=s**o;for(let n of t){let t=await this._fetchRasterTextureAtLevel(e,o,n,r);if(i(r),!t)continue;let{x:a,y:s}=this._resolveRasterDrawOrigin(n,f);this._copyImageData(t,d,a,s)}return new l({data:d})}_resolveRasterDrawOrigin(e,t){return{x:Math.max(0,Math.floor(e.xmin/t)),y:Math.max(0,Math.floor(e.ymin/t))}}async _createGridMesh(e,t,n,r,c,l,d){if(t.type!==`3d`)return null;let f=await Promise.all(r.map(e=>e.spatialReference.equals(t.spatialReference)?e:o(e,t.spatialReference,d)));if(i(d),f.some(e=>!e))return null;let{faces:p,position:m,uv:h}=T(f,e,n,c);return l?.forEach((t,n)=>{let r=n*2;h[r]=t.x/e[0],h[r+1]=t.y/e[1]}),new a({vertexAttributes:new u({position:m,uv:h}),components:[new s({faces:p})],spatialReference:t.spatialReference.clone()})}async _createFootprintMesh(e,t,n,r,a,o){if(t.type!==`3d`)return null;let s=n?.attributes.farDistance,c=E(e,r),l=a??s,u=typeof l==`number`&&l>0?await this._properties.getPointAtDistance(c,l,o):await this._properties.getMapPoint(c,o);return i(o),this._createGridMesh(e,t,r,u)}async _resolveDefaultMeshPosition(e,t,n,r,a,o,s){let c=e.geometry;if(c?.type===`mesh`&&s===this._defaultZOffsetPercentage)return c.vertexAttributes.position.slice();let l=this._resolveDefaultSuperimposeDistance(r,s),u=await this._createFootprintMesh(t,n,r,a,l,{signal:o});return i(o),u?.vertexAttributes.position.slice()??null}async _createPanoramicGraphic(t){let{areaOfInterest:r,imageSize:i,signal:a,texture:o,textureUrl:s,view:u}=t;if(!o&&!s)throw Error(`Missing texture URL or texture data.`);if(!i)return null;let d=await this._createPanoramicMesh(i,u,r,t.currentBestFeature,a);if(!d)return null;let m=d.vertexAttributes.position,h=[];for(let e=0;e<m.length;e+=3)h.push(...D);d.vertexAttributes.color=new Uint8Array(h);let g=new c({colorTexture:o??new l({url:s})});return d.components?.forEach(e=>{e.shading=`source`,e.material=g}),new e({geometry:d,symbol:new p({symbolLayers:new n([new f({})])})})}async _createPanoramicMesh(e,t,n,r,a){if(t.type!==`3d`||!r)return null;let{attributes:o}=r,{farDistance:s}=o;if(typeof s!=`number`||!(s>0))return null;let c=E(e,n,128),l=this._properties.getPanoramicTransformationState?.();if(!l)return null;let{imageToWorldProperties:u,updateElevationProps:f}=l,p=await d(c.map(e=>({...e,depth:s??u.farDistance})),u,f);return i(a),this._createGridMesh(e,t,n,p,128,c)}async _createDefaultGraphic(t){let{texture:r,textureUrl:i}=t;if(!r&&!i)throw Error(`Missing texture URL or texture data.`);if(!t.imageSize)return null;let a=t.currentBestFeature?this._resolveDefaultSuperimposeDistance(t.currentBestFeature,this._defaultZOffsetPercentage):void 0,o=await this._createFootprintMesh(t.imageSize,t.view,t.currentBestFeature,t.areaOfInterest,a,{signal:t.signal});return o?(this._applyDefaultMeshAppearance(o,r??new l({url:i})),new e({geometry:o,symbol:new p({symbolLayers:new n([new f({})])})})):null}_applyDefaultMeshAppearance(e,t){let n=e.vertexAttributes.position,r=[];for(let e=0;e<n.length;e+=3)r.push(...D);e.vertexAttributes.color=new Uint8Array(r);let i=t instanceof a?t.components?.[0]?.material??null:new c({colorTexture:t});e.components?.forEach((e,n)=>{e.shading=`source`,e.material=t instanceof a?t.components?.[n]?.material??i:i})}}export{O as default};
|